blob: 493edbc189b74dedbee3e78d5cdf529267974c28 [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"
[email protected]738f57a2013-06-29 21:06:5423#include "base/values.h"
avib7348942015-12-25 20:57:1024#include "build/build_config.h"
Min Qina904f3302018-02-13 23:33:3425#include "components/download/public/common/download_url_parameters.h"
[email protected]d4a8ca482013-10-30 21:06:4026#include "content/browser/frame_host/frame_tree.h"
lfga3e2bdc2017-03-07 20:44:0127#include "content/browser/frame_host/frame_tree_node.h"
Maxim Podgorodskiya926c4ff2017-11-20 02:06:3928#include "content/browser/frame_host/interstitial_page_impl.h"
[email protected]d4a8ca482013-10-30 21:06:4029#include "content/browser/frame_host/navigation_controller_delegate.h"
30#include "content/browser/frame_host/navigation_controller_impl.h"
[email protected]190b8c52013-11-09 01:35:4431#include "content/browser/frame_host/navigator_delegate.h"
[email protected]92404c62013-12-04 16:40:4632#include "content/browser/frame_host/render_frame_host_delegate.h"
[email protected]b0936d22013-11-28 06:47:3633#include "content/browser/frame_host/render_frame_host_manager.h"
avayvodcc85bbd2015-08-28 19:11:1534#include "content/browser/media/audio_stream_monitor.h"
[email protected]2e3bf992012-05-24 17:36:2435#include "content/browser/renderer_host/render_view_host_delegate.h"
creisc014b402015-04-23 16:41:4536#include "content/browser/renderer_host/render_view_host_impl.h"
[email protected]4ca76c02012-05-16 16:19:0537#include "content/browser/renderer_host/render_widget_host_delegate.h"
blundelle75a8f92017-03-27 08:11:1738#include "content/browser/wake_lock/wake_lock_context_host.h"
[email protected]8d128d62011-09-13 22:11:5739#include "content/common/content_export.h"
[email protected]8ed16472014-04-11 19:02:4840#include "content/public/browser/color_chooser.h"
[email protected]14392a52012-05-02 20:28:4441#include "content/public/browser/notification_observer.h"
42#include "content/public/browser/notification_registrar.h"
[email protected]58f5d562011-12-20 17:13:0343#include "content/public/browser/web_contents.h"
rockot96c63e32017-03-20 23:23:0344#include "content/public/browser/web_contents_binding_set.h"
dalecurtis88c240072015-12-09 02:11:1845#include "content/public/browser/web_contents_observer.h"
kouhei40f03cb2015-09-24 07:47:0146#include "content/public/common/page_importance_signals.h"
[email protected]daf82f82011-10-31 22:35:3147#include "content/public/common/renderer_preferences.h"
[email protected]7491ad02014-07-05 19:10:0748#include "content/public/common/resource_type.h"
[email protected]818915cd2012-11-20 13:14:1149#include "content/public/common/three_d_api_types.h"
[email protected]0dd3a0ab2011-02-18 08:17:4450#include "net/base/load_states.h"
[email protected]6f2ac772014-07-24 22:22:0851#include "net/http/http_response_headers.h"
brettw4b461082016-11-19 18:55:1652#include "ppapi/features/features.h"
Ke He231dce3c2018-01-18 05:19:0453#include "services/device/public/interfaces/geolocation_context.mojom.h"
Ke Hee4e26b4c2017-07-07 05:15:0854#include "services/device/public/interfaces/wake_lock.mojom.h"
Mounir Lamourifd9dcefa2017-07-06 10:26:5555#include "services/metrics/public/cpp/ukm_recorder.h"
Kinuko Yasuda275afbc2018-02-20 10:43:0756#include "third_party/WebKit/public/mojom/color_chooser/color_chooser.mojom.h"
esprehnfbba1292016-04-15 17:59:5657#include "third_party/WebKit/public/platform/WebDragOperation.h"
Doug Turner63f3c7b2017-07-29 05:10:0158#include "ui/accessibility/ax_modes.h"
Sylvain Defresnec6ccc77d2014-09-19 10:19:3559#include "ui/base/page_transition_types.h"
tfarina3b0452d2014-12-31 15:20:0960#include "ui/gfx/geometry/rect_f.h"
tfarinaebe974f02015-01-03 04:25:3261#include "ui/gfx/geometry/size.h"
[email protected]0dd3a0ab2011-02-18 08:17:4462
blundellf5316fc2017-05-15 11:49:0363#if defined(OS_ANDROID)
64#include "content/browser/android/nfc_host.h"
Bo Liu168c8642017-08-28 18:26:0265#include "content/public/browser/android/child_process_importance.h"
blundellf5316fc2017-05-15 11:49:0366#endif
67
[email protected]1ff427972013-02-07 21:14:0768struct ViewHostMsg_DateTimeDialogValue_Params;
[email protected]daf82f82011-10-31 22:35:3169
rockot400ea35b2016-10-15 19:15:3270namespace service_manager {
sammcf5f1b0f2016-09-20 23:05:1171class InterfaceProvider;
72}
73
[email protected]e582fdd2011-12-20 16:48:1774namespace content {
[email protected]7a846df2012-09-20 19:17:3975class BrowserPluginEmbedder;
76class BrowserPluginGuest;
[email protected]583418cc2013-01-17 14:01:1077class DateTimeChooserAndroid;
paulmeyerc0b762b2016-04-13 11:55:1778class FindRequestManager;
[email protected]8ff00d72012-10-23 19:12:2179class InterstitialPageImpl;
[email protected]71a88bb2013-02-01 22:05:1580class JavaScriptDialogManager;
csharrisona2280cd2016-02-03 23:21:1581class LoaderIOThreadNotifier;
mlamouriefdca9d2014-09-16 16:55:4082class ManifestManagerHost;
qinmin58567c82015-01-07 21:00:2083class MediaWebContentsObserver;
tommyclieb25b2a2014-11-03 19:45:0984class PluginContentOriginWhitelist;
[email protected]eaabba22012-03-07 15:02:1185class RenderViewHost;
[email protected]5a3bdf52012-05-24 15:12:5786class RenderViewHostDelegateView;
[email protected]b24b68a2012-09-24 21:57:2687class RenderWidgetHostImpl;
kenrb2a565f82015-09-02 20:24:5988class RenderWidgetHostInputEventRouter;
[email protected]35869622012-10-26 23:23:5589class SavePackage;
lunalud4a2cc82016-11-22 00:27:2390class ScreenOrientationProvider;
[email protected]09d31d52012-03-11 22:30:2791class SiteInstance;
[email protected]80e776ae2012-03-23 16:17:2092class TestWebContents;
ekaramadadd882292016-06-08 15:22:5693class TextInputManager;
miu50f97892014-09-22 22:49:5294class WebContentsAudioMuter;
[email protected]674bc592011-12-20 23:00:4295class WebContentsDelegate;
[email protected]8ff00d72012-10-23 19:12:2196class WebContentsImpl;
[email protected]fc2b46b2014-05-03 16:33:4597class WebContentsView;
[email protected]f66df822012-05-18 16:52:1798class WebContentsViewDelegate;
[email protected]31a71eaf2014-03-13 01:47:3699struct AXEventNotificationDetails;
[email protected]795c28972012-12-06 06:13:39100struct FaviconURL;
[email protected]09d31d52012-03-11 22:30:27101struct LoadNotificationDetails;
dewittj6dc5747a2016-05-17 01:48:47102struct MHTMLGenerationParams;
[email protected]f66df822012-05-18 16:52:17103
rockot5c478a72016-09-28 23:14:18104namespace mojom {
105class CreateNewWindowParams;
106}
107
mfomitchev2b8b066a2016-01-28 19:23:15108#if defined(OS_ANDROID)
[email protected]0e813a52014-08-13 10:34:56109class WebContentsAndroid;
mcnee336ea2c2017-05-23 22:50:59110#else // !defined(OS_ANDROID)
111class HostZoomMapObserver;
112#endif // defined(OS_ANDROID)
[email protected]0e813a52014-08-13 10:34:56113
brettw4b461082016-11-19 18:55:16114#if BUILDFLAG(ENABLE_PLUGINS)
zqzhang181047e62016-07-01 13:37:17115class PepperPlaybackObserver;
116#endif
117
[email protected]f66df822012-05-18 16:52:17118// Factory function for the implementations that content knows about. Takes
119// ownership of |delegate|.
[email protected]fc2b46b2014-05-03 16:33:45120WebContentsView* CreateWebContentsView(
[email protected]5a3bdf52012-05-24 15:12:57121 WebContentsImpl* web_contents,
122 WebContentsViewDelegate* delegate,
123 RenderViewHostDelegateView** render_view_host_delegate_view);
[email protected]97714c82012-06-06 10:15:13124
Nico Weber43ddd7a32017-08-15 19:19:27125class CONTENT_EXPORT WebContentsImpl : public WebContents,
126 public RenderFrameHostDelegate,
127 public RenderViewHostDelegate,
128 public RenderWidgetHostDelegate,
129 public RenderFrameHostManager::Delegate,
Joel Hockey163835a2017-12-20 11:51:57130 public blink::mojom::ColorChooserFactory,
Nico Weber43ddd7a32017-08-15 19:19:27131 public NotificationObserver,
132 public NavigationControllerDelegate,
133 public NavigatorDelegate {
[email protected]0dd3a0ab2011-02-18 08:17:44134 public:
benwells5e7260d2017-03-20 23:36:33135 class FriendWrapper;
nickf9acfbe2014-12-23 19:12:37136
dchengc2282aa2014-10-21 12:07:58137 ~WebContentsImpl() override;
[email protected]0dd3a0ab2011-02-18 08:17:44138
[email protected]d1198fd2012-08-13 22:50:19139 static WebContentsImpl* CreateWithOpener(
[email protected]54944cde2012-12-09 09:24:59140 const WebContents::CreateParams& params,
Ian Clelland5cbaaf82017-11-27 22:00:03141 RenderFrameHostImpl* opener_rfh);
[email protected]d1198fd2012-08-13 22:50:19142
[email protected]95640212014-07-26 18:14:30143 static std::vector<WebContentsImpl*> GetAllWebContents();
144
paulmeyerfeafc2d2017-04-25 21:46:40145 static WebContentsImpl* FromFrameTreeNode(
146 const FrameTreeNode* frame_tree_node);
clamy0d32d6d2015-11-24 11:16:26147 static WebContents* FromRenderFrameHostID(int render_process_host_id,
148 int render_frame_host_id);
ananta4b7467a52016-09-23 01:42:38149 static WebContents* FromFrameTreeNodeId(int frame_tree_node_id);
paulmeyerfeafc2d2017-04-25 21:46:40150 static WebContentsImpl* FromOuterFrameTreeNode(
151 const FrameTreeNode* frame_tree_node);
clamya16aa8172015-05-26 13:07:25152
[email protected]d1198fd2012-08-13 22:50:19153 // Complex initialization here. Specifically needed to avoid having
154 // members call back into our virtual functions in the constructor.
[email protected]54944cde2012-12-09 09:24:59155 virtual void Init(const WebContents::CreateParams& params);
[email protected]d1198fd2012-08-13 22:50:19156
[email protected]c7dd2f62011-07-18 15:57:59157 // Returns the SavePackage which manages the page saving job. May be NULL.
158 SavePackage* save_package() const { return save_package_.get(); }
159
mfomitchev2b8b066a2016-01-28 19:23:15160#if defined(OS_ANDROID)
[email protected]7d244f12013-08-22 21:41:51161 // In Android WebView, the RenderView needs created even there is no
162 // navigation entry, this allows Android WebViews to use
163 // javascript: URLs that load into the DOMWindow before the first page
164 // load. This is not safe to do in any context that a web page could get a
165 // reference to the DOMWindow before the first page load.
166 bool CreateRenderViewForInitialEmptyDocument();
[email protected]4cc1ab52013-01-21 19:24:34167#endif
[email protected]276b37a22011-11-08 20:45:46168
[email protected]765187182012-01-11 23:59:28169 // Expose the render manager for testing.
[email protected]ee87c8be2014-03-05 00:35:38170 // TODO(creis): Remove this now that we can get to it via FrameTreeNode.
[email protected]b0936d22013-11-28 06:47:36171 RenderFrameHostManager* GetRenderManagerForTesting();
[email protected]765187182012-01-11 23:59:28172
lazyboy8e16ddfd2015-09-28 03:41:56173 // Returns the outer WebContents of this WebContents if any.
174 // Note that without --site-per-process, this will return the WebContents
175 // of the BrowserPluginEmbedder, if |this| is a guest.
176 WebContentsImpl* GetOuterWebContents();
177
[email protected]7a846df2012-09-20 19:17:39178 // Returns guest browser plugin object, or NULL if this WebContents is not a
179 // guest.
[email protected]f8497342013-02-05 22:15:02180 BrowserPluginGuest* GetBrowserPluginGuest() const;
[email protected]738f57a2013-06-29 21:06:54181
182 // Sets a BrowserPluginGuest object for this WebContents. If this WebContents
183 // has a BrowserPluginGuest then that implies that it is being hosted by
184 // a BrowserPlugin object in an embedder renderer process.
185 void SetBrowserPluginGuest(BrowserPluginGuest* guest);
186
[email protected]7a846df2012-09-20 19:17:39187 // Returns embedder browser plugin object, or NULL if this WebContents is not
188 // an embedder.
[email protected]f8497342013-02-05 22:15:02189 BrowserPluginEmbedder* GetBrowserPluginEmbedder() const;
[email protected]738f57a2013-06-29 21:06:54190
fsamuel60b42282015-03-10 03:29:14191 // Creates a BrowserPluginEmbedder object for this WebContents if one doesn't
192 // already exist.
193 void CreateBrowserPluginEmbedderIfNecessary();
194
creis89a0f782015-05-27 16:13:17195 // Cancels modal dialogs in this WebContents, as well as in any browser
196 // plugins it is hosting.
197 void CancelActiveAndPendingDialogs();
198
[email protected]cf200a562013-05-03 16:24:29199 // Informs the render view host and the BrowserPluginEmbedder, if present, of
200 // a Drag Source End.
Ella Ge80a52dce2017-11-15 18:01:52201 void DragSourceEndedAt(float client_x,
202 float client_y,
203 float screen_x,
204 float screen_y,
Paul Meyer0c58c3712016-11-17 22:59:51205 blink::WebDragOperation operation,
206 RenderWidgetHost* source_rwh);
[email protected]cf200a562013-05-03 16:24:29207
jam73f892642016-09-11 06:04:06208 // Notification that the RenderViewHost's load state changed.
209 void LoadStateChanged(const GURL& url,
210 const net::LoadStateWithParam& load_state,
211 uint64_t upload_position,
212 uint64_t upload_size);
213
Francois Dorayfe4a1772018-02-17 04:17:09214 // Notify observers that the visibility changed.
215 void NotifyVisibilityChanged(Visibility previous_visibility);
216
calamity7fe55ce2015-04-10 03:59:37217 // Notify observers that the web contents has been focused.
Michael Thiessen896405db2017-07-20 17:52:32218 void NotifyWebContentsFocused(RenderWidgetHost* render_widget_host);
calamity7fe55ce2015-04-10 03:59:37219
zijiehe3bee08e22017-05-17 04:14:46220 // Notify observers that the web contents has lost focus.
Michael Thiessen896405db2017-07-20 17:52:32221 void NotifyWebContentsLostFocus(RenderWidgetHost* render_widget_host);
zijiehe3bee08e22017-05-17 04:14:46222
[email protected]fc2b46b2014-05-03 16:33:45223 WebContentsView* GetView() const;
224
leon.han552e9de2017-02-09 14:37:30225 void OnScreenOrientationChange();
226
227 ScreenOrientationProvider* GetScreenOrientationProviderForTesting() const {
228 return screen_orientation_provider_.get();
229 }
leon.hane4db177a2017-02-07 14:19:16230
[email protected]16620a92014-05-24 01:05:51231 bool should_normally_be_visible() { return should_normally_be_visible_; }
232
[email protected]95640212014-07-26 18:14:30233 // Broadcasts the mode change to all frames.
Doug Turner63f3c7b2017-07-29 05:10:01234 void SetAccessibilityMode(ui::AXMode mode);
[email protected]95640212014-07-26 18:14:30235
236 // Adds the given accessibility mode to the current accessibility mode
237 // bitmap.
Doug Turner63f3c7b2017-07-29 05:10:01238 void AddAccessibilityMode(ui::AXMode mode);
[email protected]95640212014-07-26 18:14:30239
mcnee336ea2c2017-05-23 22:50:59240#if !defined(OS_ANDROID)
wjmaclean64951902016-04-29 20:59:12241 // Set a temporary zoom level for the frames associated with this WebContents.
242 // If |is_temporary| is true, we are setting a new temporary zoom level,
243 // otherwise we are clearing a previously set temporary zoom level.
244 void SetTemporaryZoomLevel(double level, bool temporary_zoom_enabled);
245
246 // Sets the zoom level for frames associated with this WebContents.
247 void UpdateZoom(double level);
248
249 // Sets the zoom level for frames associated with this WebContents if it
250 // matches |host| and (if non-empty) |scheme|. Matching is done on the
251 // last committed entry.
252 void UpdateZoomIfNecessary(const std::string& scheme,
253 const std::string& host,
254 double level);
mcnee336ea2c2017-05-23 22:50:59255#endif // !defined(OS_ANDROID)
wjmaclean64951902016-04-29 20:59:12256
rockotf62002a2016-09-15 00:08:59257 // Adds a new binding set to the WebContents. Returns a closure which may be
258 // used to remove the binding set at any time. The closure is safe to call
259 // even after WebContents destruction.
260 //
261 // |binding_set| is not owned and must either outlive this WebContents or be
262 // explicitly removed before being destroyed.
263 base::Closure AddBindingSet(const std::string& interface_name,
264 WebContentsBindingSet* binding_set);
265
rockot8bbad222017-03-22 04:34:05266 // Accesses a WebContentsBindingSet for a specific interface on this
267 // WebContents. Returns null of there is no registered binder for the
268 // interface.
269 WebContentsBindingSet* GetBindingSet(const std::string& interface_name);
rockot96c63e32017-03-20 23:23:03270
paulmeyerfeafc2d2017-04-25 21:46:40271 // Returns the focused WebContents.
272 // If there are multiple inner/outer WebContents (when embedding <webview>,
273 // <guestview>, ...) returns the single one containing the currently focused
274 // frame. Otherwise, returns this WebContents.
275 WebContentsImpl* GetFocusedWebContents();
276
277 // TODO(paulmeyer): Once GuestViews are no longer implemented as
278 // BrowserPluginGuests, frame traversal across WebContents should be moved to
279 // be handled by FrameTreeNode, and |GetInnerWebContents| and
280 // |GetWebContentsAndAllInner| can be removed.
281
282 // Returns a vector to the inner WebContents within this WebContents.
283 std::vector<WebContentsImpl*> GetInnerWebContents();
284
285 // Returns a vector containing this WebContents and all inner WebContents
286 // within it (recursively).
287 std::vector<WebContentsImpl*> GetWebContentsAndAllInner();
288
Sam McNally145fb172017-05-10 00:13:23289 void NotifyManifestUrlChanged(const base::Optional<GURL>& manifest_url);
290
Dmitry Gozman1f80890232017-12-15 22:54:11291 ManifestManagerHost* GetManifestManagerHost() const {
292 return manifest_manager_host_.get();
293 }
294
Bo Liu168c8642017-08-28 18:26:02295#if defined(OS_ANDROID)
Jinsuk Kim144909f2017-09-13 23:23:22296 std::set<RenderWidgetHostImpl*> GetAllRenderWidgetHosts();
Bo Liu7c6779e92017-08-16 02:02:28297 void SetImportance(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;
327 void SetUserAgentOverride(const std::string& override) override;
328 const std::string& GetUserAgentOverride() const override;
dmazzonidd3d51a72016-12-14 18:41:01329 void EnableWebContentsOnlyAccessibilityMode() override;
330 bool IsWebContentsOnlyAccessibilityModeForTesting() const override;
dchengc2282aa2014-10-21 12:07:58331 bool IsFullAccessibilityModeForTesting() const override;
kouhei40f03cb2015-09-24 07:47:01332 const PageImportanceSignals& GetPageImportanceSignals() const override;
dchengc2282aa2014-10-21 12:07:58333 const base::string16& GetTitle() const override;
afakhry6f0c1ec22016-07-14 13:55:13334 void UpdateTitleForEntry(NavigationEntry* entry,
335 const base::string16& title) override;
dchengc2282aa2014-10-21 12:07:58336 SiteInstanceImpl* GetSiteInstance() const override;
dchengc2282aa2014-10-21 12:07:58337 bool IsLoading() const override;
338 bool IsLoadingToDifferentDocument() const override;
339 bool IsWaitingForResponse() const override;
340 const net::LoadStateWithParam& GetLoadState() const override;
341 const base::string16& GetLoadStateHost() const override;
muyuanlic693ba12017-04-27 19:12:40342 void RequestAXTreeSnapshot(const AXTreeSnapshotCallback& callback) override;
avib7348942015-12-25 20:57:10343 uint64_t GetUploadSize() const override;
344 uint64_t GetUploadPosition() const override;
dchengc2282aa2014-10-21 12:07:58345 const std::string& GetEncoding() const override;
dchengc2282aa2014-10-21 12:07:58346 void IncrementCapturerCount(const gfx::Size& capture_size) override;
347 void DecrementCapturerCount() override;
Francois Doray24fc62c2017-12-11 17:27:33348 bool IsBeingCaptured() const override;
dchengc2282aa2014-10-21 12:07:58349 bool IsAudioMuted() const override;
350 void SetAudioMuted(bool mute) override;
Jan Rucka442c83f2017-08-08 13:27:54351 bool IsCurrentlyAudible() override;
ortunodf4d7982016-04-08 02:33:35352 bool IsConnectedToBluetoothDevice() const override;
dchengc2282aa2014-10-21 12:07:58353 bool IsCrashed() const override;
354 void SetIsCrashed(base::TerminationStatus status, int error_code) override;
355 base::TerminationStatus GetCrashedStatus() const override;
afakhry98241832016-03-11 19:27:47356 int GetCrashedErrorCode() const override;
dchengc2282aa2014-10-21 12:07:58357 bool IsBeingDestroyed() const override;
358 void NotifyNavigationStateChanged(InvalidateTypes changed_flags) override;
altiminec87fd1f2016-11-17 20:22:49359 void OnAudioStateChanged(bool is_audible) override;
gab0dccfef2015-05-20 18:43:39360 base::TimeTicks GetLastActiveTime() const override;
georgesak5582cbe2015-05-22 22:08:07361 void SetLastActiveTime(base::TimeTicks last_active_time) override;
dchengc2282aa2014-10-21 12:07:58362 void WasShown() override;
363 void WasHidden() override;
Francois Doray18800972017-08-25 22:38:58364 void WasOccluded() override;
365 void WasUnOccluded() override;
Francois Dorayfe4a1772018-02-17 04:17:09366 Visibility GetVisibility() const override;
dchengc2282aa2014-10-21 12:07:58367 bool NeedToFireBeforeUnload() override;
nasko148bb0b92016-05-10 21:03:19368 void DispatchBeforeUnload() override;
lazyboy6ec48b2a2015-06-29 15:18:14369 void AttachToOuterWebContentsFrame(
370 WebContents* outer_web_contents,
371 RenderFrameHost* outer_contents_frame) override;
dalecurtis6c58ed02016-10-28 23:02:37372 void DidChangeVisibleSecurityState() override;
dchengc2282aa2014-10-21 12:07:58373 void Stop() override;
374 WebContents* Clone() override;
toyoshim24a4c7ab2016-04-05 09:24:14375 void ReloadFocusedFrame(bool bypass_cache) override;
dchengc2282aa2014-10-21 12:07:58376 void Undo() override;
377 void Redo() override;
378 void Cut() override;
379 void Copy() override;
380 void CopyToFindPboard() override;
381 void Paste() override;
382 void PasteAndMatchStyle() override;
383 void Delete() override;
384 void SelectAll() override;
yabinh351e7ec2017-03-10 02:43:24385 void CollapseSelection() override;
dchengc2282aa2014-10-21 12:07:58386 void Replace(const base::string16& word) override;
387 void ReplaceMisspelling(const base::string16& word) override;
388 void NotifyContextMenuClosed(
anand.ratn120b0b002014-10-07 15:49:32389 const CustomContextMenuContext& context) override;
megjablon3f5941072016-02-04 23:27:52390 void ReloadLoFiImages() override;
dchengc2282aa2014-10-21 12:07:58391 void ExecuteCustomContextMenuCommand(
392 int action,
393 const CustomContextMenuContext& context) override;
394 gfx::NativeView GetNativeView() override;
395 gfx::NativeView GetContentNativeView() override;
396 gfx::NativeWindow GetTopLevelNativeWindow() override;
397 gfx::Rect GetContainerBounds() override;
398 gfx::Rect GetViewBounds() override;
399 DropData* GetDropData() override;
400 void Focus() override;
401 void SetInitialFocus() override;
402 void StoreFocus() override;
403 void RestoreFocus() override;
404 void FocusThroughTabTraversal(bool reverse) override;
405 bool ShowingInterstitialPage() const override;
Pete Williamson89aa1402017-07-07 19:58:41406 void AdjustPreviewsStateForNavigation(PreviewsState* previews_state) override;
Maxim Podgorodskiya926c4ff2017-11-20 02:06:39407 InterstitialPageImpl* GetInterstitialPage() const override;
dchengc2282aa2014-10-21 12:07:58408 bool IsSavable() override;
409 void OnSavePage() override;
410 bool SavePage(const base::FilePath& main_file,
411 const base::FilePath& dir_path,
412 SavePageType save_type) override;
413 void SaveFrame(const GURL& url, const Referrer& referrer) override;
kundaji6c7f9692015-03-09 18:00:37414 void SaveFrameWithHeaders(const GURL& url,
415 const Referrer& referrer,
416 const std::string& headers) override;
dewittj6dc5747a2016-05-17 01:48:47417 void GenerateMHTML(const MHTMLGenerationParams& params,
avib7348942015-12-25 20:57:10418 const base::Callback<void(int64_t)>& callback) override;
dchengc2282aa2014-10-21 12:07:58419 const std::string& GetContentsMimeType() const override;
420 bool WillNotifyDisconnection() const override;
dchengc2282aa2014-10-21 12:07:58421 RendererPreferences* GetMutableRendererPrefs() override;
422 void Close() override;
Paul Meyer0c58c3712016-11-17 22:59:51423 void SystemDragEnded(RenderWidgetHost* source_rwh) override;
dchengc2282aa2014-10-21 12:07:58424 void UserGestureDone() override;
425 void SetClosedByUserGesture(bool value) override;
426 bool GetClosedByUserGesture() const override;
dchengc2282aa2014-10-21 12:07:58427 int GetMinimumZoomPercent() const override;
428 int GetMaximumZoomPercent() const override;
mcnee432e47d2015-11-09 19:37:46429 void SetPageScale(float page_scale_factor) override;
dchengc2282aa2014-10-21 12:07:58430 gfx::Size GetPreferredSize() const override;
431 bool GotResponseToLockMouseRequest(bool allowed) override;
432 bool HasOpener() const override;
lukasza6f8ac622017-06-06 03:10:20433 RenderFrameHostImpl* GetOpener() const override;
jochen6004a362017-02-04 00:11:40434 bool HasOriginalOpener() const override;
lukasza6f8ac622017-06-06 03:10:20435 RenderFrameHostImpl* GetOriginalOpener() const override;
dchengc2282aa2014-10-21 12:07:58436 void DidChooseColorInColorChooser(SkColor color) override;
437 void DidEndColorChooser() override;
438 int DownloadImage(const GURL& url,
439 bool is_favicon,
440 uint32_t max_bitmap_size,
pkotwiczfd773552015-03-16 00:29:14441 bool bypass_cache,
dchengc2282aa2014-10-21 12:07:58442 const ImageDownloadCallback& callback) override;
443 bool IsSubframe() const override;
444 void Find(int request_id,
445 const base::string16& search_text,
446 const blink::WebFindOptions& options) override;
447 void StopFinding(StopFindAction action) override;
dchengc2282aa2014-10-21 12:07:58448 bool WasRecentlyAudible() override;
Tommy Steimel18360512017-11-01 00:38:19449 bool WasEverAudible() override;
dominickn6919ce32015-10-15 01:52:28450 void GetManifest(const GetManifestCallback& callback) override;
avi0720b02e2017-06-13 03:22:13451 bool IsFullscreenForCurrentTab() const override;
bokanece34a82016-01-28 19:49:46452 void ExitFullscreen(bool will_cause_resize) override;
mariakhomenko44bdc4732015-04-29 01:55:38453 void ResumeLoadingCreatedWebContents() override;
qinmin72e8bd02016-10-21 19:35:37454 void SetIsOverlayContent(bool is_overlay_content) override;
ekaramad5c1f9392017-01-25 02:05:23455 bool IsFocusedElementEditable() override;
456 void ClearFocusedElement() override;
ekaramadf6750aa2017-06-06 18:29:42457 bool IsShowingContextMenu() const override;
458 void SetShowingContextMenu(bool showing) override;
mfomitchev2b8b066a2016-01-28 19:23:15459
mlamouri918734092016-03-12 04:47:52460#if defined(OS_ANDROID)
dcheng48d97c52015-02-04 20:03:20461 base::android::ScopedJavaLocalRef<jobject> GetJavaWebContents() override;
[email protected]0e813a52014-08-13 10:34:56462 virtual WebContentsAndroid* GetWebContentsAndroid();
paulmeyerc0b762b2016-04-13 11:55:17463 void ActivateNearestFindResult(float x, float y) override;
464 void RequestFindMatchRects(int current_version) override;
rockot400ea35b2016-10-15 19:15:32465 service_manager::InterfaceProvider* GetJavaInterfaces() override;
[email protected]fc2b46b2014-05-03 16:33:45466#elif defined(OS_MACOSX)
dchengc2282aa2014-10-21 12:07:58467 void SetAllowOtherViews(bool allow) override;
468 bool GetAllowOtherViews() override;
spqchane72c3cb2017-06-30 23:02:10469 bool CompletedFirstVisuallyNonEmptyPaint() const override;
[email protected]155c7f22013-12-09 17:07:18470#endif
[email protected]0bfbf882011-12-22 18:19:27471
472 // Implementation of PageNavigator.
dchengc2282aa2014-10-21 12:07:58473 WebContents* OpenURL(const OpenURLParams& params) override;
[email protected]151a63d2011-12-20 22:32:52474
[email protected]92404c62013-12-04 16:40:46475 // RenderFrameHostDelegate ---------------------------------------------------
nicka0ac8382016-12-15 23:59:23476 bool OnMessageReceived(RenderFrameHostImpl* render_frame_host,
dchengc2282aa2014-10-21 12:07:58477 const IPC::Message& message) override;
rockotf62002a2016-09-15 00:08:59478 void OnAssociatedInterfaceRequest(
479 RenderFrameHost* render_frame_host,
480 const std::string& interface_name,
481 mojo::ScopedInterfaceEndpointHandle handle) override;
Ben Goodger9e24929e2017-07-21 03:13:40482 void OnInterfaceRequest(
483 RenderFrameHost* render_frame_host,
484 const std::string& interface_name,
485 mojo::ScopedMessagePipeHandle* interface_pipe) override;
Nicolas Dossou-gbetebcab2472017-09-09 12:28:40486 void OnDidBlockFramebust(const GURL& url) override;
dchengc2282aa2014-10-21 12:07:58487 const GURL& GetMainFrameLastCommittedURL() const override;
488 void RenderFrameCreated(RenderFrameHost* render_frame_host) override;
489 void RenderFrameDeleted(RenderFrameHost* render_frame_host) override;
dchengc2282aa2014-10-21 12:07:58490 void ShowContextMenu(RenderFrameHost* render_frame_host,
491 const ContextMenuParams& params) override;
avi777ff452017-02-09 19:04:48492 void RunJavaScriptDialog(RenderFrameHost* render_frame_host,
493 const base::string16& message,
494 const base::string16& default_prompt,
495 const GURL& frame_url,
496 JavaScriptDialogType dialog_type,
497 IPC::Message* reply_msg) override;
dchengc2282aa2014-10-21 12:07:58498 void RunBeforeUnloadConfirm(RenderFrameHost* render_frame_host,
dchengc2282aa2014-10-21 12:07:58499 bool is_reload,
500 IPC::Message* reply_msg) override;
naskoada75b22016-06-11 16:09:46501 void RunFileChooser(RenderFrameHost* render_frame_host,
502 const FileChooserParams& params) override;
Charles Reis15d60b132017-11-03 17:43:47503 void DidCancelLoading() override;
dchengc2282aa2014-10-21 12:07:58504 void DidAccessInitialDocument() override;
alexmosbe2f4c32015-03-10 02:30:23505 void DidChangeName(RenderFrameHost* render_frame_host,
506 const std::string& name) override;
dchengc2282aa2014-10-21 12:07:58507 void DocumentOnLoadCompleted(RenderFrameHost* render_frame_host) override;
creis8eb8ef22015-11-04 22:51:38508 void UpdateStateForFrame(RenderFrameHost* render_frame_host,
509 const PageState& page_state) override;
dchengc2282aa2014-10-21 12:07:58510 void UpdateTitle(RenderFrameHost* render_frame_host,
dchengc2282aa2014-10-21 12:07:58511 const base::string16& title,
512 base::i18n::TextDirection title_direction) override;
513 void UpdateEncoding(RenderFrameHost* render_frame_host,
514 const std::string& encoding) override;
515 WebContents* GetAsWebContents() override;
516 bool IsNeverVisible() override;
Doug Turner63f3c7b2017-07-29 05:10:01517 ui::AXMode GetAccessibilityMode() const override;
Dominic Mazzonia7b0edb22017-08-09 16:32:51518 void AccessibilityEventReceived(
519 const std::vector<AXEventNotificationDetails>& details) override;
dmazzoni2400c462016-08-23 15:07:13520 void AccessibilityLocationChangesReceived(
521 const std::vector<AXLocationChangeNotificationDetails>& details) override;
dchengc2282aa2014-10-21 12:07:58522 RenderFrameHost* GetGuestByInstanceID(
fsamuel833ee7c2015-02-13 23:40:40523 RenderFrameHost* render_frame_host,
dchengc2282aa2014-10-21 12:07:58524 int browser_plugin_instance_id) override;
Ke He7319dbe2017-11-09 05:54:44525 device::mojom::GeolocationContext* GetGeolocationContext() override;
ke.he98b761e2017-05-09 05:59:17526 device::mojom::WakeLockContext* GetWakeLockContext() override;
juncai8e8d6ec2017-06-06 20:48:18527 device::mojom::WakeLock* GetRendererWakeLock() override;
blundellf5316fc2017-05-15 11:49:03528#if defined(OS_ANDROID)
Han Leonf6a2e5f2017-05-23 13:40:47529 void GetNFC(device::mojom::NFCRequest request) override;
blundellf5316fc2017-05-15 11:49:03530#endif
mlamouri7a78d6fd2015-01-17 13:23:53531 void EnterFullscreenMode(const GURL& origin) override;
bokanece34a82016-01-28 19:49:46532 void ExitFullscreenMode(bool will_cause_resize) override;
alexmose7da5a12015-04-09 02:22:16533 bool ShouldRouteMessageEvent(
534 RenderFrameHost* target_rfh,
535 SiteInstance* source_site_instance) const override;
alexmos58729042015-06-18 23:20:00536 void EnsureOpenerProxiesExist(RenderFrameHost* source_rfh) override;
dcheng59716272016-04-09 05:19:08537 std::unique_ptr<WebUIImpl> CreateWebUIForRenderFrameHost(
538 const GURL& url) override;
avallee0206f782016-07-28 18:55:33539 void SetFocusedFrame(FrameTreeNode* node, SiteInstance* source) override;
Avi Drissman36f801f2018-02-01 20:06:04540 void DidCallFocus() override;
avalleed68cdd12017-06-21 22:07:27541 RenderFrameHost* GetFocusedFrameIncludingInnerWebContents() override;
ekaramada110f642016-12-21 19:47:28542 void OnFocusedElementChangedInFrame(
543 RenderFrameHostImpl* frame,
544 const gfx::Rect& bounds_in_root_view) override;
Lucas Furukawa Gadaniabbfa342017-08-29 19:37:57545 void OnAdvanceFocus(RenderFrameHostImpl* source_rfh) override;
nick5ae4d2d2017-01-06 01:18:35546 void CreateNewWindow(
csharrison95f01e922017-04-24 18:52:35547 RenderFrameHost* opener,
nick5ae4d2d2017-01-06 01:18:35548 int32_t render_view_route_id,
549 int32_t main_frame_route_id,
550 int32_t main_frame_widget_route_id,
551 const mojom::CreateNewWindowParams& params,
552 SessionStorageNamespace* session_storage_namespace) override;
553 void ShowCreatedWindow(int process_id,
554 int main_frame_widget_route_id,
555 WindowOpenDisposition disposition,
556 const gfx::Rect& initial_rect,
557 bool user_gesture) override;
carloskd9d97942017-02-16 08:58:09558 void DidDisplayInsecureContent() override;
559 void DidRunInsecureContent(const GURL& security_origin,
560 const GURL& target_url) override;
561 void PassiveInsecureContentFound(const GURL& resource_url) override;
562 bool ShouldAllowRunningInsecureContent(content::WebContents* web_contents,
563 bool allowed_per_prefs,
564 const url::Origin& origin,
565 const GURL& resource_url) override;
Lukasz Anforowicze1b954d92017-10-30 21:28:06566 void ViewSource(RenderFrameHostImpl* frame) override;
Wei Li5bb659742018-02-14 03:07:58567 void PrintCrossProcessSubframe(const gfx::Rect& rect,
568 int document_cookie,
569 RenderFrameHost* render_frame_host) override;
rob.buis300b0872017-03-10 20:43:58570#if defined(OS_ANDROID)
571 base::android::ScopedJavaLocalRef<jobject> GetJavaRenderFrameHostDelegate()
572 override;
573#endif
John Abd-El-Malekd4882642017-12-04 21:45:19574 void SubresourceResponseStarted(const GURL& url,
575 const GURL& referrer,
576 const std::string& method,
577 ResourceType resource_type,
578 const std::string& ip,
579 net::CertStatus cert_status) override;
[email protected]952a68e2011-11-17 00:36:10580
[email protected]92404c62013-12-04 16:40:46581 // RenderViewHostDelegate ----------------------------------------------------
dchengc2282aa2014-10-21 12:07:58582 RenderViewHostDelegateView* GetDelegateView() override;
nicka0ac8382016-12-15 23:59:23583 bool OnMessageReceived(RenderViewHostImpl* render_view_host,
dchengc2282aa2014-10-21 12:07:58584 const IPC::Message& message) override;
[email protected]a86c0e962013-12-17 17:10:39585 // RenderFrameHostDelegate has the same method, so list it there because this
586 // interface is going away.
nick51208922015-04-24 21:38:37587 // WebContents* GetAsWebContents() override;
dchengc2282aa2014-10-21 12:07:58588 void RenderViewCreated(RenderViewHost* render_view_host) override;
589 void RenderViewReady(RenderViewHost* render_view_host) override;
590 void RenderViewTerminated(RenderViewHost* render_view_host,
591 base::TerminationStatus status,
592 int error_code) override;
593 void RenderViewDeleted(RenderViewHost* render_view_host) override;
sky8b00392d2015-01-10 00:30:28594 void UpdateTargetURL(RenderViewHost* render_view_host,
595 const GURL& url) override;
dchengc2282aa2014-10-21 12:07:58596 void Close(RenderViewHost* render_view_host) override;
597 void RequestMove(const gfx::Rect& new_bounds) override;
dchengc2282aa2014-10-21 12:07:58598 void DocumentAvailableInMainFrame(RenderViewHost* render_view_host) override;
599 void RouteCloseEvent(RenderViewHost* rvh) override;
avia90ae4e2016-11-11 20:49:33600 bool DidAddMessageToConsole(int32_t level,
601 const base::string16& message,
602 int32_t line_no,
603 const base::string16& source_id) override;
dchengc2282aa2014-10-21 12:07:58604 RendererPreferences GetRendererPrefs(
anand.ratn120b0b002014-10-07 15:49:32605 BrowserContext* browser_context) const override;
dominickn9c7ceaa32016-02-27 01:52:53606 void OnUserInteraction(RenderWidgetHostImpl* render_widget_host,
607 const blink::WebInputEvent::Type type) override;
dchengc2282aa2014-10-21 12:07:58608 void OnIgnoredUIEvent() override;
dchengc2282aa2014-10-21 12:07:58609 void Activate() override;
dchengc2282aa2014-10-21 12:07:58610 void UpdatePreferredSize(const gfx::Size& pref_size) override;
avib7348942015-12-25 20:57:10611 void CreateNewWidget(int32_t render_process_id,
612 int32_t route_id,
Dave Tapuska1bdf1832017-07-07 18:07:19613 mojom::WidgetPtr widget,
dchengc2282aa2014-10-21 12:07:58614 blink::WebPopupType popup_type) override;
avib7348942015-12-25 20:57:10615 void CreateNewFullscreenWidget(int32_t render_process_id,
Dave Tapuska1bdf1832017-07-07 18:07:19616 int32_t route_id,
617 mojom::WidgetPtr widget) override;
alexmosc2a8cec2016-05-23 22:19:53618 void ShowCreatedWidget(int process_id,
619 int route_id,
620 const gfx::Rect& initial_rect) override;
621 void ShowCreatedFullscreenWidget(int process_id, int route_id) override;
dchengc2282aa2014-10-21 12:07:58622 void RequestMediaAccessPermission(
[email protected]33662e52013-01-07 21:31:09623 const MediaStreamRequest& request,
anand.ratn120b0b002014-10-07 15:49:32624 const MediaResponseCallback& callback) override;
Chandan Padhia4b8bcb72017-09-12 16:41:04625 bool CheckMediaAccessPermission(const url::Origin& security_origin,
dchengc2282aa2014-10-21 12:07:58626 MediaStreamType type) override;
guidou8a440b842017-01-30 13:58:43627 std::string GetDefaultMediaDeviceID(MediaStreamType type) override;
dchengc2282aa2014-10-21 12:07:58628 SessionStorageNamespace* GetSessionStorageNamespace(
anand.ratn120b0b002014-10-07 15:49:32629 SiteInstance* instance) override;
dchengc2282aa2014-10-21 12:07:58630 SessionStorageNamespaceMap GetSessionStorageNamespaceMap() override;
mcnee336ea2c2017-05-23 22:50:59631#if !defined(OS_ANDROID)
avi85ee8362016-10-08 02:09:08632 double GetPendingPageZoomLevel() override;
mcnee336ea2c2017-05-23 22:50:59633#endif // !defined(OS_ANDROID)
dchengc2282aa2014-10-21 12:07:58634 FrameTree* GetFrameTree() override;
aelias5252baa2016-04-10 01:18:02635 bool IsOverridingUserAgent() override;
avi85ee8362016-10-08 02:09:08636 bool IsJavaScriptDialogShowing() const override;
avic031d392017-03-03 03:09:42637 bool ShouldIgnoreUnresponsiveRenderer() override;
qinmin72e8bd02016-10-21 19:35:37638 bool HideDownloadUI() const override;
mlamouri5cd9ae82017-02-18 11:05:09639 bool HasPersistentVideo() const override;
Alex Moshchuk27caae82017-09-11 23:11:18640 RenderFrameHost* GetPendingMainFrame() override;
lukendc35e7f2014-11-10 19:06:14641
[email protected]52913802013-12-10 05:52:18642 // NavigatorDelegate ---------------------------------------------------------
643
clamy0e119882015-07-31 16:12:33644 void DidStartNavigation(NavigationHandle* navigation_handle) override;
645 void DidRedirectNavigation(NavigationHandle* navigation_handle) override;
clamyefca29e2015-09-17 00:22:11646 void ReadyToCommitNavigation(NavigationHandle* navigation_handle) override;
clamy0e119882015-07-31 16:12:33647 void DidFinishNavigation(NavigationHandle* navigation_handle) override;
dchengc2282aa2014-10-21 12:07:58648 void DidFailLoadWithError(RenderFrameHostImpl* render_frame_host,
649 const GURL& url,
650 int error_code,
Yutaka Hirano16d3c5d2017-07-31 06:17:30651 const base::string16& error_description) override;
dchengc2282aa2014-10-21 12:07:58652 void DidNavigateMainFramePreCommit(bool navigation_is_within_page) override;
653 void DidNavigateMainFramePostCommit(
sky8b00392d2015-01-10 00:30:28654 RenderFrameHostImpl* render_frame_host,
[email protected]37567b432014-02-12 01:12:22655 const LoadCommittedDetails& details,
anand.ratn120b0b002014-10-07 15:49:32656 const FrameHostMsg_DidCommitProvisionalLoad_Params& params) override;
dchengc2282aa2014-10-21 12:07:58657 void DidNavigateAnyFramePostCommit(
[email protected]37567b432014-02-12 01:12:22658 RenderFrameHostImpl* render_frame_host,
659 const LoadCommittedDetails& details,
anand.ratn120b0b002014-10-07 15:49:32660 const FrameHostMsg_DidCommitProvisionalLoad_Params& params) override;
dchengc2282aa2014-10-21 12:07:58661 void SetMainFrameMimeType(const std::string& mime_type) override;
662 bool CanOverscrollContent() const override;
663 void NotifyChangedNavigationState(InvalidateTypes changed_flags) override;
toyoshim0df1d3a2016-09-09 09:52:48664 void DidStartNavigationToPendingEntry(const GURL& url,
665 ReloadType reload_type) override;
lukasza1d025732016-09-28 21:36:08666 bool ShouldTransferNavigation(bool is_main_frame_navigation) override;
dchengc2282aa2014-10-21 12:07:58667 bool ShouldPreserveAbortedURLs() override;
fdegansa696e5112015-04-17 01:57:59668 void DidStartLoading(FrameTreeNode* frame_tree_node,
669 bool to_different_document) override;
670 void DidStopLoading() override;
671 void DidChangeLoadProgress() override;
avid6d88b912017-01-13 00:16:00672 std::vector<std::unique_ptr<NavigationThrottle>> CreateThrottlesForNavigation(
clamycbf524d42016-09-27 12:48:35673 NavigationHandle* navigation_handle) override;
clamy1e5574e2016-09-29 16:48:44674 std::unique_ptr<NavigationUIData> GetNavigationUIData(
675 NavigationHandle* navigation_handle) override;
[email protected]52913802013-12-10 05:52:18676
[email protected]4ca76c02012-05-16 16:19:05677 // RenderWidgetHostDelegate --------------------------------------------------
678
lazyboy63f5b312015-11-23 20:19:52679 void RenderWidgetCreated(RenderWidgetHostImpl* render_widget_host) override;
dchengc2282aa2014-10-21 12:07:58680 void RenderWidgetDeleted(RenderWidgetHostImpl* render_widget_host) override;
miu9e14e492014-10-25 02:39:04681 void RenderWidgetGotFocus(RenderWidgetHostImpl* render_widget_host) override;
zijiehe3bee08e22017-05-17 04:14:46682 void RenderWidgetLostFocus(RenderWidgetHostImpl* render_widget_host) override;
rouslan2f5993f2015-01-29 00:18:31683 void RenderWidgetWasResized(RenderWidgetHostImpl* render_widget_host,
Christopher Cameron07f666b2018-02-13 23:41:19684 const ScreenInfo& screen_info,
rouslan2f5993f2015-01-29 00:18:31685 bool width_changed) override;
avic3aa8422015-11-09 20:57:22686 void ResizeDueToAutoResize(RenderWidgetHostImpl* render_widget_host,
Fady Samueld10aadd82017-11-03 18:23:57687 const gfx::Size& new_size,
688 uint64_t sequence_number) override;
kenrbe4f91082017-06-02 20:32:08689 gfx::Size GetAutoResizeSize() override;
690 void ResetAutoResizeSize() override;
skyf65d9bb2017-03-24 02:26:39691 KeyboardEventProcessingResult PreHandleKeyboardEvent(
692 const NativeWebKeyboardEvent& event) override;
dchengc2282aa2014-10-21 12:07:58693 void HandleKeyboardEvent(const NativeWebKeyboardEvent& event) override;
694 bool HandleWheelEvent(const blink::WebMouseWheelEvent& event) override;
695 bool PreHandleGestureEvent(const blink::WebGestureEvent& event) override;
dchengc2282aa2014-10-21 12:07:58696 BrowserAccessibilityManager* GetRootBrowserAccessibilityManager() override;
697 BrowserAccessibilityManager* GetOrCreateRootBrowserAccessibilityManager()
anand.ratn120b0b002014-10-07 15:49:32698 override;
lgarron145aaa82015-07-10 07:39:56699 // The following 4 functions are already listed under WebContents overrides:
mohsen7ab1ec16ec2015-07-02 18:26:23700 // void Cut() override;
701 // void Copy() override;
702 // void Paste() override;
lgarron145aaa82015-07-10 07:39:56703 // void SelectAll() override;
Dave Tapuskab336b922017-07-06 19:24:05704 void ExecuteEditCommand(const std::string& command,
705 const base::Optional<base::string16>& value) override;
mohsen7ab1ec16ec2015-07-02 18:26:23706 void MoveRangeSelectionExtent(const gfx::Point& extent) override;
707 void SelectRange(const gfx::Point& base, const gfx::Point& extent) override;
Dave Tapuskab336b922017-07-06 19:24:05708 void MoveCaret(const gfx::Point& extent) override;
Shimi Zhang37deeb22017-09-28 00:59:01709 void AdjustSelectionByCharacterOffset(int start_adjust,
710 int end_adjust,
711 bool show_selection_menu) override;
kenrb2a565f82015-09-02 20:24:59712 RenderWidgetHostInputEventRouter* GetInputEventRouter() override;
alexmos3fcd0ca2015-10-23 18:18:33713 void ReplicatePageFocus(bool is_focused) override;
alexmosc4cbacb2015-11-21 01:29:22714 RenderWidgetHostImpl* GetFocusedRenderWidgetHost(
715 RenderWidgetHostImpl* receiving_widget) override;
avallee9993fca2016-11-17 06:16:50716 RenderWidgetHostImpl* GetRenderWidgetHostWithPageFocus() override;
717 void FocusOwningWebContents(
718 RenderWidgetHostImpl* render_widget_host) override;
avice799302017-03-09 16:34:59719 void RendererUnresponsive(RenderWidgetHostImpl* render_widget_host) override;
avic3aa8422015-11-09 20:57:22720 void RendererResponsive(RenderWidgetHostImpl* render_widget_host) override;
721 void RequestToLockMouse(RenderWidgetHostImpl* render_widget_host,
722 bool user_gesture,
lfgad8244352016-07-13 16:55:51723 bool last_unlocked_by_target,
724 bool privileged) override;
avi0720b02e2017-06-13 03:22:13725 // The following function is already listed under WebContents overrides:
726 // bool IsFullscreenForCurrentTab() const override;
avibf58fa0c2015-11-11 01:45:52727 blink::WebDisplayMode GetDisplayMode(
728 RenderWidgetHostImpl* render_widget_host) const override;
avi3e4b8512015-11-11 01:55:49729 void LostCapture(RenderWidgetHostImpl* render_widget_host) override;
730 void LostMouseLock(RenderWidgetHostImpl* render_widget_host) override;
lfgad8244352016-07-13 16:55:51731 bool HasMouseLock(RenderWidgetHostImpl* render_widget_host) override;
lfg84763c92017-02-16 18:55:15732 RenderWidgetHostImpl* GetMouseLockWidget() override;
ekaramada4f42692016-02-11 19:48:37733 void OnRenderFrameProxyVisibilityChanged(bool visible) override;
lfgbb9c28a2016-03-01 03:19:49734 void SendScreenRects() override;
ekaramadadd882292016-06-08 15:22:56735 TextInputManager* GetTextInputManager() override;
paulmeyer7f6f1d4f2016-11-15 00:00:27736 bool OnUpdateDragCursor() override;
kenrb11f213a2017-03-24 18:12:06737 bool IsWidgetForMainFrame(RenderWidgetHostImpl* render_widget_host) override;
nzolghadrd87a308d2016-12-07 15:45:56738 bool AddDomainInfoToRapporSample(rappor::Sample* sample) override;
nzolghadrbbffc6c2017-05-25 17:56:39739 void UpdateUrlForUkmSource(ukm::UkmRecorder* service,
740 ukm::SourceId ukm_source_id) override;
ekaramada110f642016-12-21 19:47:28741 void FocusedNodeTouched(bool editable) override;
samans90fb8162017-04-04 22:30:45742 void DidReceiveCompositorFrame() override;
ekaramadf6750aa2017-06-06 18:29:42743 bool IsShowingContextMenuOnPage() const override;
[email protected]4ca76c02012-05-16 16:19:05744
[email protected]b0936d22013-11-28 06:47:36745 // RenderFrameHostManager::Delegate ------------------------------------------
[email protected]0bfbf882011-12-22 18:19:27746
dchengc2282aa2014-10-21 12:07:58747 bool CreateRenderViewForRenderManager(
[email protected]bffc8302014-01-23 20:52:16748 RenderViewHost* render_view_host,
alexmos5ac402d2015-07-09 07:51:10749 int opener_frame_routing_id,
[email protected]5a7100d2014-05-19 01:29:04750 int proxy_routing_id,
Pavel Feldman25234722017-10-11 02:49:06751 const base::UnguessableToken& devtools_frame_token,
lfgbede6392015-09-11 21:54:06752 const FrameReplicationState& replicated_frame_state) override;
753 void CreateRenderWidgetHostViewForRenderManager(
754 RenderViewHost* render_view_host) override;
alexmosa181efc2015-09-03 00:39:04755 bool CreateRenderFrameForRenderManager(
756 RenderFrameHost* render_frame_host,
757 int proxy_routing_id,
758 int opener_routing_id,
759 int parent_routing_id,
760 int previous_sibling_routing_id) override;
dchengc2282aa2014-10-21 12:07:58761 void BeforeUnloadFiredFromRenderManager(
762 bool proceed,
763 const base::TimeTicks& proceed_time,
anand.ratn120b0b002014-10-07 15:49:32764 bool* proceed_to_fire_unload) override;
dchengc2282aa2014-10-21 12:07:58765 void RenderProcessGoneFromRenderManager(
anand.ratn120b0b002014-10-07 15:49:32766 RenderViewHost* render_view_host) override;
Jianzhou Fengd8720c72018-01-18 03:06:30767 void UpdateRenderViewSizeForRenderManager(bool is_main_frame) override;
dchengc2282aa2014-10-21 12:07:58768 void CancelModalDialogsForRenderManager() override;
769 void NotifySwappedFromRenderManager(RenderFrameHost* old_host,
770 RenderFrameHost* new_host,
771 bool is_main_frame) override;
naskof5940b9f2015-03-02 23:04:05772 void NotifyMainFrameSwappedFromRenderManager(
773 RenderViewHost* old_host,
774 RenderViewHost* new_host) override;
dchengc2282aa2014-10-21 12:07:58775 NavigationControllerImpl& GetControllerForRenderManager() override;
dchengc2282aa2014-10-21 12:07:58776 NavigationEntry* GetLastCommittedNavigationEntryForRenderManager() override;
creisadca9862017-06-16 19:12:11777 InterstitialPageImpl* GetInterstitialForRenderManager() override;
dchengc2282aa2014-10-21 12:07:58778 bool FocusLocationBarByDefault() override;
779 void SetFocusToLocationBar(bool select_all) override;
780 bool IsHidden() override;
rob97250742015-12-10 17:45:15781 int GetOuterDelegateFrameTreeNodeId() override;
ekaramadaeb3c5c2016-11-09 03:22:35782 RenderWidgetHostImpl* GetFullscreenRenderWidgetHost() const override;
[email protected]0bfbf882011-12-22 18:19:27783
Joel Hockey163835a2017-12-20 11:51:57784 // blink::mojom::ColorChooserFactory ---------------------------------------
Joel Hockey85b379d2017-12-11 10:42:13785
Joel Hockey163835a2017-12-20 11:51:57786 void OnColorChooserFactoryRequest(
787 blink::mojom::ColorChooserFactoryRequest request);
Joel Hockey85b379d2017-12-11 10:42:13788 void OpenColorChooser(
Joel Hockey163835a2017-12-20 11:51:57789 blink::mojom::ColorChooserRequest chooser,
790 blink::mojom::ColorChooserClientPtr client,
Joel Hockey85b379d2017-12-11 10:42:13791 SkColor color,
Joel Hockey163835a2017-12-20 11:51:57792 std::vector<blink::mojom::ColorSuggestionPtr> suggestions) override;
Joel Hockey85b379d2017-12-11 10:42:13793
[email protected]8ff00d72012-10-23 19:12:21794 // NotificationObserver ------------------------------------------------------
[email protected]14392a52012-05-02 20:28:44795
dchengc2282aa2014-10-21 12:07:58796 void Observe(int type,
797 const NotificationSource& source,
798 const NotificationDetails& details) override;
[email protected]14392a52012-05-02 20:28:44799
[email protected]ec6c05f2013-10-23 18:41:57800 // NavigationControllerDelegate ----------------------------------------------
801
dchengc2282aa2014-10-21 12:07:58802 WebContents* GetWebContents() override;
803 void NotifyNavigationEntryCommitted(
anand.ratn120b0b002014-10-07 15:49:32804 const LoadCommittedDetails& load_details) override;
Sam McNally5c087a32017-08-25 01:46:14805 void NotifyNavigationEntryChanged(
806 const EntryChangedDetails& change_details) override;
807 void NotifyNavigationListPruned(const PrunedDetails& pruned_details) override;
[email protected]ec6c05f2013-10-23 18:41:57808
809 // Invoked before a form repost warning is shown.
dchengc2282aa2014-10-21 12:07:58810 void NotifyBeforeFormRepostWarningShow() override;
[email protected]ec6c05f2013-10-23 18:41:57811
812 // Activate this WebContents and show a form repost warning.
dchengc2282aa2014-10-21 12:07:58813 void ActivateAndShowRepostFormWarningDialog() override;
[email protected]ec6c05f2013-10-23 18:41:57814
[email protected]b4c84012014-04-28 19:51:10815 // Whether the initial empty page of this view has been accessed by another
816 // page, making it unsafe to show the pending URL. Always false after the
817 // first commit.
dchengc2282aa2014-10-21 12:07:58818 bool HasAccessedInitialDocument() override;
[email protected]b4c84012014-04-28 19:51:10819
avi2b177592014-12-10 02:08:02820 // Sets the history for this WebContentsImpl to |history_length| entries, with
alexmos136fd6e62016-08-15 20:58:41821 // an offset of |history_offset|. This notifies all renderers involved in
822 // rendering the current page about the new offset and length.
avi2b177592014-12-10 02:08:02823 void SetHistoryOffsetAndLength(int history_offset,
824 int history_length) override;
[email protected]553602e12011-04-05 17:01:18825
[email protected]a86c0e962013-12-17 17:10:39826 // Called by InterstitialPageImpl when it creates a RenderFrameHost.
dchengc2282aa2014-10-21 12:07:58827 void RenderFrameForInterstitialPageCreated(
anand.ratn120b0b002014-10-07 15:49:32828 RenderFrameHost* render_frame_host) override;
[email protected]561628ce2013-10-25 00:56:47829
830 // Sets the passed interstitial as the currently showing interstitial.
831 // No interstitial page should already be attached.
dchengc2282aa2014-10-21 12:07:58832 void AttachInterstitialPage(InterstitialPageImpl* interstitial_page) override;
[email protected]561628ce2013-10-25 00:56:47833
Becca Hughes9f6fd4b82017-06-15 10:01:40834 void MediaMutedStatusChanged(const WebContentsObserver::MediaPlayerId& id,
835 bool muted);
836
[email protected]561628ce2013-10-25 00:56:47837 // Unsets the currently showing interstitial.
Lucas Furukawa Gadani7f1241d2017-07-12 01:45:04838 void DetachInterstitialPage(bool has_focus) override;
[email protected]561628ce2013-10-25 00:56:47839
aelias5252baa2016-04-10 01:18:02840 void UpdateOverridingUserAgent() override;
841
clamy44e84ce2016-02-22 15:38:25842 // Unpause the throbber if it was paused.
843 void DidProceedOnInterstitial() override;
[email protected]561628ce2013-10-25 00:56:47844
[email protected]e4abd3b42013-11-12 18:28:47845 typedef base::Callback<void(WebContents*)> CreatedCallback;
[email protected]561628ce2013-10-25 00:56:47846
[email protected]34ff1cfc2014-08-20 06:16:05847 // Forces overscroll to be disabled (used by touch emulation).
848 void SetForceDisableOverscrollContent(bool force_disable);
849
Jianzhou Fengd8720c72018-01-18 03:06:30850 // Override the render view/widget size of the main frame, return whether the
851 // size changed.
852 bool SetDeviceEmulationSize(const gfx::Size& new_size);
853 void ClearDeviceEmulationSize();
854
avayvodcc85bbd2015-08-28 19:11:15855 AudioStreamMonitor* audio_stream_monitor() {
856 return &audio_stream_monitor_;
dalecurtisbc6572e12014-09-12 19:22:30857 }
858
dalecurtis88c240072015-12-09 02:11:18859 // Called by MediaWebContentsObserver when playback starts or stops. See the
860 // WebContentsObserver function stubs for more details.
billorr21c005d2016-11-17 03:57:04861 void MediaStartedPlaying(
862 const WebContentsObserver::MediaPlayerInfo& media_info,
863 const WebContentsObserver::MediaPlayerId& id);
864 void MediaStoppedPlaying(
865 const WebContentsObserver::MediaPlayerInfo& media_info,
Becca Hughes220bfc102017-11-14 18:24:07866 const WebContentsObserver::MediaPlayerId& id,
867 WebContentsObserver::MediaStoppedReason reason);
peconn257951522017-06-09 18:24:59868 // This will be called before playback is started, check
869 // GetCurrentlyPlayingVideoCount if you need this when playback starts.
870 void MediaResized(const gfx::Size& size,
871 const WebContentsObserver::MediaPlayerId& id);
Peter E Conneccb34c22017-09-08 09:37:58872 void MediaEffectivelyFullscreenChanged(bool is_fullscreen);
billorr21c005d2016-11-17 03:57:04873
peconn257951522017-06-09 18:24:59874 int GetCurrentlyPlayingVideoCount() override;
Peter Conn31c726a2017-08-17 11:07:34875 base::Optional<gfx::Size> GetFullscreenVideoSize() override;
billorr21c005d2016-11-17 03:57:04876 bool IsFullscreen() override;
dalecurtisbc6572e12014-09-12 19:22:30877
qinmin58567c82015-01-07 21:00:20878 MediaWebContentsObserver* media_web_contents_observer() {
879 return media_web_contents_observer_.get();
880 }
qinmin58567c82015-01-07 21:00:20881
tapted65ff2ea72016-03-01 23:39:00882 // Update the web contents visibility.
883 void UpdateWebContentsVisibility(bool visible);
884
paulmeyerc0b762b2016-04-13 11:55:17885 // Called by FindRequestManager when find replies come in from a renderer
886 // process.
887 void NotifyFindReply(int request_id,
888 int number_of_matches,
889 const gfx::Rect& selection_rect,
890 int active_match_ordinal,
891 bool final_update);
892
ortuno467e5792016-06-10 04:32:39893 // Modify the counter of connected devices for this WebContents.
894 void IncrementBluetoothConnectedDeviceCount();
895 void DecrementBluetoothConnectedDeviceCount();
896
mlamouri5cd9ae82017-02-18 11:05:09897 // Called when the WebContents gains or loses a persistent video.
zqzhang8ac49002017-03-16 21:51:35898 void SetHasPersistentVideo(bool has_persistent_video);
mlamouri5cd9ae82017-02-18 11:05:09899
mlamourie52c1b542017-02-23 14:57:50900 // Whether the WebContents has an active player is effectively fullscreen.
901 // That means that the video is either fullscreen or it is the content of
902 // a fullscreen page (in other words, a fullscreen video with custom
903 // controls).
904 // |IsFullscreen| must return |true| when this method is called.
905 bool HasActiveEffectivelyFullscreenVideo() const;
906
lfg1453e412017-04-11 00:48:50907 // When inner or outer WebContents are present, become the focused
908 // WebContentsImpl. This will activate this content's main frame RenderWidget
909 // and indirectly all its subframe widgets. GetFocusedRenderWidgetHost will
910 // search this WebContentsImpl for a focused RenderWidgetHost. The previously
911 // focused WebContentsImpl, if any, will have its RenderWidgetHosts
912 // deactivated.
913 void SetAsFocusedWebContentsIfNecessary();
914
paulmeyerfeafc2d2017-04-25 21:46:40915 // Called by this WebContents's BrowserPluginGuest (if one exists) to indicate
916 // that the guest will be detached.
917 void BrowserPluginGuestWillDetach();
918
paulmeyerc0b762b2016-04-13 11:55:17919#if defined(OS_ANDROID)
920 // Called by FindRequestManager when all of the find match rects are in.
921 void NotifyFindMatchRectsReply(int version,
922 const std::vector<gfx::RectF>& rects,
923 const gfx::RectF& active_rect);
924#endif
925
lof84501da082016-05-23 21:22:54926 private:
[email protected]8ff00d72012-10-23 19:12:21927 friend class WebContentsObserver;
928 friend class WebContents; // To implement factory methods.
[email protected]0dd3a0ab2011-02-18 08:17:44929
[email protected]2db9bd72012-04-13 20:20:56930 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, NoJSMessageOnInterstitials);
931 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, UpdateTitle);
[email protected]45a22ad2013-02-21 03:25:00932 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, FindOpenerRVHWhenPending);
[email protected]2db9bd72012-04-13 20:20:56933 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest,
934 CrossSiteCantPreemptAfterUnload);
nick5ae4d2d2017-01-06 01:18:35935 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, PendingContentsDestroyed);
936 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, PendingContentsShown);
[email protected]50904452013-05-09 02:05:12937 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, FrameTreeShape);
[email protected]9a890452014-02-13 22:21:02938 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, GetLastActiveTime);
estarka5635c42015-07-14 00:06:53939 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest,
940 LoadResourceFromMemoryCacheWithBadSecurityInfo);
jwwf4684d12015-09-02 06:12:52941 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest,
jam91dd24e2016-08-12 17:16:42942 LoadResourceWithEmptySecurityInfo);
avid53461d2016-02-25 17:15:04943 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest,
944 ResetJavaScriptDialogOnUserNavigate);
Megan Jablonski2f6a4c52017-07-10 23:01:25945 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, ParseDownloadHeaders);
[email protected]0dd3a0ab2011-02-18 08:17:44946 FRIEND_TEST_ALL_PREFIXES(FormStructureBrowserTest, HTMLFiles);
947 FRIEND_TEST_ALL_PREFIXES(NavigationControllerTest, HistoryNavigate);
[email protected]b0936d22013-11-28 06:47:36948 FRIEND_TEST_ALL_PREFIXES(RenderFrameHostManagerTest, PageDoesBackAndReload);
[email protected]de3c5d82014-05-28 22:12:59949 FRIEND_TEST_ALL_PREFIXES(SitePerProcessBrowserTest, CrossSiteIframe);
alexmosc2a8cec2016-05-23 22:19:53950 FRIEND_TEST_ALL_PREFIXES(SitePerProcessBrowserTest,
951 TwoSubframesCreatePopupsSimultaneously);
952 FRIEND_TEST_ALL_PREFIXES(SitePerProcessBrowserTest,
953 TwoSubframesCreatePopupMenuWidgetsSimultaneously);
dmazzoni0b5d2482014-09-10 19:45:57954 FRIEND_TEST_ALL_PREFIXES(SitePerProcessAccessibilityBrowserTest,
955 CrossSiteIframeAccessibility);
avic529387b2016-04-06 16:14:53956 FRIEND_TEST_ALL_PREFIXES(WebContentsImplBrowserTest,
957 JavaScriptDialogsInMainAndSubframes);
avi0720b02e2017-06-13 03:22:13958 FRIEND_TEST_ALL_PREFIXES(WebContentsImplBrowserTest,
959 DialogsFromJavaScriptEndFullscreen);
Avi Drissmanba3b1b342017-08-29 18:16:13960 FRIEND_TEST_ALL_PREFIXES(WebContentsImplBrowserTest,
961 PopupsFromJavaScriptEndFullscreen);
Avi Drissman36f801f2018-02-01 20:06:04962 FRIEND_TEST_ALL_PREFIXES(WebContentsImplBrowserTest,
963 FocusFromJavaScriptEndsFullscreen);
avi2d7d2c32017-03-15 21:55:02964 FRIEND_TEST_ALL_PREFIXES(RenderFrameHostImplBrowserTest,
965 IframeBeforeUnloadParentHang);
avi336125f72017-05-06 22:25:40966 FRIEND_TEST_ALL_PREFIXES(RenderFrameHostImplBrowserTest,
967 BeforeUnloadDialogRequiresGesture);
Charles Reis15d60b132017-11-03 17:43:47968 FRIEND_TEST_ALL_PREFIXES(RenderFrameHostImplBrowserTest,
969 CancelBeforeUnloadResetsURL);
Pavel Feldman3c1842b2017-08-02 05:00:16970 FRIEND_TEST_ALL_PREFIXES(DevToolsProtocolTest, JavaScriptDialogNotifications);
971 FRIEND_TEST_ALL_PREFIXES(DevToolsProtocolTest, JavaScriptDialogInterop);
972 FRIEND_TEST_ALL_PREFIXES(DevToolsProtocolTest, BeforeUnloadDialog);
Pavel Feldmanfab3cb62017-10-05 01:02:01973 FRIEND_TEST_ALL_PREFIXES(DevToolsProtocolTest, PageDisableWithOpenedDialog);
974 FRIEND_TEST_ALL_PREFIXES(DevToolsProtocolTest,
975 PageDisableWithNoDialogManager);
[email protected]0dd3a0ab2011-02-18 08:17:44976
paulmeyera41de3b2016-05-05 16:30:18977 // So |find_request_manager_| can be accessed for testing.
978 friend class FindRequestManagerTest;
979
[email protected]80e776ae2012-03-23 16:17:20980 // TODO(brettw) TestWebContents shouldn't exist!
[email protected]8ff00d72012-10-23 19:12:21981 friend class TestWebContents;
[email protected]0dd3a0ab2011-02-18 08:17:44982
[email protected]7fff43e2013-05-21 20:21:10983 class DestructionObserver;
984
lazyboy6ec48b2a2015-06-29 15:18:14985 // Represents a WebContents node in a tree of WebContents structure.
986 //
987 // Two WebContents with separate FrameTrees can be connected by
988 // outer/inner relationship using this class. Note that their FrameTrees
989 // still remain disjoint.
990 // The parent is referred to as "outer WebContents" and the descendents are
991 // referred to as "inner WebContents".
992 // For each inner WebContents, the outer WebContents will have a
993 // corresponding FrameTreeNode.
lfga3e2bdc2017-03-07 20:44:01994 class WebContentsTreeNode final : public FrameTreeNode::Observer {
lazyboy6ec48b2a2015-06-29 15:18:14995 public:
lfg601233692017-03-06 22:45:44996 explicit WebContentsTreeNode(WebContentsImpl* current_web_contents);
lfga3e2bdc2017-03-07 20:44:01997 ~WebContentsTreeNode() final;
lazyboy6ec48b2a2015-06-29 15:18:14998
lazyboy6ec48b2a2015-06-29 15:18:14999 void ConnectToOuterWebContents(WebContentsImpl* outer_web_contents,
1000 RenderFrameHostImpl* outer_contents_frame);
1001
lfg601233692017-03-06 22:45:441002 WebContentsImpl* outer_web_contents() const { return outer_web_contents_; }
avallee0206f782016-07-28 18:55:331003 int outer_contents_frame_tree_node_id() const {
lazyboy6ec48b2a2015-06-29 15:18:141004 return outer_contents_frame_tree_node_id_;
1005 }
lfga3e2bdc2017-03-07 20:44:011006 FrameTreeNode* OuterContentsFrameTreeNode() const;
lazyboy6ec48b2a2015-06-29 15:18:141007
avallee0206f782016-07-28 18:55:331008 WebContentsImpl* focused_web_contents() { return focused_web_contents_; }
1009 void SetFocusedWebContents(WebContentsImpl* web_contents);
1010
paulmeyerfeafc2d2017-04-25 21:46:401011 // Returns the inner WebContents within |frame|, if one exists, or nullptr
1012 // otherwise.
1013 WebContentsImpl* GetInnerWebContentsInFrame(const FrameTreeNode* frame);
1014
1015 const std::vector<WebContentsImpl*>& inner_web_contents() const;
1016
lazyboy6ec48b2a2015-06-29 15:18:141017 private:
paulmeyerfeafc2d2017-04-25 21:46:401018 void AttachInnerWebContents(WebContentsImpl* inner_web_contents);
1019 void DetachInnerWebContents(WebContentsImpl* inner_web_contents);
1020
lfga3e2bdc2017-03-07 20:44:011021 // FrameTreeNode::Observer implementation.
1022 void OnFrameTreeNodeDestroyed(FrameTreeNode* node) final;
lfg601233692017-03-06 22:45:441023
1024 // The WebContents that owns this WebContentsTreeNode.
1025 WebContentsImpl* const current_web_contents_;
1026
1027 // The outer WebContents of |current_web_contents_|, or nullptr if
1028 // |current_web_contents_| is the outermost WebContents.
lazyboy6ec48b2a2015-06-29 15:18:141029 WebContentsImpl* outer_web_contents_;
lfg601233692017-03-06 22:45:441030
1031 // The ID of the FrameTreeNode in the |outer_web_contents_| that hosts
1032 // |current_web_contents_| as an inner WebContents.
lazyboy6ec48b2a2015-06-29 15:18:141033 int outer_contents_frame_tree_node_id_;
lfg601233692017-03-06 22:45:441034
paulmeyerfeafc2d2017-04-25 21:46:401035 // List of inner WebContents that we host.
1036 std::vector<WebContentsImpl*> inner_web_contents_;
1037
avallee0206f782016-07-28 18:55:331038 // Only the root node should have this set. This indicates the WebContents
1039 // whose frame tree has the focused frame. The WebContents tree could be
1040 // arbitrarily deep.
1041 WebContentsImpl* focused_web_contents_;
lazyboy6ec48b2a2015-06-29 15:18:141042 };
1043
[email protected]d1198fd2012-08-13 22:50:191044 // See WebContents::Create for a description of these parameters.
Lukasz Anforowicze9ae3722017-09-29 17:37:381045 explicit WebContentsImpl(BrowserContext* browser_context);
[email protected]d1198fd2012-08-13 22:50:191046
[email protected]e2225bf2013-11-15 16:09:381047 // Add and remove observers for page navigation notifications. The order in
1048 // which notifications are sent to observers is undefined. Clients must be
1049 // sure to remove the observer before they go away.
[email protected]8ff00d72012-10-23 19:12:211050 void AddObserver(WebContentsObserver* observer);
1051 void RemoveObserver(WebContentsObserver* observer);
[email protected]d1198fd2012-08-13 22:50:191052
alexmose201c7cd2015-06-10 17:14:211053 // Clears a pending contents that has been closed before being shown.
[email protected]7fff43e2013-05-21 20:21:101054 void OnWebContentsDestroyed(WebContentsImpl* web_contents);
1055
1056 // Creates and adds to the map a destruction observer watching |web_contents|.
1057 // No-op if such an observer already exists.
1058 void AddDestructionObserver(WebContentsImpl* web_contents);
1059
1060 // Deletes and removes from the map a destruction observer
1061 // watching |web_contents|. No-op if there is no such observer.
1062 void RemoveDestructionObserver(WebContentsImpl* web_contents);
[email protected]14392a52012-05-02 20:28:441063
[email protected]de3c5d82014-05-28 22:12:591064 // Traverses all the RenderFrameHosts in the FrameTree and creates a set
[email protected]948481d2014-06-11 18:32:221065 // all the unique RenderWidgetHostViews.
1066 std::set<RenderWidgetHostView*> GetRenderWidgetHostViewsInTree();
[email protected]de3c5d82014-05-28 22:12:591067
Francois Doray18800972017-08-25 22:38:581068 // Calls WasUnOccluded() on all RenderWidgetHostViews in the frame tree.
1069 void DoWasUnOccluded();
1070
pkotwicz75ca8ffd2016-02-16 23:10:191071 // Called with the result of a DownloadImage() request.
1072 void OnDidDownloadImage(const ImageDownloadCallback& callback,
1073 int id,
1074 const GURL& image_url,
leon.hancbc4bc3c2016-02-26 07:08:521075 int32_t http_status_code,
leon.hanc2228532016-08-16 05:59:181076 const std::vector<SkBitmap>& images,
1077 const std::vector<gfx::Size>& original_image_sizes);
pkotwicz75ca8ffd2016-02-16 23:10:191078
Pavel Feldman3c1842b2017-08-02 05:00:161079 // Callback function when showing JavaScript dialogs. Takes in a routing ID
[email protected]6fba26d2014-04-29 09:38:281080 // pair to identify the RenderFrameHost that opened the dialog, because it's
1081 // possible for the RenderFrameHost to be deleted by the time this is called.
1082 void OnDialogClosed(int render_process_id,
1083 int render_frame_id,
[email protected]51da7e32012-01-30 19:24:521084 IPC::Message* reply_msg,
[email protected]87de04b02014-04-08 22:14:491085 bool dialog_was_suppressed,
[email protected]51da7e32012-01-30 19:24:521086 bool success,
[email protected]fcf75d42013-12-03 20:11:261087 const base::string16& user_input);
[email protected]51da7e32012-01-30 19:24:521088
[email protected]d0759f492012-04-19 22:50:501089 // IPC message handlers.
nicka0ac8382016-12-15 23:59:231090 void OnThemeColorChanged(RenderFrameHostImpl* source, SkColor theme_color);
1091 void OnDidLoadResourceFromMemoryCache(RenderFrameHostImpl* source,
1092 const GURL& url,
[email protected]70435962011-08-02 20:13:281093 const std::string& http_request,
[email protected]6d6cfb3a2012-05-23 22:53:181094 const std::string& mime_type,
[email protected]6c1e05212014-07-31 00:59:401095 ResourceType resource_type);
nicka0ac8382016-12-15 23:59:231096 void OnDidDisplayInsecureContent(RenderFrameHostImpl* source);
elawrenceb2ac2a232017-03-27 21:46:251097 void OnDidContainInsecureFormAction(RenderFrameHostImpl* source);
nicka0ac8382016-12-15 23:59:231098 void OnDidRunInsecureContent(RenderFrameHostImpl* source,
1099 const GURL& security_origin,
[email protected]0dd3a0ab2011-02-18 08:17:441100 const GURL& target_url);
Zhuoyu Qian4353f7f2018-01-08 05:33:001101 void OnDidDisplayContentWithCertificateErrors(RenderFrameHostImpl* source);
1102 void OnDidRunContentWithCertificateErrors(RenderFrameHostImpl* source);
nicka0ac8382016-12-15 23:59:231103 void OnDocumentLoadedInFrame(RenderFrameHostImpl* source);
1104 void OnDidFinishLoad(RenderFrameHostImpl* source, const GURL& url);
1105 void OnGoToEntryAtOffset(RenderViewHostImpl* source, int offset);
1106 void OnUpdateZoomLimits(RenderViewHostImpl* source,
1107 int minimum_percent,
[email protected]fce823222014-05-30 16:24:301108 int maximum_percent);
nicka0ac8382016-12-15 23:59:231109 void OnPageScaleFactorChanged(RenderViewHostImpl* source,
1110 float page_scale_factor);
1111 void OnEnumerateDirectory(RenderViewHostImpl* source,
1112 int request_id,
1113 const base::FilePath& path);
[email protected]b7a756d42012-01-23 18:08:171114
nicka0ac8382016-12-15 23:59:231115 void OnRegisterProtocolHandler(RenderFrameHostImpl* source,
1116 const std::string& protocol,
[email protected]7d189022011-08-25 22:54:201117 const GURL& url,
[email protected]fcf75d42013-12-03 20:11:261118 const base::string16& title,
[email protected]3a3b75a2012-06-01 08:38:361119 bool user_gesture);
nicka0ac8382016-12-15 23:59:231120 void OnUnregisterProtocolHandler(RenderFrameHostImpl* source,
1121 const std::string& protocol,
[email protected]f5273e52014-07-14 16:30:201122 const GURL& url,
1123 bool user_gesture);
nicka0ac8382016-12-15 23:59:231124 void OnFindReply(RenderFrameHostImpl* source,
1125 int request_id,
[email protected]59363fc92012-09-05 03:46:311126 int number_of_matches,
1127 const gfx::Rect& selection_rect,
1128 int active_match_ordinal,
[email protected]b888919c2011-09-02 00:32:161129 bool final_update);
mfomitchev2b8b066a2016-01-28 19:23:151130#if defined(OS_ANDROID)
nicka0ac8382016-12-15 23:59:231131 void OnFindMatchRectsReply(RenderFrameHostImpl* source,
1132 int version,
[email protected]59363fc92012-09-05 03:46:311133 const std::vector<gfx::RectF>& rects,
1134 const gfx::RectF& active_rect);
nicka0ac8382016-12-15 23:59:231135 void OnGetNearestFindResultReply(RenderFrameHostImpl* source,
1136 int request_id,
1137 float distance);
[email protected]1ff427972013-02-07 21:14:071138 void OnOpenDateTimeDialog(
nicka0ac8382016-12-15 23:59:231139 RenderViewHostImpl* source,
[email protected]1ff427972013-02-07 21:14:071140 const ViewHostMsg_DateTimeDialogValue_Params& value);
[email protected]59363fc92012-09-05 03:46:311141#endif
nicka0ac8382016-12-15 23:59:231142 void OnDomOperationResponse(RenderFrameHostImpl* source,
1143 const std::string& json_string);
1144 void OnAppCacheAccessed(RenderViewHostImpl* source,
1145 const GURL& manifest_url,
1146 bool blocked_by_policy);
nicka0ac8382016-12-15 23:59:231147 void OnUpdatePageImportanceSignals(RenderFrameHostImpl* source,
1148 const PageImportanceSignals& signals);
brettw4b461082016-11-19 18:55:161149#if BUILDFLAG(ENABLE_PLUGINS)
nicka0ac8382016-12-15 23:59:231150 void OnPepperInstanceCreated(RenderFrameHostImpl* source,
1151 int32_t pp_instance);
1152 void OnPepperInstanceDeleted(RenderFrameHostImpl* source,
1153 int32_t pp_instance);
1154 void OnPepperPluginHung(RenderFrameHostImpl* source,
1155 int plugin_child_id,
tommyclie6633ca72014-10-31 00:40:421156 const base::FilePath& path,
1157 bool is_hung);
nicka0ac8382016-12-15 23:59:231158 void OnPepperStartsPlayback(RenderFrameHostImpl* source, int32_t pp_instance);
1159 void OnPepperStopsPlayback(RenderFrameHostImpl* source, int32_t pp_instance);
1160 void OnPluginCrashed(RenderFrameHostImpl* source,
1161 const base::FilePath& plugin_path,
tommyclie6633ca72014-10-31 00:40:421162 base::ProcessId plugin_pid);
nicka0ac8382016-12-15 23:59:231163 void OnRequestPpapiBrokerPermission(RenderViewHostImpl* source,
1164 int ppb_broker_route_id,
[email protected]d8415ad92012-08-23 14:40:501165 const GURL& url,
[email protected]2dec8ec2013-02-07 19:20:341166 const base::FilePath& plugin_path);
tommyclie6633ca72014-10-31 00:40:421167
1168 // Callback function when requesting permission to access the PPAPI broker.
1169 // |result| is true if permission was granted.
nicka0ac8382016-12-15 23:59:231170 void SendPpapiBrokerPermissionResult(int process_id,
1171 int ppb_broker_route_id,
1172 bool result);
tommyclie6633ca72014-10-31 00:40:421173
fsamuel833ee7c2015-02-13 23:40:401174 void OnBrowserPluginMessage(RenderFrameHost* render_frame_host,
1175 const IPC::Message& message);
brettw4b461082016-11-19 18:55:161176#endif // BUILDFLAG(ENABLE_PLUGINS)
lukasza178ff092017-06-07 23:39:501177 void OnUpdateFaviconURL(RenderFrameHostImpl* source,
nicka0ac8382016-12-15 23:59:231178 const std::vector<FaviconURL>& candidates);
1179 void OnFirstVisuallyNonEmptyPaint(RenderViewHostImpl* source);
1180 void OnShowValidationMessage(RenderViewHostImpl* source,
1181 const gfx::Rect& anchor_in_root_view,
[email protected]6ff9c8f2013-12-20 09:05:291182 const base::string16& main_text,
1183 const base::string16& sub_text);
nicka0ac8382016-12-15 23:59:231184 void OnHideValidationMessage(RenderViewHostImpl* source);
1185 void OnMoveValidationMessage(RenderViewHostImpl* source,
1186 const gfx::Rect& anchor_in_root_view);
[email protected]edc3af82013-12-12 21:24:071187
[email protected]0dd3a0ab2011-02-18 08:17:441188 // Called by derived classes to indicate that we're no longer waiting for a
Evan Stade5e750ad02017-08-07 21:59:271189 // response. Will inform |delegate_| of the change in status so that it may,
1190 // for example, update the throbber.
1191 void SetNotWaitingForResponse();
[email protected]0dd3a0ab2011-02-18 08:17:441192
avallee9993fca2016-11-17 06:16:501193 // Inner WebContents Helpers -------------------------------------------------
1194 //
1195 // These functions are helpers in managing a hierarchy of WebContents
1196 // involved in rendering inner WebContents.
1197
1198 // When multiple WebContents are present within a tab or window, a single one
1199 // is focused and will route keyboard events in most cases to a RenderWidget
1200 // contained within it. |GetFocusedWebContents()|'s main frame widget will
1201 // receive page focus and blur events when the containing window changes focus
1202 // state.
1203
avallee9993fca2016-11-17 06:16:501204 // Returns true if |this| is the focused WebContents or an ancestor of the
1205 // focused WebContents.
1206 bool ContainsOrIsFocusedWebContents();
1207
avallee0206f782016-07-28 18:55:331208 // Returns the root of the WebContents tree.
1209 WebContentsImpl* GetOutermostWebContents();
1210
avalleed68cdd12017-06-21 22:07:271211 // Walks up the outer WebContents chain and focuses the FrameTreeNode where
1212 // each inner WebContents is attached.
1213 void FocusOuterAttachmentFrameChain();
1214
[email protected]0dd3a0ab2011-02-18 08:17:441215 // Navigation helpers --------------------------------------------------------
1216 //
1217 // These functions are helpers for Navigate() and DidNavigate().
1218
1219 // Handles post-navigation tasks in DidNavigate AFTER the entry has been
1220 // committed to the navigation controller. Note that the navigation entry is
1221 // not provided since it may be invalid/changed after being committed. The
1222 // current navigation entry is in the NavigationController at this point.
[email protected]2f7b3c5a2013-06-21 04:59:251223
[email protected]bafe6cd2012-05-23 23:09:501224 // Helper for CreateNewWidget/CreateNewFullscreenWidget.
avib7348942015-12-25 20:57:101225 void CreateNewWidget(int32_t render_process_id,
1226 int32_t route_id,
[email protected]bafe6cd2012-05-23 23:09:501227 bool is_fullscreen,
Dave Tapuska1bdf1832017-07-07 18:07:191228 mojom::WidgetPtr widget,
[email protected]180ef242013-11-07 06:50:461229 blink::WebPopupType popup_type);
[email protected]bafe6cd2012-05-23 23:09:501230
1231 // Helper for ShowCreatedWidget/ShowCreatedFullscreenWidget.
alexmosc2a8cec2016-05-23 22:19:531232 void ShowCreatedWidget(int process_id,
1233 int route_id,
[email protected]bafe6cd2012-05-23 23:09:501234 bool is_fullscreen,
bokan107a47f2015-02-03 23:23:391235 const gfx::Rect& initial_rect);
[email protected]bafe6cd2012-05-23 23:09:501236
1237 // Finds the new RenderWidgetHost and returns it. Note that this can only be
1238 // called once as this call also removes it from the internal map.
alexmosc2a8cec2016-05-23 22:19:531239 RenderWidgetHostView* GetCreatedWidget(int process_id, int route_id);
[email protected]bafe6cd2012-05-23 23:09:501240
nick5ae4d2d2017-01-06 01:18:351241 // Finds the new WebContentsImpl by |main_frame_widget_route_id|, initializes
1242 // it for renderer-initiated creation, and returns it. Note that this can only
1243 // be called once as this call also removes it from the internal map.
1244 WebContentsImpl* GetCreatedWindow(int process_id,
1245 int main_frame_widget_route_id);
[email protected]bafe6cd2012-05-23 23:09:501246
lfgdb5c4ed2016-03-04 23:09:071247 // Sends a Page message IPC.
1248 void SendPageMessage(IPC::Message* msg);
1249
lukasza6f8ac622017-06-06 03:10:201250 void SetOpenerForNewContents(FrameTreeNode* opener, bool opener_suppressed);
1251
[email protected]960b0372014-05-19 18:01:001252 // Tracking loading progress -------------------------------------------------
1253
fdegansa696e5112015-04-17 01:57:591254 // Resets the tracking state of the current load progress.
[email protected]960b0372014-05-19 18:01:001255 void ResetLoadProgressState();
1256
fdegansa696e5112015-04-17 01:57:591257 // Notifies the delegate that the load progress was updated.
1258 void SendChangeLoadProgress();
[email protected]960b0372014-05-19 18:01:001259
clamy44e84ce2016-02-22 15:38:251260 // Notifies the delegate of a change in loading state.
1261 // |details| is used to provide details on the load that just finished
1262 // (but can be null if not applicable).
1263 // |due_to_interstitial| is true if the change in load state occurred because
1264 // an interstitial page started showing/proceeded.
1265 void LoadingStateChanged(bool to_different_document,
1266 bool due_to_interstitial,
1267 LoadNotificationDetails* details);
1268
[email protected]0dd3a0ab2011-02-18 08:17:441269 // Misc non-view stuff -------------------------------------------------------
1270
avi2b177592014-12-10 02:08:021271 // Sets the history for a specified RenderViewHost to |history_length|
1272 // entries, with an offset of |history_offset|.
1273 void SetHistoryOffsetAndLengthForView(RenderViewHost* render_view_host,
1274 int history_offset,
1275 int history_length);
1276
[email protected]0dd3a0ab2011-02-18 08:17:441277 // Helper functions for sending notifications.
[email protected]02d7b6e2014-06-24 21:01:501278 void NotifyViewSwapped(RenderViewHost* old_host, RenderViewHost* new_host);
1279 void NotifyFrameSwapped(RenderFrameHost* old_host, RenderFrameHost* new_host);
[email protected]0dd3a0ab2011-02-18 08:17:441280 void NotifyDisconnected();
1281
[email protected]be1f56ab2011-12-22 06:55:311282 void SetEncoding(const std::string& encoding);
1283
[email protected]fa944cb82013-11-15 17:51:211284 // TODO(creis): This should take in a FrameTreeNode to know which node's
1285 // render manager to return. For now, we just return the root's.
[email protected]b0936d22013-11-28 06:47:361286 RenderFrameHostManager* GetRenderManager() const;
[email protected]fa944cb82013-11-15 17:51:211287
[email protected]7a846df2012-09-20 19:17:391288 // Removes browser plugin embedder if there is one.
1289 void RemoveBrowserPluginEmbedder();
1290
[email protected]dc0fd432013-08-27 15:29:211291 // Helper function to invoke WebContentsDelegate::GetSizeForNewRenderView().
Jianzhou Fengd8720c72018-01-18 03:06:301292 gfx::Size GetSizeForNewRenderView(bool is_main_frame);
[email protected]dc0fd432013-08-27 15:29:211293
[email protected]ae7eeda2014-07-04 01:53:261294 void OnFrameRemoved(RenderFrameHost* render_frame_host);
[email protected]9b159a52013-10-03 17:24:551295
[email protected]222f5822014-02-05 23:40:491296 // Helper method that's called whenever |preferred_size_| or
1297 // |preferred_size_for_capture_| changes, to propagate the new value to the
1298 // |delegate_|.
1299 void OnPreferredSizeChanged(const gfx::Size& old_size);
1300
dbeama1b926a2015-08-31 23:17:511301 // Internal helper to create WebUI objects associated with |this|. |url| is
Dan Beam055fe8f2017-10-04 23:23:361302 // used to determine which WebUI should be created (if any).
1303 std::unique_ptr<WebUIImpl> CreateWebUI(const GURL& url);
dbeama1b926a2015-08-31 23:17:511304
avid53461d2016-02-25 17:15:041305 void SetJavaScriptDialogManagerForTesting(
1306 JavaScriptDialogManager* dialog_manager);
1307
paulmeyerfeafc2d2017-04-25 21:46:401308 // Returns the FindRequestManager, which may be found in an outer WebContents.
1309 FindRequestManager* GetFindRequestManager();
1310
1311 // Returns the FindRequestManager, or creates one if it doesn't already
1312 // exist. The FindRequestManager may be found in an outer WebContents.
paulmeyerc0b762b2016-04-13 11:55:171313 FindRequestManager* GetOrCreateFindRequestManager();
1314
rockotf62002a2016-09-15 00:08:591315 // Removes a registered WebContentsBindingSet by interface name.
1316 void RemoveBindingSet(const std::string& interface_name);
1317
falken52a56e32016-12-08 05:02:401318 // Prints a console warning when visiting a localhost site with a bad
1319 // certificate via --allow-insecure-localhost.
1320 void ShowInsecureLocalhostWarningIfNeeded();
1321
mlamouri5cd9ae82017-02-18 11:05:091322 // Notify this WebContents that the preferences have changed. This will send
1323 // an IPC to all the renderer process associated with this WebContents.
1324 void NotifyPreferencesChanged();
1325
Megan Jablonski2f6a4c52017-07-10 23:01:251326 // Format of |headers| is a new line separated list of key value pairs:
1327 // "<key1>: <value1>\r\n<key2>: <value2>".
Min Qina904f3302018-02-13 23:33:341328 static download::DownloadUrlParameters::RequestHeadersType
1329 ParseDownloadHeaders(const std::string& headers);
Megan Jablonski2f6a4c52017-07-10 23:01:251330
EhsanK2075c7e2017-08-21 02:42:391331 // Sets the visibility of immediate child views, i.e. views whose parent view
1332 // is that of the main frame.
1333 void SetVisibilityForChildViews(bool visible);
1334
Lucas Furukawa Gadaniaed1fed2017-10-13 17:34:141335 // Reattaches this inner WebContents to its outer WebContents.
1336 void ReattachToOuterWebContentsFrame();
1337
Lukasz Anforowiczfd707142018-02-07 19:46:131338 // A helper for clearing the link status bubble after navigating away.
1339 // See also UpdateTargetURL.
1340 void ClearTargetURL();
1341
[email protected]0dd3a0ab2011-02-18 08:17:441342 // Data for core operation ---------------------------------------------------
1343
1344 // Delegate for notifying our owner about stuff. Not owned by us.
[email protected]8ff00d72012-10-23 19:12:211345 WebContentsDelegate* delegate_;
[email protected]0dd3a0ab2011-02-18 08:17:441346
1347 // Handles the back/forward list and loading.
[email protected]d202a7c2012-01-04 07:53:471348 NavigationControllerImpl controller_;
[email protected]0dd3a0ab2011-02-18 08:17:441349
1350 // The corresponding view.
dcheng59716272016-04-09 05:19:081351 std::unique_ptr<WebContentsView> view_;
[email protected]0dd3a0ab2011-02-18 08:17:441352
[email protected]5a3bdf52012-05-24 15:12:571353 // The view of the RVHD. Usually this is our WebContentsView implementation,
1354 // but if an embedder uses a different WebContentsView, they'll need to
1355 // provide this.
[email protected]8ff00d72012-10-23 19:12:211356 RenderViewHostDelegateView* render_view_host_delegate_view_;
[email protected]5a3bdf52012-05-24 15:12:571357
[email protected]bafe6cd2012-05-23 23:09:501358 // Tracks created WebContentsImpl objects that have not been shown yet. They
alexmosc2a8cec2016-05-23 22:19:531359 // are identified by the process ID and routing ID passed to CreateNewWindow.
1360 typedef std::pair<int, int> ProcessRoutingIdPair;
1361 std::map<ProcessRoutingIdPair, WebContentsImpl*> pending_contents_;
[email protected]bafe6cd2012-05-23 23:09:501362
alexmosc2a8cec2016-05-23 22:19:531363 // This map holds widgets that were created on behalf of the renderer but
1364 // haven't been shown yet.
1365 std::map<ProcessRoutingIdPair, RenderWidgetHostView*> pending_widget_views_;
[email protected]bafe6cd2012-05-23 23:09:501366
avia8cf81982016-08-12 20:28:461367 std::map<WebContentsImpl*, std::unique_ptr<DestructionObserver>>
1368 destruction_observers_;
[email protected]7fff43e2013-05-21 20:21:101369
[email protected]996042972011-11-08 22:43:591370 // A list of observers notified when page state changes. Weak references.
[email protected]fa944cb82013-11-15 17:51:211371 // This MUST be listed above frame_tree_ since at destruction time the
[email protected]996042972011-11-08 22:43:591372 // latter might cause RenderViewHost's destructor to call us and we might use
1373 // the observer list then.
brettw236d3172015-06-03 16:31:431374 base::ObserverList<WebContentsObserver> observers_;
[email protected]996042972011-11-08 22:43:591375
rockotf62002a2016-09-15 00:08:591376 // Associated interface binding sets attached to this WebContents.
1377 std::map<std::string, WebContentsBindingSet*> binding_sets_;
1378
[email protected]c7c0d822014-04-16 20:19:491379 // True if this tab was opened by another tab. This is not unset if the opener
1380 // is closed.
1381 bool created_with_opener_;
1382
[email protected]0dd3a0ab2011-02-18 08:17:441383 // Helper classes ------------------------------------------------------------
1384
[email protected]fa944cb82013-11-15 17:51:211385 // Manages the frame tree of the page and process swaps in each node.
[email protected]9b159a52013-10-03 17:24:551386 FrameTree frame_tree_;
1387
lfg601233692017-03-06 22:45:441388 // Contains information about the WebContents tree structure.
1389 WebContentsTreeNode node_;
lazyboy6ec48b2a2015-06-29 15:18:141390
[email protected]c7dd2f62011-07-18 15:57:591391 // SavePackage, lazily created.
1392 scoped_refptr<SavePackage> save_package_;
1393
paulmeyerc8cb7cb2016-06-07 01:14:191394 // Manages/coordinates multi-process find-in-page requests. Created lazily.
dcheng18ec0b542016-04-26 19:28:531395 std::unique_ptr<FindRequestManager> find_request_manager_;
paulmeyerc0b762b2016-04-13 11:55:171396
[email protected]0dd3a0ab2011-02-18 08:17:441397 // Data for loading state ----------------------------------------------------
1398
[email protected]6dfed692014-05-22 04:18:031399 // Indicates whether the current load is to a different document. Only valid
Evan Stadec3b26022017-07-14 19:50:241400 // if |is_loading_| is true and only tracks loads in the main frame.
[email protected]6dfed692014-05-22 04:18:031401 bool is_load_to_different_document_;
1402
[email protected]0dd3a0ab2011-02-18 08:17:441403 // Indicates if the tab is considered crashed.
1404 base::TerminationStatus crashed_status_;
1405 int crashed_error_code_;
1406
[email protected]ca13a442012-04-17 14:00:121407 // Whether this WebContents is waiting for a first-response for the
[email protected]be1f56ab2011-12-22 06:55:311408 // main resource of the page. This controls whether the throbber state is
1409 // "waiting" or "loading."
[email protected]0dd3a0ab2011-02-18 08:17:441410 bool waiting_for_response_;
1411
[email protected]0dd3a0ab2011-02-18 08:17:441412 // The current load state and the URL associated with it.
[email protected]9c235f042011-08-10 22:28:211413 net::LoadStateWithParam load_state_;
[email protected]fcf75d42013-12-03 20:11:261414 base::string16 load_state_host_;
[email protected]960b0372014-05-19 18:01:001415
[email protected]960b0372014-05-19 18:01:001416 base::TimeTicks loading_last_progress_update_;
1417
[email protected]0dd3a0ab2011-02-18 08:17:441418 // Upload progress, for displaying in the status bar.
1419 // Set to zero when there is no significant upload happening.
avib7348942015-12-25 20:57:101420 uint64_t upload_size_;
1421 uint64_t upload_position_;
[email protected]0dd3a0ab2011-02-18 08:17:441422
dfalcantarae6b7b46752015-07-10 18:14:161423 // Tracks that this WebContents needs to unblock requests to the renderer.
1424 // See ResumeLoadingCreatedWebContents.
1425 bool is_resume_pending_;
1426
creisadca9862017-06-16 19:12:111427 // The interstitial page currently shown, if any. Not owned by this class: the
1428 // InterstitialPage is self-owned and deletes itself asynchronously when
1429 // hidden. Because it may outlive this WebContents, it enters a disabled state
1430 // when hidden or preparing for destruction.
1431 InterstitialPageImpl* interstitial_page_;
1432
[email protected]0dd3a0ab2011-02-18 08:17:441433 // Data for current page -----------------------------------------------------
1434
[email protected]987fc3a2011-05-26 14:18:091435 // When a title cannot be taken from any entry, this title will be used.
[email protected]fcf75d42013-12-03 20:11:261436 base::string16 page_title_when_no_navigation_entry_;
[email protected]987fc3a2011-05-26 14:18:091437
[email protected]0dd3a0ab2011-02-18 08:17:441438 // When a navigation occurs, we record its contents MIME type. It can be
1439 // used to check whether we can do something for some special contents.
1440 std::string contents_mime_type_;
1441
[email protected]ef3adfc2014-05-11 00:04:541442 // The last reported character encoding, not canonicalized.
1443 std::string last_reported_encoding_;
1444
1445 // The canonicalized character encoding.
1446 std::string canonical_encoding_;
[email protected]0dd3a0ab2011-02-18 08:17:441447
[email protected]b4c84012014-04-28 19:51:101448 // Whether the initial empty page has been accessed by another page, making it
1449 // unsafe to show the pending URL. Usually false unless another window tries
1450 // to modify the blank page. Always false after the first commit.
1451 bool has_accessed_initial_document_;
1452
yusufod41c5f92015-03-06 00:14:281453 // The theme color for the underlying document as specified
1454 // by theme-color meta tag.
1455 SkColor theme_color_;
1456
1457 // The last published theme color.
1458 SkColor last_sent_theme_color_;
1459
peter90afaba2015-06-01 12:05:291460 // Whether the first visually non-empty paint has occurred.
1461 bool did_first_visually_non_empty_paint_;
1462
[email protected]0dd3a0ab2011-02-18 08:17:441463 // Data for misc internal state ----------------------------------------------
1464
[email protected]54597982013-02-06 01:59:551465 // When > 0, the WebContents is currently being captured (e.g., for
1466 // screenshots or mirroring); and the underlying RenderWidgetHost should not
1467 // be told it is hidden.
1468 int capturer_count_;
1469
1470 // Tracks whether RWHV should be visible once capturer_count_ becomes zero.
1471 bool should_normally_be_visible_;
[email protected]0dd3a0ab2011-02-18 08:17:441472
Francois Doray18800972017-08-25 22:38:581473 // Tracks whether RWHV should be occluded once |capturer_count_| becomes zero.
1474 bool should_normally_be_occluded_;
1475
tapted65ff2ea72016-03-01 23:39:001476 // Tracks whether this WebContents was ever set to be visible. Used to
1477 // facilitate WebContents being loaded in the background by setting
1478 // |should_normally_be_visible_|. Ensures WasShown() will trigger when first
1479 // becoming visible to the user, and prevents premature unloading.
1480 bool did_first_set_visible_;
1481
[email protected]0dd3a0ab2011-02-18 08:17:441482 // See getter above.
1483 bool is_being_destroyed_;
1484
creis97867aa2017-02-17 18:39:451485 // Keep track of whether this WebContents is currently iterating over its list
1486 // of observers, during which time it should not be deleted.
1487 bool is_notifying_observers_;
1488
[email protected]0dd3a0ab2011-02-18 08:17:441489 // Indicates whether we should notify about disconnection of this
[email protected]b172aee2012-04-10 17:05:261490 // WebContentsImpl. This is used to ensure disconnection notifications only
[email protected]0dd3a0ab2011-02-18 08:17:441491 // happen if a connection notification has happened and that they happen only
1492 // once.
1493 bool notify_disconnection_;
1494
[email protected]71a88bb2013-02-01 22:05:151495 // Pointer to the JavaScript dialog manager, lazily assigned. Used because the
[email protected]b172aee2012-04-10 17:05:261496 // delegate of this WebContentsImpl is nulled before its destructor is called.
[email protected]71a88bb2013-02-01 22:05:151497 JavaScriptDialogManager* dialog_manager_;
[email protected]2e5b90c2011-08-16 21:11:551498
avi85ee8362016-10-08 02:09:081499 // Set to true when there is an active JavaScript dialog showing.
1500 bool is_showing_javascript_dialog_ = false;
1501
[email protected]0dd3a0ab2011-02-18 08:17:441502 // Set to true when there is an active "before unload" dialog. When true,
1503 // we've forced the throbber to start in Navigate, and we need to remember to
1504 // turn it off in OnJavaScriptMessageBoxClosed if the navigation is canceled.
1505 bool is_showing_before_unload_dialog_;
1506
[email protected]0dd3a0ab2011-02-18 08:17:441507 // Settings that get passed to the renderer process.
[email protected]8ff00d72012-10-23 19:12:211508 RendererPreferences renderer_preferences_;
[email protected]0dd3a0ab2011-02-18 08:17:441509
[email protected]9a890452014-02-13 22:21:021510 // The time that this WebContents was last made active. The initial value is
1511 // the WebContents creation time.
gab0dccfef2015-05-20 18:43:391512 base::TimeTicks last_active_time_;
[email protected]0dd3a0ab2011-02-18 08:17:441513
[email protected]0dd3a0ab2011-02-18 08:17:441514 // See description above setter.
1515 bool closed_by_user_gesture_;
1516
1517 // Minimum/maximum zoom percent.
1518 int minimum_zoom_percent_;
1519 int maximum_zoom_percent_;
[email protected]0dd3a0ab2011-02-18 08:17:441520
w.shackleton49bcd392016-01-06 17:38:221521 // Used to correctly handle integer zooming through a smooth scroll device.
1522 float zoom_scroll_remainder_;
1523
[email protected]bcd2815602012-01-14 18:17:231524 // The intrinsic size of the page.
1525 gfx::Size preferred_size_;
1526
[email protected]222f5822014-02-05 23:40:491527 // The preferred size for content screen capture. When |capturer_count_| > 0,
1528 // this overrides |preferred_size_|.
1529 gfx::Size preferred_size_for_capture_;
1530
kenrbe4f91082017-06-02 20:32:081531 // Size set by a top-level frame with auto-resize enabled. This is needed by
1532 // out-of-process iframes for their visible viewport size.
1533 gfx::Size auto_resize_size_;
1534
Jianzhou Fengd8720c72018-01-18 03:06:301535 // When device emulation is enabled, override the size of current and newly
1536 // created render views/widgets.
1537 gfx::Size device_emulation_size_;
1538 gfx::Size view_size_before_emulation_;
1539
mfomitchev2b8b066a2016-01-28 19:23:151540#if defined(OS_ANDROID)
[email protected]583418cc2013-01-17 14:01:101541 // Date time chooser opened by this tab.
1542 // Only used in Android since all other platforms use a multi field UI.
dcheng59716272016-04-09 05:19:081543 std::unique_ptr<DateTimeChooserAndroid> date_time_chooser_;
[email protected]583418cc2013-01-17 14:01:101544#endif
1545
[email protected]8ed16472014-04-11 19:02:481546 // Holds information about a current color chooser dialog, if one is visible.
Joel Hockey85b379d2017-12-11 10:42:131547 class ColorChooser;
1548 std::unique_ptr<ColorChooser> color_chooser_;
[email protected]da8543762012-03-20 08:52:201549
[email protected]7a846df2012-09-20 19:17:391550 // Manages the embedder state for browser plugins, if this WebContents is an
1551 // embedder; NULL otherwise.
dcheng59716272016-04-09 05:19:081552 std::unique_ptr<BrowserPluginEmbedder> browser_plugin_embedder_;
[email protected]7a846df2012-09-20 19:17:391553 // Manages the guest state for browser plugin, if this WebContents is a guest;
1554 // NULL otherwise.
dcheng59716272016-04-09 05:19:081555 std::unique_ptr<BrowserPluginGuest> browser_plugin_guest_;
[email protected]7a846df2012-09-20 19:17:391556
brettw4b461082016-11-19 18:55:161557#if BUILDFLAG(ENABLE_PLUGINS)
tommyclieb25b2a2014-11-03 19:45:091558 // Manages the whitelist of plugin content origins exempt from power saving.
dcheng59716272016-04-09 05:19:081559 std::unique_ptr<PluginContentOriginWhitelist>
1560 plugin_content_origin_whitelist_;
tommyclieb25b2a2014-11-03 19:45:091561#endif
1562
[email protected]f53a9f872012-05-24 02:07:061563 // This must be at the end, or else we might get notifications and use other
1564 // member variables that are gone.
[email protected]8ff00d72012-10-23 19:12:211565 NotificationRegistrar registrar_;
[email protected]f53a9f872012-05-24 02:07:061566
[email protected]b24b68a2012-09-24 21:57:261567 // All live RenderWidgetHostImpls that are created by this object and may
1568 // outlive it.
[email protected]8ff00d72012-10-23 19:12:211569 std::set<RenderWidgetHostImpl*> created_widgets_;
[email protected]b24b68a2012-09-24 21:57:261570
alexmosc9e76ec2016-05-16 22:59:371571 // Process id of the shown fullscreen widget, or kInvalidUniqueID if there is
1572 // no fullscreen widget.
1573 int fullscreen_widget_process_id_;
1574
[email protected]44470a22013-01-24 01:21:541575 // Routing id of the shown fullscreen widget or MSG_ROUTING_NONE otherwise.
1576 int fullscreen_widget_routing_id_;
1577
[email protected]0b431992014-06-24 00:08:031578 // At the time the fullscreen widget was being shut down, did it have focus?
1579 // This is used to restore focus to the WebContentsView after both: 1) the
1580 // fullscreen widget is destroyed, and 2) the WebContentsDelegate has
1581 // completed making layout changes to effect an exit from fullscreen mode.
1582 bool fullscreen_widget_had_focus_at_shutdown_;
1583
[email protected]0e584b5f2013-12-30 17:28:231584 // Whether this WebContents is responsible for displaying a subframe in a
[email protected]5dcaf8e2013-12-28 01:31:421585 // different process from its parent page.
1586 bool is_subframe_;
1587
mariakhomenkoa4971c12015-07-21 19:04:371588 // When a new tab is created asynchronously, stores the OpenURLParams needed
1589 // to continue loading the page once the tab is ready.
dcheng59716272016-04-09 05:19:081590 std::unique_ptr<OpenURLParams> delayed_open_url_params_;
mariakhomenkoa4971c12015-07-21 19:04:371591
[email protected]34ff1cfc2014-08-20 06:16:051592 // Whether overscroll should be unconditionally disabled.
1593 bool force_disable_overscroll_content_;
[email protected]e85165c642014-06-10 14:34:311594
[email protected]87de04b02014-04-08 22:14:491595 // Whether the last JavaScript dialog shown was suppressed. Used for testing.
1596 bool last_dialog_suppressed_;
1597
Ke He7319dbe2017-11-09 05:54:441598 device::mojom::GeolocationContextPtr geolocation_context_;
blundellc57b93f2014-10-29 13:19:571599
blundelle75a8f92017-03-27 08:11:171600 std::unique_ptr<WakeLockContextHost> wake_lock_context_host_;
alogvinovf50445a2015-10-30 13:00:121601
juncai8e8d6ec2017-06-06 20:48:181602 device::mojom::WakeLockPtr renderer_wake_lock_;
ke.he98b761e2017-05-09 05:59:171603
Joel Hockey85b379d2017-12-11 10:42:131604 service_manager::BinderRegistry registry_;
1605
Joel Hockey163835a2017-12-20 11:51:571606 mojo::BindingSet<blink::mojom::ColorChooserFactory>
1607 color_chooser_factory_bindings_;
Joel Hockey85b379d2017-12-11 10:42:131608
blundellf5316fc2017-05-15 11:49:031609#if defined(OS_ANDROID)
1610 std::unique_ptr<NFCHost> nfc_host_;
1611#endif
1612
leon.hane4db177a2017-02-07 14:19:161613 std::unique_ptr<ScreenOrientationProvider> screen_orientation_provider_;
[email protected]01f83f92014-06-17 14:41:541614
dcheng59716272016-04-09 05:19:081615 std::unique_ptr<ManifestManagerHost> manifest_manager_host_;
mlamouriefdca9d2014-09-16 16:55:401616
[email protected]95640212014-07-26 18:14:301617 // The accessibility mode for all frames. This is queried when each frame
1618 // is created, and broadcast to all frames when it changes.
Doug Turner63f3c7b2017-07-29 05:10:011619 ui::AXMode accessibility_mode_;
[email protected]95640212014-07-26 18:14:301620
avayvodcc85bbd2015-08-28 19:11:151621 // Monitors power levels for audio streams associated with this WebContents.
1622 AudioStreamMonitor audio_stream_monitor_;
1623
miu50f97892014-09-22 22:49:521624 // Created on-demand to mute all audio output from this WebContents.
dcheng59716272016-04-09 05:19:081625 std::unique_ptr<WebContentsAudioMuter> audio_muter_;
miu50f97892014-09-22 22:49:521626
ortunodf4d7982016-04-08 02:33:351627 size_t bluetooth_connected_device_count_;
ortuno32e7db3c2016-03-29 16:14:201628
csharrisona2280cd2016-02-03 23:21:151629 // Notifies ResourceDispatcherHostImpl of various events related to loading.
dcheng59716272016-04-09 05:19:081630 std::unique_ptr<LoaderIOThreadNotifier> loader_io_thread_notifier_;
csharrisona2280cd2016-02-03 23:21:151631
dalecurtis88c240072015-12-09 02:11:181632 // Manages media players, CDMs, and power save blockers for media.
dcheng59716272016-04-09 05:19:081633 std::unique_ptr<MediaWebContentsObserver> media_web_contents_observer_;
qinmin58567c82015-01-07 21:00:201634
brettw4b461082016-11-19 18:55:161635#if BUILDFLAG(ENABLE_PLUGINS)
zqzhang181047e62016-07-01 13:37:171636 // Observes pepper playback changes, and notifies MediaSession.
1637 std::unique_ptr<PepperPlaybackObserver> pepper_playback_observer_;
brettw4b461082016-11-19 18:55:161638#endif // BUILDFLAG(ENABLE_PLUGINS)
zqzhang181047e62016-07-01 13:37:171639
mcnee336ea2c2017-05-23 22:50:591640#if !defined(OS_ANDROID)
scottmg276753cf2016-10-27 18:25:221641 std::unique_ptr<HostZoomMapObserver> host_zoom_map_observer_;
mcnee336ea2c2017-05-23 22:50:591642#endif // !defined(OS_ANDROID)
scottmg276753cf2016-10-27 18:25:221643
dcheng59716272016-04-09 05:19:081644 std::unique_ptr<RenderWidgetHostInputEventRouter> rwh_input_event_router_;
kenrb2a565f82015-09-02 20:24:591645
kouhei40f03cb2015-09-24 07:47:011646 PageImportanceSignals page_importance_signals_;
1647
mcnee336ea2c2017-05-23 22:50:591648#if !defined(OS_ANDROID)
mcnee432e47d2015-11-09 19:37:461649 bool page_scale_factor_is_one_;
mcnee336ea2c2017-05-23 22:50:591650#endif // !defined(OS_ANDROID)
mcnee432e47d2015-11-09 19:37:461651
ekaramadadd882292016-06-08 15:22:561652 // TextInputManager tracks the IME-related state for all the
1653 // RenderWidgetHostViews on this WebContents. Only exists on the outermost
1654 // WebContents and is automatically destroyed when a WebContents becomes an
1655 // inner WebContents by attaching to an outer WebContents. Then the
1656 // IME-related state for RenderWidgetHosts on the inner WebContents is tracked
1657 // by the TextInputManager in the outer WebContents.
1658 std::unique_ptr<TextInputManager> text_input_manager_;
1659
lfgbee1e0a2016-06-08 21:24:211660 // Stores the RenderWidgetHost that currently holds a mouse lock or nullptr if
1661 // there's no RenderWidgetHost holding a lock.
1662 RenderWidgetHostImpl* mouse_lock_widget_;
1663
sammcf5f1b0f2016-09-20 23:05:111664#if defined(OS_ANDROID)
rockot400ea35b2016-10-15 19:15:321665 std::unique_ptr<service_manager::InterfaceProvider> java_interfaces_;
sammcf5f1b0f2016-09-20 23:05:111666#endif
1667
qinmin72e8bd02016-10-21 19:35:371668 // Whether this WebContents is for content overlay.
1669 bool is_overlay_content_;
1670
ekaramadf6750aa2017-06-06 18:29:421671 bool showing_context_menu_;
1672
billorr21c005d2016-11-17 03:57:041673 int currently_playing_video_count_ = 0;
peconn257951522017-06-09 18:24:591674 VideoSizeMap cached_video_sizes_;
billorr21c005d2016-11-17 03:57:041675
mlamouri5cd9ae82017-02-18 11:05:091676 bool has_persistent_video_ = false;
1677
Tommy Steimel18360512017-11-01 00:38:191678 bool was_ever_audible_ = false;
1679
Lukasz Anforowiczfd707142018-02-07 19:46:131680 // Helper variable for resolving races in UpdateTargetURL / ClearTargetURL.
1681 RenderViewHost* view_that_set_last_target_url_ = nullptr;
1682
mohan.reddyaae039a2014-11-21 17:39:501683 base::WeakPtrFactory<WebContentsImpl> loading_weak_factory_;
pkotwicz75ca8ffd2016-02-16 23:10:191684 base::WeakPtrFactory<WebContentsImpl> weak_factory_;
mohan.reddyaae039a2014-11-21 17:39:501685
[email protected]b172aee2012-04-10 17:05:261686 DISALLOW_COPY_AND_ASSIGN(WebContentsImpl);
[email protected]0dd3a0ab2011-02-18 08:17:441687};
1688
nickf9acfbe2014-12-23 19:12:371689// Dangerous methods which should never be made part of the public API, so we
1690// grant their use only to an explicit friend list (c++ attorney/client idiom).
benwells5e7260d2017-03-20 23:36:331691class CONTENT_EXPORT WebContentsImpl::FriendWrapper {
nickf9acfbe2014-12-23 19:12:371692 private:
1693 friend class TestNavigationObserver;
1694 friend class WebContentsAddedObserver;
1695 friend class ContentBrowserSanityChecker;
1696
benwells5e7260d2017-03-20 23:36:331697 FriendWrapper(); // Not instantiable.
nickf9acfbe2014-12-23 19:12:371698
1699 // Adds/removes a callback called on creation of each new WebContents.
1700 static void AddCreatedCallbackForTesting(const CreatedCallback& callback);
1701 static void RemoveCreatedCallbackForTesting(const CreatedCallback& callback);
1702
benwells5e7260d2017-03-20 23:36:331703 DISALLOW_COPY_AND_ASSIGN(FriendWrapper);
nickf9acfbe2014-12-23 19:12:371704};
1705
[email protected]8ff00d72012-10-23 19:12:211706} // namespace content
1707
[email protected]93ddb3c2012-04-11 21:44:291708#endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_