[email protected] | 91854cd | 2012-01-10 19:43:57 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
[email protected] | 93ddb3c | 2012-04-11 21:44:29 | [diff] [blame] | 5 | #ifndef CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ |
| 6 | #define CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 7 | |
avi | b734894 | 2015-12-25 20:57:10 | [diff] [blame] | 8 | #include <stdint.h> |
| 9 | |
lfg | db5c4ed | 2016-03-04 23:09:07 | [diff] [blame] | 10 | #include <functional> |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 11 | #include <map> |
dcheng | 5971627 | 2016-04-09 05:19:08 | [diff] [blame] | 12 | #include <memory> |
[email protected] | b24b68a | 2012-09-24 21:57:26 | [diff] [blame] | 13 | #include <set> |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 14 | #include <string> |
Lukasz Anforowicz | e9ae372 | 2017-09-29 17:37:38 | [diff] [blame] | 15 | #include <utility> |
| 16 | #include <vector> |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 17 | |
[email protected] | 01d6517 | 2011-12-25 04:39:30 | [diff] [blame] | 18 | #include "base/compiler_specific.h" |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 19 | #include "base/gtest_prod_util.h" |
avi | b734894 | 2015-12-25 20:57:10 | [diff] [blame] | 20 | #include "base/macros.h" |
[email protected] | 6eac57a | 2011-07-12 21:15:09 | [diff] [blame] | 21 | #include "base/observer_list.h" |
[email protected] | fa20e00 | 2013-07-23 21:20:54 | [diff] [blame] | 22 | #include "base/process/process.h" |
[email protected] | 738f57a | 2013-06-29 21:06:54 | [diff] [blame] | 23 | #include "base/values.h" |
avi | b734894 | 2015-12-25 20:57:10 | [diff] [blame] | 24 | #include "build/build_config.h" |
Min Qin | a904f330 | 2018-02-13 23:33:34 | [diff] [blame] | 25 | #include "components/download/public/common/download_url_parameters.h" |
[email protected] | d4a8ca48 | 2013-10-30 21:06:40 | [diff] [blame] | 26 | #include "content/browser/frame_host/frame_tree.h" |
lfg | a3e2bdc | 2017-03-07 20:44:01 | [diff] [blame] | 27 | #include "content/browser/frame_host/frame_tree_node.h" |
Maxim Podgorodskiy | a926c4ff | 2017-11-20 02:06:39 | [diff] [blame] | 28 | #include "content/browser/frame_host/interstitial_page_impl.h" |
[email protected] | d4a8ca48 | 2013-10-30 21:06:40 | [diff] [blame] | 29 | #include "content/browser/frame_host/navigation_controller_delegate.h" |
| 30 | #include "content/browser/frame_host/navigation_controller_impl.h" |
[email protected] | 190b8c5 | 2013-11-09 01:35:44 | [diff] [blame] | 31 | #include "content/browser/frame_host/navigator_delegate.h" |
[email protected] | 92404c6 | 2013-12-04 16:40:46 | [diff] [blame] | 32 | #include "content/browser/frame_host/render_frame_host_delegate.h" |
[email protected] | b0936d2 | 2013-11-28 06:47:36 | [diff] [blame] | 33 | #include "content/browser/frame_host/render_frame_host_manager.h" |
avayvod | cc85bbd | 2015-08-28 19:11:15 | [diff] [blame] | 34 | #include "content/browser/media/audio_stream_monitor.h" |
[email protected] | 2e3bf99 | 2012-05-24 17:36:24 | [diff] [blame] | 35 | #include "content/browser/renderer_host/render_view_host_delegate.h" |
creis | c014b40 | 2015-04-23 16:41:45 | [diff] [blame] | 36 | #include "content/browser/renderer_host/render_view_host_impl.h" |
[email protected] | 4ca76c0 | 2012-05-16 16:19:05 | [diff] [blame] | 37 | #include "content/browser/renderer_host/render_widget_host_delegate.h" |
blundell | e75a8f9 | 2017-03-27 08:11:17 | [diff] [blame] | 38 | #include "content/browser/wake_lock/wake_lock_context_host.h" |
[email protected] | 8d128d6 | 2011-09-13 22:11:57 | [diff] [blame] | 39 | #include "content/common/content_export.h" |
[email protected] | 8ed1647 | 2014-04-11 19:02:48 | [diff] [blame] | 40 | #include "content/public/browser/color_chooser.h" |
[email protected] | 14392a5 | 2012-05-02 20:28:44 | [diff] [blame] | 41 | #include "content/public/browser/notification_observer.h" |
| 42 | #include "content/public/browser/notification_registrar.h" |
[email protected] | 58f5d56 | 2011-12-20 17:13:03 | [diff] [blame] | 43 | #include "content/public/browser/web_contents.h" |
rockot | 96c63e3 | 2017-03-20 23:23:03 | [diff] [blame] | 44 | #include "content/public/browser/web_contents_binding_set.h" |
dalecurtis | 88c24007 | 2015-12-09 02:11:18 | [diff] [blame] | 45 | #include "content/public/browser/web_contents_observer.h" |
kouhei | 40f03cb | 2015-09-24 07:47:01 | [diff] [blame] | 46 | #include "content/public/common/page_importance_signals.h" |
[email protected] | daf82f8 | 2011-10-31 22:35:31 | [diff] [blame] | 47 | #include "content/public/common/renderer_preferences.h" |
[email protected] | 7491ad0 | 2014-07-05 19:10:07 | [diff] [blame] | 48 | #include "content/public/common/resource_type.h" |
[email protected] | 818915cd | 2012-11-20 13:14:11 | [diff] [blame] | 49 | #include "content/public/common/three_d_api_types.h" |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 50 | #include "net/base/load_states.h" |
[email protected] | 6f2ac77 | 2014-07-24 22:22:08 | [diff] [blame] | 51 | #include "net/http/http_response_headers.h" |
brettw | 4b46108 | 2016-11-19 18:55:16 | [diff] [blame] | 52 | #include "ppapi/features/features.h" |
Ke He | 31d0bb0 | 2018-02-24 07:16:24 | [diff] [blame] | 53 | #include "services/device/public/mojom/geolocation_context.mojom.h" |
| 54 | #include "services/device/public/mojom/wake_lock.mojom.h" |
Mounir Lamouri | fd9dcefa | 2017-07-06 10:26:55 | [diff] [blame] | 55 | #include "services/metrics/public/cpp/ukm_recorder.h" |
Kinuko Yasuda | 275afbc | 2018-02-20 10:43:07 | [diff] [blame] | 56 | #include "third_party/WebKit/public/mojom/color_chooser/color_chooser.mojom.h" |
esprehn | fbba129 | 2016-04-15 17:59:56 | [diff] [blame] | 57 | #include "third_party/WebKit/public/platform/WebDragOperation.h" |
Doug Turner | 63f3c7b | 2017-07-29 05:10:01 | [diff] [blame] | 58 | #include "ui/accessibility/ax_modes.h" |
Sylvain Defresne | c6ccc77d | 2014-09-19 10:19:35 | [diff] [blame] | 59 | #include "ui/base/page_transition_types.h" |
tfarina | 3b0452d | 2014-12-31 15:20:09 | [diff] [blame] | 60 | #include "ui/gfx/geometry/rect_f.h" |
tfarina | ebe974f0 | 2015-01-03 04:25:32 | [diff] [blame] | 61 | #include "ui/gfx/geometry/size.h" |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 62 | |
blundell | f5316fc | 2017-05-15 11:49:03 | [diff] [blame] | 63 | #if defined(OS_ANDROID) |
| 64 | #include "content/browser/android/nfc_host.h" |
Bo Liu | 168c864 | 2017-08-28 18:26:02 | [diff] [blame] | 65 | #include "content/public/browser/android/child_process_importance.h" |
blundell | f5316fc | 2017-05-15 11:49:03 | [diff] [blame] | 66 | #endif |
| 67 | |
[email protected] | 1ff42797 | 2013-02-07 21:14:07 | [diff] [blame] | 68 | struct ViewHostMsg_DateTimeDialogValue_Params; |
[email protected] | daf82f8 | 2011-10-31 22:35:31 | [diff] [blame] | 69 | |
rockot | 400ea35b | 2016-10-15 19:15:32 | [diff] [blame] | 70 | namespace service_manager { |
sammc | f5f1b0f | 2016-09-20 23:05:11 | [diff] [blame] | 71 | class InterfaceProvider; |
| 72 | } |
| 73 | |
[email protected] | e582fdd | 2011-12-20 16:48:17 | [diff] [blame] | 74 | namespace content { |
[email protected] | 7a846df | 2012-09-20 19:17:39 | [diff] [blame] | 75 | class BrowserPluginEmbedder; |
| 76 | class BrowserPluginGuest; |
[email protected] | 583418cc | 2013-01-17 14:01:10 | [diff] [blame] | 77 | class DateTimeChooserAndroid; |
paulmeyer | c0b762b | 2016-04-13 11:55:17 | [diff] [blame] | 78 | class FindRequestManager; |
[email protected] | 8ff00d7 | 2012-10-23 19:12:21 | [diff] [blame] | 79 | class InterstitialPageImpl; |
[email protected] | 71a88bb | 2013-02-01 22:05:15 | [diff] [blame] | 80 | class JavaScriptDialogManager; |
csharrison | a2280cd | 2016-02-03 23:21:15 | [diff] [blame] | 81 | class LoaderIOThreadNotifier; |
mlamouri | efdca9d | 2014-09-16 16:55:40 | [diff] [blame] | 82 | class ManifestManagerHost; |
qinmin | 58567c8 | 2015-01-07 21:00:20 | [diff] [blame] | 83 | class MediaWebContentsObserver; |
tommycli | eb25b2a | 2014-11-03 19:45:09 | [diff] [blame] | 84 | class PluginContentOriginWhitelist; |
[email protected] | eaabba2 | 2012-03-07 15:02:11 | [diff] [blame] | 85 | class RenderViewHost; |
[email protected] | 5a3bdf5 | 2012-05-24 15:12:57 | [diff] [blame] | 86 | class RenderViewHostDelegateView; |
[email protected] | b24b68a | 2012-09-24 21:57:26 | [diff] [blame] | 87 | class RenderWidgetHostImpl; |
kenrb | 2a565f8 | 2015-09-02 20:24:59 | [diff] [blame] | 88 | class RenderWidgetHostInputEventRouter; |
[email protected] | 3586962 | 2012-10-26 23:23:55 | [diff] [blame] | 89 | class SavePackage; |
lunalu | d4a2cc8 | 2016-11-22 00:27:23 | [diff] [blame] | 90 | class ScreenOrientationProvider; |
[email protected] | 09d31d5 | 2012-03-11 22:30:27 | [diff] [blame] | 91 | class SiteInstance; |
[email protected] | 80e776ae | 2012-03-23 16:17:20 | [diff] [blame] | 92 | class TestWebContents; |
ekaramad | add88229 | 2016-06-08 15:22:56 | [diff] [blame] | 93 | class TextInputManager; |
miu | 50f9789 | 2014-09-22 22:49:52 | [diff] [blame] | 94 | class WebContentsAudioMuter; |
[email protected] | 674bc59 | 2011-12-20 23:00:42 | [diff] [blame] | 95 | class WebContentsDelegate; |
[email protected] | 8ff00d7 | 2012-10-23 19:12:21 | [diff] [blame] | 96 | class WebContentsImpl; |
[email protected] | fc2b46b | 2014-05-03 16:33:45 | [diff] [blame] | 97 | class WebContentsView; |
[email protected] | f66df82 | 2012-05-18 16:52:17 | [diff] [blame] | 98 | class WebContentsViewDelegate; |
[email protected] | 31a71eaf | 2014-03-13 01:47:36 | [diff] [blame] | 99 | struct AXEventNotificationDetails; |
[email protected] | 795c2897 | 2012-12-06 06:13:39 | [diff] [blame] | 100 | struct FaviconURL; |
[email protected] | 09d31d5 | 2012-03-11 22:30:27 | [diff] [blame] | 101 | struct LoadNotificationDetails; |
dewittj | 6dc5747a | 2016-05-17 01:48:47 | [diff] [blame] | 102 | struct MHTMLGenerationParams; |
[email protected] | f66df82 | 2012-05-18 16:52:17 | [diff] [blame] | 103 | |
rockot | 5c478a7 | 2016-09-28 23:14:18 | [diff] [blame] | 104 | namespace mojom { |
| 105 | class CreateNewWindowParams; |
| 106 | } |
| 107 | |
mfomitchev | 2b8b066a | 2016-01-28 19:23:15 | [diff] [blame] | 108 | #if defined(OS_ANDROID) |
[email protected] | 0e813a5 | 2014-08-13 10:34:56 | [diff] [blame] | 109 | class WebContentsAndroid; |
mcnee | 336ea2c | 2017-05-23 22:50:59 | [diff] [blame] | 110 | #else // !defined(OS_ANDROID) |
| 111 | class HostZoomMapObserver; |
| 112 | #endif // defined(OS_ANDROID) |
[email protected] | 0e813a5 | 2014-08-13 10:34:56 | [diff] [blame] | 113 | |
brettw | 4b46108 | 2016-11-19 18:55:16 | [diff] [blame] | 114 | #if BUILDFLAG(ENABLE_PLUGINS) |
zqzhang | 181047e6 | 2016-07-01 13:37:17 | [diff] [blame] | 115 | class PepperPlaybackObserver; |
| 116 | #endif |
| 117 | |
[email protected] | f66df82 | 2012-05-18 16:52:17 | [diff] [blame] | 118 | // Factory function for the implementations that content knows about. Takes |
| 119 | // ownership of |delegate|. |
[email protected] | fc2b46b | 2014-05-03 16:33:45 | [diff] [blame] | 120 | WebContentsView* CreateWebContentsView( |
[email protected] | 5a3bdf5 | 2012-05-24 15:12:57 | [diff] [blame] | 121 | WebContentsImpl* web_contents, |
| 122 | WebContentsViewDelegate* delegate, |
| 123 | RenderViewHostDelegateView** render_view_host_delegate_view); |
[email protected] | 97714c8 | 2012-06-06 10:15:13 | [diff] [blame] | 124 | |
Nico Weber | 43ddd7a3 | 2017-08-15 19:19:27 | [diff] [blame] | 125 | class CONTENT_EXPORT WebContentsImpl : public WebContents, |
| 126 | public RenderFrameHostDelegate, |
| 127 | public RenderViewHostDelegate, |
| 128 | public RenderWidgetHostDelegate, |
| 129 | public RenderFrameHostManager::Delegate, |
Joel Hockey | 163835a | 2017-12-20 11:51:57 | [diff] [blame] | 130 | public blink::mojom::ColorChooserFactory, |
Nico Weber | 43ddd7a3 | 2017-08-15 19:19:27 | [diff] [blame] | 131 | public NotificationObserver, |
| 132 | public NavigationControllerDelegate, |
| 133 | public NavigatorDelegate { |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 134 | public: |
benwells | 5e7260d | 2017-03-20 23:36:33 | [diff] [blame] | 135 | class FriendWrapper; |
nick | f9acfbe | 2014-12-23 19:12:37 | [diff] [blame] | 136 | |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 137 | ~WebContentsImpl() override; |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 138 | |
[email protected] | d1198fd | 2012-08-13 22:50:19 | [diff] [blame] | 139 | static WebContentsImpl* CreateWithOpener( |
[email protected] | 54944cde | 2012-12-09 09:24:59 | [diff] [blame] | 140 | const WebContents::CreateParams& params, |
Ian Clelland | 5cbaaf8 | 2017-11-27 22:00:03 | [diff] [blame] | 141 | RenderFrameHostImpl* opener_rfh); |
[email protected] | d1198fd | 2012-08-13 22:50:19 | [diff] [blame] | 142 | |
[email protected] | 9564021 | 2014-07-26 18:14:30 | [diff] [blame] | 143 | static std::vector<WebContentsImpl*> GetAllWebContents(); |
| 144 | |
paulmeyer | feafc2d | 2017-04-25 21:46:40 | [diff] [blame] | 145 | static WebContentsImpl* FromFrameTreeNode( |
| 146 | const FrameTreeNode* frame_tree_node); |
clamy | 0d32d6d | 2015-11-24 11:16:26 | [diff] [blame] | 147 | static WebContents* FromRenderFrameHostID(int render_process_host_id, |
| 148 | int render_frame_host_id); |
ananta | 4b7467a5 | 2016-09-23 01:42:38 | [diff] [blame] | 149 | static WebContents* FromFrameTreeNodeId(int frame_tree_node_id); |
paulmeyer | feafc2d | 2017-04-25 21:46:40 | [diff] [blame] | 150 | static WebContentsImpl* FromOuterFrameTreeNode( |
| 151 | const FrameTreeNode* frame_tree_node); |
clamy | a16aa817 | 2015-05-26 13:07:25 | [diff] [blame] | 152 | |
[email protected] | d1198fd | 2012-08-13 22:50:19 | [diff] [blame] | 153 | // Complex initialization here. Specifically needed to avoid having |
| 154 | // members call back into our virtual functions in the constructor. |
[email protected] | 54944cde | 2012-12-09 09:24:59 | [diff] [blame] | 155 | virtual void Init(const WebContents::CreateParams& params); |
[email protected] | d1198fd | 2012-08-13 22:50:19 | [diff] [blame] | 156 | |
[email protected] | c7dd2f6 | 2011-07-18 15:57:59 | [diff] [blame] | 157 | // Returns the SavePackage which manages the page saving job. May be NULL. |
| 158 | SavePackage* save_package() const { return save_package_.get(); } |
| 159 | |
mfomitchev | 2b8b066a | 2016-01-28 19:23:15 | [diff] [blame] | 160 | #if defined(OS_ANDROID) |
[email protected] | 7d244f1 | 2013-08-22 21:41:51 | [diff] [blame] | 161 | // In Android WebView, the RenderView needs created even there is no |
| 162 | // navigation entry, this allows Android WebViews to use |
| 163 | // javascript: URLs that load into the DOMWindow before the first page |
| 164 | // load. This is not safe to do in any context that a web page could get a |
| 165 | // reference to the DOMWindow before the first page load. |
| 166 | bool CreateRenderViewForInitialEmptyDocument(); |
[email protected] | 4cc1ab5 | 2013-01-21 19:24:34 | [diff] [blame] | 167 | #endif |
[email protected] | 276b37a2 | 2011-11-08 20:45:46 | [diff] [blame] | 168 | |
[email protected] | 76518718 | 2012-01-11 23:59:28 | [diff] [blame] | 169 | // Expose the render manager for testing. |
[email protected] | ee87c8be | 2014-03-05 00:35:38 | [diff] [blame] | 170 | // TODO(creis): Remove this now that we can get to it via FrameTreeNode. |
[email protected] | b0936d2 | 2013-11-28 06:47:36 | [diff] [blame] | 171 | RenderFrameHostManager* GetRenderManagerForTesting(); |
[email protected] | 76518718 | 2012-01-11 23:59:28 | [diff] [blame] | 172 | |
[email protected] | 7a846df | 2012-09-20 19:17:39 | [diff] [blame] | 173 | // Returns guest browser plugin object, or NULL if this WebContents is not a |
| 174 | // guest. |
[email protected] | f849734 | 2013-02-05 22:15:02 | [diff] [blame] | 175 | BrowserPluginGuest* GetBrowserPluginGuest() const; |
[email protected] | 738f57a | 2013-06-29 21:06:54 | [diff] [blame] | 176 | |
| 177 | // Sets a BrowserPluginGuest object for this WebContents. If this WebContents |
| 178 | // has a BrowserPluginGuest then that implies that it is being hosted by |
| 179 | // a BrowserPlugin object in an embedder renderer process. |
| 180 | void SetBrowserPluginGuest(BrowserPluginGuest* guest); |
| 181 | |
[email protected] | 7a846df | 2012-09-20 19:17:39 | [diff] [blame] | 182 | // Returns embedder browser plugin object, or NULL if this WebContents is not |
| 183 | // an embedder. |
[email protected] | f849734 | 2013-02-05 22:15:02 | [diff] [blame] | 184 | BrowserPluginEmbedder* GetBrowserPluginEmbedder() const; |
[email protected] | 738f57a | 2013-06-29 21:06:54 | [diff] [blame] | 185 | |
fsamuel | 60b4228 | 2015-03-10 03:29:14 | [diff] [blame] | 186 | // Creates a BrowserPluginEmbedder object for this WebContents if one doesn't |
| 187 | // already exist. |
| 188 | void CreateBrowserPluginEmbedderIfNecessary(); |
| 189 | |
creis | 89a0f78 | 2015-05-27 16:13:17 | [diff] [blame] | 190 | // Cancels modal dialogs in this WebContents, as well as in any browser |
| 191 | // plugins it is hosting. |
| 192 | void CancelActiveAndPendingDialogs(); |
| 193 | |
[email protected] | cf200a56 | 2013-05-03 16:24:29 | [diff] [blame] | 194 | // Informs the render view host and the BrowserPluginEmbedder, if present, of |
| 195 | // a Drag Source End. |
Ella Ge | 80a52dce | 2017-11-15 18:01:52 | [diff] [blame] | 196 | void DragSourceEndedAt(float client_x, |
| 197 | float client_y, |
| 198 | float screen_x, |
| 199 | float screen_y, |
Paul Meyer | 0c58c371 | 2016-11-17 22:59:51 | [diff] [blame] | 200 | blink::WebDragOperation operation, |
| 201 | RenderWidgetHost* source_rwh); |
[email protected] | cf200a56 | 2013-05-03 16:24:29 | [diff] [blame] | 202 | |
jam | 73f89264 | 2016-09-11 06:04:06 | [diff] [blame] | 203 | // Notification that the RenderViewHost's load state changed. |
Charles Harrison | 911fa06 | 2018-03-06 21:01:46 | [diff] [blame] | 204 | void LoadStateChanged(const std::string& host, |
jam | 73f89264 | 2016-09-11 06:04:06 | [diff] [blame] | 205 | const net::LoadStateWithParam& load_state, |
| 206 | uint64_t upload_position, |
| 207 | uint64_t upload_size); |
| 208 | |
Francois Doray | e616115 | 2018-03-27 22:05:37 | [diff] [blame^] | 209 | // Set the visibility to |visibility| and notifies observers. |
| 210 | void SetVisibility(Visibility visibility); |
Francois Doray | fe4a177 | 2018-02-17 04:17:09 | [diff] [blame] | 211 | |
calamity | 7fe55ce | 2015-04-10 03:59:37 | [diff] [blame] | 212 | // Notify observers that the web contents has been focused. |
Michael Thiessen | 896405db | 2017-07-20 17:52:32 | [diff] [blame] | 213 | void NotifyWebContentsFocused(RenderWidgetHost* render_widget_host); |
calamity | 7fe55ce | 2015-04-10 03:59:37 | [diff] [blame] | 214 | |
zijiehe | 3bee08e2 | 2017-05-17 04:14:46 | [diff] [blame] | 215 | // Notify observers that the web contents has lost focus. |
Michael Thiessen | 896405db | 2017-07-20 17:52:32 | [diff] [blame] | 216 | void NotifyWebContentsLostFocus(RenderWidgetHost* render_widget_host); |
zijiehe | 3bee08e2 | 2017-05-17 04:14:46 | [diff] [blame] | 217 | |
[email protected] | fc2b46b | 2014-05-03 16:33:45 | [diff] [blame] | 218 | WebContentsView* GetView() const; |
| 219 | |
leon.han | 552e9de | 2017-02-09 14:37:30 | [diff] [blame] | 220 | void OnScreenOrientationChange(); |
| 221 | |
| 222 | ScreenOrientationProvider* GetScreenOrientationProviderForTesting() const { |
| 223 | return screen_orientation_provider_.get(); |
| 224 | } |
leon.han | e4db177a | 2017-02-07 14:19:16 | [diff] [blame] | 225 | |
[email protected] | 9564021 | 2014-07-26 18:14:30 | [diff] [blame] | 226 | // Broadcasts the mode change to all frames. |
Doug Turner | 63f3c7b | 2017-07-29 05:10:01 | [diff] [blame] | 227 | void SetAccessibilityMode(ui::AXMode mode); |
[email protected] | 9564021 | 2014-07-26 18:14:30 | [diff] [blame] | 228 | |
| 229 | // Adds the given accessibility mode to the current accessibility mode |
| 230 | // bitmap. |
Doug Turner | 63f3c7b | 2017-07-29 05:10:01 | [diff] [blame] | 231 | void AddAccessibilityMode(ui::AXMode mode); |
[email protected] | 9564021 | 2014-07-26 18:14:30 | [diff] [blame] | 232 | |
mcnee | 336ea2c | 2017-05-23 22:50:59 | [diff] [blame] | 233 | #if !defined(OS_ANDROID) |
wjmaclean | 6495190 | 2016-04-29 20:59:12 | [diff] [blame] | 234 | // Set a temporary zoom level for the frames associated with this WebContents. |
| 235 | // If |is_temporary| is true, we are setting a new temporary zoom level, |
| 236 | // otherwise we are clearing a previously set temporary zoom level. |
| 237 | void SetTemporaryZoomLevel(double level, bool temporary_zoom_enabled); |
| 238 | |
| 239 | // Sets the zoom level for frames associated with this WebContents. |
| 240 | void UpdateZoom(double level); |
| 241 | |
| 242 | // Sets the zoom level for frames associated with this WebContents if it |
| 243 | // matches |host| and (if non-empty) |scheme|. Matching is done on the |
| 244 | // last committed entry. |
| 245 | void UpdateZoomIfNecessary(const std::string& scheme, |
| 246 | const std::string& host, |
| 247 | double level); |
mcnee | 336ea2c | 2017-05-23 22:50:59 | [diff] [blame] | 248 | #endif // !defined(OS_ANDROID) |
wjmaclean | 6495190 | 2016-04-29 20:59:12 | [diff] [blame] | 249 | |
rockot | f62002a | 2016-09-15 00:08:59 | [diff] [blame] | 250 | // Adds a new binding set to the WebContents. Returns a closure which may be |
| 251 | // used to remove the binding set at any time. The closure is safe to call |
| 252 | // even after WebContents destruction. |
| 253 | // |
| 254 | // |binding_set| is not owned and must either outlive this WebContents or be |
| 255 | // explicitly removed before being destroyed. |
| 256 | base::Closure AddBindingSet(const std::string& interface_name, |
| 257 | WebContentsBindingSet* binding_set); |
| 258 | |
rockot | 8bbad22 | 2017-03-22 04:34:05 | [diff] [blame] | 259 | // Accesses a WebContentsBindingSet for a specific interface on this |
| 260 | // WebContents. Returns null of there is no registered binder for the |
| 261 | // interface. |
| 262 | WebContentsBindingSet* GetBindingSet(const std::string& interface_name); |
rockot | 96c63e3 | 2017-03-20 23:23:03 | [diff] [blame] | 263 | |
paulmeyer | feafc2d | 2017-04-25 21:46:40 | [diff] [blame] | 264 | // Returns the focused WebContents. |
| 265 | // If there are multiple inner/outer WebContents (when embedding <webview>, |
| 266 | // <guestview>, ...) returns the single one containing the currently focused |
| 267 | // frame. Otherwise, returns this WebContents. |
| 268 | WebContentsImpl* GetFocusedWebContents(); |
| 269 | |
| 270 | // TODO(paulmeyer): Once GuestViews are no longer implemented as |
| 271 | // BrowserPluginGuests, frame traversal across WebContents should be moved to |
| 272 | // be handled by FrameTreeNode, and |GetInnerWebContents| and |
| 273 | // |GetWebContentsAndAllInner| can be removed. |
| 274 | |
| 275 | // Returns a vector to the inner WebContents within this WebContents. |
| 276 | std::vector<WebContentsImpl*> GetInnerWebContents(); |
| 277 | |
| 278 | // Returns a vector containing this WebContents and all inner WebContents |
| 279 | // within it (recursively). |
| 280 | std::vector<WebContentsImpl*> GetWebContentsAndAllInner(); |
| 281 | |
Sam McNally | 145fb17 | 2017-05-10 00:13:23 | [diff] [blame] | 282 | void NotifyManifestUrlChanged(const base::Optional<GURL>& manifest_url); |
| 283 | |
Dmitry Gozman | 1f8089023 | 2017-12-15 22:54:11 | [diff] [blame] | 284 | ManifestManagerHost* GetManifestManagerHost() const { |
| 285 | return manifest_manager_host_.get(); |
| 286 | } |
| 287 | |
Bo Liu | 168c864 | 2017-08-28 18:26:02 | [diff] [blame] | 288 | #if defined(OS_ANDROID) |
Jinsuk Kim | 144909f | 2017-09-13 23:23:22 | [diff] [blame] | 289 | std::set<RenderWidgetHostImpl*> GetAllRenderWidgetHosts(); |
Bo Liu | 7c6779e9 | 2017-08-16 02:02:28 | [diff] [blame] | 290 | void SetImportance(ChildProcessImportance importance); |
Bo Liu | 168c864 | 2017-08-28 18:26:02 | [diff] [blame] | 291 | #endif |
Bo Liu | 7c6779e9 | 2017-08-16 02:02:28 | [diff] [blame] | 292 | |
[email protected] | 8ff00d7 | 2012-10-23 19:12:21 | [diff] [blame] | 293 | // WebContents ------------------------------------------------------ |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 294 | WebContentsDelegate* GetDelegate() override; |
| 295 | void SetDelegate(WebContentsDelegate* delegate) override; |
| 296 | NavigationControllerImpl& GetController() override; |
| 297 | const NavigationControllerImpl& GetController() const override; |
| 298 | BrowserContext* GetBrowserContext() const override; |
| 299 | const GURL& GetURL() const override; |
| 300 | const GURL& GetVisibleURL() const override; |
| 301 | const GURL& GetLastCommittedURL() const override; |
Lukasz Anforowicz | e9ae372 | 2017-09-29 17:37:38 | [diff] [blame] | 302 | RenderFrameHostImpl* GetMainFrame() const override; |
nick | 53d5cbf | 2015-04-23 22:50:14 | [diff] [blame] | 303 | RenderFrameHostImpl* GetFocusedFrame() override; |
creis | f71a263 | 2017-05-04 19:03:50 | [diff] [blame] | 304 | RenderFrameHostImpl* FindFrameByFrameTreeNodeId(int frame_tree_node_id, |
| 305 | int process_id) override; |
| 306 | RenderFrameHostImpl* UnsafeFindFrameByFrameTreeNodeId( |
rob | 3e2a073 | 2016-01-06 21:22:09 | [diff] [blame] | 307 | int frame_tree_node_id) override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 308 | void ForEachFrame( |
Lei Zhang | ebcc630 | 2018-01-12 19:46:45 | [diff] [blame] | 309 | const base::RepeatingCallback<void(RenderFrameHost*)>& on_frame) override; |
dcheng | afb53e2 | 2016-02-04 08:11:08 | [diff] [blame] | 310 | std::vector<RenderFrameHost*> GetAllFrames() override; |
lukasza | cbdf52e | 2016-01-15 21:19:51 | [diff] [blame] | 311 | int SendToAllFrames(IPC::Message* message) override; |
creis | c014b40 | 2015-04-23 16:41:45 | [diff] [blame] | 312 | RenderViewHostImpl* GetRenderViewHost() const override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 313 | RenderWidgetHostView* GetRenderWidgetHostView() const override; |
lfg | 265a267 | 2016-04-23 03:11:02 | [diff] [blame] | 314 | RenderWidgetHostView* GetTopLevelRenderWidgetHostView() override; |
nasko | c0fceff | 2015-04-30 15:53:52 | [diff] [blame] | 315 | void ClosePage() override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 316 | RenderWidgetHostView* GetFullscreenRenderWidgetHostView() const override; |
yusufo | d41c5f9 | 2015-03-06 00:14:28 | [diff] [blame] | 317 | SkColor GetThemeColor() const override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 318 | WebUI* GetWebUI() const override; |
| 319 | WebUI* GetCommittedWebUI() const override; |
Changwan Ryu | c1134a8 | 2018-03-07 02:10:14 | [diff] [blame] | 320 | void SetUserAgentOverride(const std::string& override, |
| 321 | bool override_in_new_tabs) override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 322 | const std::string& GetUserAgentOverride() const override; |
Changwan Ryu | c1134a8 | 2018-03-07 02:10:14 | [diff] [blame] | 323 | bool ShouldOverrideUserAgentInNewTabs() override; |
dmazzoni | dd3d51a7 | 2016-12-14 18:41:01 | [diff] [blame] | 324 | void EnableWebContentsOnlyAccessibilityMode() override; |
| 325 | bool IsWebContentsOnlyAccessibilityModeForTesting() const override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 326 | bool IsFullAccessibilityModeForTesting() const override; |
kouhei | 40f03cb | 2015-09-24 07:47:01 | [diff] [blame] | 327 | const PageImportanceSignals& GetPageImportanceSignals() const override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 328 | const base::string16& GetTitle() const override; |
afakhry | 6f0c1ec2 | 2016-07-14 13:55:13 | [diff] [blame] | 329 | void UpdateTitleForEntry(NavigationEntry* entry, |
| 330 | const base::string16& title) override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 331 | SiteInstanceImpl* GetSiteInstance() const override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 332 | bool IsLoading() const override; |
| 333 | bool IsLoadingToDifferentDocument() const override; |
| 334 | bool IsWaitingForResponse() const override; |
| 335 | const net::LoadStateWithParam& GetLoadState() const override; |
| 336 | const base::string16& GetLoadStateHost() const override; |
Avi Drissman | 1e620f3 | 2018-03-16 13:57:29 | [diff] [blame] | 337 | void RequestAXTreeSnapshot(AXTreeSnapshotCallback callback, |
| 338 | ui::AXMode ax_mode) override; |
avi | b734894 | 2015-12-25 20:57:10 | [diff] [blame] | 339 | uint64_t GetUploadSize() const override; |
| 340 | uint64_t GetUploadPosition() const override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 341 | const std::string& GetEncoding() const override; |
Shubhie Panicker | ddf2a4e | 2018-03-06 00:09:06 | [diff] [blame] | 342 | void SetWasDiscarded(bool was_discarded) override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 343 | void IncrementCapturerCount(const gfx::Size& capture_size) override; |
| 344 | void DecrementCapturerCount() override; |
Francois Doray | 24fc62c | 2017-12-11 17:27:33 | [diff] [blame] | 345 | bool IsBeingCaptured() const override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 346 | bool IsAudioMuted() const override; |
| 347 | void SetAudioMuted(bool mute) override; |
Jan Rucka | 442c83f | 2017-08-08 13:27:54 | [diff] [blame] | 348 | bool IsCurrentlyAudible() override; |
ortuno | df4d798 | 2016-04-08 02:33:35 | [diff] [blame] | 349 | bool IsConnectedToBluetoothDevice() const override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 350 | bool IsCrashed() const override; |
| 351 | void SetIsCrashed(base::TerminationStatus status, int error_code) override; |
| 352 | base::TerminationStatus GetCrashedStatus() const override; |
afakhry | 9824183 | 2016-03-11 19:27:47 | [diff] [blame] | 353 | int GetCrashedErrorCode() const override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 354 | bool IsBeingDestroyed() const override; |
| 355 | void NotifyNavigationStateChanged(InvalidateTypes changed_flags) override; |
altimin | ec87fd1f | 2016-11-17 20:22:49 | [diff] [blame] | 356 | void OnAudioStateChanged(bool is_audible) override; |
gab | 0dccfef | 2015-05-20 18:43:39 | [diff] [blame] | 357 | base::TimeTicks GetLastActiveTime() const override; |
georgesak | 5582cbe | 2015-05-22 22:08:07 | [diff] [blame] | 358 | void SetLastActiveTime(base::TimeTicks last_active_time) override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 359 | void WasShown() override; |
| 360 | void WasHidden() override; |
Francois Doray | 1880097 | 2017-08-25 22:38:58 | [diff] [blame] | 361 | void WasOccluded() override; |
Francois Doray | fe4a177 | 2018-02-17 04:17:09 | [diff] [blame] | 362 | Visibility GetVisibility() const override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 363 | bool NeedToFireBeforeUnload() override; |
nasko | 148bb0b9 | 2016-05-10 21:03:19 | [diff] [blame] | 364 | void DispatchBeforeUnload() override; |
lazyboy | 6ec48b2a | 2015-06-29 15:18:14 | [diff] [blame] | 365 | void AttachToOuterWebContentsFrame( |
| 366 | WebContents* outer_web_contents, |
| 367 | RenderFrameHost* outer_contents_frame) override; |
Wei Li | 5c0b4d1 | 2018-03-22 15:05:22 | [diff] [blame] | 368 | WebContentsImpl* GetOuterWebContents() override; |
dalecurtis | 6c58ed0 | 2016-10-28 23:02:37 | [diff] [blame] | 369 | void DidChangeVisibleSecurityState() override; |
Wei Li | 5c0b4d1 | 2018-03-22 15:05:22 | [diff] [blame] | 370 | |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 371 | void Stop() override; |
Fadi Meawad | a6573e0 | 2018-03-10 00:52:11 | [diff] [blame] | 372 | void FreezePage() override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 373 | WebContents* Clone() override; |
toyoshim | 24a4c7ab | 2016-04-05 09:24:14 | [diff] [blame] | 374 | void ReloadFocusedFrame(bool bypass_cache) override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 375 | void Undo() override; |
| 376 | void Redo() override; |
| 377 | void Cut() override; |
| 378 | void Copy() override; |
| 379 | void CopyToFindPboard() override; |
| 380 | void Paste() override; |
| 381 | void PasteAndMatchStyle() override; |
| 382 | void Delete() override; |
| 383 | void SelectAll() override; |
yabinh | 351e7ec | 2017-03-10 02:43:24 | [diff] [blame] | 384 | void CollapseSelection() override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 385 | void Replace(const base::string16& word) override; |
| 386 | void ReplaceMisspelling(const base::string16& word) override; |
| 387 | void NotifyContextMenuClosed( |
anand.ratn | 120b0b00 | 2014-10-07 15:49:32 | [diff] [blame] | 388 | const CustomContextMenuContext& context) override; |
megjablon | 3f594107 | 2016-02-04 23:27:52 | [diff] [blame] | 389 | void ReloadLoFiImages() override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 390 | void ExecuteCustomContextMenuCommand( |
| 391 | int action, |
| 392 | const CustomContextMenuContext& context) override; |
| 393 | gfx::NativeView GetNativeView() override; |
| 394 | gfx::NativeView GetContentNativeView() override; |
| 395 | gfx::NativeWindow GetTopLevelNativeWindow() override; |
| 396 | gfx::Rect GetContainerBounds() override; |
| 397 | gfx::Rect GetViewBounds() override; |
| 398 | DropData* GetDropData() override; |
| 399 | void Focus() override; |
| 400 | void SetInitialFocus() override; |
| 401 | void StoreFocus() override; |
| 402 | void RestoreFocus() override; |
| 403 | void FocusThroughTabTraversal(bool reverse) override; |
| 404 | bool ShowingInterstitialPage() const override; |
Pete Williamson | 89aa140 | 2017-07-07 19:58:41 | [diff] [blame] | 405 | void AdjustPreviewsStateForNavigation(PreviewsState* previews_state) override; |
Maxim Podgorodskiy | a926c4ff | 2017-11-20 02:06:39 | [diff] [blame] | 406 | InterstitialPageImpl* GetInterstitialPage() const override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 407 | bool IsSavable() override; |
| 408 | void OnSavePage() override; |
| 409 | bool SavePage(const base::FilePath& main_file, |
| 410 | const base::FilePath& dir_path, |
| 411 | SavePageType save_type) override; |
| 412 | void SaveFrame(const GURL& url, const Referrer& referrer) override; |
kundaji | 6c7f969 | 2015-03-09 18:00:37 | [diff] [blame] | 413 | void SaveFrameWithHeaders(const GURL& url, |
| 414 | const Referrer& referrer, |
Xing Liu | 10329bf | 2018-03-20 19:22:14 | [diff] [blame] | 415 | const std::string& headers, |
| 416 | const base::string16& suggested_filename) override; |
dewittj | 6dc5747a | 2016-05-17 01:48:47 | [diff] [blame] | 417 | void GenerateMHTML(const MHTMLGenerationParams& params, |
Avi Drissman | 149b783 | 2018-03-23 14:31:49 | [diff] [blame] | 418 | base::OnceCallback<void(int64_t)> callback) override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 419 | const std::string& GetContentsMimeType() const override; |
| 420 | bool WillNotifyDisconnection() const override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 421 | RendererPreferences* GetMutableRendererPrefs() override; |
| 422 | void Close() override; |
Paul Meyer | 0c58c371 | 2016-11-17 22:59:51 | [diff] [blame] | 423 | void SystemDragEnded(RenderWidgetHost* source_rwh) override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 424 | void UserGestureDone() override; |
| 425 | void SetClosedByUserGesture(bool value) override; |
| 426 | bool GetClosedByUserGesture() const override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 427 | int GetMinimumZoomPercent() const override; |
| 428 | int GetMaximumZoomPercent() const override; |
mcnee | 432e47d | 2015-11-09 19:37:46 | [diff] [blame] | 429 | void SetPageScale(float page_scale_factor) override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 430 | gfx::Size GetPreferredSize() const override; |
| 431 | bool GotResponseToLockMouseRequest(bool allowed) override; |
| 432 | bool HasOpener() const override; |
lukasza | 6f8ac62 | 2017-06-06 03:10:20 | [diff] [blame] | 433 | RenderFrameHostImpl* GetOpener() const override; |
jochen | 6004a36 | 2017-02-04 00:11:40 | [diff] [blame] | 434 | bool HasOriginalOpener() const override; |
lukasza | 6f8ac62 | 2017-06-06 03:10:20 | [diff] [blame] | 435 | RenderFrameHostImpl* GetOriginalOpener() const override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 436 | void DidChooseColorInColorChooser(SkColor color) override; |
| 437 | void DidEndColorChooser() override; |
| 438 | int DownloadImage(const GURL& url, |
| 439 | bool is_favicon, |
| 440 | uint32_t max_bitmap_size, |
pkotwicz | fd77355 | 2015-03-16 00:29:14 | [diff] [blame] | 441 | bool bypass_cache, |
Avi Drissman | a5a52dd | 2018-03-27 03:39:02 | [diff] [blame] | 442 | ImageDownloadCallback callback) override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 443 | bool IsSubframe() const override; |
| 444 | void Find(int request_id, |
| 445 | const base::string16& search_text, |
| 446 | const blink::WebFindOptions& options) override; |
| 447 | void StopFinding(StopFindAction action) override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 448 | bool WasRecentlyAudible() override; |
Tommy Steimel | 1836051 | 2017-11-01 00:38:19 | [diff] [blame] | 449 | bool WasEverAudible() override; |
Avi Drissman | a5a52dd | 2018-03-27 03:39:02 | [diff] [blame] | 450 | void GetManifest(GetManifestCallback callback) override; |
avi | 0720b02e | 2017-06-13 03:22:13 | [diff] [blame] | 451 | bool IsFullscreenForCurrentTab() const override; |
bokan | ece34a8 | 2016-01-28 19:49:46 | [diff] [blame] | 452 | void ExitFullscreen(bool will_cause_resize) override; |
mariakhomenko | 44bdc473 | 2015-04-29 01:55:38 | [diff] [blame] | 453 | void ResumeLoadingCreatedWebContents() override; |
qinmin | 72e8bd0 | 2016-10-21 19:35:37 | [diff] [blame] | 454 | void SetIsOverlayContent(bool is_overlay_content) override; |
ekaramad | 5c1f939 | 2017-01-25 02:05:23 | [diff] [blame] | 455 | bool IsFocusedElementEditable() override; |
| 456 | void ClearFocusedElement() override; |
ekaramad | f6750aa | 2017-06-06 18:29:42 | [diff] [blame] | 457 | bool IsShowingContextMenu() const override; |
| 458 | void SetShowingContextMenu(bool showing) override; |
mfomitchev | 2b8b066a | 2016-01-28 19:23:15 | [diff] [blame] | 459 | |
mlamouri | 91873409 | 2016-03-12 04:47:52 | [diff] [blame] | 460 | #if defined(OS_ANDROID) |
dcheng | 48d97c5 | 2015-02-04 20:03:20 | [diff] [blame] | 461 | base::android::ScopedJavaLocalRef<jobject> GetJavaWebContents() override; |
[email protected] | 0e813a5 | 2014-08-13 10:34:56 | [diff] [blame] | 462 | virtual WebContentsAndroid* GetWebContentsAndroid(); |
paulmeyer | c0b762b | 2016-04-13 11:55:17 | [diff] [blame] | 463 | void ActivateNearestFindResult(float x, float y) override; |
| 464 | void RequestFindMatchRects(int current_version) override; |
rockot | 400ea35b | 2016-10-15 19:15:32 | [diff] [blame] | 465 | service_manager::InterfaceProvider* GetJavaInterfaces() override; |
[email protected] | fc2b46b | 2014-05-03 16:33:45 | [diff] [blame] | 466 | #elif defined(OS_MACOSX) |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 467 | void SetAllowOtherViews(bool allow) override; |
| 468 | bool GetAllowOtherViews() override; |
spqchan | e72c3cb | 2017-06-30 23:02:10 | [diff] [blame] | 469 | bool CompletedFirstVisuallyNonEmptyPaint() const override; |
[email protected] | 155c7f2 | 2013-12-09 17:07:18 | [diff] [blame] | 470 | #endif |
[email protected] | 0bfbf88 | 2011-12-22 18:19:27 | [diff] [blame] | 471 | |
| 472 | // Implementation of PageNavigator. |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 473 | WebContents* OpenURL(const OpenURLParams& params) override; |
[email protected] | 151a63d | 2011-12-20 22:32:52 | [diff] [blame] | 474 | |
[email protected] | 92404c6 | 2013-12-04 16:40:46 | [diff] [blame] | 475 | // RenderFrameHostDelegate --------------------------------------------------- |
nick | a0ac838 | 2016-12-15 23:59:23 | [diff] [blame] | 476 | bool OnMessageReceived(RenderFrameHostImpl* render_frame_host, |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 477 | const IPC::Message& message) override; |
rockot | f62002a | 2016-09-15 00:08:59 | [diff] [blame] | 478 | void OnAssociatedInterfaceRequest( |
| 479 | RenderFrameHost* render_frame_host, |
| 480 | const std::string& interface_name, |
| 481 | mojo::ScopedInterfaceEndpointHandle handle) override; |
Ben Goodger | 9e24929e | 2017-07-21 03:13:40 | [diff] [blame] | 482 | void OnInterfaceRequest( |
| 483 | RenderFrameHost* render_frame_host, |
| 484 | const std::string& interface_name, |
| 485 | mojo::ScopedMessagePipeHandle* interface_pipe) override; |
Nicolas Dossou-gbete | bcab247 | 2017-09-09 12:28:40 | [diff] [blame] | 486 | void OnDidBlockFramebust(const GURL& url) override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 487 | const GURL& GetMainFrameLastCommittedURL() const override; |
| 488 | void RenderFrameCreated(RenderFrameHost* render_frame_host) override; |
| 489 | void RenderFrameDeleted(RenderFrameHost* render_frame_host) override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 490 | void ShowContextMenu(RenderFrameHost* render_frame_host, |
| 491 | const ContextMenuParams& params) override; |
avi | 777ff45 | 2017-02-09 19:04:48 | [diff] [blame] | 492 | void RunJavaScriptDialog(RenderFrameHost* render_frame_host, |
| 493 | const base::string16& message, |
| 494 | const base::string16& default_prompt, |
avi | 777ff45 | 2017-02-09 19:04:48 | [diff] [blame] | 495 | JavaScriptDialogType dialog_type, |
| 496 | IPC::Message* reply_msg) override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 497 | void RunBeforeUnloadConfirm(RenderFrameHost* render_frame_host, |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 498 | bool is_reload, |
| 499 | IPC::Message* reply_msg) override; |
nasko | ada75b2 | 2016-06-11 16:09:46 | [diff] [blame] | 500 | void RunFileChooser(RenderFrameHost* render_frame_host, |
| 501 | const FileChooserParams& params) override; |
Charles Reis | 15d60b13 | 2017-11-03 17:43:47 | [diff] [blame] | 502 | void DidCancelLoading() override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 503 | void DidAccessInitialDocument() override; |
alexmos | be2f4c3 | 2015-03-10 02:30:23 | [diff] [blame] | 504 | void DidChangeName(RenderFrameHost* render_frame_host, |
| 505 | const std::string& name) override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 506 | void DocumentOnLoadCompleted(RenderFrameHost* render_frame_host) override; |
creis | 8eb8ef2 | 2015-11-04 22:51:38 | [diff] [blame] | 507 | void UpdateStateForFrame(RenderFrameHost* render_frame_host, |
| 508 | const PageState& page_state) override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 509 | void UpdateTitle(RenderFrameHost* render_frame_host, |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 510 | const base::string16& title, |
| 511 | base::i18n::TextDirection title_direction) override; |
| 512 | void UpdateEncoding(RenderFrameHost* render_frame_host, |
| 513 | const std::string& encoding) override; |
| 514 | WebContents* GetAsWebContents() override; |
| 515 | bool IsNeverVisible() override; |
Doug Turner | 63f3c7b | 2017-07-29 05:10:01 | [diff] [blame] | 516 | ui::AXMode GetAccessibilityMode() const override; |
Dominic Mazzoni | a7b0edb2 | 2017-08-09 16:32:51 | [diff] [blame] | 517 | void AccessibilityEventReceived( |
| 518 | const std::vector<AXEventNotificationDetails>& details) override; |
dmazzoni | 2400c46 | 2016-08-23 15:07:13 | [diff] [blame] | 519 | void AccessibilityLocationChangesReceived( |
| 520 | const std::vector<AXLocationChangeNotificationDetails>& details) override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 521 | RenderFrameHost* GetGuestByInstanceID( |
fsamuel | 833ee7c | 2015-02-13 23:40:40 | [diff] [blame] | 522 | RenderFrameHost* render_frame_host, |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 523 | int browser_plugin_instance_id) override; |
Ke He | 7319dbe | 2017-11-09 05:54:44 | [diff] [blame] | 524 | device::mojom::GeolocationContext* GetGeolocationContext() override; |
ke.he | 98b761e | 2017-05-09 05:59:17 | [diff] [blame] | 525 | device::mojom::WakeLockContext* GetWakeLockContext() override; |
juncai | 8e8d6ec | 2017-06-06 20:48:18 | [diff] [blame] | 526 | device::mojom::WakeLock* GetRendererWakeLock() override; |
blundell | f5316fc | 2017-05-15 11:49:03 | [diff] [blame] | 527 | #if defined(OS_ANDROID) |
Han Leon | f6a2e5f | 2017-05-23 13:40:47 | [diff] [blame] | 528 | void GetNFC(device::mojom::NFCRequest request) override; |
blundell | f5316fc | 2017-05-15 11:49:03 | [diff] [blame] | 529 | #endif |
mlamouri | 7a78d6fd | 2015-01-17 13:23:53 | [diff] [blame] | 530 | void EnterFullscreenMode(const GURL& origin) override; |
bokan | ece34a8 | 2016-01-28 19:49:46 | [diff] [blame] | 531 | void ExitFullscreenMode(bool will_cause_resize) override; |
alexmos | e7da5a1 | 2015-04-09 02:22:16 | [diff] [blame] | 532 | bool ShouldRouteMessageEvent( |
| 533 | RenderFrameHost* target_rfh, |
| 534 | SiteInstance* source_site_instance) const override; |
alexmos | 5872904 | 2015-06-18 23:20:00 | [diff] [blame] | 535 | void EnsureOpenerProxiesExist(RenderFrameHost* source_rfh) override; |
dcheng | 5971627 | 2016-04-09 05:19:08 | [diff] [blame] | 536 | std::unique_ptr<WebUIImpl> CreateWebUIForRenderFrameHost( |
| 537 | const GURL& url) override; |
avallee | 0206f78 | 2016-07-28 18:55:33 | [diff] [blame] | 538 | void SetFocusedFrame(FrameTreeNode* node, SiteInstance* source) override; |
Avi Drissman | 36f801f | 2018-02-01 20:06:04 | [diff] [blame] | 539 | void DidCallFocus() override; |
avallee | d68cdd1 | 2017-06-21 22:07:27 | [diff] [blame] | 540 | RenderFrameHost* GetFocusedFrameIncludingInnerWebContents() override; |
ekaramad | a110f64 | 2016-12-21 19:47:28 | [diff] [blame] | 541 | void OnFocusedElementChangedInFrame( |
| 542 | RenderFrameHostImpl* frame, |
| 543 | const gfx::Rect& bounds_in_root_view) override; |
Lucas Furukawa Gadani | abbfa34 | 2017-08-29 19:37:57 | [diff] [blame] | 544 | void OnAdvanceFocus(RenderFrameHostImpl* source_rfh) override; |
nick | 5ae4d2d | 2017-01-06 01:18:35 | [diff] [blame] | 545 | void CreateNewWindow( |
csharrison | 95f01e92 | 2017-04-24 18:52:35 | [diff] [blame] | 546 | RenderFrameHost* opener, |
nick | 5ae4d2d | 2017-01-06 01:18:35 | [diff] [blame] | 547 | int32_t render_view_route_id, |
| 548 | int32_t main_frame_route_id, |
| 549 | int32_t main_frame_widget_route_id, |
| 550 | const mojom::CreateNewWindowParams& params, |
| 551 | SessionStorageNamespace* session_storage_namespace) override; |
| 552 | void ShowCreatedWindow(int process_id, |
| 553 | int main_frame_widget_route_id, |
| 554 | WindowOpenDisposition disposition, |
| 555 | const gfx::Rect& initial_rect, |
| 556 | bool user_gesture) override; |
carlosk | d9d9794 | 2017-02-16 08:58:09 | [diff] [blame] | 557 | void DidDisplayInsecureContent() override; |
| 558 | void DidRunInsecureContent(const GURL& security_origin, |
| 559 | const GURL& target_url) override; |
| 560 | void PassiveInsecureContentFound(const GURL& resource_url) override; |
| 561 | bool ShouldAllowRunningInsecureContent(content::WebContents* web_contents, |
| 562 | bool allowed_per_prefs, |
| 563 | const url::Origin& origin, |
| 564 | const GURL& resource_url) override; |
Lukasz Anforowicz | e1b954d9 | 2017-10-30 21:28:06 | [diff] [blame] | 565 | void ViewSource(RenderFrameHostImpl* frame) override; |
Wei Li | 5bb65974 | 2018-02-14 03:07:58 | [diff] [blame] | 566 | void PrintCrossProcessSubframe(const gfx::Rect& rect, |
| 567 | int document_cookie, |
| 568 | RenderFrameHost* render_frame_host) override; |
rob.buis | 300b087 | 2017-03-10 20:43:58 | [diff] [blame] | 569 | #if defined(OS_ANDROID) |
| 570 | base::android::ScopedJavaLocalRef<jobject> GetJavaRenderFrameHostDelegate() |
| 571 | override; |
| 572 | #endif |
Jay Civelli | d5904f0 | 2018-03-23 19:43:57 | [diff] [blame] | 573 | void SubresourceResponseStarted(const GURL& url, |
| 574 | net::CertStatus cert_status) override; |
Jay Civelli | 116683f | 2018-03-27 19:56:23 | [diff] [blame] | 575 | void ResourceLoadComplete( |
| 576 | mojom::ResourceLoadInfoPtr resource_load_information) override; |
Jennifer Apacible | c45fd05 | 2018-02-25 12:04:55 | [diff] [blame] | 577 | void UpdatePictureInPictureSurfaceId(viz::SurfaceId surface_id) override; |
[email protected] | 952a68e | 2011-11-17 00:36:10 | [diff] [blame] | 578 | |
[email protected] | 92404c6 | 2013-12-04 16:40:46 | [diff] [blame] | 579 | // RenderViewHostDelegate ---------------------------------------------------- |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 580 | RenderViewHostDelegateView* GetDelegateView() override; |
nick | a0ac838 | 2016-12-15 23:59:23 | [diff] [blame] | 581 | bool OnMessageReceived(RenderViewHostImpl* render_view_host, |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 582 | const IPC::Message& message) override; |
[email protected] | a86c0e96 | 2013-12-17 17:10:39 | [diff] [blame] | 583 | // RenderFrameHostDelegate has the same method, so list it there because this |
| 584 | // interface is going away. |
nick | 5120892 | 2015-04-24 21:38:37 | [diff] [blame] | 585 | // WebContents* GetAsWebContents() override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 586 | void RenderViewCreated(RenderViewHost* render_view_host) override; |
| 587 | void RenderViewReady(RenderViewHost* render_view_host) override; |
| 588 | void RenderViewTerminated(RenderViewHost* render_view_host, |
| 589 | base::TerminationStatus status, |
| 590 | int error_code) override; |
| 591 | void RenderViewDeleted(RenderViewHost* render_view_host) override; |
sky | 8b00392d | 2015-01-10 00:30:28 | [diff] [blame] | 592 | void UpdateTargetURL(RenderViewHost* render_view_host, |
| 593 | const GURL& url) override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 594 | void Close(RenderViewHost* render_view_host) override; |
| 595 | void RequestMove(const gfx::Rect& new_bounds) override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 596 | void DocumentAvailableInMainFrame(RenderViewHost* render_view_host) override; |
| 597 | void RouteCloseEvent(RenderViewHost* rvh) override; |
avi | a90ae4e | 2016-11-11 20:49:33 | [diff] [blame] | 598 | bool DidAddMessageToConsole(int32_t level, |
| 599 | const base::string16& message, |
| 600 | int32_t line_no, |
| 601 | const base::string16& source_id) override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 602 | RendererPreferences GetRendererPrefs( |
anand.ratn | 120b0b00 | 2014-10-07 15:49:32 | [diff] [blame] | 603 | BrowserContext* browser_context) const override; |
dominickn | 9c7ceaa3 | 2016-02-27 01:52:53 | [diff] [blame] | 604 | void OnUserInteraction(RenderWidgetHostImpl* render_widget_host, |
| 605 | const blink::WebInputEvent::Type type) override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 606 | void OnIgnoredUIEvent() override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 607 | void Activate() override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 608 | void UpdatePreferredSize(const gfx::Size& pref_size) override; |
avi | b734894 | 2015-12-25 20:57:10 | [diff] [blame] | 609 | void CreateNewWidget(int32_t render_process_id, |
| 610 | int32_t route_id, |
Dave Tapuska | 1bdf183 | 2017-07-07 18:07:19 | [diff] [blame] | 611 | mojom::WidgetPtr widget, |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 612 | blink::WebPopupType popup_type) override; |
avi | b734894 | 2015-12-25 20:57:10 | [diff] [blame] | 613 | void CreateNewFullscreenWidget(int32_t render_process_id, |
Dave Tapuska | 1bdf183 | 2017-07-07 18:07:19 | [diff] [blame] | 614 | int32_t route_id, |
| 615 | mojom::WidgetPtr widget) override; |
alexmos | c2a8cec | 2016-05-23 22:19:53 | [diff] [blame] | 616 | void ShowCreatedWidget(int process_id, |
| 617 | int route_id, |
| 618 | const gfx::Rect& initial_rect) override; |
| 619 | void ShowCreatedFullscreenWidget(int process_id, int route_id) override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 620 | void RequestMediaAccessPermission( |
[email protected] | 33662e5 | 2013-01-07 21:31:09 | [diff] [blame] | 621 | const MediaStreamRequest& request, |
anand.ratn | 120b0b00 | 2014-10-07 15:49:32 | [diff] [blame] | 622 | const MediaResponseCallback& callback) override; |
Raymes Khoury | ad7c24a1 | 2018-03-05 23:22:58 | [diff] [blame] | 623 | bool CheckMediaAccessPermission(RenderFrameHost* render_frame_host, |
| 624 | const url::Origin& security_origin, |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 625 | MediaStreamType type) override; |
guidou | 8a440b84 | 2017-01-30 13:58:43 | [diff] [blame] | 626 | std::string GetDefaultMediaDeviceID(MediaStreamType type) override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 627 | SessionStorageNamespace* GetSessionStorageNamespace( |
anand.ratn | 120b0b00 | 2014-10-07 15:49:32 | [diff] [blame] | 628 | SiteInstance* instance) override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 629 | SessionStorageNamespaceMap GetSessionStorageNamespaceMap() override; |
mcnee | 336ea2c | 2017-05-23 22:50:59 | [diff] [blame] | 630 | #if !defined(OS_ANDROID) |
avi | 85ee836 | 2016-10-08 02:09:08 | [diff] [blame] | 631 | double GetPendingPageZoomLevel() override; |
mcnee | 336ea2c | 2017-05-23 22:50:59 | [diff] [blame] | 632 | #endif // !defined(OS_ANDROID) |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 633 | FrameTree* GetFrameTree() override; |
aelias | 5252baa | 2016-04-10 01:18:02 | [diff] [blame] | 634 | bool IsOverridingUserAgent() override; |
avi | 85ee836 | 2016-10-08 02:09:08 | [diff] [blame] | 635 | bool IsJavaScriptDialogShowing() const override; |
avi | c031d39 | 2017-03-03 03:09:42 | [diff] [blame] | 636 | bool ShouldIgnoreUnresponsiveRenderer() override; |
qinmin | 72e8bd0 | 2016-10-21 19:35:37 | [diff] [blame] | 637 | bool HideDownloadUI() const override; |
mlamouri | 5cd9ae8 | 2017-02-18 11:05:09 | [diff] [blame] | 638 | bool HasPersistentVideo() const override; |
Alex Moshchuk | 27caae8 | 2017-09-11 23:11:18 | [diff] [blame] | 639 | RenderFrameHost* GetPendingMainFrame() override; |
luken | dc35e7f | 2014-11-10 19:06:14 | [diff] [blame] | 640 | |
[email protected] | 5291380 | 2013-12-10 05:52:18 | [diff] [blame] | 641 | // NavigatorDelegate --------------------------------------------------------- |
| 642 | |
clamy | 0e11988 | 2015-07-31 16:12:33 | [diff] [blame] | 643 | void DidStartNavigation(NavigationHandle* navigation_handle) override; |
| 644 | void DidRedirectNavigation(NavigationHandle* navigation_handle) override; |
clamy | efca29e | 2015-09-17 00:22:11 | [diff] [blame] | 645 | void ReadyToCommitNavigation(NavigationHandle* navigation_handle) override; |
clamy | 0e11988 | 2015-07-31 16:12:33 | [diff] [blame] | 646 | void DidFinishNavigation(NavigationHandle* navigation_handle) override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 647 | void DidFailLoadWithError(RenderFrameHostImpl* render_frame_host, |
| 648 | const GURL& url, |
| 649 | int error_code, |
Yutaka Hirano | 16d3c5d | 2017-07-31 06:17:30 | [diff] [blame] | 650 | const base::string16& error_description) override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 651 | void DidNavigateMainFramePreCommit(bool navigation_is_within_page) override; |
| 652 | void DidNavigateMainFramePostCommit( |
sky | 8b00392d | 2015-01-10 00:30:28 | [diff] [blame] | 653 | RenderFrameHostImpl* render_frame_host, |
[email protected] | 37567b43 | 2014-02-12 01:12:22 | [diff] [blame] | 654 | const LoadCommittedDetails& details, |
anand.ratn | 120b0b00 | 2014-10-07 15:49:32 | [diff] [blame] | 655 | const FrameHostMsg_DidCommitProvisionalLoad_Params& params) override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 656 | void DidNavigateAnyFramePostCommit( |
[email protected] | 37567b43 | 2014-02-12 01:12:22 | [diff] [blame] | 657 | RenderFrameHostImpl* render_frame_host, |
| 658 | const LoadCommittedDetails& details, |
anand.ratn | 120b0b00 | 2014-10-07 15:49:32 | [diff] [blame] | 659 | const FrameHostMsg_DidCommitProvisionalLoad_Params& params) override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 660 | void SetMainFrameMimeType(const std::string& mime_type) override; |
| 661 | bool CanOverscrollContent() const override; |
| 662 | void NotifyChangedNavigationState(InvalidateTypes changed_flags) override; |
toyoshim | 0df1d3a | 2016-09-09 09:52:48 | [diff] [blame] | 663 | void DidStartNavigationToPendingEntry(const GURL& url, |
| 664 | ReloadType reload_type) override; |
lukasza | 1d02573 | 2016-09-28 21:36:08 | [diff] [blame] | 665 | bool ShouldTransferNavigation(bool is_main_frame_navigation) override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 666 | bool ShouldPreserveAbortedURLs() override; |
fdegans | a696e511 | 2015-04-17 01:57:59 | [diff] [blame] | 667 | void DidStartLoading(FrameTreeNode* frame_tree_node, |
| 668 | bool to_different_document) override; |
| 669 | void DidStopLoading() override; |
| 670 | void DidChangeLoadProgress() override; |
avi | d6d88b91 | 2017-01-13 00:16:00 | [diff] [blame] | 671 | std::vector<std::unique_ptr<NavigationThrottle>> CreateThrottlesForNavigation( |
clamy | cbf524d4 | 2016-09-27 12:48:35 | [diff] [blame] | 672 | NavigationHandle* navigation_handle) override; |
clamy | 1e5574e | 2016-09-29 16:48:44 | [diff] [blame] | 673 | std::unique_ptr<NavigationUIData> GetNavigationUIData( |
| 674 | NavigationHandle* navigation_handle) override; |
[email protected] | 5291380 | 2013-12-10 05:52:18 | [diff] [blame] | 675 | |
[email protected] | 4ca76c0 | 2012-05-16 16:19:05 | [diff] [blame] | 676 | // RenderWidgetHostDelegate -------------------------------------------------- |
| 677 | |
lazyboy | 63f5b31 | 2015-11-23 20:19:52 | [diff] [blame] | 678 | void RenderWidgetCreated(RenderWidgetHostImpl* render_widget_host) override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 679 | void RenderWidgetDeleted(RenderWidgetHostImpl* render_widget_host) override; |
miu | 9e14e49 | 2014-10-25 02:39:04 | [diff] [blame] | 680 | void RenderWidgetGotFocus(RenderWidgetHostImpl* render_widget_host) override; |
zijiehe | 3bee08e2 | 2017-05-17 04:14:46 | [diff] [blame] | 681 | void RenderWidgetLostFocus(RenderWidgetHostImpl* render_widget_host) override; |
rouslan | 2f5993f | 2015-01-29 00:18:31 | [diff] [blame] | 682 | void RenderWidgetWasResized(RenderWidgetHostImpl* render_widget_host, |
Christopher Cameron | 07f666b | 2018-02-13 23:41:19 | [diff] [blame] | 683 | const ScreenInfo& screen_info, |
rouslan | 2f5993f | 2015-01-29 00:18:31 | [diff] [blame] | 684 | bool width_changed) override; |
avi | c3aa842 | 2015-11-09 20:57:22 | [diff] [blame] | 685 | void ResizeDueToAutoResize(RenderWidgetHostImpl* render_widget_host, |
Fady Samuel | d10aadd8 | 2017-11-03 18:23:57 | [diff] [blame] | 686 | const gfx::Size& new_size, |
| 687 | uint64_t sequence_number) override; |
kenrb | e4f9108 | 2017-06-02 20:32:08 | [diff] [blame] | 688 | gfx::Size GetAutoResizeSize() override; |
| 689 | void ResetAutoResizeSize() override; |
sky | f65d9bb | 2017-03-24 02:26:39 | [diff] [blame] | 690 | KeyboardEventProcessingResult PreHandleKeyboardEvent( |
| 691 | const NativeWebKeyboardEvent& event) override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 692 | void HandleKeyboardEvent(const NativeWebKeyboardEvent& event) override; |
| 693 | bool HandleWheelEvent(const blink::WebMouseWheelEvent& event) override; |
| 694 | bool PreHandleGestureEvent(const blink::WebGestureEvent& event) override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 695 | BrowserAccessibilityManager* GetRootBrowserAccessibilityManager() override; |
| 696 | BrowserAccessibilityManager* GetOrCreateRootBrowserAccessibilityManager() |
anand.ratn | 120b0b00 | 2014-10-07 15:49:32 | [diff] [blame] | 697 | override; |
lgarron | 145aaa8 | 2015-07-10 07:39:56 | [diff] [blame] | 698 | // The following 4 functions are already listed under WebContents overrides: |
mohsen | 7ab1ec16ec | 2015-07-02 18:26:23 | [diff] [blame] | 699 | // void Cut() override; |
| 700 | // void Copy() override; |
| 701 | // void Paste() override; |
lgarron | 145aaa8 | 2015-07-10 07:39:56 | [diff] [blame] | 702 | // void SelectAll() override; |
Dave Tapuska | b336b92 | 2017-07-06 19:24:05 | [diff] [blame] | 703 | void ExecuteEditCommand(const std::string& command, |
| 704 | const base::Optional<base::string16>& value) override; |
mohsen | 7ab1ec16ec | 2015-07-02 18:26:23 | [diff] [blame] | 705 | void MoveRangeSelectionExtent(const gfx::Point& extent) override; |
| 706 | void SelectRange(const gfx::Point& base, const gfx::Point& extent) override; |
Dave Tapuska | b336b92 | 2017-07-06 19:24:05 | [diff] [blame] | 707 | void MoveCaret(const gfx::Point& extent) override; |
Shimi Zhang | 37deeb2 | 2017-09-28 00:59:01 | [diff] [blame] | 708 | void AdjustSelectionByCharacterOffset(int start_adjust, |
| 709 | int end_adjust, |
| 710 | bool show_selection_menu) override; |
kenrb | 2a565f8 | 2015-09-02 20:24:59 | [diff] [blame] | 711 | RenderWidgetHostInputEventRouter* GetInputEventRouter() override; |
alexmos | 3fcd0ca | 2015-10-23 18:18:33 | [diff] [blame] | 712 | void ReplicatePageFocus(bool is_focused) override; |
alexmos | c4cbacb | 2015-11-21 01:29:22 | [diff] [blame] | 713 | RenderWidgetHostImpl* GetFocusedRenderWidgetHost( |
| 714 | RenderWidgetHostImpl* receiving_widget) override; |
avallee | 9993fca | 2016-11-17 06:16:50 | [diff] [blame] | 715 | RenderWidgetHostImpl* GetRenderWidgetHostWithPageFocus() override; |
| 716 | void FocusOwningWebContents( |
| 717 | RenderWidgetHostImpl* render_widget_host) override; |
avi | ce79930 | 2017-03-09 16:34:59 | [diff] [blame] | 718 | void RendererUnresponsive(RenderWidgetHostImpl* render_widget_host) override; |
avi | c3aa842 | 2015-11-09 20:57:22 | [diff] [blame] | 719 | void RendererResponsive(RenderWidgetHostImpl* render_widget_host) override; |
| 720 | void RequestToLockMouse(RenderWidgetHostImpl* render_widget_host, |
| 721 | bool user_gesture, |
lfg | ad824435 | 2016-07-13 16:55:51 | [diff] [blame] | 722 | bool last_unlocked_by_target, |
| 723 | bool privileged) override; |
Joe Downing | 192998b2 | 2018-03-22 15:51:36 | [diff] [blame] | 724 | bool RequestKeyboardLock(RenderWidgetHostImpl* render_widget_host) override; |
| 725 | void CancelKeyboardLock(RenderWidgetHostImpl* render_widget_host) override; |
| 726 | RenderWidgetHostImpl* GetKeyboardLockWidget() override; |
avi | 0720b02e | 2017-06-13 03:22:13 | [diff] [blame] | 727 | // The following function is already listed under WebContents overrides: |
| 728 | // bool IsFullscreenForCurrentTab() const override; |
avi | bf58fa0c | 2015-11-11 01:45:52 | [diff] [blame] | 729 | blink::WebDisplayMode GetDisplayMode( |
| 730 | RenderWidgetHostImpl* render_widget_host) const override; |
avi | 3e4b851 | 2015-11-11 01:55:49 | [diff] [blame] | 731 | void LostCapture(RenderWidgetHostImpl* render_widget_host) override; |
| 732 | void LostMouseLock(RenderWidgetHostImpl* render_widget_host) override; |
lfg | ad824435 | 2016-07-13 16:55:51 | [diff] [blame] | 733 | bool HasMouseLock(RenderWidgetHostImpl* render_widget_host) override; |
lfg | 84763c9 | 2017-02-16 18:55:15 | [diff] [blame] | 734 | RenderWidgetHostImpl* GetMouseLockWidget() override; |
ekaramad | a4f4269 | 2016-02-11 19:48:37 | [diff] [blame] | 735 | void OnRenderFrameProxyVisibilityChanged(bool visible) override; |
lfg | bb9c28a | 2016-03-01 03:19:49 | [diff] [blame] | 736 | void SendScreenRects() override; |
ekaramad | add88229 | 2016-06-08 15:22:56 | [diff] [blame] | 737 | TextInputManager* GetTextInputManager() override; |
paulmeyer | 7f6f1d4f | 2016-11-15 00:00:27 | [diff] [blame] | 738 | bool OnUpdateDragCursor() override; |
kenrb | 11f213a | 2017-03-24 18:12:06 | [diff] [blame] | 739 | bool IsWidgetForMainFrame(RenderWidgetHostImpl* render_widget_host) override; |
nzolghadr | d87a308d | 2016-12-07 15:45:56 | [diff] [blame] | 740 | bool AddDomainInfoToRapporSample(rappor::Sample* sample) override; |
nzolghadr | bbffc6c | 2017-05-25 17:56:39 | [diff] [blame] | 741 | void UpdateUrlForUkmSource(ukm::UkmRecorder* service, |
| 742 | ukm::SourceId ukm_source_id) override; |
ekaramad | a110f64 | 2016-12-21 19:47:28 | [diff] [blame] | 743 | void FocusedNodeTouched(bool editable) override; |
samans | 90fb816 | 2017-04-04 22:30:45 | [diff] [blame] | 744 | void DidReceiveCompositorFrame() override; |
ekaramad | f6750aa | 2017-06-06 18:29:42 | [diff] [blame] | 745 | bool IsShowingContextMenuOnPage() const override; |
[email protected] | 4ca76c0 | 2012-05-16 16:19:05 | [diff] [blame] | 746 | |
[email protected] | b0936d2 | 2013-11-28 06:47:36 | [diff] [blame] | 747 | // RenderFrameHostManager::Delegate ------------------------------------------ |
[email protected] | 0bfbf88 | 2011-12-22 18:19:27 | [diff] [blame] | 748 | |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 749 | bool CreateRenderViewForRenderManager( |
[email protected] | bffc830 | 2014-01-23 20:52:16 | [diff] [blame] | 750 | RenderViewHost* render_view_host, |
alexmos | 5ac402d | 2015-07-09 07:51:10 | [diff] [blame] | 751 | int opener_frame_routing_id, |
[email protected] | 5a7100d | 2014-05-19 01:29:04 | [diff] [blame] | 752 | int proxy_routing_id, |
Pavel Feldman | 2523472 | 2017-10-11 02:49:06 | [diff] [blame] | 753 | const base::UnguessableToken& devtools_frame_token, |
lfg | bede639 | 2015-09-11 21:54:06 | [diff] [blame] | 754 | const FrameReplicationState& replicated_frame_state) override; |
| 755 | void CreateRenderWidgetHostViewForRenderManager( |
| 756 | RenderViewHost* render_view_host) override; |
alexmos | a181efc | 2015-09-03 00:39:04 | [diff] [blame] | 757 | bool CreateRenderFrameForRenderManager( |
| 758 | RenderFrameHost* render_frame_host, |
| 759 | int proxy_routing_id, |
| 760 | int opener_routing_id, |
| 761 | int parent_routing_id, |
| 762 | int previous_sibling_routing_id) override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 763 | void BeforeUnloadFiredFromRenderManager( |
| 764 | bool proceed, |
| 765 | const base::TimeTicks& proceed_time, |
anand.ratn | 120b0b00 | 2014-10-07 15:49:32 | [diff] [blame] | 766 | bool* proceed_to_fire_unload) override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 767 | void RenderProcessGoneFromRenderManager( |
anand.ratn | 120b0b00 | 2014-10-07 15:49:32 | [diff] [blame] | 768 | RenderViewHost* render_view_host) override; |
Jianzhou Feng | d8720c7 | 2018-01-18 03:06:30 | [diff] [blame] | 769 | void UpdateRenderViewSizeForRenderManager(bool is_main_frame) override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 770 | void CancelModalDialogsForRenderManager() override; |
| 771 | void NotifySwappedFromRenderManager(RenderFrameHost* old_host, |
| 772 | RenderFrameHost* new_host, |
| 773 | bool is_main_frame) override; |
nasko | f5940b9f | 2015-03-02 23:04:05 | [diff] [blame] | 774 | void NotifyMainFrameSwappedFromRenderManager( |
| 775 | RenderViewHost* old_host, |
| 776 | RenderViewHost* new_host) override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 777 | NavigationControllerImpl& GetControllerForRenderManager() override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 778 | NavigationEntry* GetLastCommittedNavigationEntryForRenderManager() override; |
creis | adca986 | 2017-06-16 19:12:11 | [diff] [blame] | 779 | InterstitialPageImpl* GetInterstitialForRenderManager() override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 780 | bool FocusLocationBarByDefault() override; |
| 781 | void SetFocusToLocationBar(bool select_all) override; |
| 782 | bool IsHidden() override; |
rob | 9725074 | 2015-12-10 17:45:15 | [diff] [blame] | 783 | int GetOuterDelegateFrameTreeNodeId() override; |
ekaramad | aeb3c5c | 2016-11-09 03:22:35 | [diff] [blame] | 784 | RenderWidgetHostImpl* GetFullscreenRenderWidgetHost() const override; |
[email protected] | 0bfbf88 | 2011-12-22 18:19:27 | [diff] [blame] | 785 | |
Joel Hockey | 163835a | 2017-12-20 11:51:57 | [diff] [blame] | 786 | // blink::mojom::ColorChooserFactory --------------------------------------- |
Joel Hockey | 85b379d | 2017-12-11 10:42:13 | [diff] [blame] | 787 | |
Joel Hockey | 163835a | 2017-12-20 11:51:57 | [diff] [blame] | 788 | void OnColorChooserFactoryRequest( |
| 789 | blink::mojom::ColorChooserFactoryRequest request); |
Joel Hockey | 85b379d | 2017-12-11 10:42:13 | [diff] [blame] | 790 | void OpenColorChooser( |
Joel Hockey | 163835a | 2017-12-20 11:51:57 | [diff] [blame] | 791 | blink::mojom::ColorChooserRequest chooser, |
| 792 | blink::mojom::ColorChooserClientPtr client, |
Joel Hockey | 85b379d | 2017-12-11 10:42:13 | [diff] [blame] | 793 | SkColor color, |
Joel Hockey | 163835a | 2017-12-20 11:51:57 | [diff] [blame] | 794 | std::vector<blink::mojom::ColorSuggestionPtr> suggestions) override; |
Joel Hockey | 85b379d | 2017-12-11 10:42:13 | [diff] [blame] | 795 | |
[email protected] | 8ff00d7 | 2012-10-23 19:12:21 | [diff] [blame] | 796 | // NotificationObserver ------------------------------------------------------ |
[email protected] | 14392a5 | 2012-05-02 20:28:44 | [diff] [blame] | 797 | |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 798 | void Observe(int type, |
| 799 | const NotificationSource& source, |
| 800 | const NotificationDetails& details) override; |
[email protected] | 14392a5 | 2012-05-02 20:28:44 | [diff] [blame] | 801 | |
[email protected] | ec6c05f | 2013-10-23 18:41:57 | [diff] [blame] | 802 | // NavigationControllerDelegate ---------------------------------------------- |
| 803 | |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 804 | WebContents* GetWebContents() override; |
| 805 | void NotifyNavigationEntryCommitted( |
anand.ratn | 120b0b00 | 2014-10-07 15:49:32 | [diff] [blame] | 806 | const LoadCommittedDetails& load_details) override; |
Sam McNally | 5c087a3 | 2017-08-25 01:46:14 | [diff] [blame] | 807 | void NotifyNavigationEntryChanged( |
| 808 | const EntryChangedDetails& change_details) override; |
| 809 | void NotifyNavigationListPruned(const PrunedDetails& pruned_details) override; |
Christian Dullweber | 1af31e6 | 2018-02-22 11:49:48 | [diff] [blame] | 810 | void NotifyNavigationEntriesDeleted() override; |
[email protected] | ec6c05f | 2013-10-23 18:41:57 | [diff] [blame] | 811 | |
| 812 | // Invoked before a form repost warning is shown. |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 813 | void NotifyBeforeFormRepostWarningShow() override; |
[email protected] | ec6c05f | 2013-10-23 18:41:57 | [diff] [blame] | 814 | |
| 815 | // Activate this WebContents and show a form repost warning. |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 816 | void ActivateAndShowRepostFormWarningDialog() override; |
[email protected] | ec6c05f | 2013-10-23 18:41:57 | [diff] [blame] | 817 | |
[email protected] | b4c8401 | 2014-04-28 19:51:10 | [diff] [blame] | 818 | // Whether the initial empty page of this view has been accessed by another |
| 819 | // page, making it unsafe to show the pending URL. Always false after the |
| 820 | // first commit. |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 821 | bool HasAccessedInitialDocument() override; |
[email protected] | b4c8401 | 2014-04-28 19:51:10 | [diff] [blame] | 822 | |
avi | 2b17759 | 2014-12-10 02:08:02 | [diff] [blame] | 823 | // Sets the history for this WebContentsImpl to |history_length| entries, with |
alexmos | 136fd6e6 | 2016-08-15 20:58:41 | [diff] [blame] | 824 | // an offset of |history_offset|. This notifies all renderers involved in |
| 825 | // rendering the current page about the new offset and length. |
avi | 2b17759 | 2014-12-10 02:08:02 | [diff] [blame] | 826 | void SetHistoryOffsetAndLength(int history_offset, |
| 827 | int history_length) override; |
[email protected] | 553602e1 | 2011-04-05 17:01:18 | [diff] [blame] | 828 | |
[email protected] | a86c0e96 | 2013-12-17 17:10:39 | [diff] [blame] | 829 | // Called by InterstitialPageImpl when it creates a RenderFrameHost. |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 830 | void RenderFrameForInterstitialPageCreated( |
anand.ratn | 120b0b00 | 2014-10-07 15:49:32 | [diff] [blame] | 831 | RenderFrameHost* render_frame_host) override; |
[email protected] | 561628ce | 2013-10-25 00:56:47 | [diff] [blame] | 832 | |
| 833 | // Sets the passed interstitial as the currently showing interstitial. |
| 834 | // No interstitial page should already be attached. |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 835 | void AttachInterstitialPage(InterstitialPageImpl* interstitial_page) override; |
[email protected] | 561628ce | 2013-10-25 00:56:47 | [diff] [blame] | 836 | |
Becca Hughes | 9f6fd4b8 | 2017-06-15 10:01:40 | [diff] [blame] | 837 | void MediaMutedStatusChanged(const WebContentsObserver::MediaPlayerId& id, |
| 838 | bool muted); |
| 839 | |
[email protected] | 561628ce | 2013-10-25 00:56:47 | [diff] [blame] | 840 | // Unsets the currently showing interstitial. |
Lucas Furukawa Gadani | 7f1241d | 2017-07-12 01:45:04 | [diff] [blame] | 841 | void DetachInterstitialPage(bool has_focus) override; |
[email protected] | 561628ce | 2013-10-25 00:56:47 | [diff] [blame] | 842 | |
aelias | 5252baa | 2016-04-10 01:18:02 | [diff] [blame] | 843 | void UpdateOverridingUserAgent() override; |
| 844 | |
clamy | 44e84ce | 2016-02-22 15:38:25 | [diff] [blame] | 845 | // Unpause the throbber if it was paused. |
| 846 | void DidProceedOnInterstitial() override; |
[email protected] | 561628ce | 2013-10-25 00:56:47 | [diff] [blame] | 847 | |
[email protected] | 34ff1cfc | 2014-08-20 06:16:05 | [diff] [blame] | 848 | // Forces overscroll to be disabled (used by touch emulation). |
| 849 | void SetForceDisableOverscrollContent(bool force_disable); |
| 850 | |
Jianzhou Feng | d8720c7 | 2018-01-18 03:06:30 | [diff] [blame] | 851 | // Override the render view/widget size of the main frame, return whether the |
| 852 | // size changed. |
| 853 | bool SetDeviceEmulationSize(const gfx::Size& new_size); |
| 854 | void ClearDeviceEmulationSize(); |
| 855 | |
avayvod | cc85bbd | 2015-08-28 19:11:15 | [diff] [blame] | 856 | AudioStreamMonitor* audio_stream_monitor() { |
| 857 | return &audio_stream_monitor_; |
dalecurtis | bc6572e1 | 2014-09-12 19:22:30 | [diff] [blame] | 858 | } |
| 859 | |
dalecurtis | 88c24007 | 2015-12-09 02:11:18 | [diff] [blame] | 860 | // Called by MediaWebContentsObserver when playback starts or stops. See the |
| 861 | // WebContentsObserver function stubs for more details. |
billorr | 21c005d | 2016-11-17 03:57:04 | [diff] [blame] | 862 | void MediaStartedPlaying( |
| 863 | const WebContentsObserver::MediaPlayerInfo& media_info, |
| 864 | const WebContentsObserver::MediaPlayerId& id); |
| 865 | void MediaStoppedPlaying( |
| 866 | const WebContentsObserver::MediaPlayerInfo& media_info, |
Becca Hughes | 220bfc10 | 2017-11-14 18:24:07 | [diff] [blame] | 867 | const WebContentsObserver::MediaPlayerId& id, |
| 868 | WebContentsObserver::MediaStoppedReason reason); |
peconn | 25795152 | 2017-06-09 18:24:59 | [diff] [blame] | 869 | // This will be called before playback is started, check |
| 870 | // GetCurrentlyPlayingVideoCount if you need this when playback starts. |
| 871 | void MediaResized(const gfx::Size& size, |
| 872 | const WebContentsObserver::MediaPlayerId& id); |
Peter E Conn | eccb34c2 | 2017-09-08 09:37:58 | [diff] [blame] | 873 | void MediaEffectivelyFullscreenChanged(bool is_fullscreen); |
billorr | 21c005d | 2016-11-17 03:57:04 | [diff] [blame] | 874 | |
peconn | 25795152 | 2017-06-09 18:24:59 | [diff] [blame] | 875 | int GetCurrentlyPlayingVideoCount() override; |
Peter Conn | 31c726a | 2017-08-17 11:07:34 | [diff] [blame] | 876 | base::Optional<gfx::Size> GetFullscreenVideoSize() override; |
billorr | 21c005d | 2016-11-17 03:57:04 | [diff] [blame] | 877 | bool IsFullscreen() override; |
dalecurtis | bc6572e1 | 2014-09-12 19:22:30 | [diff] [blame] | 878 | |
qinmin | 58567c8 | 2015-01-07 21:00:20 | [diff] [blame] | 879 | MediaWebContentsObserver* media_web_contents_observer() { |
| 880 | return media_web_contents_observer_.get(); |
| 881 | } |
qinmin | 58567c8 | 2015-01-07 21:00:20 | [diff] [blame] | 882 | |
tapted | 65ff2ea7 | 2016-03-01 23:39:00 | [diff] [blame] | 883 | // Update the web contents visibility. |
Francois Doray | e616115 | 2018-03-27 22:05:37 | [diff] [blame^] | 884 | void UpdateWebContentsVisibility(Visibility visibility); |
tapted | 65ff2ea7 | 2016-03-01 23:39:00 | [diff] [blame] | 885 | |
paulmeyer | c0b762b | 2016-04-13 11:55:17 | [diff] [blame] | 886 | // Called by FindRequestManager when find replies come in from a renderer |
| 887 | // process. |
| 888 | void NotifyFindReply(int request_id, |
| 889 | int number_of_matches, |
| 890 | const gfx::Rect& selection_rect, |
| 891 | int active_match_ordinal, |
| 892 | bool final_update); |
| 893 | |
ortuno | 467e579 | 2016-06-10 04:32:39 | [diff] [blame] | 894 | // Modify the counter of connected devices for this WebContents. |
| 895 | void IncrementBluetoothConnectedDeviceCount(); |
| 896 | void DecrementBluetoothConnectedDeviceCount(); |
| 897 | |
mlamouri | 5cd9ae8 | 2017-02-18 11:05:09 | [diff] [blame] | 898 | // Called when the WebContents gains or loses a persistent video. |
zqzhang | 8ac4900 | 2017-03-16 21:51:35 | [diff] [blame] | 899 | void SetHasPersistentVideo(bool has_persistent_video); |
mlamouri | 5cd9ae8 | 2017-02-18 11:05:09 | [diff] [blame] | 900 | |
mlamouri | e52c1b54 | 2017-02-23 14:57:50 | [diff] [blame] | 901 | // Whether the WebContents has an active player is effectively fullscreen. |
| 902 | // That means that the video is either fullscreen or it is the content of |
| 903 | // a fullscreen page (in other words, a fullscreen video with custom |
| 904 | // controls). |
| 905 | // |IsFullscreen| must return |true| when this method is called. |
| 906 | bool HasActiveEffectivelyFullscreenVideo() const; |
| 907 | |
François Beaufort | ad6c523 | 2018-02-26 11:00:44 | [diff] [blame] | 908 | // Whether the WebContents effectively fullscreen active player allows |
| 909 | // Picture-in-Picture. |
| 910 | // |IsFullscreen| must return |true| when this method is called. |
| 911 | bool IsPictureInPictureAllowedForFullscreenVideo() const; |
| 912 | |
lfg | 1453e41 | 2017-04-11 00:48:50 | [diff] [blame] | 913 | // When inner or outer WebContents are present, become the focused |
| 914 | // WebContentsImpl. This will activate this content's main frame RenderWidget |
| 915 | // and indirectly all its subframe widgets. GetFocusedRenderWidgetHost will |
| 916 | // search this WebContentsImpl for a focused RenderWidgetHost. The previously |
| 917 | // focused WebContentsImpl, if any, will have its RenderWidgetHosts |
| 918 | // deactivated. |
| 919 | void SetAsFocusedWebContentsIfNecessary(); |
| 920 | |
paulmeyer | feafc2d | 2017-04-25 21:46:40 | [diff] [blame] | 921 | // Called by this WebContents's BrowserPluginGuest (if one exists) to indicate |
| 922 | // that the guest will be detached. |
| 923 | void BrowserPluginGuestWillDetach(); |
| 924 | |
paulmeyer | c0b762b | 2016-04-13 11:55:17 | [diff] [blame] | 925 | #if defined(OS_ANDROID) |
| 926 | // Called by FindRequestManager when all of the find match rects are in. |
| 927 | void NotifyFindMatchRectsReply(int version, |
| 928 | const std::vector<gfx::RectF>& rects, |
| 929 | const gfx::RectF& active_rect); |
| 930 | #endif |
| 931 | |
lof84 | 501da08 | 2016-05-23 21:22:54 | [diff] [blame] | 932 | private: |
[email protected] | 8ff00d7 | 2012-10-23 19:12:21 | [diff] [blame] | 933 | friend class WebContentsObserver; |
| 934 | friend class WebContents; // To implement factory methods. |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 935 | |
[email protected] | 2db9bd7 | 2012-04-13 20:20:56 | [diff] [blame] | 936 | FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, NoJSMessageOnInterstitials); |
| 937 | FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, UpdateTitle); |
[email protected] | 45a22ad | 2013-02-21 03:25:00 | [diff] [blame] | 938 | FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, FindOpenerRVHWhenPending); |
[email protected] | 2db9bd7 | 2012-04-13 20:20:56 | [diff] [blame] | 939 | FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, |
| 940 | CrossSiteCantPreemptAfterUnload); |
nick | 5ae4d2d | 2017-01-06 01:18:35 | [diff] [blame] | 941 | FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, PendingContentsDestroyed); |
| 942 | FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, PendingContentsShown); |
[email protected] | 5090445 | 2013-05-09 02:05:12 | [diff] [blame] | 943 | FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, FrameTreeShape); |
[email protected] | 9a89045 | 2014-02-13 22:21:02 | [diff] [blame] | 944 | FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, GetLastActiveTime); |
estark | a5635c4 | 2015-07-14 00:06:53 | [diff] [blame] | 945 | FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, |
| 946 | LoadResourceFromMemoryCacheWithBadSecurityInfo); |
jww | f4684d1 | 2015-09-02 06:12:52 | [diff] [blame] | 947 | FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, |
jam | 91dd24e | 2016-08-12 17:16:42 | [diff] [blame] | 948 | LoadResourceWithEmptySecurityInfo); |
avi | d53461d | 2016-02-25 17:15:04 | [diff] [blame] | 949 | FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, |
| 950 | ResetJavaScriptDialogOnUserNavigate); |
Megan Jablonski | 2f6a4c5 | 2017-07-10 23:01:25 | [diff] [blame] | 951 | FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, ParseDownloadHeaders); |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 952 | FRIEND_TEST_ALL_PREFIXES(FormStructureBrowserTest, HTMLFiles); |
| 953 | FRIEND_TEST_ALL_PREFIXES(NavigationControllerTest, HistoryNavigate); |
[email protected] | b0936d2 | 2013-11-28 06:47:36 | [diff] [blame] | 954 | FRIEND_TEST_ALL_PREFIXES(RenderFrameHostManagerTest, PageDoesBackAndReload); |
[email protected] | de3c5d8 | 2014-05-28 22:12:59 | [diff] [blame] | 955 | FRIEND_TEST_ALL_PREFIXES(SitePerProcessBrowserTest, CrossSiteIframe); |
alexmos | c2a8cec | 2016-05-23 22:19:53 | [diff] [blame] | 956 | FRIEND_TEST_ALL_PREFIXES(SitePerProcessBrowserTest, |
| 957 | TwoSubframesCreatePopupsSimultaneously); |
| 958 | FRIEND_TEST_ALL_PREFIXES(SitePerProcessBrowserTest, |
| 959 | TwoSubframesCreatePopupMenuWidgetsSimultaneously); |
dmazzoni | 0b5d248 | 2014-09-10 19:45:57 | [diff] [blame] | 960 | FRIEND_TEST_ALL_PREFIXES(SitePerProcessAccessibilityBrowserTest, |
| 961 | CrossSiteIframeAccessibility); |
avi | c529387b | 2016-04-06 16:14:53 | [diff] [blame] | 962 | FRIEND_TEST_ALL_PREFIXES(WebContentsImplBrowserTest, |
| 963 | JavaScriptDialogsInMainAndSubframes); |
avi | 0720b02e | 2017-06-13 03:22:13 | [diff] [blame] | 964 | FRIEND_TEST_ALL_PREFIXES(WebContentsImplBrowserTest, |
| 965 | DialogsFromJavaScriptEndFullscreen); |
Avi Drissman | ba3b1b34 | 2017-08-29 18:16:13 | [diff] [blame] | 966 | FRIEND_TEST_ALL_PREFIXES(WebContentsImplBrowserTest, |
| 967 | PopupsFromJavaScriptEndFullscreen); |
Avi Drissman | 36f801f | 2018-02-01 20:06:04 | [diff] [blame] | 968 | FRIEND_TEST_ALL_PREFIXES(WebContentsImplBrowserTest, |
| 969 | FocusFromJavaScriptEndsFullscreen); |
avi | 2d7d2c3 | 2017-03-15 21:55:02 | [diff] [blame] | 970 | FRIEND_TEST_ALL_PREFIXES(RenderFrameHostImplBrowserTest, |
| 971 | IframeBeforeUnloadParentHang); |
avi | 336125f7 | 2017-05-06 22:25:40 | [diff] [blame] | 972 | FRIEND_TEST_ALL_PREFIXES(RenderFrameHostImplBrowserTest, |
| 973 | BeforeUnloadDialogRequiresGesture); |
Charles Reis | 15d60b13 | 2017-11-03 17:43:47 | [diff] [blame] | 974 | FRIEND_TEST_ALL_PREFIXES(RenderFrameHostImplBrowserTest, |
| 975 | CancelBeforeUnloadResetsURL); |
Pavel Feldman | 3c1842b | 2017-08-02 05:00:16 | [diff] [blame] | 976 | FRIEND_TEST_ALL_PREFIXES(DevToolsProtocolTest, JavaScriptDialogNotifications); |
| 977 | FRIEND_TEST_ALL_PREFIXES(DevToolsProtocolTest, JavaScriptDialogInterop); |
| 978 | FRIEND_TEST_ALL_PREFIXES(DevToolsProtocolTest, BeforeUnloadDialog); |
Pavel Feldman | fab3cb6 | 2017-10-05 01:02:01 | [diff] [blame] | 979 | FRIEND_TEST_ALL_PREFIXES(DevToolsProtocolTest, PageDisableWithOpenedDialog); |
| 980 | FRIEND_TEST_ALL_PREFIXES(DevToolsProtocolTest, |
| 981 | PageDisableWithNoDialogManager); |
Nick Carter | d73635b | 2018-03-13 18:31:41 | [diff] [blame] | 982 | FRIEND_TEST_ALL_PREFIXES(PointerLockBrowserTest, |
| 983 | PointerLockInnerContentsCrashes); |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 984 | |
paulmeyer | a41de3b | 2016-05-05 16:30:18 | [diff] [blame] | 985 | // So |find_request_manager_| can be accessed for testing. |
| 986 | friend class FindRequestManagerTest; |
| 987 | |
[email protected] | 80e776ae | 2012-03-23 16:17:20 | [diff] [blame] | 988 | // TODO(brettw) TestWebContents shouldn't exist! |
[email protected] | 8ff00d7 | 2012-10-23 19:12:21 | [diff] [blame] | 989 | friend class TestWebContents; |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 990 | |
[email protected] | 7fff43e | 2013-05-21 20:21:10 | [diff] [blame] | 991 | class DestructionObserver; |
| 992 | |
lazyboy | 6ec48b2a | 2015-06-29 15:18:14 | [diff] [blame] | 993 | // Represents a WebContents node in a tree of WebContents structure. |
| 994 | // |
| 995 | // Two WebContents with separate FrameTrees can be connected by |
| 996 | // outer/inner relationship using this class. Note that their FrameTrees |
| 997 | // still remain disjoint. |
| 998 | // The parent is referred to as "outer WebContents" and the descendents are |
| 999 | // referred to as "inner WebContents". |
| 1000 | // For each inner WebContents, the outer WebContents will have a |
| 1001 | // corresponding FrameTreeNode. |
lfg | a3e2bdc | 2017-03-07 20:44:01 | [diff] [blame] | 1002 | class WebContentsTreeNode final : public FrameTreeNode::Observer { |
lazyboy | 6ec48b2a | 2015-06-29 15:18:14 | [diff] [blame] | 1003 | public: |
lfg | 60123369 | 2017-03-06 22:45:44 | [diff] [blame] | 1004 | explicit WebContentsTreeNode(WebContentsImpl* current_web_contents); |
lfg | a3e2bdc | 2017-03-07 20:44:01 | [diff] [blame] | 1005 | ~WebContentsTreeNode() final; |
lazyboy | 6ec48b2a | 2015-06-29 15:18:14 | [diff] [blame] | 1006 | |
lazyboy | 6ec48b2a | 2015-06-29 15:18:14 | [diff] [blame] | 1007 | void ConnectToOuterWebContents(WebContentsImpl* outer_web_contents, |
| 1008 | RenderFrameHostImpl* outer_contents_frame); |
| 1009 | |
lfg | 60123369 | 2017-03-06 22:45:44 | [diff] [blame] | 1010 | WebContentsImpl* outer_web_contents() const { return outer_web_contents_; } |
avallee | 0206f78 | 2016-07-28 18:55:33 | [diff] [blame] | 1011 | int outer_contents_frame_tree_node_id() const { |
lazyboy | 6ec48b2a | 2015-06-29 15:18:14 | [diff] [blame] | 1012 | return outer_contents_frame_tree_node_id_; |
| 1013 | } |
lfg | a3e2bdc | 2017-03-07 20:44:01 | [diff] [blame] | 1014 | FrameTreeNode* OuterContentsFrameTreeNode() const; |
lazyboy | 6ec48b2a | 2015-06-29 15:18:14 | [diff] [blame] | 1015 | |
avallee | 0206f78 | 2016-07-28 18:55:33 | [diff] [blame] | 1016 | WebContentsImpl* focused_web_contents() { return focused_web_contents_; } |
| 1017 | void SetFocusedWebContents(WebContentsImpl* web_contents); |
| 1018 | |
paulmeyer | feafc2d | 2017-04-25 21:46:40 | [diff] [blame] | 1019 | // Returns the inner WebContents within |frame|, if one exists, or nullptr |
| 1020 | // otherwise. |
| 1021 | WebContentsImpl* GetInnerWebContentsInFrame(const FrameTreeNode* frame); |
| 1022 | |
| 1023 | const std::vector<WebContentsImpl*>& inner_web_contents() const; |
| 1024 | |
lazyboy | 6ec48b2a | 2015-06-29 15:18:14 | [diff] [blame] | 1025 | private: |
paulmeyer | feafc2d | 2017-04-25 21:46:40 | [diff] [blame] | 1026 | void AttachInnerWebContents(WebContentsImpl* inner_web_contents); |
| 1027 | void DetachInnerWebContents(WebContentsImpl* inner_web_contents); |
| 1028 | |
lfg | a3e2bdc | 2017-03-07 20:44:01 | [diff] [blame] | 1029 | // FrameTreeNode::Observer implementation. |
| 1030 | void OnFrameTreeNodeDestroyed(FrameTreeNode* node) final; |
lfg | 60123369 | 2017-03-06 22:45:44 | [diff] [blame] | 1031 | |
| 1032 | // The WebContents that owns this WebContentsTreeNode. |
| 1033 | WebContentsImpl* const current_web_contents_; |
| 1034 | |
| 1035 | // The outer WebContents of |current_web_contents_|, or nullptr if |
| 1036 | // |current_web_contents_| is the outermost WebContents. |
lazyboy | 6ec48b2a | 2015-06-29 15:18:14 | [diff] [blame] | 1037 | WebContentsImpl* outer_web_contents_; |
lfg | 60123369 | 2017-03-06 22:45:44 | [diff] [blame] | 1038 | |
| 1039 | // The ID of the FrameTreeNode in the |outer_web_contents_| that hosts |
| 1040 | // |current_web_contents_| as an inner WebContents. |
lazyboy | 6ec48b2a | 2015-06-29 15:18:14 | [diff] [blame] | 1041 | int outer_contents_frame_tree_node_id_; |
lfg | 60123369 | 2017-03-06 22:45:44 | [diff] [blame] | 1042 | |
paulmeyer | feafc2d | 2017-04-25 21:46:40 | [diff] [blame] | 1043 | // List of inner WebContents that we host. |
| 1044 | std::vector<WebContentsImpl*> inner_web_contents_; |
| 1045 | |
avallee | 0206f78 | 2016-07-28 18:55:33 | [diff] [blame] | 1046 | // Only the root node should have this set. This indicates the WebContents |
| 1047 | // whose frame tree has the focused frame. The WebContents tree could be |
| 1048 | // arbitrarily deep. |
| 1049 | WebContentsImpl* focused_web_contents_; |
lazyboy | 6ec48b2a | 2015-06-29 15:18:14 | [diff] [blame] | 1050 | }; |
| 1051 | |
[email protected] | d1198fd | 2012-08-13 22:50:19 | [diff] [blame] | 1052 | // See WebContents::Create for a description of these parameters. |
Lukasz Anforowicz | e9ae372 | 2017-09-29 17:37:38 | [diff] [blame] | 1053 | explicit WebContentsImpl(BrowserContext* browser_context); |
[email protected] | d1198fd | 2012-08-13 22:50:19 | [diff] [blame] | 1054 | |
[email protected] | e2225bf | 2013-11-15 16:09:38 | [diff] [blame] | 1055 | // Add and remove observers for page navigation notifications. The order in |
| 1056 | // which notifications are sent to observers is undefined. Clients must be |
| 1057 | // sure to remove the observer before they go away. |
[email protected] | 8ff00d7 | 2012-10-23 19:12:21 | [diff] [blame] | 1058 | void AddObserver(WebContentsObserver* observer); |
| 1059 | void RemoveObserver(WebContentsObserver* observer); |
[email protected] | d1198fd | 2012-08-13 22:50:19 | [diff] [blame] | 1060 | |
alexmos | e201c7cd | 2015-06-10 17:14:21 | [diff] [blame] | 1061 | // Clears a pending contents that has been closed before being shown. |
[email protected] | 7fff43e | 2013-05-21 20:21:10 | [diff] [blame] | 1062 | void OnWebContentsDestroyed(WebContentsImpl* web_contents); |
| 1063 | |
| 1064 | // Creates and adds to the map a destruction observer watching |web_contents|. |
| 1065 | // No-op if such an observer already exists. |
| 1066 | void AddDestructionObserver(WebContentsImpl* web_contents); |
| 1067 | |
| 1068 | // Deletes and removes from the map a destruction observer |
| 1069 | // watching |web_contents|. No-op if there is no such observer. |
| 1070 | void RemoveDestructionObserver(WebContentsImpl* web_contents); |
[email protected] | 14392a5 | 2012-05-02 20:28:44 | [diff] [blame] | 1071 | |
[email protected] | de3c5d8 | 2014-05-28 22:12:59 | [diff] [blame] | 1072 | // Traverses all the RenderFrameHosts in the FrameTree and creates a set |
[email protected] | 948481d | 2014-06-11 18:32:22 | [diff] [blame] | 1073 | // all the unique RenderWidgetHostViews. |
| 1074 | std::set<RenderWidgetHostView*> GetRenderWidgetHostViewsInTree(); |
[email protected] | de3c5d8 | 2014-05-28 22:12:59 | [diff] [blame] | 1075 | |
pkotwicz | 75ca8ffd | 2016-02-16 23:10:19 | [diff] [blame] | 1076 | // Called with the result of a DownloadImage() request. |
Avi Drissman | a5a52dd | 2018-03-27 03:39:02 | [diff] [blame] | 1077 | void OnDidDownloadImage(ImageDownloadCallback callback, |
pkotwicz | 75ca8ffd | 2016-02-16 23:10:19 | [diff] [blame] | 1078 | int id, |
| 1079 | const GURL& image_url, |
leon.han | cbc4bc3c | 2016-02-26 07:08:52 | [diff] [blame] | 1080 | int32_t http_status_code, |
leon.han | c222853 | 2016-08-16 05:59:18 | [diff] [blame] | 1081 | const std::vector<SkBitmap>& images, |
| 1082 | const std::vector<gfx::Size>& original_image_sizes); |
pkotwicz | 75ca8ffd | 2016-02-16 23:10:19 | [diff] [blame] | 1083 | |
Pavel Feldman | 3c1842b | 2017-08-02 05:00:16 | [diff] [blame] | 1084 | // Callback function when showing JavaScript dialogs. Takes in a routing ID |
[email protected] | 6fba26d | 2014-04-29 09:38:28 | [diff] [blame] | 1085 | // pair to identify the RenderFrameHost that opened the dialog, because it's |
| 1086 | // possible for the RenderFrameHost to be deleted by the time this is called. |
| 1087 | void OnDialogClosed(int render_process_id, |
| 1088 | int render_frame_id, |
[email protected] | 51da7e3 | 2012-01-30 19:24:52 | [diff] [blame] | 1089 | IPC::Message* reply_msg, |
[email protected] | 87de04b0 | 2014-04-08 22:14:49 | [diff] [blame] | 1090 | bool dialog_was_suppressed, |
[email protected] | 51da7e3 | 2012-01-30 19:24:52 | [diff] [blame] | 1091 | bool success, |
[email protected] | fcf75d4 | 2013-12-03 20:11:26 | [diff] [blame] | 1092 | const base::string16& user_input); |
[email protected] | 51da7e3 | 2012-01-30 19:24:52 | [diff] [blame] | 1093 | |
[email protected] | d0759f49 | 2012-04-19 22:50:50 | [diff] [blame] | 1094 | // IPC message handlers. |
nick | a0ac838 | 2016-12-15 23:59:23 | [diff] [blame] | 1095 | void OnThemeColorChanged(RenderFrameHostImpl* source, SkColor theme_color); |
| 1096 | void OnDidLoadResourceFromMemoryCache(RenderFrameHostImpl* source, |
| 1097 | const GURL& url, |
[email protected] | 7043596 | 2011-08-02 20:13:28 | [diff] [blame] | 1098 | const std::string& http_request, |
[email protected] | 6d6cfb3a | 2012-05-23 22:53:18 | [diff] [blame] | 1099 | const std::string& mime_type, |
[email protected] | 6c1e0521 | 2014-07-31 00:59:40 | [diff] [blame] | 1100 | ResourceType resource_type); |
nick | a0ac838 | 2016-12-15 23:59:23 | [diff] [blame] | 1101 | void OnDidDisplayInsecureContent(RenderFrameHostImpl* source); |
elawrence | b2ac2a23 | 2017-03-27 21:46:25 | [diff] [blame] | 1102 | void OnDidContainInsecureFormAction(RenderFrameHostImpl* source); |
nick | a0ac838 | 2016-12-15 23:59:23 | [diff] [blame] | 1103 | void OnDidRunInsecureContent(RenderFrameHostImpl* source, |
| 1104 | const GURL& security_origin, |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 1105 | const GURL& target_url); |
Zhuoyu Qian | 4353f7f | 2018-01-08 05:33:00 | [diff] [blame] | 1106 | void OnDidDisplayContentWithCertificateErrors(RenderFrameHostImpl* source); |
| 1107 | void OnDidRunContentWithCertificateErrors(RenderFrameHostImpl* source); |
nick | a0ac838 | 2016-12-15 23:59:23 | [diff] [blame] | 1108 | void OnDocumentLoadedInFrame(RenderFrameHostImpl* source); |
| 1109 | void OnDidFinishLoad(RenderFrameHostImpl* source, const GURL& url); |
| 1110 | void OnGoToEntryAtOffset(RenderViewHostImpl* source, int offset); |
| 1111 | void OnUpdateZoomLimits(RenderViewHostImpl* source, |
| 1112 | int minimum_percent, |
[email protected] | fce82322 | 2014-05-30 16:24:30 | [diff] [blame] | 1113 | int maximum_percent); |
nick | a0ac838 | 2016-12-15 23:59:23 | [diff] [blame] | 1114 | void OnPageScaleFactorChanged(RenderViewHostImpl* source, |
| 1115 | float page_scale_factor); |
| 1116 | void OnEnumerateDirectory(RenderViewHostImpl* source, |
| 1117 | int request_id, |
| 1118 | const base::FilePath& path); |
[email protected] | b7a756d4 | 2012-01-23 18:08:17 | [diff] [blame] | 1119 | |
nick | a0ac838 | 2016-12-15 23:59:23 | [diff] [blame] | 1120 | void OnRegisterProtocolHandler(RenderFrameHostImpl* source, |
| 1121 | const std::string& protocol, |
[email protected] | 7d18902 | 2011-08-25 22:54:20 | [diff] [blame] | 1122 | const GURL& url, |
[email protected] | fcf75d4 | 2013-12-03 20:11:26 | [diff] [blame] | 1123 | const base::string16& title, |
[email protected] | 3a3b75a | 2012-06-01 08:38:36 | [diff] [blame] | 1124 | bool user_gesture); |
nick | a0ac838 | 2016-12-15 23:59:23 | [diff] [blame] | 1125 | void OnUnregisterProtocolHandler(RenderFrameHostImpl* source, |
| 1126 | const std::string& protocol, |
[email protected] | f5273e5 | 2014-07-14 16:30:20 | [diff] [blame] | 1127 | const GURL& url, |
| 1128 | bool user_gesture); |
nick | a0ac838 | 2016-12-15 23:59:23 | [diff] [blame] | 1129 | void OnFindReply(RenderFrameHostImpl* source, |
| 1130 | int request_id, |
[email protected] | 59363fc9 | 2012-09-05 03:46:31 | [diff] [blame] | 1131 | int number_of_matches, |
| 1132 | const gfx::Rect& selection_rect, |
| 1133 | int active_match_ordinal, |
[email protected] | b888919c | 2011-09-02 00:32:16 | [diff] [blame] | 1134 | bool final_update); |
mfomitchev | 2b8b066a | 2016-01-28 19:23:15 | [diff] [blame] | 1135 | #if defined(OS_ANDROID) |
nick | a0ac838 | 2016-12-15 23:59:23 | [diff] [blame] | 1136 | void OnFindMatchRectsReply(RenderFrameHostImpl* source, |
| 1137 | int version, |
[email protected] | 59363fc9 | 2012-09-05 03:46:31 | [diff] [blame] | 1138 | const std::vector<gfx::RectF>& rects, |
| 1139 | const gfx::RectF& active_rect); |
nick | a0ac838 | 2016-12-15 23:59:23 | [diff] [blame] | 1140 | void OnGetNearestFindResultReply(RenderFrameHostImpl* source, |
| 1141 | int request_id, |
| 1142 | float distance); |
[email protected] | 1ff42797 | 2013-02-07 21:14:07 | [diff] [blame] | 1143 | void OnOpenDateTimeDialog( |
nick | a0ac838 | 2016-12-15 23:59:23 | [diff] [blame] | 1144 | RenderViewHostImpl* source, |
[email protected] | 1ff42797 | 2013-02-07 21:14:07 | [diff] [blame] | 1145 | const ViewHostMsg_DateTimeDialogValue_Params& value); |
[email protected] | 59363fc9 | 2012-09-05 03:46:31 | [diff] [blame] | 1146 | #endif |
nick | a0ac838 | 2016-12-15 23:59:23 | [diff] [blame] | 1147 | void OnDomOperationResponse(RenderFrameHostImpl* source, |
| 1148 | const std::string& json_string); |
| 1149 | void OnAppCacheAccessed(RenderViewHostImpl* source, |
| 1150 | const GURL& manifest_url, |
| 1151 | bool blocked_by_policy); |
nick | a0ac838 | 2016-12-15 23:59:23 | [diff] [blame] | 1152 | void OnUpdatePageImportanceSignals(RenderFrameHostImpl* source, |
| 1153 | const PageImportanceSignals& signals); |
brettw | 4b46108 | 2016-11-19 18:55:16 | [diff] [blame] | 1154 | #if BUILDFLAG(ENABLE_PLUGINS) |
nick | a0ac838 | 2016-12-15 23:59:23 | [diff] [blame] | 1155 | void OnPepperInstanceCreated(RenderFrameHostImpl* source, |
| 1156 | int32_t pp_instance); |
| 1157 | void OnPepperInstanceDeleted(RenderFrameHostImpl* source, |
| 1158 | int32_t pp_instance); |
| 1159 | void OnPepperPluginHung(RenderFrameHostImpl* source, |
| 1160 | int plugin_child_id, |
tommycli | e6633ca7 | 2014-10-31 00:40:42 | [diff] [blame] | 1161 | const base::FilePath& path, |
| 1162 | bool is_hung); |
nick | a0ac838 | 2016-12-15 23:59:23 | [diff] [blame] | 1163 | void OnPepperStartsPlayback(RenderFrameHostImpl* source, int32_t pp_instance); |
| 1164 | void OnPepperStopsPlayback(RenderFrameHostImpl* source, int32_t pp_instance); |
| 1165 | void OnPluginCrashed(RenderFrameHostImpl* source, |
| 1166 | const base::FilePath& plugin_path, |
tommycli | e6633ca7 | 2014-10-31 00:40:42 | [diff] [blame] | 1167 | base::ProcessId plugin_pid); |
nick | a0ac838 | 2016-12-15 23:59:23 | [diff] [blame] | 1168 | void OnRequestPpapiBrokerPermission(RenderViewHostImpl* source, |
| 1169 | int ppb_broker_route_id, |
[email protected] | d8415ad9 | 2012-08-23 14:40:50 | [diff] [blame] | 1170 | const GURL& url, |
[email protected] | 2dec8ec | 2013-02-07 19:20:34 | [diff] [blame] | 1171 | const base::FilePath& plugin_path); |
tommycli | e6633ca7 | 2014-10-31 00:40:42 | [diff] [blame] | 1172 | |
| 1173 | // Callback function when requesting permission to access the PPAPI broker. |
| 1174 | // |result| is true if permission was granted. |
nick | a0ac838 | 2016-12-15 23:59:23 | [diff] [blame] | 1175 | void SendPpapiBrokerPermissionResult(int process_id, |
| 1176 | int ppb_broker_route_id, |
| 1177 | bool result); |
tommycli | e6633ca7 | 2014-10-31 00:40:42 | [diff] [blame] | 1178 | |
fsamuel | 833ee7c | 2015-02-13 23:40:40 | [diff] [blame] | 1179 | void OnBrowserPluginMessage(RenderFrameHost* render_frame_host, |
| 1180 | const IPC::Message& message); |
brettw | 4b46108 | 2016-11-19 18:55:16 | [diff] [blame] | 1181 | #endif // BUILDFLAG(ENABLE_PLUGINS) |
lukasza | 178ff09 | 2017-06-07 23:39:50 | [diff] [blame] | 1182 | void OnUpdateFaviconURL(RenderFrameHostImpl* source, |
nick | a0ac838 | 2016-12-15 23:59:23 | [diff] [blame] | 1183 | const std::vector<FaviconURL>& candidates); |
| 1184 | void OnFirstVisuallyNonEmptyPaint(RenderViewHostImpl* source); |
| 1185 | void OnShowValidationMessage(RenderViewHostImpl* source, |
| 1186 | const gfx::Rect& anchor_in_root_view, |
[email protected] | 6ff9c8f | 2013-12-20 09:05:29 | [diff] [blame] | 1187 | const base::string16& main_text, |
| 1188 | const base::string16& sub_text); |
nick | a0ac838 | 2016-12-15 23:59:23 | [diff] [blame] | 1189 | void OnHideValidationMessage(RenderViewHostImpl* source); |
| 1190 | void OnMoveValidationMessage(RenderViewHostImpl* source, |
| 1191 | const gfx::Rect& anchor_in_root_view); |
[email protected] | edc3af8 | 2013-12-12 21:24:07 | [diff] [blame] | 1192 | |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 1193 | // Called by derived classes to indicate that we're no longer waiting for a |
Evan Stade | 5e750ad0 | 2017-08-07 21:59:27 | [diff] [blame] | 1194 | // response. Will inform |delegate_| of the change in status so that it may, |
| 1195 | // for example, update the throbber. |
| 1196 | void SetNotWaitingForResponse(); |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 1197 | |
avallee | 9993fca | 2016-11-17 06:16:50 | [diff] [blame] | 1198 | // Inner WebContents Helpers ------------------------------------------------- |
| 1199 | // |
| 1200 | // These functions are helpers in managing a hierarchy of WebContents |
| 1201 | // involved in rendering inner WebContents. |
| 1202 | |
| 1203 | // When multiple WebContents are present within a tab or window, a single one |
| 1204 | // is focused and will route keyboard events in most cases to a RenderWidget |
| 1205 | // contained within it. |GetFocusedWebContents()|'s main frame widget will |
| 1206 | // receive page focus and blur events when the containing window changes focus |
| 1207 | // state. |
| 1208 | |
avallee | 9993fca | 2016-11-17 06:16:50 | [diff] [blame] | 1209 | // Returns true if |this| is the focused WebContents or an ancestor of the |
| 1210 | // focused WebContents. |
| 1211 | bool ContainsOrIsFocusedWebContents(); |
| 1212 | |
avallee | 0206f78 | 2016-07-28 18:55:33 | [diff] [blame] | 1213 | // Returns the root of the WebContents tree. |
| 1214 | WebContentsImpl* GetOutermostWebContents(); |
| 1215 | |
avallee | d68cdd1 | 2017-06-21 22:07:27 | [diff] [blame] | 1216 | // Walks up the outer WebContents chain and focuses the FrameTreeNode where |
| 1217 | // each inner WebContents is attached. |
| 1218 | void FocusOuterAttachmentFrameChain(); |
| 1219 | |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 1220 | // Navigation helpers -------------------------------------------------------- |
| 1221 | // |
| 1222 | // These functions are helpers for Navigate() and DidNavigate(). |
| 1223 | |
| 1224 | // Handles post-navigation tasks in DidNavigate AFTER the entry has been |
| 1225 | // committed to the navigation controller. Note that the navigation entry is |
| 1226 | // not provided since it may be invalid/changed after being committed. The |
| 1227 | // current navigation entry is in the NavigationController at this point. |
[email protected] | 2f7b3c5a | 2013-06-21 04:59:25 | [diff] [blame] | 1228 | |
[email protected] | bafe6cd | 2012-05-23 23:09:50 | [diff] [blame] | 1229 | // Helper for CreateNewWidget/CreateNewFullscreenWidget. |
avi | b734894 | 2015-12-25 20:57:10 | [diff] [blame] | 1230 | void CreateNewWidget(int32_t render_process_id, |
| 1231 | int32_t route_id, |
[email protected] | bafe6cd | 2012-05-23 23:09:50 | [diff] [blame] | 1232 | bool is_fullscreen, |
Dave Tapuska | 1bdf183 | 2017-07-07 18:07:19 | [diff] [blame] | 1233 | mojom::WidgetPtr widget, |
[email protected] | 180ef24 | 2013-11-07 06:50:46 | [diff] [blame] | 1234 | blink::WebPopupType popup_type); |
[email protected] | bafe6cd | 2012-05-23 23:09:50 | [diff] [blame] | 1235 | |
| 1236 | // Helper for ShowCreatedWidget/ShowCreatedFullscreenWidget. |
alexmos | c2a8cec | 2016-05-23 22:19:53 | [diff] [blame] | 1237 | void ShowCreatedWidget(int process_id, |
| 1238 | int route_id, |
[email protected] | bafe6cd | 2012-05-23 23:09:50 | [diff] [blame] | 1239 | bool is_fullscreen, |
bokan | 107a47f | 2015-02-03 23:23:39 | [diff] [blame] | 1240 | const gfx::Rect& initial_rect); |
[email protected] | bafe6cd | 2012-05-23 23:09:50 | [diff] [blame] | 1241 | |
| 1242 | // Finds the new RenderWidgetHost and returns it. Note that this can only be |
| 1243 | // called once as this call also removes it from the internal map. |
alexmos | c2a8cec | 2016-05-23 22:19:53 | [diff] [blame] | 1244 | RenderWidgetHostView* GetCreatedWidget(int process_id, int route_id); |
[email protected] | bafe6cd | 2012-05-23 23:09:50 | [diff] [blame] | 1245 | |
nick | 5ae4d2d | 2017-01-06 01:18:35 | [diff] [blame] | 1246 | // Finds the new WebContentsImpl by |main_frame_widget_route_id|, initializes |
| 1247 | // it for renderer-initiated creation, and returns it. Note that this can only |
| 1248 | // be called once as this call also removes it from the internal map. |
| 1249 | WebContentsImpl* GetCreatedWindow(int process_id, |
| 1250 | int main_frame_widget_route_id); |
[email protected] | bafe6cd | 2012-05-23 23:09:50 | [diff] [blame] | 1251 | |
lfg | db5c4ed | 2016-03-04 23:09:07 | [diff] [blame] | 1252 | // Sends a Page message IPC. |
| 1253 | void SendPageMessage(IPC::Message* msg); |
| 1254 | |
lukasza | 6f8ac62 | 2017-06-06 03:10:20 | [diff] [blame] | 1255 | void SetOpenerForNewContents(FrameTreeNode* opener, bool opener_suppressed); |
| 1256 | |
[email protected] | 960b037 | 2014-05-19 18:01:00 | [diff] [blame] | 1257 | // Tracking loading progress ------------------------------------------------- |
| 1258 | |
fdegans | a696e511 | 2015-04-17 01:57:59 | [diff] [blame] | 1259 | // Resets the tracking state of the current load progress. |
[email protected] | 960b037 | 2014-05-19 18:01:00 | [diff] [blame] | 1260 | void ResetLoadProgressState(); |
| 1261 | |
fdegans | a696e511 | 2015-04-17 01:57:59 | [diff] [blame] | 1262 | // Notifies the delegate that the load progress was updated. |
| 1263 | void SendChangeLoadProgress(); |
[email protected] | 960b037 | 2014-05-19 18:01:00 | [diff] [blame] | 1264 | |
clamy | 44e84ce | 2016-02-22 15:38:25 | [diff] [blame] | 1265 | // Notifies the delegate of a change in loading state. |
| 1266 | // |details| is used to provide details on the load that just finished |
| 1267 | // (but can be null if not applicable). |
| 1268 | // |due_to_interstitial| is true if the change in load state occurred because |
| 1269 | // an interstitial page started showing/proceeded. |
| 1270 | void LoadingStateChanged(bool to_different_document, |
| 1271 | bool due_to_interstitial, |
| 1272 | LoadNotificationDetails* details); |
| 1273 | |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 1274 | // Misc non-view stuff ------------------------------------------------------- |
| 1275 | |
avi | 2b17759 | 2014-12-10 02:08:02 | [diff] [blame] | 1276 | // Sets the history for a specified RenderViewHost to |history_length| |
| 1277 | // entries, with an offset of |history_offset|. |
| 1278 | void SetHistoryOffsetAndLengthForView(RenderViewHost* render_view_host, |
| 1279 | int history_offset, |
| 1280 | int history_length); |
| 1281 | |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 1282 | // Helper functions for sending notifications. |
[email protected] | 02d7b6e | 2014-06-24 21:01:50 | [diff] [blame] | 1283 | void NotifyViewSwapped(RenderViewHost* old_host, RenderViewHost* new_host); |
| 1284 | void NotifyFrameSwapped(RenderFrameHost* old_host, RenderFrameHost* new_host); |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 1285 | void NotifyDisconnected(); |
| 1286 | |
[email protected] | be1f56ab | 2011-12-22 06:55:31 | [diff] [blame] | 1287 | void SetEncoding(const std::string& encoding); |
| 1288 | |
[email protected] | fa944cb8 | 2013-11-15 17:51:21 | [diff] [blame] | 1289 | // TODO(creis): This should take in a FrameTreeNode to know which node's |
| 1290 | // render manager to return. For now, we just return the root's. |
[email protected] | b0936d2 | 2013-11-28 06:47:36 | [diff] [blame] | 1291 | RenderFrameHostManager* GetRenderManager() const; |
[email protected] | fa944cb8 | 2013-11-15 17:51:21 | [diff] [blame] | 1292 | |
[email protected] | 7a846df | 2012-09-20 19:17:39 | [diff] [blame] | 1293 | // Removes browser plugin embedder if there is one. |
| 1294 | void RemoveBrowserPluginEmbedder(); |
| 1295 | |
[email protected] | dc0fd43 | 2013-08-27 15:29:21 | [diff] [blame] | 1296 | // Helper function to invoke WebContentsDelegate::GetSizeForNewRenderView(). |
Jianzhou Feng | d8720c7 | 2018-01-18 03:06:30 | [diff] [blame] | 1297 | gfx::Size GetSizeForNewRenderView(bool is_main_frame); |
[email protected] | dc0fd43 | 2013-08-27 15:29:21 | [diff] [blame] | 1298 | |
[email protected] | ae7eeda | 2014-07-04 01:53:26 | [diff] [blame] | 1299 | void OnFrameRemoved(RenderFrameHost* render_frame_host); |
[email protected] | 9b159a5 | 2013-10-03 17:24:55 | [diff] [blame] | 1300 | |
[email protected] | 222f582 | 2014-02-05 23:40:49 | [diff] [blame] | 1301 | // Helper method that's called whenever |preferred_size_| or |
| 1302 | // |preferred_size_for_capture_| changes, to propagate the new value to the |
| 1303 | // |delegate_|. |
| 1304 | void OnPreferredSizeChanged(const gfx::Size& old_size); |
| 1305 | |
dbeam | a1b926a | 2015-08-31 23:17:51 | [diff] [blame] | 1306 | // Internal helper to create WebUI objects associated with |this|. |url| is |
Dan Beam | 055fe8f | 2017-10-04 23:23:36 | [diff] [blame] | 1307 | // used to determine which WebUI should be created (if any). |
| 1308 | std::unique_ptr<WebUIImpl> CreateWebUI(const GURL& url); |
dbeam | a1b926a | 2015-08-31 23:17:51 | [diff] [blame] | 1309 | |
avi | d53461d | 2016-02-25 17:15:04 | [diff] [blame] | 1310 | void SetJavaScriptDialogManagerForTesting( |
| 1311 | JavaScriptDialogManager* dialog_manager); |
| 1312 | |
paulmeyer | feafc2d | 2017-04-25 21:46:40 | [diff] [blame] | 1313 | // Returns the FindRequestManager, which may be found in an outer WebContents. |
| 1314 | FindRequestManager* GetFindRequestManager(); |
| 1315 | |
| 1316 | // Returns the FindRequestManager, or creates one if it doesn't already |
| 1317 | // exist. The FindRequestManager may be found in an outer WebContents. |
paulmeyer | c0b762b | 2016-04-13 11:55:17 | [diff] [blame] | 1318 | FindRequestManager* GetOrCreateFindRequestManager(); |
| 1319 | |
rockot | f62002a | 2016-09-15 00:08:59 | [diff] [blame] | 1320 | // Removes a registered WebContentsBindingSet by interface name. |
| 1321 | void RemoveBindingSet(const std::string& interface_name); |
| 1322 | |
falken | 52a56e3 | 2016-12-08 05:02:40 | [diff] [blame] | 1323 | // Prints a console warning when visiting a localhost site with a bad |
| 1324 | // certificate via --allow-insecure-localhost. |
| 1325 | void ShowInsecureLocalhostWarningIfNeeded(); |
| 1326 | |
mlamouri | 5cd9ae8 | 2017-02-18 11:05:09 | [diff] [blame] | 1327 | // Notify this WebContents that the preferences have changed. This will send |
| 1328 | // an IPC to all the renderer process associated with this WebContents. |
| 1329 | void NotifyPreferencesChanged(); |
| 1330 | |
Megan Jablonski | 2f6a4c5 | 2017-07-10 23:01:25 | [diff] [blame] | 1331 | // Format of |headers| is a new line separated list of key value pairs: |
| 1332 | // "<key1>: <value1>\r\n<key2>: <value2>". |
Min Qin | a904f330 | 2018-02-13 23:33:34 | [diff] [blame] | 1333 | static download::DownloadUrlParameters::RequestHeadersType |
| 1334 | ParseDownloadHeaders(const std::string& headers); |
Megan Jablonski | 2f6a4c5 | 2017-07-10 23:01:25 | [diff] [blame] | 1335 | |
EhsanK | 2075c7e | 2017-08-21 02:42:39 | [diff] [blame] | 1336 | // Sets the visibility of immediate child views, i.e. views whose parent view |
| 1337 | // is that of the main frame. |
| 1338 | void SetVisibilityForChildViews(bool visible); |
| 1339 | |
Lucas Furukawa Gadani | aed1fed | 2017-10-13 17:34:14 | [diff] [blame] | 1340 | // Reattaches this inner WebContents to its outer WebContents. |
| 1341 | void ReattachToOuterWebContentsFrame(); |
| 1342 | |
Lukasz Anforowicz | fd70714 | 2018-02-07 19:46:13 | [diff] [blame] | 1343 | // A helper for clearing the link status bubble after navigating away. |
| 1344 | // See also UpdateTargetURL. |
| 1345 | void ClearTargetURL(); |
| 1346 | |
Avi Drissman | 1e620f3 | 2018-03-16 13:57:29 | [diff] [blame] | 1347 | class AXTreeSnapshotCombiner; |
| 1348 | void RecursiveRequestAXTreeSnapshotOnFrame(FrameTreeNode* root_node, |
| 1349 | AXTreeSnapshotCombiner* combiner, |
| 1350 | ui::AXMode ax_mode); |
| 1351 | |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 1352 | // Data for core operation --------------------------------------------------- |
| 1353 | |
| 1354 | // Delegate for notifying our owner about stuff. Not owned by us. |
[email protected] | 8ff00d7 | 2012-10-23 19:12:21 | [diff] [blame] | 1355 | WebContentsDelegate* delegate_; |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 1356 | |
| 1357 | // Handles the back/forward list and loading. |
[email protected] | d202a7c | 2012-01-04 07:53:47 | [diff] [blame] | 1358 | NavigationControllerImpl controller_; |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 1359 | |
| 1360 | // The corresponding view. |
dcheng | 5971627 | 2016-04-09 05:19:08 | [diff] [blame] | 1361 | std::unique_ptr<WebContentsView> view_; |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 1362 | |
[email protected] | 5a3bdf5 | 2012-05-24 15:12:57 | [diff] [blame] | 1363 | // The view of the RVHD. Usually this is our WebContentsView implementation, |
| 1364 | // but if an embedder uses a different WebContentsView, they'll need to |
| 1365 | // provide this. |
[email protected] | 8ff00d7 | 2012-10-23 19:12:21 | [diff] [blame] | 1366 | RenderViewHostDelegateView* render_view_host_delegate_view_; |
[email protected] | 5a3bdf5 | 2012-05-24 15:12:57 | [diff] [blame] | 1367 | |
[email protected] | bafe6cd | 2012-05-23 23:09:50 | [diff] [blame] | 1368 | // Tracks created WebContentsImpl objects that have not been shown yet. They |
alexmos | c2a8cec | 2016-05-23 22:19:53 | [diff] [blame] | 1369 | // are identified by the process ID and routing ID passed to CreateNewWindow. |
| 1370 | typedef std::pair<int, int> ProcessRoutingIdPair; |
| 1371 | std::map<ProcessRoutingIdPair, WebContentsImpl*> pending_contents_; |
[email protected] | bafe6cd | 2012-05-23 23:09:50 | [diff] [blame] | 1372 | |
alexmos | c2a8cec | 2016-05-23 22:19:53 | [diff] [blame] | 1373 | // This map holds widgets that were created on behalf of the renderer but |
| 1374 | // haven't been shown yet. |
| 1375 | std::map<ProcessRoutingIdPair, RenderWidgetHostView*> pending_widget_views_; |
[email protected] | bafe6cd | 2012-05-23 23:09:50 | [diff] [blame] | 1376 | |
avi | a8cf8198 | 2016-08-12 20:28:46 | [diff] [blame] | 1377 | std::map<WebContentsImpl*, std::unique_ptr<DestructionObserver>> |
| 1378 | destruction_observers_; |
[email protected] | 7fff43e | 2013-05-21 20:21:10 | [diff] [blame] | 1379 | |
[email protected] | 99604297 | 2011-11-08 22:43:59 | [diff] [blame] | 1380 | // A list of observers notified when page state changes. Weak references. |
[email protected] | fa944cb8 | 2013-11-15 17:51:21 | [diff] [blame] | 1381 | // This MUST be listed above frame_tree_ since at destruction time the |
[email protected] | 99604297 | 2011-11-08 22:43:59 | [diff] [blame] | 1382 | // latter might cause RenderViewHost's destructor to call us and we might use |
| 1383 | // the observer list then. |
brettw | 236d317 | 2015-06-03 16:31:43 | [diff] [blame] | 1384 | base::ObserverList<WebContentsObserver> observers_; |
[email protected] | 99604297 | 2011-11-08 22:43:59 | [diff] [blame] | 1385 | |
rockot | f62002a | 2016-09-15 00:08:59 | [diff] [blame] | 1386 | // Associated interface binding sets attached to this WebContents. |
| 1387 | std::map<std::string, WebContentsBindingSet*> binding_sets_; |
| 1388 | |
[email protected] | c7c0d82 | 2014-04-16 20:19:49 | [diff] [blame] | 1389 | // True if this tab was opened by another tab. This is not unset if the opener |
| 1390 | // is closed. |
| 1391 | bool created_with_opener_; |
| 1392 | |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 1393 | // Helper classes ------------------------------------------------------------ |
| 1394 | |
[email protected] | fa944cb8 | 2013-11-15 17:51:21 | [diff] [blame] | 1395 | // Manages the frame tree of the page and process swaps in each node. |
[email protected] | 9b159a5 | 2013-10-03 17:24:55 | [diff] [blame] | 1396 | FrameTree frame_tree_; |
| 1397 | |
lfg | 60123369 | 2017-03-06 22:45:44 | [diff] [blame] | 1398 | // Contains information about the WebContents tree structure. |
| 1399 | WebContentsTreeNode node_; |
lazyboy | 6ec48b2a | 2015-06-29 15:18:14 | [diff] [blame] | 1400 | |
[email protected] | c7dd2f6 | 2011-07-18 15:57:59 | [diff] [blame] | 1401 | // SavePackage, lazily created. |
| 1402 | scoped_refptr<SavePackage> save_package_; |
| 1403 | |
paulmeyer | c8cb7cb | 2016-06-07 01:14:19 | [diff] [blame] | 1404 | // Manages/coordinates multi-process find-in-page requests. Created lazily. |
dcheng | 18ec0b54 | 2016-04-26 19:28:53 | [diff] [blame] | 1405 | std::unique_ptr<FindRequestManager> find_request_manager_; |
paulmeyer | c0b762b | 2016-04-13 11:55:17 | [diff] [blame] | 1406 | |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 1407 | // Data for loading state ---------------------------------------------------- |
| 1408 | |
[email protected] | 6dfed69 | 2014-05-22 04:18:03 | [diff] [blame] | 1409 | // Indicates whether the current load is to a different document. Only valid |
Evan Stade | c3b2602 | 2017-07-14 19:50:24 | [diff] [blame] | 1410 | // if |is_loading_| is true and only tracks loads in the main frame. |
[email protected] | 6dfed69 | 2014-05-22 04:18:03 | [diff] [blame] | 1411 | bool is_load_to_different_document_; |
| 1412 | |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 1413 | // Indicates if the tab is considered crashed. |
| 1414 | base::TerminationStatus crashed_status_; |
| 1415 | int crashed_error_code_; |
| 1416 | |
[email protected] | ca13a44 | 2012-04-17 14:00:12 | [diff] [blame] | 1417 | // Whether this WebContents is waiting for a first-response for the |
[email protected] | be1f56ab | 2011-12-22 06:55:31 | [diff] [blame] | 1418 | // main resource of the page. This controls whether the throbber state is |
| 1419 | // "waiting" or "loading." |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 1420 | bool waiting_for_response_; |
| 1421 | |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 1422 | // The current load state and the URL associated with it. |
[email protected] | 9c235f04 | 2011-08-10 22:28:21 | [diff] [blame] | 1423 | net::LoadStateWithParam load_state_; |
[email protected] | fcf75d4 | 2013-12-03 20:11:26 | [diff] [blame] | 1424 | base::string16 load_state_host_; |
[email protected] | 960b037 | 2014-05-19 18:01:00 | [diff] [blame] | 1425 | |
[email protected] | 960b037 | 2014-05-19 18:01:00 | [diff] [blame] | 1426 | base::TimeTicks loading_last_progress_update_; |
| 1427 | |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 1428 | // Upload progress, for displaying in the status bar. |
| 1429 | // Set to zero when there is no significant upload happening. |
avi | b734894 | 2015-12-25 20:57:10 | [diff] [blame] | 1430 | uint64_t upload_size_; |
| 1431 | uint64_t upload_position_; |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 1432 | |
dfalcantara | e6b7b4675 | 2015-07-10 18:14:16 | [diff] [blame] | 1433 | // Tracks that this WebContents needs to unblock requests to the renderer. |
| 1434 | // See ResumeLoadingCreatedWebContents. |
| 1435 | bool is_resume_pending_; |
| 1436 | |
creis | adca986 | 2017-06-16 19:12:11 | [diff] [blame] | 1437 | // The interstitial page currently shown, if any. Not owned by this class: the |
| 1438 | // InterstitialPage is self-owned and deletes itself asynchronously when |
| 1439 | // hidden. Because it may outlive this WebContents, it enters a disabled state |
| 1440 | // when hidden or preparing for destruction. |
| 1441 | InterstitialPageImpl* interstitial_page_; |
| 1442 | |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 1443 | // Data for current page ----------------------------------------------------- |
| 1444 | |
[email protected] | 987fc3a | 2011-05-26 14:18:09 | [diff] [blame] | 1445 | // When a title cannot be taken from any entry, this title will be used. |
[email protected] | fcf75d4 | 2013-12-03 20:11:26 | [diff] [blame] | 1446 | base::string16 page_title_when_no_navigation_entry_; |
[email protected] | 987fc3a | 2011-05-26 14:18:09 | [diff] [blame] | 1447 | |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 1448 | // When a navigation occurs, we record its contents MIME type. It can be |
| 1449 | // used to check whether we can do something for some special contents. |
| 1450 | std::string contents_mime_type_; |
| 1451 | |
[email protected] | ef3adfc | 2014-05-11 00:04:54 | [diff] [blame] | 1452 | // The last reported character encoding, not canonicalized. |
| 1453 | std::string last_reported_encoding_; |
| 1454 | |
| 1455 | // The canonicalized character encoding. |
| 1456 | std::string canonical_encoding_; |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 1457 | |
[email protected] | b4c8401 | 2014-04-28 19:51:10 | [diff] [blame] | 1458 | // Whether the initial empty page has been accessed by another page, making it |
| 1459 | // unsafe to show the pending URL. Usually false unless another window tries |
| 1460 | // to modify the blank page. Always false after the first commit. |
| 1461 | bool has_accessed_initial_document_; |
| 1462 | |
yusufo | d41c5f9 | 2015-03-06 00:14:28 | [diff] [blame] | 1463 | // The theme color for the underlying document as specified |
| 1464 | // by theme-color meta tag. |
| 1465 | SkColor theme_color_; |
| 1466 | |
| 1467 | // The last published theme color. |
| 1468 | SkColor last_sent_theme_color_; |
| 1469 | |
peter | 90afaba | 2015-06-01 12:05:29 | [diff] [blame] | 1470 | // Whether the first visually non-empty paint has occurred. |
| 1471 | bool did_first_visually_non_empty_paint_; |
| 1472 | |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 1473 | // Data for misc internal state ---------------------------------------------- |
| 1474 | |
[email protected] | 5459798 | 2013-02-06 01:59:55 | [diff] [blame] | 1475 | // When > 0, the WebContents is currently being captured (e.g., for |
| 1476 | // screenshots or mirroring); and the underlying RenderWidgetHost should not |
| 1477 | // be told it is hidden. |
| 1478 | int capturer_count_; |
| 1479 | |
Francois Doray | e616115 | 2018-03-27 22:05:37 | [diff] [blame^] | 1480 | // The visibility of the WebContents. Initialized from |
| 1481 | // |CreateParams::initially_hidden|. Updated from |
| 1482 | // UpdateWebContentsVisibility(), WasShown(), WasHidden(), WasOccluded(). |
| 1483 | Visibility visibility_ = Visibility::VISIBLE; |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 1484 | |
Francois Doray | e616115 | 2018-03-27 22:05:37 | [diff] [blame^] | 1485 | // Whether there has been a call to UpdateWebContentsVisibility(VISIBLE). |
| 1486 | bool did_first_set_visible_ = false; |
tapted | 65ff2ea7 | 2016-03-01 23:39:00 | [diff] [blame] | 1487 | |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 1488 | // See getter above. |
| 1489 | bool is_being_destroyed_; |
| 1490 | |
creis | 97867aa | 2017-02-17 18:39:45 | [diff] [blame] | 1491 | // Keep track of whether this WebContents is currently iterating over its list |
| 1492 | // of observers, during which time it should not be deleted. |
| 1493 | bool is_notifying_observers_; |
| 1494 | |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 1495 | // Indicates whether we should notify about disconnection of this |
[email protected] | b172aee | 2012-04-10 17:05:26 | [diff] [blame] | 1496 | // WebContentsImpl. This is used to ensure disconnection notifications only |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 1497 | // happen if a connection notification has happened and that they happen only |
| 1498 | // once. |
| 1499 | bool notify_disconnection_; |
| 1500 | |
[email protected] | 71a88bb | 2013-02-01 22:05:15 | [diff] [blame] | 1501 | // Pointer to the JavaScript dialog manager, lazily assigned. Used because the |
[email protected] | b172aee | 2012-04-10 17:05:26 | [diff] [blame] | 1502 | // delegate of this WebContentsImpl is nulled before its destructor is called. |
[email protected] | 71a88bb | 2013-02-01 22:05:15 | [diff] [blame] | 1503 | JavaScriptDialogManager* dialog_manager_; |
[email protected] | 2e5b90c | 2011-08-16 21:11:55 | [diff] [blame] | 1504 | |
avi | 85ee836 | 2016-10-08 02:09:08 | [diff] [blame] | 1505 | // Set to true when there is an active JavaScript dialog showing. |
| 1506 | bool is_showing_javascript_dialog_ = false; |
| 1507 | |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 1508 | // Set to true when there is an active "before unload" dialog. When true, |
| 1509 | // we've forced the throbber to start in Navigate, and we need to remember to |
| 1510 | // turn it off in OnJavaScriptMessageBoxClosed if the navigation is canceled. |
| 1511 | bool is_showing_before_unload_dialog_; |
| 1512 | |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 1513 | // Settings that get passed to the renderer process. |
[email protected] | 8ff00d7 | 2012-10-23 19:12:21 | [diff] [blame] | 1514 | RendererPreferences renderer_preferences_; |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 1515 | |
[email protected] | 9a89045 | 2014-02-13 22:21:02 | [diff] [blame] | 1516 | // The time that this WebContents was last made active. The initial value is |
| 1517 | // the WebContents creation time. |
gab | 0dccfef | 2015-05-20 18:43:39 | [diff] [blame] | 1518 | base::TimeTicks last_active_time_; |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 1519 | |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 1520 | // See description above setter. |
| 1521 | bool closed_by_user_gesture_; |
| 1522 | |
| 1523 | // Minimum/maximum zoom percent. |
| 1524 | int minimum_zoom_percent_; |
| 1525 | int maximum_zoom_percent_; |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 1526 | |
w.shackleton | 49bcd39 | 2016-01-06 17:38:22 | [diff] [blame] | 1527 | // Used to correctly handle integer zooming through a smooth scroll device. |
| 1528 | float zoom_scroll_remainder_; |
| 1529 | |
[email protected] | bcd281560 | 2012-01-14 18:17:23 | [diff] [blame] | 1530 | // The intrinsic size of the page. |
| 1531 | gfx::Size preferred_size_; |
| 1532 | |
[email protected] | 222f582 | 2014-02-05 23:40:49 | [diff] [blame] | 1533 | // The preferred size for content screen capture. When |capturer_count_| > 0, |
| 1534 | // this overrides |preferred_size_|. |
| 1535 | gfx::Size preferred_size_for_capture_; |
| 1536 | |
kenrb | e4f9108 | 2017-06-02 20:32:08 | [diff] [blame] | 1537 | // Size set by a top-level frame with auto-resize enabled. This is needed by |
| 1538 | // out-of-process iframes for their visible viewport size. |
| 1539 | gfx::Size auto_resize_size_; |
| 1540 | |
Jianzhou Feng | d8720c7 | 2018-01-18 03:06:30 | [diff] [blame] | 1541 | // When device emulation is enabled, override the size of current and newly |
| 1542 | // created render views/widgets. |
| 1543 | gfx::Size device_emulation_size_; |
| 1544 | gfx::Size view_size_before_emulation_; |
| 1545 | |
mfomitchev | 2b8b066a | 2016-01-28 19:23:15 | [diff] [blame] | 1546 | #if defined(OS_ANDROID) |
[email protected] | 583418cc | 2013-01-17 14:01:10 | [diff] [blame] | 1547 | // Date time chooser opened by this tab. |
| 1548 | // Only used in Android since all other platforms use a multi field UI. |
dcheng | 5971627 | 2016-04-09 05:19:08 | [diff] [blame] | 1549 | std::unique_ptr<DateTimeChooserAndroid> date_time_chooser_; |
[email protected] | 583418cc | 2013-01-17 14:01:10 | [diff] [blame] | 1550 | #endif |
| 1551 | |
[email protected] | 8ed1647 | 2014-04-11 19:02:48 | [diff] [blame] | 1552 | // Holds information about a current color chooser dialog, if one is visible. |
Joel Hockey | 85b379d | 2017-12-11 10:42:13 | [diff] [blame] | 1553 | class ColorChooser; |
| 1554 | std::unique_ptr<ColorChooser> color_chooser_; |
[email protected] | da854376 | 2012-03-20 08:52:20 | [diff] [blame] | 1555 | |
[email protected] | 7a846df | 2012-09-20 19:17:39 | [diff] [blame] | 1556 | // Manages the embedder state for browser plugins, if this WebContents is an |
| 1557 | // embedder; NULL otherwise. |
dcheng | 5971627 | 2016-04-09 05:19:08 | [diff] [blame] | 1558 | std::unique_ptr<BrowserPluginEmbedder> browser_plugin_embedder_; |
[email protected] | 7a846df | 2012-09-20 19:17:39 | [diff] [blame] | 1559 | // Manages the guest state for browser plugin, if this WebContents is a guest; |
| 1560 | // NULL otherwise. |
dcheng | 5971627 | 2016-04-09 05:19:08 | [diff] [blame] | 1561 | std::unique_ptr<BrowserPluginGuest> browser_plugin_guest_; |
[email protected] | 7a846df | 2012-09-20 19:17:39 | [diff] [blame] | 1562 | |
brettw | 4b46108 | 2016-11-19 18:55:16 | [diff] [blame] | 1563 | #if BUILDFLAG(ENABLE_PLUGINS) |
tommycli | eb25b2a | 2014-11-03 19:45:09 | [diff] [blame] | 1564 | // Manages the whitelist of plugin content origins exempt from power saving. |
dcheng | 5971627 | 2016-04-09 05:19:08 | [diff] [blame] | 1565 | std::unique_ptr<PluginContentOriginWhitelist> |
| 1566 | plugin_content_origin_whitelist_; |
tommycli | eb25b2a | 2014-11-03 19:45:09 | [diff] [blame] | 1567 | #endif |
| 1568 | |
[email protected] | f53a9f87 | 2012-05-24 02:07:06 | [diff] [blame] | 1569 | // This must be at the end, or else we might get notifications and use other |
| 1570 | // member variables that are gone. |
[email protected] | 8ff00d7 | 2012-10-23 19:12:21 | [diff] [blame] | 1571 | NotificationRegistrar registrar_; |
[email protected] | f53a9f87 | 2012-05-24 02:07:06 | [diff] [blame] | 1572 | |
[email protected] | b24b68a | 2012-09-24 21:57:26 | [diff] [blame] | 1573 | // All live RenderWidgetHostImpls that are created by this object and may |
| 1574 | // outlive it. |
[email protected] | 8ff00d7 | 2012-10-23 19:12:21 | [diff] [blame] | 1575 | std::set<RenderWidgetHostImpl*> created_widgets_; |
[email protected] | b24b68a | 2012-09-24 21:57:26 | [diff] [blame] | 1576 | |
alexmos | c9e76ec | 2016-05-16 22:59:37 | [diff] [blame] | 1577 | // Process id of the shown fullscreen widget, or kInvalidUniqueID if there is |
| 1578 | // no fullscreen widget. |
| 1579 | int fullscreen_widget_process_id_; |
| 1580 | |
[email protected] | 44470a2 | 2013-01-24 01:21:54 | [diff] [blame] | 1581 | // Routing id of the shown fullscreen widget or MSG_ROUTING_NONE otherwise. |
| 1582 | int fullscreen_widget_routing_id_; |
| 1583 | |
[email protected] | 0b43199 | 2014-06-24 00:08:03 | [diff] [blame] | 1584 | // At the time the fullscreen widget was being shut down, did it have focus? |
| 1585 | // This is used to restore focus to the WebContentsView after both: 1) the |
| 1586 | // fullscreen widget is destroyed, and 2) the WebContentsDelegate has |
| 1587 | // completed making layout changes to effect an exit from fullscreen mode. |
| 1588 | bool fullscreen_widget_had_focus_at_shutdown_; |
| 1589 | |
[email protected] | 0e584b5f | 2013-12-30 17:28:23 | [diff] [blame] | 1590 | // Whether this WebContents is responsible for displaying a subframe in a |
[email protected] | 5dcaf8e | 2013-12-28 01:31:42 | [diff] [blame] | 1591 | // different process from its parent page. |
| 1592 | bool is_subframe_; |
| 1593 | |
mariakhomenko | a4971c1 | 2015-07-21 19:04:37 | [diff] [blame] | 1594 | // When a new tab is created asynchronously, stores the OpenURLParams needed |
| 1595 | // to continue loading the page once the tab is ready. |
dcheng | 5971627 | 2016-04-09 05:19:08 | [diff] [blame] | 1596 | std::unique_ptr<OpenURLParams> delayed_open_url_params_; |
mariakhomenko | a4971c1 | 2015-07-21 19:04:37 | [diff] [blame] | 1597 | |
[email protected] | 34ff1cfc | 2014-08-20 06:16:05 | [diff] [blame] | 1598 | // Whether overscroll should be unconditionally disabled. |
| 1599 | bool force_disable_overscroll_content_; |
[email protected] | e85165c64 | 2014-06-10 14:34:31 | [diff] [blame] | 1600 | |
[email protected] | 87de04b0 | 2014-04-08 22:14:49 | [diff] [blame] | 1601 | // Whether the last JavaScript dialog shown was suppressed. Used for testing. |
| 1602 | bool last_dialog_suppressed_; |
| 1603 | |
Ke He | 7319dbe | 2017-11-09 05:54:44 | [diff] [blame] | 1604 | device::mojom::GeolocationContextPtr geolocation_context_; |
blundell | c57b93f | 2014-10-29 13:19:57 | [diff] [blame] | 1605 | |
blundell | e75a8f9 | 2017-03-27 08:11:17 | [diff] [blame] | 1606 | std::unique_ptr<WakeLockContextHost> wake_lock_context_host_; |
alogvinov | f50445a | 2015-10-30 13:00:12 | [diff] [blame] | 1607 | |
juncai | 8e8d6ec | 2017-06-06 20:48:18 | [diff] [blame] | 1608 | device::mojom::WakeLockPtr renderer_wake_lock_; |
ke.he | 98b761e | 2017-05-09 05:59:17 | [diff] [blame] | 1609 | |
Joel Hockey | 85b379d | 2017-12-11 10:42:13 | [diff] [blame] | 1610 | service_manager::BinderRegistry registry_; |
| 1611 | |
Joel Hockey | 163835a | 2017-12-20 11:51:57 | [diff] [blame] | 1612 | mojo::BindingSet<blink::mojom::ColorChooserFactory> |
| 1613 | color_chooser_factory_bindings_; |
Joel Hockey | 85b379d | 2017-12-11 10:42:13 | [diff] [blame] | 1614 | |
blundell | f5316fc | 2017-05-15 11:49:03 | [diff] [blame] | 1615 | #if defined(OS_ANDROID) |
| 1616 | std::unique_ptr<NFCHost> nfc_host_; |
| 1617 | #endif |
| 1618 | |
leon.han | e4db177a | 2017-02-07 14:19:16 | [diff] [blame] | 1619 | std::unique_ptr<ScreenOrientationProvider> screen_orientation_provider_; |
[email protected] | 01f83f9 | 2014-06-17 14:41:54 | [diff] [blame] | 1620 | |
dcheng | 5971627 | 2016-04-09 05:19:08 | [diff] [blame] | 1621 | std::unique_ptr<ManifestManagerHost> manifest_manager_host_; |
mlamouri | efdca9d | 2014-09-16 16:55:40 | [diff] [blame] | 1622 | |
[email protected] | 9564021 | 2014-07-26 18:14:30 | [diff] [blame] | 1623 | // The accessibility mode for all frames. This is queried when each frame |
| 1624 | // is created, and broadcast to all frames when it changes. |
Doug Turner | 63f3c7b | 2017-07-29 05:10:01 | [diff] [blame] | 1625 | ui::AXMode accessibility_mode_; |
[email protected] | 9564021 | 2014-07-26 18:14:30 | [diff] [blame] | 1626 | |
avayvod | cc85bbd | 2015-08-28 19:11:15 | [diff] [blame] | 1627 | // Monitors power levels for audio streams associated with this WebContents. |
| 1628 | AudioStreamMonitor audio_stream_monitor_; |
| 1629 | |
miu | 50f9789 | 2014-09-22 22:49:52 | [diff] [blame] | 1630 | // Created on-demand to mute all audio output from this WebContents. |
dcheng | 5971627 | 2016-04-09 05:19:08 | [diff] [blame] | 1631 | std::unique_ptr<WebContentsAudioMuter> audio_muter_; |
miu | 50f9789 | 2014-09-22 22:49:52 | [diff] [blame] | 1632 | |
ortuno | df4d798 | 2016-04-08 02:33:35 | [diff] [blame] | 1633 | size_t bluetooth_connected_device_count_; |
ortuno | 32e7db3c | 2016-03-29 16:14:20 | [diff] [blame] | 1634 | |
csharrison | a2280cd | 2016-02-03 23:21:15 | [diff] [blame] | 1635 | // Notifies ResourceDispatcherHostImpl of various events related to loading. |
dcheng | 5971627 | 2016-04-09 05:19:08 | [diff] [blame] | 1636 | std::unique_ptr<LoaderIOThreadNotifier> loader_io_thread_notifier_; |
csharrison | a2280cd | 2016-02-03 23:21:15 | [diff] [blame] | 1637 | |
dalecurtis | 88c24007 | 2015-12-09 02:11:18 | [diff] [blame] | 1638 | // Manages media players, CDMs, and power save blockers for media. |
dcheng | 5971627 | 2016-04-09 05:19:08 | [diff] [blame] | 1639 | std::unique_ptr<MediaWebContentsObserver> media_web_contents_observer_; |
qinmin | 58567c8 | 2015-01-07 21:00:20 | [diff] [blame] | 1640 | |
brettw | 4b46108 | 2016-11-19 18:55:16 | [diff] [blame] | 1641 | #if BUILDFLAG(ENABLE_PLUGINS) |
zqzhang | 181047e6 | 2016-07-01 13:37:17 | [diff] [blame] | 1642 | // Observes pepper playback changes, and notifies MediaSession. |
| 1643 | std::unique_ptr<PepperPlaybackObserver> pepper_playback_observer_; |
brettw | 4b46108 | 2016-11-19 18:55:16 | [diff] [blame] | 1644 | #endif // BUILDFLAG(ENABLE_PLUGINS) |
zqzhang | 181047e6 | 2016-07-01 13:37:17 | [diff] [blame] | 1645 | |
mcnee | 336ea2c | 2017-05-23 22:50:59 | [diff] [blame] | 1646 | #if !defined(OS_ANDROID) |
scottmg | 276753cf | 2016-10-27 18:25:22 | [diff] [blame] | 1647 | std::unique_ptr<HostZoomMapObserver> host_zoom_map_observer_; |
mcnee | 336ea2c | 2017-05-23 22:50:59 | [diff] [blame] | 1648 | #endif // !defined(OS_ANDROID) |
scottmg | 276753cf | 2016-10-27 18:25:22 | [diff] [blame] | 1649 | |
dcheng | 5971627 | 2016-04-09 05:19:08 | [diff] [blame] | 1650 | std::unique_ptr<RenderWidgetHostInputEventRouter> rwh_input_event_router_; |
kenrb | 2a565f8 | 2015-09-02 20:24:59 | [diff] [blame] | 1651 | |
kouhei | 40f03cb | 2015-09-24 07:47:01 | [diff] [blame] | 1652 | PageImportanceSignals page_importance_signals_; |
| 1653 | |
mcnee | 336ea2c | 2017-05-23 22:50:59 | [diff] [blame] | 1654 | #if !defined(OS_ANDROID) |
mcnee | 432e47d | 2015-11-09 19:37:46 | [diff] [blame] | 1655 | bool page_scale_factor_is_one_; |
mcnee | 336ea2c | 2017-05-23 22:50:59 | [diff] [blame] | 1656 | #endif // !defined(OS_ANDROID) |
mcnee | 432e47d | 2015-11-09 19:37:46 | [diff] [blame] | 1657 | |
ekaramad | add88229 | 2016-06-08 15:22:56 | [diff] [blame] | 1658 | // TextInputManager tracks the IME-related state for all the |
| 1659 | // RenderWidgetHostViews on this WebContents. Only exists on the outermost |
| 1660 | // WebContents and is automatically destroyed when a WebContents becomes an |
| 1661 | // inner WebContents by attaching to an outer WebContents. Then the |
| 1662 | // IME-related state for RenderWidgetHosts on the inner WebContents is tracked |
| 1663 | // by the TextInputManager in the outer WebContents. |
| 1664 | std::unique_ptr<TextInputManager> text_input_manager_; |
| 1665 | |
lfg | bee1e0a | 2016-06-08 21:24:21 | [diff] [blame] | 1666 | // Stores the RenderWidgetHost that currently holds a mouse lock or nullptr if |
| 1667 | // there's no RenderWidgetHost holding a lock. |
Joe Downing | 192998b2 | 2018-03-22 15:51:36 | [diff] [blame] | 1668 | RenderWidgetHostImpl* mouse_lock_widget_ = nullptr; |
| 1669 | |
| 1670 | // Stores the RenderWidgetHost that currently holds a keyboard lock or nullptr |
| 1671 | // if no RenderWidgetHost has the keyboard locked. |
| 1672 | RenderWidgetHostImpl* keyboard_lock_widget_ = nullptr; |
lfg | bee1e0a | 2016-06-08 21:24:21 | [diff] [blame] | 1673 | |
sammc | f5f1b0f | 2016-09-20 23:05:11 | [diff] [blame] | 1674 | #if defined(OS_ANDROID) |
rockot | 400ea35b | 2016-10-15 19:15:32 | [diff] [blame] | 1675 | std::unique_ptr<service_manager::InterfaceProvider> java_interfaces_; |
sammc | f5f1b0f | 2016-09-20 23:05:11 | [diff] [blame] | 1676 | #endif |
| 1677 | |
qinmin | 72e8bd0 | 2016-10-21 19:35:37 | [diff] [blame] | 1678 | // Whether this WebContents is for content overlay. |
| 1679 | bool is_overlay_content_; |
| 1680 | |
ekaramad | f6750aa | 2017-06-06 18:29:42 | [diff] [blame] | 1681 | bool showing_context_menu_; |
| 1682 | |
billorr | 21c005d | 2016-11-17 03:57:04 | [diff] [blame] | 1683 | int currently_playing_video_count_ = 0; |
peconn | 25795152 | 2017-06-09 18:24:59 | [diff] [blame] | 1684 | VideoSizeMap cached_video_sizes_; |
billorr | 21c005d | 2016-11-17 03:57:04 | [diff] [blame] | 1685 | |
mlamouri | 5cd9ae8 | 2017-02-18 11:05:09 | [diff] [blame] | 1686 | bool has_persistent_video_ = false; |
| 1687 | |
Tommy Steimel | 1836051 | 2017-11-01 00:38:19 | [diff] [blame] | 1688 | bool was_ever_audible_ = false; |
| 1689 | |
Lukasz Anforowicz | fd70714 | 2018-02-07 19:46:13 | [diff] [blame] | 1690 | // Helper variable for resolving races in UpdateTargetURL / ClearTargetURL. |
| 1691 | RenderViewHost* view_that_set_last_target_url_ = nullptr; |
| 1692 | |
Changwan Ryu | c1134a8 | 2018-03-07 02:10:14 | [diff] [blame] | 1693 | // Whether we should override user agent in new tabs. |
| 1694 | bool should_override_user_agent_in_new_tabs_ = false; |
| 1695 | |
mohan.reddy | aae039a | 2014-11-21 17:39:50 | [diff] [blame] | 1696 | base::WeakPtrFactory<WebContentsImpl> loading_weak_factory_; |
pkotwicz | 75ca8ffd | 2016-02-16 23:10:19 | [diff] [blame] | 1697 | base::WeakPtrFactory<WebContentsImpl> weak_factory_; |
mohan.reddy | aae039a | 2014-11-21 17:39:50 | [diff] [blame] | 1698 | |
[email protected] | b172aee | 2012-04-10 17:05:26 | [diff] [blame] | 1699 | DISALLOW_COPY_AND_ASSIGN(WebContentsImpl); |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 1700 | }; |
| 1701 | |
nick | f9acfbe | 2014-12-23 19:12:37 | [diff] [blame] | 1702 | // Dangerous methods which should never be made part of the public API, so we |
| 1703 | // grant their use only to an explicit friend list (c++ attorney/client idiom). |
benwells | 5e7260d | 2017-03-20 23:36:33 | [diff] [blame] | 1704 | class CONTENT_EXPORT WebContentsImpl::FriendWrapper { |
Avi Drissman | a911482 | 2018-03-23 18:25:55 | [diff] [blame] | 1705 | public: |
| 1706 | using CreatedCallback = base::RepeatingCallback<void(WebContents*)>; |
| 1707 | |
nick | f9acfbe | 2014-12-23 19:12:37 | [diff] [blame] | 1708 | private: |
| 1709 | friend class TestNavigationObserver; |
| 1710 | friend class WebContentsAddedObserver; |
| 1711 | friend class ContentBrowserSanityChecker; |
| 1712 | |
benwells | 5e7260d | 2017-03-20 23:36:33 | [diff] [blame] | 1713 | FriendWrapper(); // Not instantiable. |
nick | f9acfbe | 2014-12-23 19:12:37 | [diff] [blame] | 1714 | |
| 1715 | // Adds/removes a callback called on creation of each new WebContents. |
| 1716 | static void AddCreatedCallbackForTesting(const CreatedCallback& callback); |
| 1717 | static void RemoveCreatedCallbackForTesting(const CreatedCallback& callback); |
| 1718 | |
benwells | 5e7260d | 2017-03-20 23:36:33 | [diff] [blame] | 1719 | DISALLOW_COPY_AND_ASSIGN(FriendWrapper); |
nick | f9acfbe | 2014-12-23 19:12:37 | [diff] [blame] | 1720 | }; |
| 1721 | |
[email protected] | 8ff00d7 | 2012-10-23 19:12:21 | [diff] [blame] | 1722 | } // namespace content |
| 1723 | |
[email protected] | 93ddb3c | 2012-04-11 21:44:29 | [diff] [blame] | 1724 | #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ |