blob: a5cfbff97fab3d7d58c6de7b4c2e189f13278901 [file] [log] [blame]
[email protected]91854cd2012-01-10 19:43:571// Copyright (c) 2012 The Chromium Authors. All rights reserved.
[email protected]0dd3a0ab2011-02-18 08:17:442// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
[email protected]93ddb3c2012-04-11 21:44:295#ifndef CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_
6#define CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_
[email protected]0dd3a0ab2011-02-18 08:17:447
avib7348942015-12-25 20:57:108#include <stdint.h>
9
lfgdb5c4ed2016-03-04 23:09:0710#include <functional>
[email protected]0dd3a0ab2011-02-18 08:17:4411#include <map>
dcheng59716272016-04-09 05:19:0812#include <memory>
[email protected]b24b68a2012-09-24 21:57:2613#include <set>
[email protected]0dd3a0ab2011-02-18 08:17:4414#include <string>
Lukasz Anforowicze9ae3722017-09-29 17:37:3815#include <utility>
16#include <vector>
[email protected]0dd3a0ab2011-02-18 08:17:4417
[email protected]01d65172011-12-25 04:39:3018#include "base/compiler_specific.h"
[email protected]0dd3a0ab2011-02-18 08:17:4419#include "base/gtest_prod_util.h"
avib7348942015-12-25 20:57:1020#include "base/macros.h"
[email protected]6eac57a2011-07-12 21:15:0921#include "base/observer_list.h"
[email protected]fa20e002013-07-23 21:20:5422#include "base/process/process.h"
Daniel Cheng90196c82018-04-25 21:49:1423#include "base/time/time.h"
[email protected]738f57a2013-06-29 21:06:5424#include "base/values.h"
avib7348942015-12-25 20:57:1025#include "build/build_config.h"
Min Qina904f3302018-02-13 23:33:3426#include "components/download/public/common/download_url_parameters.h"
[email protected]d4a8ca482013-10-30 21:06:4027#include "content/browser/frame_host/frame_tree.h"
lfga3e2bdc2017-03-07 20:44:0128#include "content/browser/frame_host/frame_tree_node.h"
Maxim Podgorodskiya926c4ff2017-11-20 02:06:3929#include "content/browser/frame_host/interstitial_page_impl.h"
[email protected]d4a8ca482013-10-30 21:06:4030#include "content/browser/frame_host/navigation_controller_delegate.h"
31#include "content/browser/frame_host/navigation_controller_impl.h"
[email protected]190b8c52013-11-09 01:35:4432#include "content/browser/frame_host/navigator_delegate.h"
[email protected]92404c62013-12-04 16:40:4633#include "content/browser/frame_host/render_frame_host_delegate.h"
[email protected]b0936d22013-11-28 06:47:3634#include "content/browser/frame_host/render_frame_host_manager.h"
avayvodcc85bbd2015-08-28 19:11:1535#include "content/browser/media/audio_stream_monitor.h"
[email protected]2e3bf992012-05-24 17:36:2436#include "content/browser/renderer_host/render_view_host_delegate.h"
creisc014b402015-04-23 16:41:4537#include "content/browser/renderer_host/render_view_host_impl.h"
[email protected]4ca76c02012-05-16 16:19:0538#include "content/browser/renderer_host/render_widget_host_delegate.h"
blundelle75a8f92017-03-27 08:11:1739#include "content/browser/wake_lock/wake_lock_context_host.h"
[email protected]8d128d62011-09-13 22:11:5740#include "content/common/content_export.h"
[email protected]8ed16472014-04-11 19:02:4841#include "content/public/browser/color_chooser.h"
[email protected]14392a52012-05-02 20:28:4442#include "content/public/browser/notification_observer.h"
43#include "content/public/browser/notification_registrar.h"
[email protected]58f5d562011-12-20 17:13:0344#include "content/public/browser/web_contents.h"
rockot96c63e32017-03-20 23:23:0345#include "content/public/browser/web_contents_binding_set.h"
dalecurtis88c240072015-12-09 02:11:1846#include "content/public/browser/web_contents_observer.h"
kouhei40f03cb2015-09-24 07:47:0147#include "content/public/common/page_importance_signals.h"
[email protected]daf82f82011-10-31 22:35:3148#include "content/public/common/renderer_preferences.h"
[email protected]7491ad02014-07-05 19:10:0749#include "content/public/common/resource_type.h"
[email protected]818915cd2012-11-20 13:14:1150#include "content/public/common/three_d_api_types.h"
[email protected]0dd3a0ab2011-02-18 08:17:4451#include "net/base/load_states.h"
[email protected]6f2ac772014-07-24 22:22:0852#include "net/http/http_response_headers.h"
Scott Violet02e38b92018-03-27 23:42:1453#include "ppapi/buildflags/buildflags.h"
Ke He31d0bb02018-02-24 07:16:2454#include "services/device/public/mojom/geolocation_context.mojom.h"
55#include "services/device/public/mojom/wake_lock.mojom.h"
Mounir Lamourifd9dcefa2017-07-06 10:26:5556#include "services/metrics/public/cpp/ukm_recorder.h"
Blink Reformata30d4232018-04-07 15:31:0657#include "third_party/blink/public/mojom/color_chooser/color_chooser.mojom.h"
58#include "third_party/blink/public/platform/web_drag_operation.h"
Doug Turner63f3c7b2017-07-29 05:10:0159#include "ui/accessibility/ax_modes.h"
Sylvain Defresnec6ccc77d2014-09-19 10:19:3560#include "ui/base/page_transition_types.h"
tfarina3b0452d2014-12-31 15:20:0961#include "ui/gfx/geometry/rect_f.h"
tfarinaebe974f02015-01-03 04:25:3262#include "ui/gfx/geometry/size.h"
[email protected]0dd3a0ab2011-02-18 08:17:4463
blundellf5316fc2017-05-15 11:49:0364#if defined(OS_ANDROID)
65#include "content/browser/android/nfc_host.h"
Bo Liu168c8642017-08-28 18:26:0266#include "content/public/browser/android/child_process_importance.h"
blundellf5316fc2017-05-15 11:49:0367#endif
68
[email protected]1ff427972013-02-07 21:14:0769struct ViewHostMsg_DateTimeDialogValue_Params;
[email protected]daf82f82011-10-31 22:35:3170
rockot400ea35b2016-10-15 19:15:3271namespace service_manager {
sammcf5f1b0f2016-09-20 23:05:1172class InterfaceProvider;
73}
74
[email protected]e582fdd2011-12-20 16:48:1775namespace content {
[email protected]7a846df2012-09-20 19:17:3976class BrowserPluginEmbedder;
77class BrowserPluginGuest;
[email protected]583418cc2013-01-17 14:01:1078class DateTimeChooserAndroid;
paulmeyerc0b762b2016-04-13 11:55:1779class FindRequestManager;
[email protected]8ff00d72012-10-23 19:12:2180class InterstitialPageImpl;
[email protected]71a88bb2013-02-01 22:05:1581class JavaScriptDialogManager;
csharrisona2280cd2016-02-03 23:21:1582class LoaderIOThreadNotifier;
mlamouriefdca9d2014-09-16 16:55:4083class ManifestManagerHost;
qinmin58567c82015-01-07 21:00:2084class MediaWebContentsObserver;
tommyclieb25b2a2014-11-03 19:45:0985class PluginContentOriginWhitelist;
[email protected]eaabba22012-03-07 15:02:1186class RenderViewHost;
[email protected]5a3bdf52012-05-24 15:12:5787class RenderViewHostDelegateView;
[email protected]b24b68a2012-09-24 21:57:2688class RenderWidgetHostImpl;
kenrb2a565f82015-09-02 20:24:5989class RenderWidgetHostInputEventRouter;
[email protected]35869622012-10-26 23:23:5590class SavePackage;
lunalud4a2cc82016-11-22 00:27:2391class ScreenOrientationProvider;
[email protected]09d31d52012-03-11 22:30:2792class SiteInstance;
[email protected]80e776ae2012-03-23 16:17:2093class TestWebContents;
ekaramadadd882292016-06-08 15:22:5694class TextInputManager;
miu50f97892014-09-22 22:49:5295class WebContentsAudioMuter;
[email protected]674bc592011-12-20 23:00:4296class WebContentsDelegate;
[email protected]8ff00d72012-10-23 19:12:2197class WebContentsImpl;
[email protected]fc2b46b2014-05-03 16:33:4598class WebContentsView;
[email protected]f66df822012-05-18 16:52:1799class WebContentsViewDelegate;
[email protected]31a71eaf2014-03-13 01:47:36100struct AXEventNotificationDetails;
[email protected]795c28972012-12-06 06:13:39101struct FaviconURL;
[email protected]09d31d52012-03-11 22:30:27102struct LoadNotificationDetails;
dewittj6dc5747a2016-05-17 01:48:47103struct MHTMLGenerationParams;
[email protected]f66df822012-05-18 16:52:17104
rockot5c478a72016-09-28 23:14:18105namespace mojom {
106class CreateNewWindowParams;
107}
108
mfomitchev2b8b066a2016-01-28 19:23:15109#if defined(OS_ANDROID)
[email protected]0e813a52014-08-13 10:34:56110class WebContentsAndroid;
mcnee336ea2c2017-05-23 22:50:59111#else // !defined(OS_ANDROID)
112class HostZoomMapObserver;
113#endif // defined(OS_ANDROID)
[email protected]0e813a52014-08-13 10:34:56114
brettw4b461082016-11-19 18:55:16115#if BUILDFLAG(ENABLE_PLUGINS)
zqzhang181047e62016-07-01 13:37:17116class PepperPlaybackObserver;
117#endif
118
[email protected]f66df822012-05-18 16:52:17119// Factory function for the implementations that content knows about. Takes
120// ownership of |delegate|.
[email protected]fc2b46b2014-05-03 16:33:45121WebContentsView* CreateWebContentsView(
[email protected]5a3bdf52012-05-24 15:12:57122 WebContentsImpl* web_contents,
123 WebContentsViewDelegate* delegate,
124 RenderViewHostDelegateView** render_view_host_delegate_view);
[email protected]97714c82012-06-06 10:15:13125
Nico Weber43ddd7a32017-08-15 19:19:27126class CONTENT_EXPORT WebContentsImpl : public WebContents,
127 public RenderFrameHostDelegate,
128 public RenderViewHostDelegate,
129 public RenderWidgetHostDelegate,
130 public RenderFrameHostManager::Delegate,
Joel Hockey163835a2017-12-20 11:51:57131 public blink::mojom::ColorChooserFactory,
Nico Weber43ddd7a32017-08-15 19:19:27132 public NotificationObserver,
133 public NavigationControllerDelegate,
134 public NavigatorDelegate {
[email protected]0dd3a0ab2011-02-18 08:17:44135 public:
benwells5e7260d2017-03-20 23:36:33136 class FriendWrapper;
nickf9acfbe2014-12-23 19:12:37137
dchengc2282aa2014-10-21 12:07:58138 ~WebContentsImpl() override;
[email protected]0dd3a0ab2011-02-18 08:17:44139
erikchen50735fd2018-05-05 15:08:33140 static std::unique_ptr<WebContentsImpl> CreateWithOpener(
[email protected]54944cde2012-12-09 09:24:59141 const WebContents::CreateParams& params,
Ian Clelland5cbaaf82017-11-27 22:00:03142 RenderFrameHostImpl* opener_rfh);
[email protected]d1198fd2012-08-13 22:50:19143
[email protected]95640212014-07-26 18:14:30144 static std::vector<WebContentsImpl*> GetAllWebContents();
145
paulmeyerfeafc2d2017-04-25 21:46:40146 static WebContentsImpl* FromFrameTreeNode(
147 const FrameTreeNode* frame_tree_node);
clamy0d32d6d2015-11-24 11:16:26148 static WebContents* FromRenderFrameHostID(int render_process_host_id,
149 int render_frame_host_id);
ananta4b7467a52016-09-23 01:42:38150 static WebContents* FromFrameTreeNodeId(int frame_tree_node_id);
paulmeyerfeafc2d2017-04-25 21:46:40151 static WebContentsImpl* FromOuterFrameTreeNode(
152 const FrameTreeNode* frame_tree_node);
clamya16aa8172015-05-26 13:07:25153
[email protected]d1198fd2012-08-13 22:50:19154 // Complex initialization here. Specifically needed to avoid having
155 // members call back into our virtual functions in the constructor.
[email protected]54944cde2012-12-09 09:24:59156 virtual void Init(const WebContents::CreateParams& params);
[email protected]d1198fd2012-08-13 22:50:19157
[email protected]c7dd2f62011-07-18 15:57:59158 // Returns the SavePackage which manages the page saving job. May be NULL.
159 SavePackage* save_package() const { return save_package_.get(); }
160
mfomitchev2b8b066a2016-01-28 19:23:15161#if defined(OS_ANDROID)
[email protected]7d244f12013-08-22 21:41:51162 // In Android WebView, the RenderView needs created even there is no
163 // navigation entry, this allows Android WebViews to use
164 // javascript: URLs that load into the DOMWindow before the first page
165 // load. This is not safe to do in any context that a web page could get a
166 // reference to the DOMWindow before the first page load.
167 bool CreateRenderViewForInitialEmptyDocument();
[email protected]4cc1ab52013-01-21 19:24:34168#endif
[email protected]276b37a22011-11-08 20:45:46169
[email protected]765187182012-01-11 23:59:28170 // Expose the render manager for testing.
[email protected]ee87c8be2014-03-05 00:35:38171 // TODO(creis): Remove this now that we can get to it via FrameTreeNode.
[email protected]b0936d22013-11-28 06:47:36172 RenderFrameHostManager* GetRenderManagerForTesting();
[email protected]765187182012-01-11 23:59:28173
[email protected]7a846df2012-09-20 19:17:39174 // Returns guest browser plugin object, or NULL if this WebContents is not a
175 // guest.
[email protected]f8497342013-02-05 22:15:02176 BrowserPluginGuest* GetBrowserPluginGuest() const;
[email protected]738f57a2013-06-29 21:06:54177
178 // Sets a BrowserPluginGuest object for this WebContents. If this WebContents
179 // has a BrowserPluginGuest then that implies that it is being hosted by
180 // a BrowserPlugin object in an embedder renderer process.
181 void SetBrowserPluginGuest(BrowserPluginGuest* guest);
182
[email protected]7a846df2012-09-20 19:17:39183 // Returns embedder browser plugin object, or NULL if this WebContents is not
184 // an embedder.
[email protected]f8497342013-02-05 22:15:02185 BrowserPluginEmbedder* GetBrowserPluginEmbedder() const;
[email protected]738f57a2013-06-29 21:06:54186
fsamuel60b42282015-03-10 03:29:14187 // Creates a BrowserPluginEmbedder object for this WebContents if one doesn't
188 // already exist.
189 void CreateBrowserPluginEmbedderIfNecessary();
190
creis89a0f782015-05-27 16:13:17191 // Cancels modal dialogs in this WebContents, as well as in any browser
192 // plugins it is hosting.
193 void CancelActiveAndPendingDialogs();
194
[email protected]cf200a562013-05-03 16:24:29195 // Informs the render view host and the BrowserPluginEmbedder, if present, of
196 // a Drag Source End.
Ella Ge80a52dce2017-11-15 18:01:52197 void DragSourceEndedAt(float client_x,
198 float client_y,
199 float screen_x,
200 float screen_y,
Paul Meyer0c58c3712016-11-17 22:59:51201 blink::WebDragOperation operation,
202 RenderWidgetHost* source_rwh);
[email protected]cf200a562013-05-03 16:24:29203
jam73f892642016-09-11 06:04:06204 // Notification that the RenderViewHost's load state changed.
Charles Harrison911fa062018-03-06 21:01:46205 void LoadStateChanged(const std::string& host,
jam73f892642016-09-11 06:04:06206 const net::LoadStateWithParam& load_state,
207 uint64_t upload_position,
208 uint64_t upload_size);
209
Francois Doraye6161152018-03-27 22:05:37210 // Set the visibility to |visibility| and notifies observers.
211 void SetVisibility(Visibility visibility);
Francois Dorayfe4a1772018-02-17 04:17:09212
calamity7fe55ce2015-04-10 03:59:37213 // Notify observers that the web contents has been focused.
Michael Thiessen896405db2017-07-20 17:52:32214 void NotifyWebContentsFocused(RenderWidgetHost* render_widget_host);
calamity7fe55ce2015-04-10 03:59:37215
zijiehe3bee08e22017-05-17 04:14:46216 // Notify observers that the web contents has lost focus.
Michael Thiessen896405db2017-07-20 17:52:32217 void NotifyWebContentsLostFocus(RenderWidgetHost* render_widget_host);
zijiehe3bee08e22017-05-17 04:14:46218
[email protected]fc2b46b2014-05-03 16:33:45219 WebContentsView* GetView() const;
220
leon.han552e9de2017-02-09 14:37:30221 void OnScreenOrientationChange();
222
223 ScreenOrientationProvider* GetScreenOrientationProviderForTesting() const {
224 return screen_orientation_provider_.get();
225 }
leon.hane4db177a2017-02-07 14:19:16226
[email protected]95640212014-07-26 18:14:30227 // Broadcasts the mode change to all frames.
Doug Turner63f3c7b2017-07-29 05:10:01228 void SetAccessibilityMode(ui::AXMode mode);
[email protected]95640212014-07-26 18:14:30229
230 // Adds the given accessibility mode to the current accessibility mode
231 // bitmap.
Doug Turner63f3c7b2017-07-29 05:10:01232 void AddAccessibilityMode(ui::AXMode mode);
[email protected]95640212014-07-26 18:14:30233
mcnee336ea2c2017-05-23 22:50:59234#if !defined(OS_ANDROID)
wjmaclean64951902016-04-29 20:59:12235 // Set a temporary zoom level for the frames associated with this WebContents.
236 // If |is_temporary| is true, we are setting a new temporary zoom level,
237 // otherwise we are clearing a previously set temporary zoom level.
238 void SetTemporaryZoomLevel(double level, bool temporary_zoom_enabled);
239
240 // Sets the zoom level for frames associated with this WebContents.
241 void UpdateZoom(double level);
242
243 // Sets the zoom level for frames associated with this WebContents if it
244 // matches |host| and (if non-empty) |scheme|. Matching is done on the
245 // last committed entry.
246 void UpdateZoomIfNecessary(const std::string& scheme,
247 const std::string& host,
248 double level);
mcnee336ea2c2017-05-23 22:50:59249#endif // !defined(OS_ANDROID)
wjmaclean64951902016-04-29 20:59:12250
rockotf62002a2016-09-15 00:08:59251 // Adds a new binding set to the WebContents. Returns a closure which may be
252 // used to remove the binding set at any time. The closure is safe to call
253 // even after WebContents destruction.
254 //
255 // |binding_set| is not owned and must either outlive this WebContents or be
256 // explicitly removed before being destroyed.
257 base::Closure AddBindingSet(const std::string& interface_name,
258 WebContentsBindingSet* binding_set);
259
rockot8bbad222017-03-22 04:34:05260 // Accesses a WebContentsBindingSet for a specific interface on this
261 // WebContents. Returns null of there is no registered binder for the
262 // interface.
263 WebContentsBindingSet* GetBindingSet(const std::string& interface_name);
rockot96c63e32017-03-20 23:23:03264
paulmeyerfeafc2d2017-04-25 21:46:40265 // Returns the focused WebContents.
266 // If there are multiple inner/outer WebContents (when embedding <webview>,
267 // <guestview>, ...) returns the single one containing the currently focused
268 // frame. Otherwise, returns this WebContents.
269 WebContentsImpl* GetFocusedWebContents();
270
271 // TODO(paulmeyer): Once GuestViews are no longer implemented as
272 // BrowserPluginGuests, frame traversal across WebContents should be moved to
273 // be handled by FrameTreeNode, and |GetInnerWebContents| and
274 // |GetWebContentsAndAllInner| can be removed.
275
276 // Returns a vector to the inner WebContents within this WebContents.
277 std::vector<WebContentsImpl*> GetInnerWebContents();
278
279 // Returns a vector containing this WebContents and all inner WebContents
280 // within it (recursively).
281 std::vector<WebContentsImpl*> GetWebContentsAndAllInner();
282
Sam McNally145fb172017-05-10 00:13:23283 void NotifyManifestUrlChanged(const base::Optional<GURL>& manifest_url);
284
Dmitry Gozman1f80890232017-12-15 22:54:11285 ManifestManagerHost* GetManifestManagerHost() const {
286 return manifest_manager_host_.get();
287 }
288
Daniel Cheng90196c82018-04-25 21:49:14289 // TODO(https://crbug.com/826293): This is a simple mitigation to validate
290 // that an action that requires a user gesture actually has one in the
291 // trustworthy browser process, rather than relying on the untrustworthy
292 // renderer. This should be eventually merged into and accounted for in the
293 // user activation work.
294 bool HasRecentInteractiveInputEvent() const;
295
Bo Liu168c8642017-08-28 18:26:02296#if defined(OS_ANDROID)
Bo Liu16dd7b8322018-05-02 21:19:50297 void SetMainFrameImportance(ChildProcessImportance importance);
Bo Liu168c8642017-08-28 18:26:02298#endif
Bo Liu7c6779e92017-08-16 02:02:28299
[email protected]8ff00d72012-10-23 19:12:21300 // WebContents ------------------------------------------------------
dchengc2282aa2014-10-21 12:07:58301 WebContentsDelegate* GetDelegate() override;
302 void SetDelegate(WebContentsDelegate* delegate) override;
303 NavigationControllerImpl& GetController() override;
304 const NavigationControllerImpl& GetController() const override;
305 BrowserContext* GetBrowserContext() const override;
306 const GURL& GetURL() const override;
307 const GURL& GetVisibleURL() const override;
308 const GURL& GetLastCommittedURL() const override;
Lukasz Anforowicze9ae3722017-09-29 17:37:38309 RenderFrameHostImpl* GetMainFrame() const override;
nick53d5cbf2015-04-23 22:50:14310 RenderFrameHostImpl* GetFocusedFrame() override;
creisf71a2632017-05-04 19:03:50311 RenderFrameHostImpl* FindFrameByFrameTreeNodeId(int frame_tree_node_id,
312 int process_id) override;
313 RenderFrameHostImpl* UnsafeFindFrameByFrameTreeNodeId(
rob3e2a0732016-01-06 21:22:09314 int frame_tree_node_id) override;
dchengc2282aa2014-10-21 12:07:58315 void ForEachFrame(
Lei Zhangebcc6302018-01-12 19:46:45316 const base::RepeatingCallback<void(RenderFrameHost*)>& on_frame) override;
dchengafb53e22016-02-04 08:11:08317 std::vector<RenderFrameHost*> GetAllFrames() override;
lukaszacbdf52e2016-01-15 21:19:51318 int SendToAllFrames(IPC::Message* message) override;
creisc014b402015-04-23 16:41:45319 RenderViewHostImpl* GetRenderViewHost() const override;
dchengc2282aa2014-10-21 12:07:58320 RenderWidgetHostView* GetRenderWidgetHostView() const override;
lfg265a2672016-04-23 03:11:02321 RenderWidgetHostView* GetTopLevelRenderWidgetHostView() override;
naskoc0fceff2015-04-30 15:53:52322 void ClosePage() override;
dchengc2282aa2014-10-21 12:07:58323 RenderWidgetHostView* GetFullscreenRenderWidgetHostView() const override;
yusufod41c5f92015-03-06 00:14:28324 SkColor GetThemeColor() const override;
dchengc2282aa2014-10-21 12:07:58325 WebUI* GetWebUI() const override;
326 WebUI* GetCommittedWebUI() const override;
Changwan Ryuc1134a82018-03-07 02:10:14327 void SetUserAgentOverride(const std::string& override,
328 bool override_in_new_tabs) override;
dchengc2282aa2014-10-21 12:07:58329 const std::string& GetUserAgentOverride() const override;
Changwan Ryuc1134a82018-03-07 02:10:14330 bool ShouldOverrideUserAgentInNewTabs() override;
dmazzonidd3d51a72016-12-14 18:41:01331 void EnableWebContentsOnlyAccessibilityMode() override;
332 bool IsWebContentsOnlyAccessibilityModeForTesting() const override;
dchengc2282aa2014-10-21 12:07:58333 bool IsFullAccessibilityModeForTesting() const override;
kouhei40f03cb2015-09-24 07:47:01334 const PageImportanceSignals& GetPageImportanceSignals() const override;
dchengc2282aa2014-10-21 12:07:58335 const base::string16& GetTitle() const override;
afakhry6f0c1ec22016-07-14 13:55:13336 void UpdateTitleForEntry(NavigationEntry* entry,
337 const base::string16& title) override;
dchengc2282aa2014-10-21 12:07:58338 SiteInstanceImpl* GetSiteInstance() const override;
dchengc2282aa2014-10-21 12:07:58339 bool IsLoading() const override;
340 bool IsLoadingToDifferentDocument() const override;
341 bool IsWaitingForResponse() const override;
342 const net::LoadStateWithParam& GetLoadState() const override;
343 const base::string16& GetLoadStateHost() const override;
Avi Drissman1e620f32018-03-16 13:57:29344 void RequestAXTreeSnapshot(AXTreeSnapshotCallback callback,
345 ui::AXMode ax_mode) override;
avib7348942015-12-25 20:57:10346 uint64_t GetUploadSize() const override;
347 uint64_t GetUploadPosition() const override;
dchengc2282aa2014-10-21 12:07:58348 const std::string& GetEncoding() const override;
Shubhie Panickerddf2a4e2018-03-06 00:09:06349 void SetWasDiscarded(bool was_discarded) override;
dchengc2282aa2014-10-21 12:07:58350 void IncrementCapturerCount(const gfx::Size& capture_size) override;
351 void DecrementCapturerCount() override;
Francois Doray24fc62c2017-12-11 17:27:33352 bool IsBeingCaptured() const override;
dchengc2282aa2014-10-21 12:07:58353 bool IsAudioMuted() const override;
354 void SetAudioMuted(bool mute) override;
Jan Rucka442c83f2017-08-08 13:27:54355 bool IsCurrentlyAudible() override;
ortunodf4d7982016-04-08 02:33:35356 bool IsConnectedToBluetoothDevice() const override;
dchengc2282aa2014-10-21 12:07:58357 bool IsCrashed() const override;
358 void SetIsCrashed(base::TerminationStatus status, int error_code) override;
359 base::TerminationStatus GetCrashedStatus() const override;
afakhry98241832016-03-11 19:27:47360 int GetCrashedErrorCode() const override;
dchengc2282aa2014-10-21 12:07:58361 bool IsBeingDestroyed() const override;
362 void NotifyNavigationStateChanged(InvalidateTypes changed_flags) override;
altiminec87fd1f2016-11-17 20:22:49363 void OnAudioStateChanged(bool is_audible) override;
gab0dccfef2015-05-20 18:43:39364 base::TimeTicks GetLastActiveTime() const override;
georgesak5582cbe2015-05-22 22:08:07365 void SetLastActiveTime(base::TimeTicks last_active_time) override;
dchengc2282aa2014-10-21 12:07:58366 void WasShown() override;
367 void WasHidden() override;
Francois Doray18800972017-08-25 22:38:58368 void WasOccluded() override;
Francois Dorayfe4a1772018-02-17 04:17:09369 Visibility GetVisibility() const override;
dchengc2282aa2014-10-21 12:07:58370 bool NeedToFireBeforeUnload() override;
nasko148bb0b92016-05-10 21:03:19371 void DispatchBeforeUnload() override;
lazyboy6ec48b2a2015-06-29 15:18:14372 void AttachToOuterWebContentsFrame(
373 WebContents* outer_web_contents,
374 RenderFrameHost* outer_contents_frame) override;
Wei Li5c0b4d12018-03-22 15:05:22375 WebContentsImpl* GetOuterWebContents() override;
dalecurtis6c58ed02016-10-28 23:02:37376 void DidChangeVisibleSecurityState() override;
Ahmed Fakhryd70bf37b2018-04-04 17:07:24377 void NotifyPreferencesChanged() override;
Wei Li5c0b4d12018-03-22 15:05:22378
dchengc2282aa2014-10-21 12:07:58379 void Stop() override;
Fadi Meawada6573e02018-03-10 00:52:11380 void FreezePage() override;
erikchen6c7df7f7a2018-05-03 18:13:59381 std::unique_ptr<WebContents> Clone() override;
toyoshim24a4c7ab2016-04-05 09:24:14382 void ReloadFocusedFrame(bool bypass_cache) override;
dchengc2282aa2014-10-21 12:07:58383 void Undo() override;
384 void Redo() override;
385 void Cut() override;
386 void Copy() override;
387 void CopyToFindPboard() override;
388 void Paste() override;
389 void PasteAndMatchStyle() override;
390 void Delete() override;
391 void SelectAll() override;
yabinh351e7ec2017-03-10 02:43:24392 void CollapseSelection() override;
dchengc2282aa2014-10-21 12:07:58393 void Replace(const base::string16& word) override;
394 void ReplaceMisspelling(const base::string16& word) override;
395 void NotifyContextMenuClosed(
anand.ratn120b0b002014-10-07 15:49:32396 const CustomContextMenuContext& context) override;
megjablon3f5941072016-02-04 23:27:52397 void ReloadLoFiImages() override;
dchengc2282aa2014-10-21 12:07:58398 void ExecuteCustomContextMenuCommand(
399 int action,
400 const CustomContextMenuContext& context) override;
401 gfx::NativeView GetNativeView() override;
402 gfx::NativeView GetContentNativeView() override;
403 gfx::NativeWindow GetTopLevelNativeWindow() override;
404 gfx::Rect GetContainerBounds() override;
405 gfx::Rect GetViewBounds() override;
406 DropData* GetDropData() override;
407 void Focus() override;
408 void SetInitialFocus() override;
409 void StoreFocus() override;
410 void RestoreFocus() override;
411 void FocusThroughTabTraversal(bool reverse) override;
412 bool ShowingInterstitialPage() const override;
Pete Williamson89aa1402017-07-07 19:58:41413 void AdjustPreviewsStateForNavigation(PreviewsState* previews_state) override;
Maxim Podgorodskiya926c4ff2017-11-20 02:06:39414 InterstitialPageImpl* GetInterstitialPage() const override;
dchengc2282aa2014-10-21 12:07:58415 bool IsSavable() override;
416 void OnSavePage() override;
417 bool SavePage(const base::FilePath& main_file,
418 const base::FilePath& dir_path,
419 SavePageType save_type) override;
420 void SaveFrame(const GURL& url, const Referrer& referrer) override;
kundaji6c7f9692015-03-09 18:00:37421 void SaveFrameWithHeaders(const GURL& url,
422 const Referrer& referrer,
Xing Liu10329bf2018-03-20 19:22:14423 const std::string& headers,
424 const base::string16& suggested_filename) override;
dewittj6dc5747a2016-05-17 01:48:47425 void GenerateMHTML(const MHTMLGenerationParams& params,
Avi Drissman149b7832018-03-23 14:31:49426 base::OnceCallback<void(int64_t)> callback) override;
dchengc2282aa2014-10-21 12:07:58427 const std::string& GetContentsMimeType() const override;
428 bool WillNotifyDisconnection() const override;
dchengc2282aa2014-10-21 12:07:58429 RendererPreferences* GetMutableRendererPrefs() override;
430 void Close() override;
Paul Meyer0c58c3712016-11-17 22:59:51431 void SystemDragEnded(RenderWidgetHost* source_rwh) override;
Daniel Cheng90196c82018-04-25 21:49:14432 void NavigatedByUser() override;
dchengc2282aa2014-10-21 12:07:58433 void SetClosedByUserGesture(bool value) override;
434 bool GetClosedByUserGesture() const override;
dchengc2282aa2014-10-21 12:07:58435 int GetMinimumZoomPercent() const override;
436 int GetMaximumZoomPercent() const override;
mcnee432e47d2015-11-09 19:37:46437 void SetPageScale(float page_scale_factor) override;
dchengc2282aa2014-10-21 12:07:58438 gfx::Size GetPreferredSize() const override;
439 bool GotResponseToLockMouseRequest(bool allowed) override;
Joe Downing13dd76b2018-04-09 18:32:15440 bool GotResponseToKeyboardLockRequest(bool allowed) override;
dchengc2282aa2014-10-21 12:07:58441 bool HasOpener() const override;
lukasza6f8ac622017-06-06 03:10:20442 RenderFrameHostImpl* GetOpener() const override;
jochen6004a362017-02-04 00:11:40443 bool HasOriginalOpener() const override;
lukasza6f8ac622017-06-06 03:10:20444 RenderFrameHostImpl* GetOriginalOpener() const override;
dchengc2282aa2014-10-21 12:07:58445 void DidChooseColorInColorChooser(SkColor color) override;
446 void DidEndColorChooser() override;
447 int DownloadImage(const GURL& url,
448 bool is_favicon,
449 uint32_t max_bitmap_size,
pkotwiczfd773552015-03-16 00:29:14450 bool bypass_cache,
Avi Drissmana5a52dd2018-03-27 03:39:02451 ImageDownloadCallback callback) override;
dchengc2282aa2014-10-21 12:07:58452 bool IsSubframe() const override;
453 void Find(int request_id,
454 const base::string16& search_text,
455 const blink::WebFindOptions& options) override;
456 void StopFinding(StopFindAction action) override;
dchengc2282aa2014-10-21 12:07:58457 bool WasRecentlyAudible() override;
Tommy Steimel18360512017-11-01 00:38:19458 bool WasEverAudible() override;
Avi Drissmana5a52dd2018-03-27 03:39:02459 void GetManifest(GetManifestCallback callback) override;
avi0720b02e2017-06-13 03:22:13460 bool IsFullscreenForCurrentTab() const override;
bokanece34a82016-01-28 19:49:46461 void ExitFullscreen(bool will_cause_resize) override;
mariakhomenko44bdc4732015-04-29 01:55:38462 void ResumeLoadingCreatedWebContents() override;
qinmin72e8bd02016-10-21 19:35:37463 void SetIsOverlayContent(bool is_overlay_content) override;
ekaramad5c1f9392017-01-25 02:05:23464 bool IsFocusedElementEditable() override;
465 void ClearFocusedElement() override;
ekaramadf6750aa2017-06-06 18:29:42466 bool IsShowingContextMenu() const override;
467 void SetShowingContextMenu(bool showing) override;
Gyuyoung Kim80143f5e2018-04-02 02:40:25468 void PausePageScheduledTasks(bool paused) override;
mfomitchev2b8b066a2016-01-28 19:23:15469
mlamouri918734092016-03-12 04:47:52470#if defined(OS_ANDROID)
dcheng48d97c52015-02-04 20:03:20471 base::android::ScopedJavaLocalRef<jobject> GetJavaWebContents() override;
[email protected]0e813a52014-08-13 10:34:56472 virtual WebContentsAndroid* GetWebContentsAndroid();
paulmeyerc0b762b2016-04-13 11:55:17473 void ActivateNearestFindResult(float x, float y) override;
474 void RequestFindMatchRects(int current_version) override;
rockot400ea35b2016-10-15 19:15:32475 service_manager::InterfaceProvider* GetJavaInterfaces() override;
[email protected]fc2b46b2014-05-03 16:33:45476#elif defined(OS_MACOSX)
dchengc2282aa2014-10-21 12:07:58477 void SetAllowOtherViews(bool allow) override;
478 bool GetAllowOtherViews() override;
spqchane72c3cb2017-06-30 23:02:10479 bool CompletedFirstVisuallyNonEmptyPaint() const override;
[email protected]155c7f22013-12-09 17:07:18480#endif
[email protected]0bfbf882011-12-22 18:19:27481
482 // Implementation of PageNavigator.
dchengc2282aa2014-10-21 12:07:58483 WebContents* OpenURL(const OpenURLParams& params) override;
[email protected]151a63d2011-12-20 22:32:52484
[email protected]92404c62013-12-04 16:40:46485 // RenderFrameHostDelegate ---------------------------------------------------
nicka0ac8382016-12-15 23:59:23486 bool OnMessageReceived(RenderFrameHostImpl* render_frame_host,
dchengc2282aa2014-10-21 12:07:58487 const IPC::Message& message) override;
rockotf62002a2016-09-15 00:08:59488 void OnAssociatedInterfaceRequest(
489 RenderFrameHost* render_frame_host,
490 const std::string& interface_name,
491 mojo::ScopedInterfaceEndpointHandle handle) override;
Ben Goodger9e24929e2017-07-21 03:13:40492 void OnInterfaceRequest(
493 RenderFrameHost* render_frame_host,
494 const std::string& interface_name,
495 mojo::ScopedMessagePipeHandle* interface_pipe) override;
Nicolas Dossou-gbetebcab2472017-09-09 12:28:40496 void OnDidBlockFramebust(const GURL& url) override;
dchengc2282aa2014-10-21 12:07:58497 const GURL& GetMainFrameLastCommittedURL() const override;
498 void RenderFrameCreated(RenderFrameHost* render_frame_host) override;
499 void RenderFrameDeleted(RenderFrameHost* render_frame_host) override;
dchengc2282aa2014-10-21 12:07:58500 void ShowContextMenu(RenderFrameHost* render_frame_host,
501 const ContextMenuParams& params) override;
avi777ff452017-02-09 19:04:48502 void RunJavaScriptDialog(RenderFrameHost* render_frame_host,
503 const base::string16& message,
504 const base::string16& default_prompt,
avi777ff452017-02-09 19:04:48505 JavaScriptDialogType dialog_type,
506 IPC::Message* reply_msg) override;
dchengc2282aa2014-10-21 12:07:58507 void RunBeforeUnloadConfirm(RenderFrameHost* render_frame_host,
dchengc2282aa2014-10-21 12:07:58508 bool is_reload,
509 IPC::Message* reply_msg) override;
naskoada75b22016-06-11 16:09:46510 void RunFileChooser(RenderFrameHost* render_frame_host,
511 const FileChooserParams& params) override;
Charles Reis15d60b132017-11-03 17:43:47512 void DidCancelLoading() override;
dchengc2282aa2014-10-21 12:07:58513 void DidAccessInitialDocument() override;
alexmosbe2f4c32015-03-10 02:30:23514 void DidChangeName(RenderFrameHost* render_frame_host,
515 const std::string& name) override;
dchengc2282aa2014-10-21 12:07:58516 void DocumentOnLoadCompleted(RenderFrameHost* render_frame_host) override;
creis8eb8ef22015-11-04 22:51:38517 void UpdateStateForFrame(RenderFrameHost* render_frame_host,
518 const PageState& page_state) override;
dchengc2282aa2014-10-21 12:07:58519 void UpdateTitle(RenderFrameHost* render_frame_host,
dchengc2282aa2014-10-21 12:07:58520 const base::string16& title,
521 base::i18n::TextDirection title_direction) override;
522 void UpdateEncoding(RenderFrameHost* render_frame_host,
523 const std::string& encoding) override;
524 WebContents* GetAsWebContents() override;
525 bool IsNeverVisible() override;
Doug Turner63f3c7b2017-07-29 05:10:01526 ui::AXMode GetAccessibilityMode() const override;
Dominic Mazzonia7b0edb22017-08-09 16:32:51527 void AccessibilityEventReceived(
528 const std::vector<AXEventNotificationDetails>& details) override;
dmazzoni2400c462016-08-23 15:07:13529 void AccessibilityLocationChangesReceived(
530 const std::vector<AXLocationChangeNotificationDetails>& details) override;
dchengc2282aa2014-10-21 12:07:58531 RenderFrameHost* GetGuestByInstanceID(
fsamuel833ee7c2015-02-13 23:40:40532 RenderFrameHost* render_frame_host,
dchengc2282aa2014-10-21 12:07:58533 int browser_plugin_instance_id) override;
Ke He7319dbe2017-11-09 05:54:44534 device::mojom::GeolocationContext* GetGeolocationContext() override;
ke.he98b761e2017-05-09 05:59:17535 device::mojom::WakeLockContext* GetWakeLockContext() override;
juncai8e8d6ec2017-06-06 20:48:18536 device::mojom::WakeLock* GetRendererWakeLock() override;
blundellf5316fc2017-05-15 11:49:03537#if defined(OS_ANDROID)
Han Leonf6a2e5f2017-05-23 13:40:47538 void GetNFC(device::mojom::NFCRequest request) override;
blundellf5316fc2017-05-15 11:49:03539#endif
Dave Tapuska3ed44192018-05-01 18:53:30540 void EnterFullscreenMode(const GURL& origin,
541 const blink::WebFullscreenOptions& options) override;
bokanece34a82016-01-28 19:49:46542 void ExitFullscreenMode(bool will_cause_resize) override;
alexmose7da5a12015-04-09 02:22:16543 bool ShouldRouteMessageEvent(
544 RenderFrameHost* target_rfh,
545 SiteInstance* source_site_instance) const override;
alexmos58729042015-06-18 23:20:00546 void EnsureOpenerProxiesExist(RenderFrameHost* source_rfh) override;
dcheng59716272016-04-09 05:19:08547 std::unique_ptr<WebUIImpl> CreateWebUIForRenderFrameHost(
548 const GURL& url) override;
avallee0206f782016-07-28 18:55:33549 void SetFocusedFrame(FrameTreeNode* node, SiteInstance* source) override;
Avi Drissman36f801f2018-02-01 20:06:04550 void DidCallFocus() override;
avalleed68cdd12017-06-21 22:07:27551 RenderFrameHost* GetFocusedFrameIncludingInnerWebContents() override;
ekaramada110f642016-12-21 19:47:28552 void OnFocusedElementChangedInFrame(
553 RenderFrameHostImpl* frame,
554 const gfx::Rect& bounds_in_root_view) override;
Lucas Furukawa Gadaniabbfa342017-08-29 19:37:57555 void OnAdvanceFocus(RenderFrameHostImpl* source_rfh) override;
nick5ae4d2d2017-01-06 01:18:35556 void CreateNewWindow(
csharrison95f01e922017-04-24 18:52:35557 RenderFrameHost* opener,
nick5ae4d2d2017-01-06 01:18:35558 int32_t render_view_route_id,
559 int32_t main_frame_route_id,
560 int32_t main_frame_widget_route_id,
561 const mojom::CreateNewWindowParams& params,
562 SessionStorageNamespace* session_storage_namespace) override;
563 void ShowCreatedWindow(int process_id,
564 int main_frame_widget_route_id,
565 WindowOpenDisposition disposition,
566 const gfx::Rect& initial_rect,
567 bool user_gesture) override;
carloskd9d97942017-02-16 08:58:09568 void DidDisplayInsecureContent() override;
569 void DidRunInsecureContent(const GURL& security_origin,
570 const GURL& target_url) override;
571 void PassiveInsecureContentFound(const GURL& resource_url) override;
572 bool ShouldAllowRunningInsecureContent(content::WebContents* web_contents,
573 bool allowed_per_prefs,
574 const url::Origin& origin,
575 const GURL& resource_url) override;
Lukasz Anforowicze1b954d92017-10-30 21:28:06576 void ViewSource(RenderFrameHostImpl* frame) override;
Wei Li5bb659742018-02-14 03:07:58577 void PrintCrossProcessSubframe(const gfx::Rect& rect,
578 int document_cookie,
579 RenderFrameHost* render_frame_host) override;
rob.buis300b0872017-03-10 20:43:58580#if defined(OS_ANDROID)
581 base::android::ScopedJavaLocalRef<jobject> GetJavaRenderFrameHostDelegate()
582 override;
583#endif
Jay Civellid5904f02018-03-23 19:43:57584 void SubresourceResponseStarted(const GURL& url,
585 net::CertStatus cert_status) override;
Jay Civelli116683f2018-03-27 19:56:23586 void ResourceLoadComplete(
Jay Civelli52a63302018-04-30 22:39:55587 RenderFrameHost* render_frame_host,
Jay Civelli116683f2018-03-27 19:56:23588 mojom::ResourceLoadInfoPtr resource_load_information) override;
Jennifer Apacibleb1c9ca12018-04-12 07:49:38589 void UpdatePictureInPictureSurfaceId(const viz::SurfaceId& surface_id,
590 const gfx::Size& natural_size) override;
Jennifer Apaciblef6d55b12018-04-06 04:23:40591 void ExitPictureInPicture() override;
[email protected]952a68e2011-11-17 00:36:10592
[email protected]92404c62013-12-04 16:40:46593 // RenderViewHostDelegate ----------------------------------------------------
dchengc2282aa2014-10-21 12:07:58594 RenderViewHostDelegateView* GetDelegateView() override;
nicka0ac8382016-12-15 23:59:23595 bool OnMessageReceived(RenderViewHostImpl* render_view_host,
dchengc2282aa2014-10-21 12:07:58596 const IPC::Message& message) override;
[email protected]a86c0e962013-12-17 17:10:39597 // RenderFrameHostDelegate has the same method, so list it there because this
598 // interface is going away.
nick51208922015-04-24 21:38:37599 // WebContents* GetAsWebContents() override;
dchengc2282aa2014-10-21 12:07:58600 void RenderViewCreated(RenderViewHost* render_view_host) override;
601 void RenderViewReady(RenderViewHost* render_view_host) override;
602 void RenderViewTerminated(RenderViewHost* render_view_host,
603 base::TerminationStatus status,
604 int error_code) override;
605 void RenderViewDeleted(RenderViewHost* render_view_host) override;
sky8b00392d2015-01-10 00:30:28606 void UpdateTargetURL(RenderViewHost* render_view_host,
607 const GURL& url) override;
dchengc2282aa2014-10-21 12:07:58608 void Close(RenderViewHost* render_view_host) override;
609 void RequestMove(const gfx::Rect& new_bounds) override;
dchengc2282aa2014-10-21 12:07:58610 void DocumentAvailableInMainFrame(RenderViewHost* render_view_host) override;
611 void RouteCloseEvent(RenderViewHost* rvh) override;
avia90ae4e2016-11-11 20:49:33612 bool DidAddMessageToConsole(int32_t level,
613 const base::string16& message,
614 int32_t line_no,
615 const base::string16& source_id) override;
dchengc2282aa2014-10-21 12:07:58616 RendererPreferences GetRendererPrefs(
anand.ratn120b0b002014-10-07 15:49:32617 BrowserContext* browser_context) const override;
Daniel Cheng90196c82018-04-25 21:49:14618 void DidReceiveInputEvent(RenderWidgetHostImpl* render_widget_host,
619 const blink::WebInputEvent::Type type) override;
dchengc2282aa2014-10-21 12:07:58620 void OnIgnoredUIEvent() override;
dchengc2282aa2014-10-21 12:07:58621 void Activate() override;
dchengc2282aa2014-10-21 12:07:58622 void UpdatePreferredSize(const gfx::Size& pref_size) override;
avib7348942015-12-25 20:57:10623 void CreateNewWidget(int32_t render_process_id,
624 int32_t route_id,
Dave Tapuska1bdf1832017-07-07 18:07:19625 mojom::WidgetPtr widget,
dchengc2282aa2014-10-21 12:07:58626 blink::WebPopupType popup_type) override;
avib7348942015-12-25 20:57:10627 void CreateNewFullscreenWidget(int32_t render_process_id,
Dave Tapuska1bdf1832017-07-07 18:07:19628 int32_t route_id,
629 mojom::WidgetPtr widget) override;
alexmosc2a8cec2016-05-23 22:19:53630 void ShowCreatedWidget(int process_id,
631 int route_id,
632 const gfx::Rect& initial_rect) override;
633 void ShowCreatedFullscreenWidget(int process_id, int route_id) override;
dchengc2282aa2014-10-21 12:07:58634 void RequestMediaAccessPermission(
[email protected]33662e52013-01-07 21:31:09635 const MediaStreamRequest& request,
anand.ratn120b0b002014-10-07 15:49:32636 const MediaResponseCallback& callback) override;
Raymes Khouryad7c24a12018-03-05 23:22:58637 bool CheckMediaAccessPermission(RenderFrameHost* render_frame_host,
638 const url::Origin& security_origin,
dchengc2282aa2014-10-21 12:07:58639 MediaStreamType type) override;
guidou8a440b842017-01-30 13:58:43640 std::string GetDefaultMediaDeviceID(MediaStreamType type) override;
dchengc2282aa2014-10-21 12:07:58641 SessionStorageNamespace* GetSessionStorageNamespace(
anand.ratn120b0b002014-10-07 15:49:32642 SiteInstance* instance) override;
dchengc2282aa2014-10-21 12:07:58643 SessionStorageNamespaceMap GetSessionStorageNamespaceMap() override;
mcnee336ea2c2017-05-23 22:50:59644#if !defined(OS_ANDROID)
avi85ee8362016-10-08 02:09:08645 double GetPendingPageZoomLevel() override;
mcnee336ea2c2017-05-23 22:50:59646#endif // !defined(OS_ANDROID)
dchengc2282aa2014-10-21 12:07:58647 FrameTree* GetFrameTree() override;
aelias5252baa2016-04-10 01:18:02648 bool IsOverridingUserAgent() override;
avi85ee8362016-10-08 02:09:08649 bool IsJavaScriptDialogShowing() const override;
avic031d392017-03-03 03:09:42650 bool ShouldIgnoreUnresponsiveRenderer() override;
qinmin72e8bd02016-10-21 19:35:37651 bool HideDownloadUI() const override;
mlamouri5cd9ae82017-02-18 11:05:09652 bool HasPersistentVideo() const override;
Alex Moshchuk27caae82017-09-11 23:11:18653 RenderFrameHost* GetPendingMainFrame() override;
lukendc35e7f2014-11-10 19:06:14654
[email protected]52913802013-12-10 05:52:18655 // NavigatorDelegate ---------------------------------------------------------
656
clamy0e119882015-07-31 16:12:33657 void DidStartNavigation(NavigationHandle* navigation_handle) override;
658 void DidRedirectNavigation(NavigationHandle* navigation_handle) override;
clamyefca29e2015-09-17 00:22:11659 void ReadyToCommitNavigation(NavigationHandle* navigation_handle) override;
clamy0e119882015-07-31 16:12:33660 void DidFinishNavigation(NavigationHandle* navigation_handle) override;
dchengc2282aa2014-10-21 12:07:58661 void DidFailLoadWithError(RenderFrameHostImpl* render_frame_host,
662 const GURL& url,
663 int error_code,
Yutaka Hirano16d3c5d2017-07-31 06:17:30664 const base::string16& error_description) override;
dchengc2282aa2014-10-21 12:07:58665 void DidNavigateMainFramePreCommit(bool navigation_is_within_page) override;
666 void DidNavigateMainFramePostCommit(
sky8b00392d2015-01-10 00:30:28667 RenderFrameHostImpl* render_frame_host,
[email protected]37567b432014-02-12 01:12:22668 const LoadCommittedDetails& details,
anand.ratn120b0b002014-10-07 15:49:32669 const FrameHostMsg_DidCommitProvisionalLoad_Params& params) override;
dchengc2282aa2014-10-21 12:07:58670 void DidNavigateAnyFramePostCommit(
[email protected]37567b432014-02-12 01:12:22671 RenderFrameHostImpl* render_frame_host,
672 const LoadCommittedDetails& details,
anand.ratn120b0b002014-10-07 15:49:32673 const FrameHostMsg_DidCommitProvisionalLoad_Params& params) override;
dchengc2282aa2014-10-21 12:07:58674 void SetMainFrameMimeType(const std::string& mime_type) override;
675 bool CanOverscrollContent() const override;
676 void NotifyChangedNavigationState(InvalidateTypes changed_flags) override;
toyoshim0df1d3a2016-09-09 09:52:48677 void DidStartNavigationToPendingEntry(const GURL& url,
678 ReloadType reload_type) override;
lukasza1d025732016-09-28 21:36:08679 bool ShouldTransferNavigation(bool is_main_frame_navigation) override;
dchengc2282aa2014-10-21 12:07:58680 bool ShouldPreserveAbortedURLs() override;
fdegansa696e5112015-04-17 01:57:59681 void DidStartLoading(FrameTreeNode* frame_tree_node,
682 bool to_different_document) override;
683 void DidStopLoading() override;
684 void DidChangeLoadProgress() override;
avid6d88b912017-01-13 00:16:00685 std::vector<std::unique_ptr<NavigationThrottle>> CreateThrottlesForNavigation(
clamycbf524d42016-09-27 12:48:35686 NavigationHandle* navigation_handle) override;
clamy1e5574e2016-09-29 16:48:44687 std::unique_ptr<NavigationUIData> GetNavigationUIData(
688 NavigationHandle* navigation_handle) override;
[email protected]52913802013-12-10 05:52:18689
[email protected]4ca76c02012-05-16 16:19:05690 // RenderWidgetHostDelegate --------------------------------------------------
691
lazyboy63f5b312015-11-23 20:19:52692 void RenderWidgetCreated(RenderWidgetHostImpl* render_widget_host) override;
dchengc2282aa2014-10-21 12:07:58693 void RenderWidgetDeleted(RenderWidgetHostImpl* render_widget_host) override;
miu9e14e492014-10-25 02:39:04694 void RenderWidgetGotFocus(RenderWidgetHostImpl* render_widget_host) override;
zijiehe3bee08e22017-05-17 04:14:46695 void RenderWidgetLostFocus(RenderWidgetHostImpl* render_widget_host) override;
rouslan2f5993f2015-01-29 00:18:31696 void RenderWidgetWasResized(RenderWidgetHostImpl* render_widget_host,
Christopher Cameron07f666b2018-02-13 23:41:19697 const ScreenInfo& screen_info,
rouslan2f5993f2015-01-29 00:18:31698 bool width_changed) override;
Fady Samuel97947112018-05-05 16:24:54699 void ResizeDueToAutoResize(RenderWidgetHostImpl* render_widget_host,
700 const gfx::Size& new_size) override;
kenrbe4f91082017-06-02 20:32:08701 gfx::Size GetAutoResizeSize() override;
702 void ResetAutoResizeSize() override;
skyf65d9bb2017-03-24 02:26:39703 KeyboardEventProcessingResult PreHandleKeyboardEvent(
704 const NativeWebKeyboardEvent& event) override;
dchengc2282aa2014-10-21 12:07:58705 void HandleKeyboardEvent(const NativeWebKeyboardEvent& event) override;
706 bool HandleWheelEvent(const blink::WebMouseWheelEvent& event) override;
707 bool PreHandleGestureEvent(const blink::WebGestureEvent& event) override;
dchengc2282aa2014-10-21 12:07:58708 BrowserAccessibilityManager* GetRootBrowserAccessibilityManager() override;
709 BrowserAccessibilityManager* GetOrCreateRootBrowserAccessibilityManager()
anand.ratn120b0b002014-10-07 15:49:32710 override;
lgarron145aaa82015-07-10 07:39:56711 // The following 4 functions are already listed under WebContents overrides:
mohsen7ab1ec16ec2015-07-02 18:26:23712 // void Cut() override;
713 // void Copy() override;
714 // void Paste() override;
lgarron145aaa82015-07-10 07:39:56715 // void SelectAll() override;
Dave Tapuskab336b922017-07-06 19:24:05716 void ExecuteEditCommand(const std::string& command,
717 const base::Optional<base::string16>& value) override;
mohsen7ab1ec16ec2015-07-02 18:26:23718 void MoveRangeSelectionExtent(const gfx::Point& extent) override;
719 void SelectRange(const gfx::Point& base, const gfx::Point& extent) override;
Dave Tapuskab336b922017-07-06 19:24:05720 void MoveCaret(const gfx::Point& extent) override;
Shimi Zhang37deeb22017-09-28 00:59:01721 void AdjustSelectionByCharacterOffset(int start_adjust,
722 int end_adjust,
723 bool show_selection_menu) override;
kenrb2a565f82015-09-02 20:24:59724 RenderWidgetHostInputEventRouter* GetInputEventRouter() override;
alexmos3fcd0ca2015-10-23 18:18:33725 void ReplicatePageFocus(bool is_focused) override;
alexmosc4cbacb2015-11-21 01:29:22726 RenderWidgetHostImpl* GetFocusedRenderWidgetHost(
727 RenderWidgetHostImpl* receiving_widget) override;
avallee9993fca2016-11-17 06:16:50728 RenderWidgetHostImpl* GetRenderWidgetHostWithPageFocus() override;
729 void FocusOwningWebContents(
730 RenderWidgetHostImpl* render_widget_host) override;
avice799302017-03-09 16:34:59731 void RendererUnresponsive(RenderWidgetHostImpl* render_widget_host) override;
avic3aa8422015-11-09 20:57:22732 void RendererResponsive(RenderWidgetHostImpl* render_widget_host) override;
733 void RequestToLockMouse(RenderWidgetHostImpl* render_widget_host,
734 bool user_gesture,
lfgad8244352016-07-13 16:55:51735 bool last_unlocked_by_target,
736 bool privileged) override;
Joe Downing13dd76b2018-04-09 18:32:15737 bool RequestKeyboardLock(RenderWidgetHostImpl* render_widget_host,
738 bool esc_key_locked) override;
Joe Downing192998b22018-03-22 15:51:36739 void CancelKeyboardLock(RenderWidgetHostImpl* render_widget_host) override;
740 RenderWidgetHostImpl* GetKeyboardLockWidget() override;
avi0720b02e2017-06-13 03:22:13741 // The following function is already listed under WebContents overrides:
742 // bool IsFullscreenForCurrentTab() const override;
avibf58fa0c2015-11-11 01:45:52743 blink::WebDisplayMode GetDisplayMode(
744 RenderWidgetHostImpl* render_widget_host) const override;
avi3e4b8512015-11-11 01:55:49745 void LostCapture(RenderWidgetHostImpl* render_widget_host) override;
746 void LostMouseLock(RenderWidgetHostImpl* render_widget_host) override;
lfgad8244352016-07-13 16:55:51747 bool HasMouseLock(RenderWidgetHostImpl* render_widget_host) override;
lfg84763c92017-02-16 18:55:15748 RenderWidgetHostImpl* GetMouseLockWidget() override;
ekaramada4f42692016-02-11 19:48:37749 void OnRenderFrameProxyVisibilityChanged(bool visible) override;
lfgbb9c28a2016-03-01 03:19:49750 void SendScreenRects() override;
ekaramadadd882292016-06-08 15:22:56751 TextInputManager* GetTextInputManager() override;
paulmeyer7f6f1d4f2016-11-15 00:00:27752 bool OnUpdateDragCursor() override;
kenrb11f213a2017-03-24 18:12:06753 bool IsWidgetForMainFrame(RenderWidgetHostImpl* render_widget_host) override;
nzolghadrd87a308d2016-12-07 15:45:56754 bool AddDomainInfoToRapporSample(rappor::Sample* sample) override;
nzolghadrbbffc6c2017-05-25 17:56:39755 void UpdateUrlForUkmSource(ukm::UkmRecorder* service,
756 ukm::SourceId ukm_source_id) override;
ekaramada110f642016-12-21 19:47:28757 void FocusedNodeTouched(bool editable) override;
samans90fb8162017-04-04 22:30:45758 void DidReceiveCompositorFrame() override;
ekaramadf6750aa2017-06-06 18:29:42759 bool IsShowingContextMenuOnPage() const override;
[email protected]4ca76c02012-05-16 16:19:05760
[email protected]b0936d22013-11-28 06:47:36761 // RenderFrameHostManager::Delegate ------------------------------------------
[email protected]0bfbf882011-12-22 18:19:27762
dchengc2282aa2014-10-21 12:07:58763 bool CreateRenderViewForRenderManager(
[email protected]bffc8302014-01-23 20:52:16764 RenderViewHost* render_view_host,
alexmos5ac402d2015-07-09 07:51:10765 int opener_frame_routing_id,
[email protected]5a7100d2014-05-19 01:29:04766 int proxy_routing_id,
Pavel Feldman25234722017-10-11 02:49:06767 const base::UnguessableToken& devtools_frame_token,
lfgbede6392015-09-11 21:54:06768 const FrameReplicationState& replicated_frame_state) override;
769 void CreateRenderWidgetHostViewForRenderManager(
770 RenderViewHost* render_view_host) override;
alexmosa181efc2015-09-03 00:39:04771 bool CreateRenderFrameForRenderManager(
772 RenderFrameHost* render_frame_host,
773 int proxy_routing_id,
774 int opener_routing_id,
775 int parent_routing_id,
776 int previous_sibling_routing_id) override;
dchengc2282aa2014-10-21 12:07:58777 void BeforeUnloadFiredFromRenderManager(
778 bool proceed,
779 const base::TimeTicks& proceed_time,
anand.ratn120b0b002014-10-07 15:49:32780 bool* proceed_to_fire_unload) override;
dchengc2282aa2014-10-21 12:07:58781 void RenderProcessGoneFromRenderManager(
anand.ratn120b0b002014-10-07 15:49:32782 RenderViewHost* render_view_host) override;
Jianzhou Fengd8720c72018-01-18 03:06:30783 void UpdateRenderViewSizeForRenderManager(bool is_main_frame) override;
dchengc2282aa2014-10-21 12:07:58784 void CancelModalDialogsForRenderManager() override;
785 void NotifySwappedFromRenderManager(RenderFrameHost* old_host,
786 RenderFrameHost* new_host,
787 bool is_main_frame) override;
naskof5940b9f2015-03-02 23:04:05788 void NotifyMainFrameSwappedFromRenderManager(
789 RenderViewHost* old_host,
790 RenderViewHost* new_host) override;
dchengc2282aa2014-10-21 12:07:58791 NavigationControllerImpl& GetControllerForRenderManager() override;
dchengc2282aa2014-10-21 12:07:58792 NavigationEntry* GetLastCommittedNavigationEntryForRenderManager() override;
creisadca9862017-06-16 19:12:11793 InterstitialPageImpl* GetInterstitialForRenderManager() override;
dchengc2282aa2014-10-21 12:07:58794 bool FocusLocationBarByDefault() override;
795 void SetFocusToLocationBar(bool select_all) override;
796 bool IsHidden() override;
rob97250742015-12-10 17:45:15797 int GetOuterDelegateFrameTreeNodeId() override;
ekaramadaeb3c5c2016-11-09 03:22:35798 RenderWidgetHostImpl* GetFullscreenRenderWidgetHost() const override;
[email protected]0bfbf882011-12-22 18:19:27799
Joel Hockey163835a2017-12-20 11:51:57800 // blink::mojom::ColorChooserFactory ---------------------------------------
Joel Hockey85b379d2017-12-11 10:42:13801
Joel Hockey163835a2017-12-20 11:51:57802 void OnColorChooserFactoryRequest(
803 blink::mojom::ColorChooserFactoryRequest request);
Joel Hockey85b379d2017-12-11 10:42:13804 void OpenColorChooser(
Joel Hockey163835a2017-12-20 11:51:57805 blink::mojom::ColorChooserRequest chooser,
806 blink::mojom::ColorChooserClientPtr client,
Joel Hockey85b379d2017-12-11 10:42:13807 SkColor color,
Joel Hockey163835a2017-12-20 11:51:57808 std::vector<blink::mojom::ColorSuggestionPtr> suggestions) override;
Joel Hockey85b379d2017-12-11 10:42:13809
[email protected]8ff00d72012-10-23 19:12:21810 // NotificationObserver ------------------------------------------------------
[email protected]14392a52012-05-02 20:28:44811
dchengc2282aa2014-10-21 12:07:58812 void Observe(int type,
813 const NotificationSource& source,
814 const NotificationDetails& details) override;
[email protected]14392a52012-05-02 20:28:44815
[email protected]ec6c05f2013-10-23 18:41:57816 // NavigationControllerDelegate ----------------------------------------------
817
dchengc2282aa2014-10-21 12:07:58818 WebContents* GetWebContents() override;
819 void NotifyNavigationEntryCommitted(
anand.ratn120b0b002014-10-07 15:49:32820 const LoadCommittedDetails& load_details) override;
Sam McNally5c087a32017-08-25 01:46:14821 void NotifyNavigationEntryChanged(
822 const EntryChangedDetails& change_details) override;
823 void NotifyNavigationListPruned(const PrunedDetails& pruned_details) override;
Christian Dullweber1af31e62018-02-22 11:49:48824 void NotifyNavigationEntriesDeleted() override;
[email protected]ec6c05f2013-10-23 18:41:57825
826 // Invoked before a form repost warning is shown.
dchengc2282aa2014-10-21 12:07:58827 void NotifyBeforeFormRepostWarningShow() override;
[email protected]ec6c05f2013-10-23 18:41:57828
829 // Activate this WebContents and show a form repost warning.
dchengc2282aa2014-10-21 12:07:58830 void ActivateAndShowRepostFormWarningDialog() override;
[email protected]ec6c05f2013-10-23 18:41:57831
[email protected]b4c84012014-04-28 19:51:10832 // Whether the initial empty page of this view has been accessed by another
833 // page, making it unsafe to show the pending URL. Always false after the
834 // first commit.
dchengc2282aa2014-10-21 12:07:58835 bool HasAccessedInitialDocument() override;
[email protected]b4c84012014-04-28 19:51:10836
avi2b177592014-12-10 02:08:02837 // Sets the history for this WebContentsImpl to |history_length| entries, with
alexmos136fd6e62016-08-15 20:58:41838 // an offset of |history_offset|. This notifies all renderers involved in
839 // rendering the current page about the new offset and length.
avi2b177592014-12-10 02:08:02840 void SetHistoryOffsetAndLength(int history_offset,
841 int history_length) override;
[email protected]553602e12011-04-05 17:01:18842
[email protected]a86c0e962013-12-17 17:10:39843 // Called by InterstitialPageImpl when it creates a RenderFrameHost.
dchengc2282aa2014-10-21 12:07:58844 void RenderFrameForInterstitialPageCreated(
anand.ratn120b0b002014-10-07 15:49:32845 RenderFrameHost* render_frame_host) override;
[email protected]561628ce2013-10-25 00:56:47846
847 // Sets the passed interstitial as the currently showing interstitial.
848 // No interstitial page should already be attached.
dchengc2282aa2014-10-21 12:07:58849 void AttachInterstitialPage(InterstitialPageImpl* interstitial_page) override;
[email protected]561628ce2013-10-25 00:56:47850
Becca Hughes9f6fd4b82017-06-15 10:01:40851 void MediaMutedStatusChanged(const WebContentsObserver::MediaPlayerId& id,
852 bool muted);
853
[email protected]561628ce2013-10-25 00:56:47854 // Unsets the currently showing interstitial.
Lucas Furukawa Gadani7f1241d2017-07-12 01:45:04855 void DetachInterstitialPage(bool has_focus) override;
[email protected]561628ce2013-10-25 00:56:47856
aelias5252baa2016-04-10 01:18:02857 void UpdateOverridingUserAgent() override;
858
clamy44e84ce2016-02-22 15:38:25859 // Unpause the throbber if it was paused.
860 void DidProceedOnInterstitial() override;
[email protected]561628ce2013-10-25 00:56:47861
[email protected]34ff1cfc2014-08-20 06:16:05862 // Forces overscroll to be disabled (used by touch emulation).
863 void SetForceDisableOverscrollContent(bool force_disable);
864
Jianzhou Fengd8720c72018-01-18 03:06:30865 // Override the render view/widget size of the main frame, return whether the
866 // size changed.
867 bool SetDeviceEmulationSize(const gfx::Size& new_size);
868 void ClearDeviceEmulationSize();
869
avayvodcc85bbd2015-08-28 19:11:15870 AudioStreamMonitor* audio_stream_monitor() {
871 return &audio_stream_monitor_;
dalecurtisbc6572e12014-09-12 19:22:30872 }
873
dalecurtis88c240072015-12-09 02:11:18874 // Called by MediaWebContentsObserver when playback starts or stops. See the
875 // WebContentsObserver function stubs for more details.
billorr21c005d2016-11-17 03:57:04876 void MediaStartedPlaying(
877 const WebContentsObserver::MediaPlayerInfo& media_info,
878 const WebContentsObserver::MediaPlayerId& id);
879 void MediaStoppedPlaying(
880 const WebContentsObserver::MediaPlayerInfo& media_info,
Becca Hughes220bfc102017-11-14 18:24:07881 const WebContentsObserver::MediaPlayerId& id,
882 WebContentsObserver::MediaStoppedReason reason);
peconn257951522017-06-09 18:24:59883 // This will be called before playback is started, check
884 // GetCurrentlyPlayingVideoCount if you need this when playback starts.
885 void MediaResized(const gfx::Size& size,
886 const WebContentsObserver::MediaPlayerId& id);
Peter E Conneccb34c22017-09-08 09:37:58887 void MediaEffectivelyFullscreenChanged(bool is_fullscreen);
billorr21c005d2016-11-17 03:57:04888
peconn257951522017-06-09 18:24:59889 int GetCurrentlyPlayingVideoCount() override;
Peter Conn31c726a2017-08-17 11:07:34890 base::Optional<gfx::Size> GetFullscreenVideoSize() override;
billorr21c005d2016-11-17 03:57:04891 bool IsFullscreen() override;
dalecurtisbc6572e12014-09-12 19:22:30892
qinmin58567c82015-01-07 21:00:20893 MediaWebContentsObserver* media_web_contents_observer() {
894 return media_web_contents_observer_.get();
895 }
qinmin58567c82015-01-07 21:00:20896
tapted65ff2ea72016-03-01 23:39:00897 // Update the web contents visibility.
Francois Doraye6161152018-03-27 22:05:37898 void UpdateWebContentsVisibility(Visibility visibility);
tapted65ff2ea72016-03-01 23:39:00899
paulmeyerc0b762b2016-04-13 11:55:17900 // Called by FindRequestManager when find replies come in from a renderer
901 // process.
902 void NotifyFindReply(int request_id,
903 int number_of_matches,
904 const gfx::Rect& selection_rect,
905 int active_match_ordinal,
906 bool final_update);
907
ortuno467e5792016-06-10 04:32:39908 // Modify the counter of connected devices for this WebContents.
909 void IncrementBluetoothConnectedDeviceCount();
910 void DecrementBluetoothConnectedDeviceCount();
911
mlamouri5cd9ae82017-02-18 11:05:09912 // Called when the WebContents gains or loses a persistent video.
zqzhang8ac49002017-03-16 21:51:35913 void SetHasPersistentVideo(bool has_persistent_video);
mlamouri5cd9ae82017-02-18 11:05:09914
mlamourie52c1b542017-02-23 14:57:50915 // Whether the WebContents has an active player is effectively fullscreen.
916 // That means that the video is either fullscreen or it is the content of
917 // a fullscreen page (in other words, a fullscreen video with custom
918 // controls).
919 // |IsFullscreen| must return |true| when this method is called.
920 bool HasActiveEffectivelyFullscreenVideo() const;
921
François Beaufortad6c5232018-02-26 11:00:44922 // Whether the WebContents effectively fullscreen active player allows
923 // Picture-in-Picture.
924 // |IsFullscreen| must return |true| when this method is called.
925 bool IsPictureInPictureAllowedForFullscreenVideo() const;
926
lfg1453e412017-04-11 00:48:50927 // When inner or outer WebContents are present, become the focused
928 // WebContentsImpl. This will activate this content's main frame RenderWidget
929 // and indirectly all its subframe widgets. GetFocusedRenderWidgetHost will
930 // search this WebContentsImpl for a focused RenderWidgetHost. The previously
931 // focused WebContentsImpl, if any, will have its RenderWidgetHosts
932 // deactivated.
933 void SetAsFocusedWebContentsIfNecessary();
934
paulmeyerfeafc2d2017-04-25 21:46:40935 // Called by this WebContents's BrowserPluginGuest (if one exists) to indicate
936 // that the guest will be detached.
937 void BrowserPluginGuestWillDetach();
938
paulmeyerc0b762b2016-04-13 11:55:17939#if defined(OS_ANDROID)
940 // Called by FindRequestManager when all of the find match rects are in.
941 void NotifyFindMatchRectsReply(int version,
942 const std::vector<gfx::RectF>& rects,
943 const gfx::RectF& active_rect);
944#endif
945
Guido Urdanetaf4008002018-05-03 10:43:04946 // Returns a base salt used to generate group IDs for media-device
947 // enumerations.
948 const std::string& GetMediaDeviceGroupIDSaltBase() const;
949
lof84501da082016-05-23 21:22:54950 private:
[email protected]8ff00d72012-10-23 19:12:21951 friend class WebContentsObserver;
952 friend class WebContents; // To implement factory methods.
[email protected]0dd3a0ab2011-02-18 08:17:44953
[email protected]2db9bd72012-04-13 20:20:56954 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, NoJSMessageOnInterstitials);
955 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, UpdateTitle);
[email protected]45a22ad2013-02-21 03:25:00956 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, FindOpenerRVHWhenPending);
[email protected]2db9bd72012-04-13 20:20:56957 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest,
958 CrossSiteCantPreemptAfterUnload);
nick5ae4d2d2017-01-06 01:18:35959 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, PendingContentsDestroyed);
960 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, PendingContentsShown);
[email protected]50904452013-05-09 02:05:12961 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, FrameTreeShape);
[email protected]9a890452014-02-13 22:21:02962 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, GetLastActiveTime);
estarka5635c42015-07-14 00:06:53963 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest,
964 LoadResourceFromMemoryCacheWithBadSecurityInfo);
jwwf4684d12015-09-02 06:12:52965 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest,
jam91dd24e2016-08-12 17:16:42966 LoadResourceWithEmptySecurityInfo);
avid53461d2016-02-25 17:15:04967 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest,
968 ResetJavaScriptDialogOnUserNavigate);
Megan Jablonski2f6a4c52017-07-10 23:01:25969 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, ParseDownloadHeaders);
[email protected]0dd3a0ab2011-02-18 08:17:44970 FRIEND_TEST_ALL_PREFIXES(FormStructureBrowserTest, HTMLFiles);
971 FRIEND_TEST_ALL_PREFIXES(NavigationControllerTest, HistoryNavigate);
[email protected]b0936d22013-11-28 06:47:36972 FRIEND_TEST_ALL_PREFIXES(RenderFrameHostManagerTest, PageDoesBackAndReload);
[email protected]de3c5d82014-05-28 22:12:59973 FRIEND_TEST_ALL_PREFIXES(SitePerProcessBrowserTest, CrossSiteIframe);
alexmosc2a8cec2016-05-23 22:19:53974 FRIEND_TEST_ALL_PREFIXES(SitePerProcessBrowserTest,
975 TwoSubframesCreatePopupsSimultaneously);
976 FRIEND_TEST_ALL_PREFIXES(SitePerProcessBrowserTest,
977 TwoSubframesCreatePopupMenuWidgetsSimultaneously);
dmazzoni0b5d2482014-09-10 19:45:57978 FRIEND_TEST_ALL_PREFIXES(SitePerProcessAccessibilityBrowserTest,
979 CrossSiteIframeAccessibility);
avic529387b2016-04-06 16:14:53980 FRIEND_TEST_ALL_PREFIXES(WebContentsImplBrowserTest,
981 JavaScriptDialogsInMainAndSubframes);
avi0720b02e2017-06-13 03:22:13982 FRIEND_TEST_ALL_PREFIXES(WebContentsImplBrowserTest,
983 DialogsFromJavaScriptEndFullscreen);
Avi Drissmanba3b1b342017-08-29 18:16:13984 FRIEND_TEST_ALL_PREFIXES(WebContentsImplBrowserTest,
985 PopupsFromJavaScriptEndFullscreen);
Avi Drissman36f801f2018-02-01 20:06:04986 FRIEND_TEST_ALL_PREFIXES(WebContentsImplBrowserTest,
987 FocusFromJavaScriptEndsFullscreen);
avi2d7d2c32017-03-15 21:55:02988 FRIEND_TEST_ALL_PREFIXES(RenderFrameHostImplBrowserTest,
989 IframeBeforeUnloadParentHang);
avi336125f72017-05-06 22:25:40990 FRIEND_TEST_ALL_PREFIXES(RenderFrameHostImplBrowserTest,
991 BeforeUnloadDialogRequiresGesture);
Charles Reis15d60b132017-11-03 17:43:47992 FRIEND_TEST_ALL_PREFIXES(RenderFrameHostImplBrowserTest,
993 CancelBeforeUnloadResetsURL);
Pavel Feldman3c1842b2017-08-02 05:00:16994 FRIEND_TEST_ALL_PREFIXES(DevToolsProtocolTest, JavaScriptDialogNotifications);
995 FRIEND_TEST_ALL_PREFIXES(DevToolsProtocolTest, JavaScriptDialogInterop);
996 FRIEND_TEST_ALL_PREFIXES(DevToolsProtocolTest, BeforeUnloadDialog);
Pavel Feldmanfab3cb62017-10-05 01:02:01997 FRIEND_TEST_ALL_PREFIXES(DevToolsProtocolTest, PageDisableWithOpenedDialog);
998 FRIEND_TEST_ALL_PREFIXES(DevToolsProtocolTest,
999 PageDisableWithNoDialogManager);
Nick Carterd73635b2018-03-13 18:31:411000 FRIEND_TEST_ALL_PREFIXES(PointerLockBrowserTest,
1001 PointerLockInnerContentsCrashes);
[email protected]0dd3a0ab2011-02-18 08:17:441002
paulmeyera41de3b2016-05-05 16:30:181003 // So |find_request_manager_| can be accessed for testing.
1004 friend class FindRequestManagerTest;
1005
[email protected]80e776ae2012-03-23 16:17:201006 // TODO(brettw) TestWebContents shouldn't exist!
[email protected]8ff00d72012-10-23 19:12:211007 friend class TestWebContents;
[email protected]0dd3a0ab2011-02-18 08:17:441008
[email protected]7fff43e2013-05-21 20:21:101009 class DestructionObserver;
1010
lazyboy6ec48b2a2015-06-29 15:18:141011 // Represents a WebContents node in a tree of WebContents structure.
1012 //
1013 // Two WebContents with separate FrameTrees can be connected by
1014 // outer/inner relationship using this class. Note that their FrameTrees
1015 // still remain disjoint.
1016 // The parent is referred to as "outer WebContents" and the descendents are
1017 // referred to as "inner WebContents".
1018 // For each inner WebContents, the outer WebContents will have a
1019 // corresponding FrameTreeNode.
lfga3e2bdc2017-03-07 20:44:011020 class WebContentsTreeNode final : public FrameTreeNode::Observer {
lazyboy6ec48b2a2015-06-29 15:18:141021 public:
lfg601233692017-03-06 22:45:441022 explicit WebContentsTreeNode(WebContentsImpl* current_web_contents);
lfga3e2bdc2017-03-07 20:44:011023 ~WebContentsTreeNode() final;
lazyboy6ec48b2a2015-06-29 15:18:141024
lazyboy6ec48b2a2015-06-29 15:18:141025 void ConnectToOuterWebContents(WebContentsImpl* outer_web_contents,
1026 RenderFrameHostImpl* outer_contents_frame);
1027
lfg601233692017-03-06 22:45:441028 WebContentsImpl* outer_web_contents() const { return outer_web_contents_; }
avallee0206f782016-07-28 18:55:331029 int outer_contents_frame_tree_node_id() const {
lazyboy6ec48b2a2015-06-29 15:18:141030 return outer_contents_frame_tree_node_id_;
1031 }
lfga3e2bdc2017-03-07 20:44:011032 FrameTreeNode* OuterContentsFrameTreeNode() const;
lazyboy6ec48b2a2015-06-29 15:18:141033
avallee0206f782016-07-28 18:55:331034 WebContentsImpl* focused_web_contents() { return focused_web_contents_; }
1035 void SetFocusedWebContents(WebContentsImpl* web_contents);
1036
paulmeyerfeafc2d2017-04-25 21:46:401037 // Returns the inner WebContents within |frame|, if one exists, or nullptr
1038 // otherwise.
1039 WebContentsImpl* GetInnerWebContentsInFrame(const FrameTreeNode* frame);
1040
1041 const std::vector<WebContentsImpl*>& inner_web_contents() const;
1042
lazyboy6ec48b2a2015-06-29 15:18:141043 private:
paulmeyerfeafc2d2017-04-25 21:46:401044 void AttachInnerWebContents(WebContentsImpl* inner_web_contents);
1045 void DetachInnerWebContents(WebContentsImpl* inner_web_contents);
1046
lfga3e2bdc2017-03-07 20:44:011047 // FrameTreeNode::Observer implementation.
1048 void OnFrameTreeNodeDestroyed(FrameTreeNode* node) final;
lfg601233692017-03-06 22:45:441049
1050 // The WebContents that owns this WebContentsTreeNode.
1051 WebContentsImpl* const current_web_contents_;
1052
1053 // The outer WebContents of |current_web_contents_|, or nullptr if
1054 // |current_web_contents_| is the outermost WebContents.
lazyboy6ec48b2a2015-06-29 15:18:141055 WebContentsImpl* outer_web_contents_;
lfg601233692017-03-06 22:45:441056
1057 // The ID of the FrameTreeNode in the |outer_web_contents_| that hosts
1058 // |current_web_contents_| as an inner WebContents.
lazyboy6ec48b2a2015-06-29 15:18:141059 int outer_contents_frame_tree_node_id_;
lfg601233692017-03-06 22:45:441060
paulmeyerfeafc2d2017-04-25 21:46:401061 // List of inner WebContents that we host.
1062 std::vector<WebContentsImpl*> inner_web_contents_;
1063
avallee0206f782016-07-28 18:55:331064 // Only the root node should have this set. This indicates the WebContents
1065 // whose frame tree has the focused frame. The WebContents tree could be
1066 // arbitrarily deep.
1067 WebContentsImpl* focused_web_contents_;
lazyboy6ec48b2a2015-06-29 15:18:141068 };
1069
[email protected]d1198fd2012-08-13 22:50:191070 // See WebContents::Create for a description of these parameters.
Lukasz Anforowicze9ae3722017-09-29 17:37:381071 explicit WebContentsImpl(BrowserContext* browser_context);
[email protected]d1198fd2012-08-13 22:50:191072
[email protected]e2225bf2013-11-15 16:09:381073 // Add and remove observers for page navigation notifications. The order in
1074 // which notifications are sent to observers is undefined. Clients must be
1075 // sure to remove the observer before they go away.
[email protected]8ff00d72012-10-23 19:12:211076 void AddObserver(WebContentsObserver* observer);
1077 void RemoveObserver(WebContentsObserver* observer);
[email protected]d1198fd2012-08-13 22:50:191078
alexmose201c7cd2015-06-10 17:14:211079 // Clears a pending contents that has been closed before being shown.
[email protected]7fff43e2013-05-21 20:21:101080 void OnWebContentsDestroyed(WebContentsImpl* web_contents);
1081
1082 // Creates and adds to the map a destruction observer watching |web_contents|.
1083 // No-op if such an observer already exists.
1084 void AddDestructionObserver(WebContentsImpl* web_contents);
1085
1086 // Deletes and removes from the map a destruction observer
1087 // watching |web_contents|. No-op if there is no such observer.
1088 void RemoveDestructionObserver(WebContentsImpl* web_contents);
[email protected]14392a52012-05-02 20:28:441089
[email protected]de3c5d82014-05-28 22:12:591090 // Traverses all the RenderFrameHosts in the FrameTree and creates a set
[email protected]948481d2014-06-11 18:32:221091 // all the unique RenderWidgetHostViews.
1092 std::set<RenderWidgetHostView*> GetRenderWidgetHostViewsInTree();
[email protected]de3c5d82014-05-28 22:12:591093
pkotwicz75ca8ffd2016-02-16 23:10:191094 // Called with the result of a DownloadImage() request.
Avi Drissmana5a52dd2018-03-27 03:39:021095 void OnDidDownloadImage(ImageDownloadCallback callback,
pkotwicz75ca8ffd2016-02-16 23:10:191096 int id,
1097 const GURL& image_url,
leon.hancbc4bc3c2016-02-26 07:08:521098 int32_t http_status_code,
leon.hanc2228532016-08-16 05:59:181099 const std::vector<SkBitmap>& images,
1100 const std::vector<gfx::Size>& original_image_sizes);
pkotwicz75ca8ffd2016-02-16 23:10:191101
Pavel Feldman3c1842b2017-08-02 05:00:161102 // Callback function when showing JavaScript dialogs. Takes in a routing ID
[email protected]6fba26d2014-04-29 09:38:281103 // pair to identify the RenderFrameHost that opened the dialog, because it's
1104 // possible for the RenderFrameHost to be deleted by the time this is called.
1105 void OnDialogClosed(int render_process_id,
1106 int render_frame_id,
[email protected]51da7e32012-01-30 19:24:521107 IPC::Message* reply_msg,
[email protected]87de04b02014-04-08 22:14:491108 bool dialog_was_suppressed,
[email protected]51da7e32012-01-30 19:24:521109 bool success,
[email protected]fcf75d42013-12-03 20:11:261110 const base::string16& user_input);
[email protected]51da7e32012-01-30 19:24:521111
[email protected]d0759f492012-04-19 22:50:501112 // IPC message handlers.
nicka0ac8382016-12-15 23:59:231113 void OnThemeColorChanged(RenderFrameHostImpl* source, SkColor theme_color);
1114 void OnDidLoadResourceFromMemoryCache(RenderFrameHostImpl* source,
1115 const GURL& url,
[email protected]70435962011-08-02 20:13:281116 const std::string& http_request,
[email protected]6d6cfb3a2012-05-23 22:53:181117 const std::string& mime_type,
[email protected]6c1e05212014-07-31 00:59:401118 ResourceType resource_type);
nicka0ac8382016-12-15 23:59:231119 void OnDidDisplayInsecureContent(RenderFrameHostImpl* source);
elawrenceb2ac2a232017-03-27 21:46:251120 void OnDidContainInsecureFormAction(RenderFrameHostImpl* source);
nicka0ac8382016-12-15 23:59:231121 void OnDidRunInsecureContent(RenderFrameHostImpl* source,
1122 const GURL& security_origin,
[email protected]0dd3a0ab2011-02-18 08:17:441123 const GURL& target_url);
Zhuoyu Qian4353f7f2018-01-08 05:33:001124 void OnDidDisplayContentWithCertificateErrors(RenderFrameHostImpl* source);
1125 void OnDidRunContentWithCertificateErrors(RenderFrameHostImpl* source);
nicka0ac8382016-12-15 23:59:231126 void OnDocumentLoadedInFrame(RenderFrameHostImpl* source);
1127 void OnDidFinishLoad(RenderFrameHostImpl* source, const GURL& url);
1128 void OnGoToEntryAtOffset(RenderViewHostImpl* source, int offset);
1129 void OnUpdateZoomLimits(RenderViewHostImpl* source,
1130 int minimum_percent,
[email protected]fce823222014-05-30 16:24:301131 int maximum_percent);
nicka0ac8382016-12-15 23:59:231132 void OnPageScaleFactorChanged(RenderViewHostImpl* source,
1133 float page_scale_factor);
1134 void OnEnumerateDirectory(RenderViewHostImpl* source,
1135 int request_id,
1136 const base::FilePath& path);
[email protected]b7a756d42012-01-23 18:08:171137
nicka0ac8382016-12-15 23:59:231138 void OnRegisterProtocolHandler(RenderFrameHostImpl* source,
1139 const std::string& protocol,
[email protected]7d189022011-08-25 22:54:201140 const GURL& url,
[email protected]fcf75d42013-12-03 20:11:261141 const base::string16& title,
[email protected]3a3b75a2012-06-01 08:38:361142 bool user_gesture);
nicka0ac8382016-12-15 23:59:231143 void OnUnregisterProtocolHandler(RenderFrameHostImpl* source,
1144 const std::string& protocol,
[email protected]f5273e52014-07-14 16:30:201145 const GURL& url,
1146 bool user_gesture);
nicka0ac8382016-12-15 23:59:231147 void OnFindReply(RenderFrameHostImpl* source,
1148 int request_id,
[email protected]59363fc92012-09-05 03:46:311149 int number_of_matches,
1150 const gfx::Rect& selection_rect,
1151 int active_match_ordinal,
[email protected]b888919c2011-09-02 00:32:161152 bool final_update);
mfomitchev2b8b066a2016-01-28 19:23:151153#if defined(OS_ANDROID)
nicka0ac8382016-12-15 23:59:231154 void OnFindMatchRectsReply(RenderFrameHostImpl* source,
1155 int version,
[email protected]59363fc92012-09-05 03:46:311156 const std::vector<gfx::RectF>& rects,
1157 const gfx::RectF& active_rect);
nicka0ac8382016-12-15 23:59:231158 void OnGetNearestFindResultReply(RenderFrameHostImpl* source,
1159 int request_id,
1160 float distance);
[email protected]1ff427972013-02-07 21:14:071161 void OnOpenDateTimeDialog(
nicka0ac8382016-12-15 23:59:231162 RenderViewHostImpl* source,
[email protected]1ff427972013-02-07 21:14:071163 const ViewHostMsg_DateTimeDialogValue_Params& value);
[email protected]59363fc92012-09-05 03:46:311164#endif
nicka0ac8382016-12-15 23:59:231165 void OnDomOperationResponse(RenderFrameHostImpl* source,
1166 const std::string& json_string);
1167 void OnAppCacheAccessed(RenderViewHostImpl* source,
1168 const GURL& manifest_url,
1169 bool blocked_by_policy);
nicka0ac8382016-12-15 23:59:231170 void OnUpdatePageImportanceSignals(RenderFrameHostImpl* source,
1171 const PageImportanceSignals& signals);
brettw4b461082016-11-19 18:55:161172#if BUILDFLAG(ENABLE_PLUGINS)
nicka0ac8382016-12-15 23:59:231173 void OnPepperInstanceCreated(RenderFrameHostImpl* source,
1174 int32_t pp_instance);
1175 void OnPepperInstanceDeleted(RenderFrameHostImpl* source,
1176 int32_t pp_instance);
1177 void OnPepperPluginHung(RenderFrameHostImpl* source,
1178 int plugin_child_id,
tommyclie6633ca72014-10-31 00:40:421179 const base::FilePath& path,
1180 bool is_hung);
nicka0ac8382016-12-15 23:59:231181 void OnPepperStartsPlayback(RenderFrameHostImpl* source, int32_t pp_instance);
1182 void OnPepperStopsPlayback(RenderFrameHostImpl* source, int32_t pp_instance);
1183 void OnPluginCrashed(RenderFrameHostImpl* source,
1184 const base::FilePath& plugin_path,
tommyclie6633ca72014-10-31 00:40:421185 base::ProcessId plugin_pid);
nicka0ac8382016-12-15 23:59:231186 void OnRequestPpapiBrokerPermission(RenderViewHostImpl* source,
1187 int ppb_broker_route_id,
[email protected]d8415ad92012-08-23 14:40:501188 const GURL& url,
[email protected]2dec8ec2013-02-07 19:20:341189 const base::FilePath& plugin_path);
tommyclie6633ca72014-10-31 00:40:421190
1191 // Callback function when requesting permission to access the PPAPI broker.
1192 // |result| is true if permission was granted.
nicka0ac8382016-12-15 23:59:231193 void SendPpapiBrokerPermissionResult(int process_id,
1194 int ppb_broker_route_id,
1195 bool result);
tommyclie6633ca72014-10-31 00:40:421196
fsamuel833ee7c2015-02-13 23:40:401197 void OnBrowserPluginMessage(RenderFrameHost* render_frame_host,
1198 const IPC::Message& message);
brettw4b461082016-11-19 18:55:161199#endif // BUILDFLAG(ENABLE_PLUGINS)
lukasza178ff092017-06-07 23:39:501200 void OnUpdateFaviconURL(RenderFrameHostImpl* source,
nicka0ac8382016-12-15 23:59:231201 const std::vector<FaviconURL>& candidates);
1202 void OnFirstVisuallyNonEmptyPaint(RenderViewHostImpl* source);
1203 void OnShowValidationMessage(RenderViewHostImpl* source,
1204 const gfx::Rect& anchor_in_root_view,
[email protected]6ff9c8f2013-12-20 09:05:291205 const base::string16& main_text,
1206 const base::string16& sub_text);
nicka0ac8382016-12-15 23:59:231207 void OnHideValidationMessage(RenderViewHostImpl* source);
1208 void OnMoveValidationMessage(RenderViewHostImpl* source,
1209 const gfx::Rect& anchor_in_root_view);
[email protected]edc3af82013-12-12 21:24:071210
[email protected]0dd3a0ab2011-02-18 08:17:441211 // Called by derived classes to indicate that we're no longer waiting for a
Evan Stade5e750ad02017-08-07 21:59:271212 // response. Will inform |delegate_| of the change in status so that it may,
1213 // for example, update the throbber.
1214 void SetNotWaitingForResponse();
[email protected]0dd3a0ab2011-02-18 08:17:441215
avallee9993fca2016-11-17 06:16:501216 // Inner WebContents Helpers -------------------------------------------------
1217 //
1218 // These functions are helpers in managing a hierarchy of WebContents
1219 // involved in rendering inner WebContents.
1220
1221 // When multiple WebContents are present within a tab or window, a single one
1222 // is focused and will route keyboard events in most cases to a RenderWidget
1223 // contained within it. |GetFocusedWebContents()|'s main frame widget will
1224 // receive page focus and blur events when the containing window changes focus
1225 // state.
1226
avallee9993fca2016-11-17 06:16:501227 // Returns true if |this| is the focused WebContents or an ancestor of the
1228 // focused WebContents.
1229 bool ContainsOrIsFocusedWebContents();
1230
avallee0206f782016-07-28 18:55:331231 // Returns the root of the WebContents tree.
1232 WebContentsImpl* GetOutermostWebContents();
1233
avalleed68cdd12017-06-21 22:07:271234 // Walks up the outer WebContents chain and focuses the FrameTreeNode where
1235 // each inner WebContents is attached.
1236 void FocusOuterAttachmentFrameChain();
1237
[email protected]0dd3a0ab2011-02-18 08:17:441238 // Navigation helpers --------------------------------------------------------
1239 //
1240 // These functions are helpers for Navigate() and DidNavigate().
1241
1242 // Handles post-navigation tasks in DidNavigate AFTER the entry has been
1243 // committed to the navigation controller. Note that the navigation entry is
1244 // not provided since it may be invalid/changed after being committed. The
1245 // current navigation entry is in the NavigationController at this point.
[email protected]2f7b3c5a2013-06-21 04:59:251246
[email protected]bafe6cd2012-05-23 23:09:501247 // Helper for CreateNewWidget/CreateNewFullscreenWidget.
avib7348942015-12-25 20:57:101248 void CreateNewWidget(int32_t render_process_id,
1249 int32_t route_id,
[email protected]bafe6cd2012-05-23 23:09:501250 bool is_fullscreen,
Dave Tapuska1bdf1832017-07-07 18:07:191251 mojom::WidgetPtr widget,
[email protected]180ef242013-11-07 06:50:461252 blink::WebPopupType popup_type);
[email protected]bafe6cd2012-05-23 23:09:501253
1254 // Helper for ShowCreatedWidget/ShowCreatedFullscreenWidget.
alexmosc2a8cec2016-05-23 22:19:531255 void ShowCreatedWidget(int process_id,
1256 int route_id,
[email protected]bafe6cd2012-05-23 23:09:501257 bool is_fullscreen,
bokan107a47f2015-02-03 23:23:391258 const gfx::Rect& initial_rect);
[email protected]bafe6cd2012-05-23 23:09:501259
1260 // Finds the new RenderWidgetHost and returns it. Note that this can only be
1261 // called once as this call also removes it from the internal map.
alexmosc2a8cec2016-05-23 22:19:531262 RenderWidgetHostView* GetCreatedWidget(int process_id, int route_id);
[email protected]bafe6cd2012-05-23 23:09:501263
nick5ae4d2d2017-01-06 01:18:351264 // Finds the new WebContentsImpl by |main_frame_widget_route_id|, initializes
1265 // it for renderer-initiated creation, and returns it. Note that this can only
1266 // be called once as this call also removes it from the internal map.
erikchenbee5c9622018-04-27 19:30:251267 std::unique_ptr<WebContents> GetCreatedWindow(int process_id,
1268 int main_frame_widget_route_id);
[email protected]bafe6cd2012-05-23 23:09:501269
lfgdb5c4ed2016-03-04 23:09:071270 // Sends a Page message IPC.
1271 void SendPageMessage(IPC::Message* msg);
1272
lukasza6f8ac622017-06-06 03:10:201273 void SetOpenerForNewContents(FrameTreeNode* opener, bool opener_suppressed);
1274
[email protected]960b0372014-05-19 18:01:001275 // Tracking loading progress -------------------------------------------------
1276
fdegansa696e5112015-04-17 01:57:591277 // Resets the tracking state of the current load progress.
[email protected]960b0372014-05-19 18:01:001278 void ResetLoadProgressState();
1279
fdegansa696e5112015-04-17 01:57:591280 // Notifies the delegate that the load progress was updated.
1281 void SendChangeLoadProgress();
[email protected]960b0372014-05-19 18:01:001282
clamy44e84ce2016-02-22 15:38:251283 // Notifies the delegate of a change in loading state.
1284 // |details| is used to provide details on the load that just finished
1285 // (but can be null if not applicable).
1286 // |due_to_interstitial| is true if the change in load state occurred because
1287 // an interstitial page started showing/proceeded.
1288 void LoadingStateChanged(bool to_different_document,
1289 bool due_to_interstitial,
1290 LoadNotificationDetails* details);
1291
[email protected]0dd3a0ab2011-02-18 08:17:441292 // Misc non-view stuff -------------------------------------------------------
1293
avi2b177592014-12-10 02:08:021294 // Sets the history for a specified RenderViewHost to |history_length|
1295 // entries, with an offset of |history_offset|.
1296 void SetHistoryOffsetAndLengthForView(RenderViewHost* render_view_host,
1297 int history_offset,
1298 int history_length);
1299
[email protected]0dd3a0ab2011-02-18 08:17:441300 // Helper functions for sending notifications.
[email protected]02d7b6e2014-06-24 21:01:501301 void NotifyViewSwapped(RenderViewHost* old_host, RenderViewHost* new_host);
1302 void NotifyFrameSwapped(RenderFrameHost* old_host, RenderFrameHost* new_host);
[email protected]0dd3a0ab2011-02-18 08:17:441303 void NotifyDisconnected();
1304
[email protected]be1f56ab2011-12-22 06:55:311305 void SetEncoding(const std::string& encoding);
1306
[email protected]fa944cb82013-11-15 17:51:211307 // TODO(creis): This should take in a FrameTreeNode to know which node's
1308 // render manager to return. For now, we just return the root's.
[email protected]b0936d22013-11-28 06:47:361309 RenderFrameHostManager* GetRenderManager() const;
[email protected]fa944cb82013-11-15 17:51:211310
[email protected]7a846df2012-09-20 19:17:391311 // Removes browser plugin embedder if there is one.
1312 void RemoveBrowserPluginEmbedder();
1313
[email protected]dc0fd432013-08-27 15:29:211314 // Helper function to invoke WebContentsDelegate::GetSizeForNewRenderView().
Jianzhou Fengd8720c72018-01-18 03:06:301315 gfx::Size GetSizeForNewRenderView(bool is_main_frame);
[email protected]dc0fd432013-08-27 15:29:211316
[email protected]ae7eeda2014-07-04 01:53:261317 void OnFrameRemoved(RenderFrameHost* render_frame_host);
[email protected]9b159a52013-10-03 17:24:551318
[email protected]222f5822014-02-05 23:40:491319 // Helper method that's called whenever |preferred_size_| or
1320 // |preferred_size_for_capture_| changes, to propagate the new value to the
1321 // |delegate_|.
1322 void OnPreferredSizeChanged(const gfx::Size& old_size);
1323
Daniel Cheng90196c82018-04-25 21:49:141324 void OnUserInteraction(const blink::WebInputEvent::Type type);
1325
dbeama1b926a2015-08-31 23:17:511326 // Internal helper to create WebUI objects associated with |this|. |url| is
Dan Beam055fe8f2017-10-04 23:23:361327 // used to determine which WebUI should be created (if any).
1328 std::unique_ptr<WebUIImpl> CreateWebUI(const GURL& url);
dbeama1b926a2015-08-31 23:17:511329
avid53461d2016-02-25 17:15:041330 void SetJavaScriptDialogManagerForTesting(
1331 JavaScriptDialogManager* dialog_manager);
1332
paulmeyerfeafc2d2017-04-25 21:46:401333 // Returns the FindRequestManager, which may be found in an outer WebContents.
1334 FindRequestManager* GetFindRequestManager();
1335
1336 // Returns the FindRequestManager, or creates one if it doesn't already
1337 // exist. The FindRequestManager may be found in an outer WebContents.
paulmeyerc0b762b2016-04-13 11:55:171338 FindRequestManager* GetOrCreateFindRequestManager();
1339
rockotf62002a2016-09-15 00:08:591340 // Removes a registered WebContentsBindingSet by interface name.
1341 void RemoveBindingSet(const std::string& interface_name);
1342
falken52a56e32016-12-08 05:02:401343 // Prints a console warning when visiting a localhost site with a bad
1344 // certificate via --allow-insecure-localhost.
1345 void ShowInsecureLocalhostWarningIfNeeded();
1346
Megan Jablonski2f6a4c52017-07-10 23:01:251347 // Format of |headers| is a new line separated list of key value pairs:
1348 // "<key1>: <value1>\r\n<key2>: <value2>".
Min Qina904f3302018-02-13 23:33:341349 static download::DownloadUrlParameters::RequestHeadersType
1350 ParseDownloadHeaders(const std::string& headers);
Megan Jablonski2f6a4c52017-07-10 23:01:251351
EhsanK2075c7e2017-08-21 02:42:391352 // Sets the visibility of immediate child views, i.e. views whose parent view
1353 // is that of the main frame.
1354 void SetVisibilityForChildViews(bool visible);
1355
Lucas Furukawa Gadaniaed1fed2017-10-13 17:34:141356 // Reattaches this inner WebContents to its outer WebContents.
1357 void ReattachToOuterWebContentsFrame();
1358
Lukasz Anforowiczfd707142018-02-07 19:46:131359 // A helper for clearing the link status bubble after navigating away.
1360 // See also UpdateTargetURL.
1361 void ClearTargetURL();
1362
Avi Drissman1e620f32018-03-16 13:57:291363 class AXTreeSnapshotCombiner;
1364 void RecursiveRequestAXTreeSnapshotOnFrame(FrameTreeNode* root_node,
1365 AXTreeSnapshotCombiner* combiner,
1366 ui::AXMode ax_mode);
1367
[email protected]0dd3a0ab2011-02-18 08:17:441368 // Data for core operation ---------------------------------------------------
1369
1370 // Delegate for notifying our owner about stuff. Not owned by us.
[email protected]8ff00d72012-10-23 19:12:211371 WebContentsDelegate* delegate_;
[email protected]0dd3a0ab2011-02-18 08:17:441372
1373 // Handles the back/forward list and loading.
[email protected]d202a7c2012-01-04 07:53:471374 NavigationControllerImpl controller_;
[email protected]0dd3a0ab2011-02-18 08:17:441375
1376 // The corresponding view.
dcheng59716272016-04-09 05:19:081377 std::unique_ptr<WebContentsView> view_;
[email protected]0dd3a0ab2011-02-18 08:17:441378
[email protected]5a3bdf52012-05-24 15:12:571379 // The view of the RVHD. Usually this is our WebContentsView implementation,
1380 // but if an embedder uses a different WebContentsView, they'll need to
1381 // provide this.
[email protected]8ff00d72012-10-23 19:12:211382 RenderViewHostDelegateView* render_view_host_delegate_view_;
[email protected]5a3bdf52012-05-24 15:12:571383
[email protected]bafe6cd2012-05-23 23:09:501384 // Tracks created WebContentsImpl objects that have not been shown yet. They
alexmosc2a8cec2016-05-23 22:19:531385 // are identified by the process ID and routing ID passed to CreateNewWindow.
1386 typedef std::pair<int, int> ProcessRoutingIdPair;
erikchenbee5c9622018-04-27 19:30:251387 std::map<ProcessRoutingIdPair, std::unique_ptr<WebContents>>
1388 pending_contents_;
[email protected]bafe6cd2012-05-23 23:09:501389
alexmosc2a8cec2016-05-23 22:19:531390 // This map holds widgets that were created on behalf of the renderer but
1391 // haven't been shown yet.
1392 std::map<ProcessRoutingIdPair, RenderWidgetHostView*> pending_widget_views_;
[email protected]bafe6cd2012-05-23 23:09:501393
avia8cf81982016-08-12 20:28:461394 std::map<WebContentsImpl*, std::unique_ptr<DestructionObserver>>
1395 destruction_observers_;
[email protected]7fff43e2013-05-21 20:21:101396
[email protected]996042972011-11-08 22:43:591397 // A list of observers notified when page state changes. Weak references.
[email protected]fa944cb82013-11-15 17:51:211398 // This MUST be listed above frame_tree_ since at destruction time the
[email protected]996042972011-11-08 22:43:591399 // latter might cause RenderViewHost's destructor to call us and we might use
1400 // the observer list then.
brettw236d3172015-06-03 16:31:431401 base::ObserverList<WebContentsObserver> observers_;
[email protected]996042972011-11-08 22:43:591402
rockotf62002a2016-09-15 00:08:591403 // Associated interface binding sets attached to this WebContents.
1404 std::map<std::string, WebContentsBindingSet*> binding_sets_;
1405
[email protected]c7c0d822014-04-16 20:19:491406 // True if this tab was opened by another tab. This is not unset if the opener
1407 // is closed.
1408 bool created_with_opener_;
1409
[email protected]0dd3a0ab2011-02-18 08:17:441410 // Helper classes ------------------------------------------------------------
1411
[email protected]fa944cb82013-11-15 17:51:211412 // Manages the frame tree of the page and process swaps in each node.
[email protected]9b159a52013-10-03 17:24:551413 FrameTree frame_tree_;
1414
lfg601233692017-03-06 22:45:441415 // Contains information about the WebContents tree structure.
1416 WebContentsTreeNode node_;
lazyboy6ec48b2a2015-06-29 15:18:141417
[email protected]c7dd2f62011-07-18 15:57:591418 // SavePackage, lazily created.
1419 scoped_refptr<SavePackage> save_package_;
1420
paulmeyerc8cb7cb2016-06-07 01:14:191421 // Manages/coordinates multi-process find-in-page requests. Created lazily.
dcheng18ec0b542016-04-26 19:28:531422 std::unique_ptr<FindRequestManager> find_request_manager_;
paulmeyerc0b762b2016-04-13 11:55:171423
[email protected]0dd3a0ab2011-02-18 08:17:441424 // Data for loading state ----------------------------------------------------
1425
[email protected]6dfed692014-05-22 04:18:031426 // Indicates whether the current load is to a different document. Only valid
Evan Stadec3b26022017-07-14 19:50:241427 // if |is_loading_| is true and only tracks loads in the main frame.
[email protected]6dfed692014-05-22 04:18:031428 bool is_load_to_different_document_;
1429
[email protected]0dd3a0ab2011-02-18 08:17:441430 // Indicates if the tab is considered crashed.
1431 base::TerminationStatus crashed_status_;
1432 int crashed_error_code_;
1433
[email protected]ca13a442012-04-17 14:00:121434 // Whether this WebContents is waiting for a first-response for the
[email protected]be1f56ab2011-12-22 06:55:311435 // main resource of the page. This controls whether the throbber state is
1436 // "waiting" or "loading."
[email protected]0dd3a0ab2011-02-18 08:17:441437 bool waiting_for_response_;
1438
[email protected]0dd3a0ab2011-02-18 08:17:441439 // The current load state and the URL associated with it.
[email protected]9c235f042011-08-10 22:28:211440 net::LoadStateWithParam load_state_;
[email protected]fcf75d42013-12-03 20:11:261441 base::string16 load_state_host_;
[email protected]960b0372014-05-19 18:01:001442
[email protected]960b0372014-05-19 18:01:001443 base::TimeTicks loading_last_progress_update_;
1444
[email protected]0dd3a0ab2011-02-18 08:17:441445 // Upload progress, for displaying in the status bar.
1446 // Set to zero when there is no significant upload happening.
avib7348942015-12-25 20:57:101447 uint64_t upload_size_;
1448 uint64_t upload_position_;
[email protected]0dd3a0ab2011-02-18 08:17:441449
dfalcantarae6b7b46752015-07-10 18:14:161450 // Tracks that this WebContents needs to unblock requests to the renderer.
1451 // See ResumeLoadingCreatedWebContents.
1452 bool is_resume_pending_;
1453
creisadca9862017-06-16 19:12:111454 // The interstitial page currently shown, if any. Not owned by this class: the
1455 // InterstitialPage is self-owned and deletes itself asynchronously when
1456 // hidden. Because it may outlive this WebContents, it enters a disabled state
1457 // when hidden or preparing for destruction.
1458 InterstitialPageImpl* interstitial_page_;
1459
[email protected]0dd3a0ab2011-02-18 08:17:441460 // Data for current page -----------------------------------------------------
1461
[email protected]987fc3a2011-05-26 14:18:091462 // When a title cannot be taken from any entry, this title will be used.
[email protected]fcf75d42013-12-03 20:11:261463 base::string16 page_title_when_no_navigation_entry_;
[email protected]987fc3a2011-05-26 14:18:091464
[email protected]0dd3a0ab2011-02-18 08:17:441465 // When a navigation occurs, we record its contents MIME type. It can be
1466 // used to check whether we can do something for some special contents.
1467 std::string contents_mime_type_;
1468
[email protected]ef3adfc2014-05-11 00:04:541469 // The last reported character encoding, not canonicalized.
1470 std::string last_reported_encoding_;
1471
1472 // The canonicalized character encoding.
1473 std::string canonical_encoding_;
[email protected]0dd3a0ab2011-02-18 08:17:441474
[email protected]b4c84012014-04-28 19:51:101475 // Whether the initial empty page has been accessed by another page, making it
1476 // unsafe to show the pending URL. Usually false unless another window tries
1477 // to modify the blank page. Always false after the first commit.
1478 bool has_accessed_initial_document_;
1479
yusufod41c5f92015-03-06 00:14:281480 // The theme color for the underlying document as specified
1481 // by theme-color meta tag.
1482 SkColor theme_color_;
1483
1484 // The last published theme color.
1485 SkColor last_sent_theme_color_;
1486
peter90afaba2015-06-01 12:05:291487 // Whether the first visually non-empty paint has occurred.
1488 bool did_first_visually_non_empty_paint_;
1489
[email protected]0dd3a0ab2011-02-18 08:17:441490 // Data for misc internal state ----------------------------------------------
1491
[email protected]54597982013-02-06 01:59:551492 // When > 0, the WebContents is currently being captured (e.g., for
1493 // screenshots or mirroring); and the underlying RenderWidgetHost should not
1494 // be told it is hidden.
1495 int capturer_count_;
1496
Francois Doraye6161152018-03-27 22:05:371497 // The visibility of the WebContents. Initialized from
1498 // |CreateParams::initially_hidden|. Updated from
1499 // UpdateWebContentsVisibility(), WasShown(), WasHidden(), WasOccluded().
1500 Visibility visibility_ = Visibility::VISIBLE;
[email protected]0dd3a0ab2011-02-18 08:17:441501
Francois Doraye6161152018-03-27 22:05:371502 // Whether there has been a call to UpdateWebContentsVisibility(VISIBLE).
1503 bool did_first_set_visible_ = false;
tapted65ff2ea72016-03-01 23:39:001504
[email protected]0dd3a0ab2011-02-18 08:17:441505 // See getter above.
1506 bool is_being_destroyed_;
1507
creis97867aa2017-02-17 18:39:451508 // Keep track of whether this WebContents is currently iterating over its list
1509 // of observers, during which time it should not be deleted.
1510 bool is_notifying_observers_;
1511
[email protected]0dd3a0ab2011-02-18 08:17:441512 // Indicates whether we should notify about disconnection of this
[email protected]b172aee2012-04-10 17:05:261513 // WebContentsImpl. This is used to ensure disconnection notifications only
[email protected]0dd3a0ab2011-02-18 08:17:441514 // happen if a connection notification has happened and that they happen only
1515 // once.
1516 bool notify_disconnection_;
1517
[email protected]71a88bb2013-02-01 22:05:151518 // Pointer to the JavaScript dialog manager, lazily assigned. Used because the
[email protected]b172aee2012-04-10 17:05:261519 // delegate of this WebContentsImpl is nulled before its destructor is called.
[email protected]71a88bb2013-02-01 22:05:151520 JavaScriptDialogManager* dialog_manager_;
[email protected]2e5b90c2011-08-16 21:11:551521
avi85ee8362016-10-08 02:09:081522 // Set to true when there is an active JavaScript dialog showing.
1523 bool is_showing_javascript_dialog_ = false;
1524
[email protected]0dd3a0ab2011-02-18 08:17:441525 // Set to true when there is an active "before unload" dialog. When true,
1526 // we've forced the throbber to start in Navigate, and we need to remember to
1527 // turn it off in OnJavaScriptMessageBoxClosed if the navigation is canceled.
1528 bool is_showing_before_unload_dialog_;
1529
[email protected]0dd3a0ab2011-02-18 08:17:441530 // Settings that get passed to the renderer process.
[email protected]8ff00d72012-10-23 19:12:211531 RendererPreferences renderer_preferences_;
[email protected]0dd3a0ab2011-02-18 08:17:441532
[email protected]9a890452014-02-13 22:21:021533 // The time that this WebContents was last made active. The initial value is
1534 // the WebContents creation time.
gab0dccfef2015-05-20 18:43:391535 base::TimeTicks last_active_time_;
[email protected]0dd3a0ab2011-02-18 08:17:441536
Daniel Cheng90196c82018-04-25 21:49:141537 // The time that this WebContents last received an 'interactive' input event
1538 // from the user. Interactive input events are things like mouse clicks and
1539 // keyboard input, but not mouse wheel scrolling or mouse moves.
1540 base::TimeTicks last_interactive_input_event_time_;
1541
[email protected]0dd3a0ab2011-02-18 08:17:441542 // See description above setter.
1543 bool closed_by_user_gesture_;
1544
1545 // Minimum/maximum zoom percent.
1546 int minimum_zoom_percent_;
1547 int maximum_zoom_percent_;
[email protected]0dd3a0ab2011-02-18 08:17:441548
w.shackleton49bcd392016-01-06 17:38:221549 // Used to correctly handle integer zooming through a smooth scroll device.
1550 float zoom_scroll_remainder_;
1551
[email protected]bcd2815602012-01-14 18:17:231552 // The intrinsic size of the page.
1553 gfx::Size preferred_size_;
1554
[email protected]222f5822014-02-05 23:40:491555 // The preferred size for content screen capture. When |capturer_count_| > 0,
1556 // this overrides |preferred_size_|.
1557 gfx::Size preferred_size_for_capture_;
1558
kenrbe4f91082017-06-02 20:32:081559 // Size set by a top-level frame with auto-resize enabled. This is needed by
1560 // out-of-process iframes for their visible viewport size.
1561 gfx::Size auto_resize_size_;
1562
Jianzhou Fengd8720c72018-01-18 03:06:301563 // When device emulation is enabled, override the size of current and newly
1564 // created render views/widgets.
1565 gfx::Size device_emulation_size_;
1566 gfx::Size view_size_before_emulation_;
1567
mfomitchev2b8b066a2016-01-28 19:23:151568#if defined(OS_ANDROID)
[email protected]583418cc2013-01-17 14:01:101569 // Date time chooser opened by this tab.
1570 // Only used in Android since all other platforms use a multi field UI.
dcheng59716272016-04-09 05:19:081571 std::unique_ptr<DateTimeChooserAndroid> date_time_chooser_;
[email protected]583418cc2013-01-17 14:01:101572#endif
1573
[email protected]8ed16472014-04-11 19:02:481574 // Holds information about a current color chooser dialog, if one is visible.
Joel Hockey85b379d2017-12-11 10:42:131575 class ColorChooser;
1576 std::unique_ptr<ColorChooser> color_chooser_;
[email protected]da8543762012-03-20 08:52:201577
[email protected]7a846df2012-09-20 19:17:391578 // Manages the embedder state for browser plugins, if this WebContents is an
1579 // embedder; NULL otherwise.
dcheng59716272016-04-09 05:19:081580 std::unique_ptr<BrowserPluginEmbedder> browser_plugin_embedder_;
[email protected]7a846df2012-09-20 19:17:391581 // Manages the guest state for browser plugin, if this WebContents is a guest;
1582 // NULL otherwise.
dcheng59716272016-04-09 05:19:081583 std::unique_ptr<BrowserPluginGuest> browser_plugin_guest_;
[email protected]7a846df2012-09-20 19:17:391584
brettw4b461082016-11-19 18:55:161585#if BUILDFLAG(ENABLE_PLUGINS)
tommyclieb25b2a2014-11-03 19:45:091586 // Manages the whitelist of plugin content origins exempt from power saving.
dcheng59716272016-04-09 05:19:081587 std::unique_ptr<PluginContentOriginWhitelist>
1588 plugin_content_origin_whitelist_;
tommyclieb25b2a2014-11-03 19:45:091589#endif
1590
[email protected]f53a9f872012-05-24 02:07:061591 // This must be at the end, or else we might get notifications and use other
1592 // member variables that are gone.
[email protected]8ff00d72012-10-23 19:12:211593 NotificationRegistrar registrar_;
[email protected]f53a9f872012-05-24 02:07:061594
[email protected]b24b68a2012-09-24 21:57:261595 // All live RenderWidgetHostImpls that are created by this object and may
1596 // outlive it.
[email protected]8ff00d72012-10-23 19:12:211597 std::set<RenderWidgetHostImpl*> created_widgets_;
[email protected]b24b68a2012-09-24 21:57:261598
alexmosc9e76ec2016-05-16 22:59:371599 // Process id of the shown fullscreen widget, or kInvalidUniqueID if there is
1600 // no fullscreen widget.
1601 int fullscreen_widget_process_id_;
1602
[email protected]44470a22013-01-24 01:21:541603 // Routing id of the shown fullscreen widget or MSG_ROUTING_NONE otherwise.
1604 int fullscreen_widget_routing_id_;
1605
[email protected]0b431992014-06-24 00:08:031606 // At the time the fullscreen widget was being shut down, did it have focus?
1607 // This is used to restore focus to the WebContentsView after both: 1) the
1608 // fullscreen widget is destroyed, and 2) the WebContentsDelegate has
1609 // completed making layout changes to effect an exit from fullscreen mode.
1610 bool fullscreen_widget_had_focus_at_shutdown_;
1611
[email protected]0e584b5f2013-12-30 17:28:231612 // Whether this WebContents is responsible for displaying a subframe in a
[email protected]5dcaf8e2013-12-28 01:31:421613 // different process from its parent page.
1614 bool is_subframe_;
1615
mariakhomenkoa4971c12015-07-21 19:04:371616 // When a new tab is created asynchronously, stores the OpenURLParams needed
1617 // to continue loading the page once the tab is ready.
dcheng59716272016-04-09 05:19:081618 std::unique_ptr<OpenURLParams> delayed_open_url_params_;
mariakhomenkoa4971c12015-07-21 19:04:371619
[email protected]34ff1cfc2014-08-20 06:16:051620 // Whether overscroll should be unconditionally disabled.
1621 bool force_disable_overscroll_content_;
[email protected]e85165c642014-06-10 14:34:311622
[email protected]87de04b02014-04-08 22:14:491623 // Whether the last JavaScript dialog shown was suppressed. Used for testing.
1624 bool last_dialog_suppressed_;
1625
Ke He7319dbe2017-11-09 05:54:441626 device::mojom::GeolocationContextPtr geolocation_context_;
blundellc57b93f2014-10-29 13:19:571627
blundelle75a8f92017-03-27 08:11:171628 std::unique_ptr<WakeLockContextHost> wake_lock_context_host_;
alogvinovf50445a2015-10-30 13:00:121629
juncai8e8d6ec2017-06-06 20:48:181630 device::mojom::WakeLockPtr renderer_wake_lock_;
ke.he98b761e2017-05-09 05:59:171631
Joel Hockey85b379d2017-12-11 10:42:131632 service_manager::BinderRegistry registry_;
1633
Joel Hockey163835a2017-12-20 11:51:571634 mojo::BindingSet<blink::mojom::ColorChooserFactory>
1635 color_chooser_factory_bindings_;
Joel Hockey85b379d2017-12-11 10:42:131636
blundellf5316fc2017-05-15 11:49:031637#if defined(OS_ANDROID)
1638 std::unique_ptr<NFCHost> nfc_host_;
1639#endif
1640
leon.hane4db177a2017-02-07 14:19:161641 std::unique_ptr<ScreenOrientationProvider> screen_orientation_provider_;
[email protected]01f83f92014-06-17 14:41:541642
dcheng59716272016-04-09 05:19:081643 std::unique_ptr<ManifestManagerHost> manifest_manager_host_;
mlamouriefdca9d2014-09-16 16:55:401644
[email protected]95640212014-07-26 18:14:301645 // The accessibility mode for all frames. This is queried when each frame
1646 // is created, and broadcast to all frames when it changes.
Doug Turner63f3c7b2017-07-29 05:10:011647 ui::AXMode accessibility_mode_;
[email protected]95640212014-07-26 18:14:301648
avayvodcc85bbd2015-08-28 19:11:151649 // Monitors power levels for audio streams associated with this WebContents.
1650 AudioStreamMonitor audio_stream_monitor_;
1651
miu50f97892014-09-22 22:49:521652 // Created on-demand to mute all audio output from this WebContents.
dcheng59716272016-04-09 05:19:081653 std::unique_ptr<WebContentsAudioMuter> audio_muter_;
miu50f97892014-09-22 22:49:521654
ortunodf4d7982016-04-08 02:33:351655 size_t bluetooth_connected_device_count_;
ortuno32e7db3c2016-03-29 16:14:201656
csharrisona2280cd2016-02-03 23:21:151657 // Notifies ResourceDispatcherHostImpl of various events related to loading.
dcheng59716272016-04-09 05:19:081658 std::unique_ptr<LoaderIOThreadNotifier> loader_io_thread_notifier_;
csharrisona2280cd2016-02-03 23:21:151659
dalecurtis88c240072015-12-09 02:11:181660 // Manages media players, CDMs, and power save blockers for media.
dcheng59716272016-04-09 05:19:081661 std::unique_ptr<MediaWebContentsObserver> media_web_contents_observer_;
qinmin58567c82015-01-07 21:00:201662
brettw4b461082016-11-19 18:55:161663#if BUILDFLAG(ENABLE_PLUGINS)
zqzhang181047e62016-07-01 13:37:171664 // Observes pepper playback changes, and notifies MediaSession.
1665 std::unique_ptr<PepperPlaybackObserver> pepper_playback_observer_;
brettw4b461082016-11-19 18:55:161666#endif // BUILDFLAG(ENABLE_PLUGINS)
zqzhang181047e62016-07-01 13:37:171667
mcnee336ea2c2017-05-23 22:50:591668#if !defined(OS_ANDROID)
scottmg276753cf2016-10-27 18:25:221669 std::unique_ptr<HostZoomMapObserver> host_zoom_map_observer_;
mcnee336ea2c2017-05-23 22:50:591670#endif // !defined(OS_ANDROID)
scottmg276753cf2016-10-27 18:25:221671
dcheng59716272016-04-09 05:19:081672 std::unique_ptr<RenderWidgetHostInputEventRouter> rwh_input_event_router_;
kenrb2a565f82015-09-02 20:24:591673
kouhei40f03cb2015-09-24 07:47:011674 PageImportanceSignals page_importance_signals_;
1675
Guido Urdanetaf4008002018-05-03 10:43:041676 std::string media_device_group_id_salt_base_;
1677
mcnee336ea2c2017-05-23 22:50:591678#if !defined(OS_ANDROID)
mcnee432e47d2015-11-09 19:37:461679 bool page_scale_factor_is_one_;
mcnee336ea2c2017-05-23 22:50:591680#endif // !defined(OS_ANDROID)
mcnee432e47d2015-11-09 19:37:461681
ekaramadadd882292016-06-08 15:22:561682 // TextInputManager tracks the IME-related state for all the
1683 // RenderWidgetHostViews on this WebContents. Only exists on the outermost
1684 // WebContents and is automatically destroyed when a WebContents becomes an
1685 // inner WebContents by attaching to an outer WebContents. Then the
1686 // IME-related state for RenderWidgetHosts on the inner WebContents is tracked
1687 // by the TextInputManager in the outer WebContents.
1688 std::unique_ptr<TextInputManager> text_input_manager_;
1689
lfgbee1e0a2016-06-08 21:24:211690 // Stores the RenderWidgetHost that currently holds a mouse lock or nullptr if
1691 // there's no RenderWidgetHost holding a lock.
Joe Downing192998b22018-03-22 15:51:361692 RenderWidgetHostImpl* mouse_lock_widget_ = nullptr;
1693
1694 // Stores the RenderWidgetHost that currently holds a keyboard lock or nullptr
1695 // if no RenderWidgetHost has the keyboard locked.
1696 RenderWidgetHostImpl* keyboard_lock_widget_ = nullptr;
lfgbee1e0a2016-06-08 21:24:211697
Joe Downing13dd76b2018-04-09 18:32:151698 // Indicates whether the escape key is one of the requested keys to be locked.
1699 // This information is used to drive the browser UI so the correct exit
1700 // instructions are displayed to the user in fullscreen mode.
1701 bool esc_key_locked_ = false;
1702
sammcf5f1b0f2016-09-20 23:05:111703#if defined(OS_ANDROID)
rockot400ea35b2016-10-15 19:15:321704 std::unique_ptr<service_manager::InterfaceProvider> java_interfaces_;
sammcf5f1b0f2016-09-20 23:05:111705#endif
1706
qinmin72e8bd02016-10-21 19:35:371707 // Whether this WebContents is for content overlay.
1708 bool is_overlay_content_;
1709
ekaramadf6750aa2017-06-06 18:29:421710 bool showing_context_menu_;
1711
billorr21c005d2016-11-17 03:57:041712 int currently_playing_video_count_ = 0;
peconn257951522017-06-09 18:24:591713 VideoSizeMap cached_video_sizes_;
billorr21c005d2016-11-17 03:57:041714
mlamouri5cd9ae82017-02-18 11:05:091715 bool has_persistent_video_ = false;
1716
Tommy Steimel18360512017-11-01 00:38:191717 bool was_ever_audible_ = false;
1718
Lukasz Anforowiczfd707142018-02-07 19:46:131719 // Helper variable for resolving races in UpdateTargetURL / ClearTargetURL.
1720 RenderViewHost* view_that_set_last_target_url_ = nullptr;
1721
Changwan Ryuc1134a82018-03-07 02:10:141722 // Whether we should override user agent in new tabs.
1723 bool should_override_user_agent_in_new_tabs_ = false;
1724
mohan.reddyaae039a2014-11-21 17:39:501725 base::WeakPtrFactory<WebContentsImpl> loading_weak_factory_;
pkotwicz75ca8ffd2016-02-16 23:10:191726 base::WeakPtrFactory<WebContentsImpl> weak_factory_;
mohan.reddyaae039a2014-11-21 17:39:501727
[email protected]b172aee2012-04-10 17:05:261728 DISALLOW_COPY_AND_ASSIGN(WebContentsImpl);
[email protected]0dd3a0ab2011-02-18 08:17:441729};
1730
nickf9acfbe2014-12-23 19:12:371731// Dangerous methods which should never be made part of the public API, so we
1732// grant their use only to an explicit friend list (c++ attorney/client idiom).
benwells5e7260d2017-03-20 23:36:331733class CONTENT_EXPORT WebContentsImpl::FriendWrapper {
Avi Drissmana9114822018-03-23 18:25:551734 public:
1735 using CreatedCallback = base::RepeatingCallback<void(WebContents*)>;
1736
nickf9acfbe2014-12-23 19:12:371737 private:
1738 friend class TestNavigationObserver;
1739 friend class WebContentsAddedObserver;
1740 friend class ContentBrowserSanityChecker;
1741
benwells5e7260d2017-03-20 23:36:331742 FriendWrapper(); // Not instantiable.
nickf9acfbe2014-12-23 19:12:371743
1744 // Adds/removes a callback called on creation of each new WebContents.
1745 static void AddCreatedCallbackForTesting(const CreatedCallback& callback);
1746 static void RemoveCreatedCallbackForTesting(const CreatedCallback& callback);
1747
benwells5e7260d2017-03-20 23:36:331748 DISALLOW_COPY_AND_ASSIGN(FriendWrapper);
nickf9acfbe2014-12-23 19:12:371749};
1750
[email protected]8ff00d72012-10-23 19:12:211751} // namespace content
1752
[email protected]93ddb3c2012-04-11 21:44:291753#endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_