blob: 7a5368a0de583d6e4c1168fb8bcdde60c3796eb4 [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>
[email protected]0dd3a0ab2011-02-18 08:17:4415
[email protected]01d65172011-12-25 04:39:3016#include "base/compiler_specific.h"
[email protected]0dd3a0ab2011-02-18 08:17:4417#include "base/gtest_prod_util.h"
avib7348942015-12-25 20:57:1018#include "base/macros.h"
[email protected]6eac57a2011-07-12 21:15:0919#include "base/observer_list.h"
[email protected]fa20e002013-07-23 21:20:5420#include "base/process/process.h"
[email protected]738f57a2013-06-29 21:06:5421#include "base/values.h"
avib7348942015-12-25 20:57:1022#include "build/build_config.h"
[email protected]d4a8ca482013-10-30 21:06:4023#include "content/browser/frame_host/frame_tree.h"
lfga3e2bdc2017-03-07 20:44:0124#include "content/browser/frame_host/frame_tree_node.h"
[email protected]d4a8ca482013-10-30 21:06:4025#include "content/browser/frame_host/navigation_controller_delegate.h"
26#include "content/browser/frame_host/navigation_controller_impl.h"
[email protected]190b8c52013-11-09 01:35:4427#include "content/browser/frame_host/navigator_delegate.h"
[email protected]92404c62013-12-04 16:40:4628#include "content/browser/frame_host/render_frame_host_delegate.h"
[email protected]b0936d22013-11-28 06:47:3629#include "content/browser/frame_host/render_frame_host_manager.h"
avayvodcc85bbd2015-08-28 19:11:1530#include "content/browser/media/audio_stream_monitor.h"
[email protected]2e3bf992012-05-24 17:36:2431#include "content/browser/renderer_host/render_view_host_delegate.h"
creisc014b402015-04-23 16:41:4532#include "content/browser/renderer_host/render_view_host_impl.h"
[email protected]4ca76c02012-05-16 16:19:0533#include "content/browser/renderer_host/render_widget_host_delegate.h"
blundelle75a8f92017-03-27 08:11:1734#include "content/browser/wake_lock/wake_lock_context_host.h"
dougtcd3dad732017-03-14 03:26:2335#include "content/common/accessibility_mode.h"
[email protected]8d128d62011-09-13 22:11:5736#include "content/common/content_export.h"
[email protected]8ed16472014-04-11 19:02:4837#include "content/public/browser/color_chooser.h"
[email protected]14392a52012-05-02 20:28:4438#include "content/public/browser/notification_observer.h"
39#include "content/public/browser/notification_registrar.h"
[email protected]58f5d562011-12-20 17:13:0340#include "content/public/browser/web_contents.h"
rockot96c63e32017-03-20 23:23:0341#include "content/public/browser/web_contents_binding_set.h"
dalecurtis88c240072015-12-09 02:11:1842#include "content/public/browser/web_contents_observer.h"
kouhei40f03cb2015-09-24 07:47:0143#include "content/public/common/page_importance_signals.h"
[email protected]daf82f82011-10-31 22:35:3144#include "content/public/common/renderer_preferences.h"
[email protected]7491ad02014-07-05 19:10:0745#include "content/public/common/resource_type.h"
[email protected]818915cd2012-11-20 13:14:1146#include "content/public/common/three_d_api_types.h"
blundelle75a8f92017-03-27 08:11:1747#include "device/wake_lock/public/interfaces/wake_lock_context.mojom.h"
[email protected]0dd3a0ab2011-02-18 08:17:4448#include "net/base/load_states.h"
[email protected]6f2ac772014-07-24 22:22:0849#include "net/http/http_response_headers.h"
brettw4b461082016-11-19 18:55:1650#include "ppapi/features/features.h"
esprehnfbba1292016-04-15 17:59:5651#include "third_party/WebKit/public/platform/WebDragOperation.h"
Sylvain Defresnec6ccc77d2014-09-19 10:19:3552#include "ui/base/page_transition_types.h"
tfarina3b0452d2014-12-31 15:20:0953#include "ui/gfx/geometry/rect_f.h"
tfarinaebe974f02015-01-03 04:25:3254#include "ui/gfx/geometry/size.h"
[email protected]0dd3a0ab2011-02-18 08:17:4455
[email protected]1ff427972013-02-07 21:14:0756struct ViewHostMsg_DateTimeDialogValue_Params;
[email protected]daf82f82011-10-31 22:35:3157
rockot400ea35b2016-10-15 19:15:3258namespace service_manager {
sammcf5f1b0f2016-09-20 23:05:1159class InterfaceProvider;
60}
61
[email protected]e582fdd2011-12-20 16:48:1762namespace content {
[email protected]7a846df2012-09-20 19:17:3963class BrowserPluginEmbedder;
64class BrowserPluginGuest;
[email protected]583418cc2013-01-17 14:01:1065class DateTimeChooserAndroid;
paulmeyerc0b762b2016-04-13 11:55:1766class FindRequestManager;
scottmg276753cf2016-10-27 18:25:2267class HostZoomMapObserver;
[email protected]8ff00d72012-10-23 19:12:2168class InterstitialPageImpl;
[email protected]71a88bb2013-02-01 22:05:1569class JavaScriptDialogManager;
csharrisona2280cd2016-02-03 23:21:1570class LoaderIOThreadNotifier;
mlamouriefdca9d2014-09-16 16:55:4071class ManifestManagerHost;
qinmin58567c82015-01-07 21:00:2072class MediaWebContentsObserver;
tommyclieb25b2a2014-11-03 19:45:0973class PluginContentOriginWhitelist;
[email protected]eaabba22012-03-07 15:02:1174class RenderViewHost;
[email protected]5a3bdf52012-05-24 15:12:5775class RenderViewHostDelegateView;
[email protected]b24b68a2012-09-24 21:57:2676class RenderWidgetHostImpl;
kenrb2a565f82015-09-02 20:24:5977class RenderWidgetHostInputEventRouter;
[email protected]35869622012-10-26 23:23:5578class SavePackage;
lunalud4a2cc82016-11-22 00:27:2379class ScreenOrientationProvider;
[email protected]09d31d52012-03-11 22:30:2780class SiteInstance;
[email protected]80e776ae2012-03-23 16:17:2081class TestWebContents;
ekaramadadd882292016-06-08 15:22:5682class TextInputManager;
miu50f97892014-09-22 22:49:5283class WebContentsAudioMuter;
[email protected]674bc592011-12-20 23:00:4284class WebContentsDelegate;
[email protected]8ff00d72012-10-23 19:12:2185class WebContentsImpl;
[email protected]fc2b46b2014-05-03 16:33:4586class WebContentsView;
[email protected]f66df822012-05-18 16:52:1787class WebContentsViewDelegate;
[email protected]31a71eaf2014-03-13 01:47:3688struct AXEventNotificationDetails;
[email protected]8bc5ff02013-11-29 06:34:0389struct ColorSuggestion;
[email protected]795c28972012-12-06 06:13:3990struct FaviconURL;
[email protected]09d31d52012-03-11 22:30:2791struct LoadNotificationDetails;
dewittj6dc5747a2016-05-17 01:48:4792struct MHTMLGenerationParams;
[email protected]d60f3702013-12-26 16:30:2493struct ResourceRedirectDetails;
94struct ResourceRequestDetails;
[email protected]f66df822012-05-18 16:52:1795
rockot5c478a72016-09-28 23:14:1896namespace mojom {
97class CreateNewWindowParams;
98}
99
mfomitchev2b8b066a2016-01-28 19:23:15100#if defined(OS_ANDROID)
[email protected]0e813a52014-08-13 10:34:56101class WebContentsAndroid;
102#endif
103
brettw4b461082016-11-19 18:55:16104#if BUILDFLAG(ENABLE_PLUGINS)
zqzhang181047e62016-07-01 13:37:17105class PepperPlaybackObserver;
106#endif
107
[email protected]f66df822012-05-18 16:52:17108// Factory function for the implementations that content knows about. Takes
109// ownership of |delegate|.
[email protected]fc2b46b2014-05-03 16:33:45110WebContentsView* CreateWebContentsView(
[email protected]5a3bdf52012-05-24 15:12:57111 WebContentsImpl* web_contents,
112 WebContentsViewDelegate* delegate,
113 RenderViewHostDelegateView** render_view_host_delegate_view);
[email protected]97714c82012-06-06 10:15:13114
[email protected]b172aee2012-04-10 17:05:26115class CONTENT_EXPORT WebContentsImpl
[email protected]8ff00d72012-10-23 19:12:21116 : public NON_EXPORTED_BASE(WebContents),
[email protected]92404c62013-12-04 16:40:46117 public NON_EXPORTED_BASE(RenderFrameHostDelegate),
[email protected]8ff00d72012-10-23 19:12:21118 public RenderViewHostDelegate,
119 public RenderWidgetHostDelegate,
[email protected]b0936d22013-11-28 06:47:36120 public RenderFrameHostManager::Delegate,
[email protected]ec6c05f2013-10-23 18:41:57121 public NotificationObserver,
[email protected]190b8c52013-11-09 01:35:44122 public NON_EXPORTED_BASE(NavigationControllerDelegate),
123 public NON_EXPORTED_BASE(NavigatorDelegate) {
[email protected]0dd3a0ab2011-02-18 08:17:44124 public:
benwells5e7260d2017-03-20 23:36:33125 class FriendWrapper;
nickf9acfbe2014-12-23 19:12:37126
dchengc2282aa2014-10-21 12:07:58127 ~WebContentsImpl() override;
[email protected]0dd3a0ab2011-02-18 08:17:44128
[email protected]d1198fd2012-08-13 22:50:19129 static WebContentsImpl* CreateWithOpener(
[email protected]54944cde2012-12-09 09:24:59130 const WebContents::CreateParams& params,
alexmose201c7cd2015-06-10 17:14:21131 FrameTreeNode* opener);
[email protected]d1198fd2012-08-13 22:50:19132
[email protected]95640212014-07-26 18:14:30133 static std::vector<WebContentsImpl*> GetAllWebContents();
134
paulmeyerb6c7ab52017-04-10 20:13:31135 static WebContentsImpl* FromFrameTreeNode(FrameTreeNode* frame_tree_node);
clamy0d32d6d2015-11-24 11:16:26136 static WebContents* FromRenderFrameHostID(int render_process_host_id,
137 int render_frame_host_id);
ananta4b7467a52016-09-23 01:42:38138 static WebContents* FromFrameTreeNodeId(int frame_tree_node_id);
clamya16aa8172015-05-26 13:07:25139
[email protected]d1198fd2012-08-13 22:50:19140 // Complex initialization here. Specifically needed to avoid having
141 // members call back into our virtual functions in the constructor.
[email protected]54944cde2012-12-09 09:24:59142 virtual void Init(const WebContents::CreateParams& params);
[email protected]d1198fd2012-08-13 22:50:19143
[email protected]c7dd2f62011-07-18 15:57:59144 // Returns the SavePackage which manages the page saving job. May be NULL.
145 SavePackage* save_package() const { return save_package_.get(); }
146
mfomitchev2b8b066a2016-01-28 19:23:15147#if defined(OS_ANDROID)
[email protected]7d244f12013-08-22 21:41:51148 // In Android WebView, the RenderView needs created even there is no
149 // navigation entry, this allows Android WebViews to use
150 // javascript: URLs that load into the DOMWindow before the first page
151 // load. This is not safe to do in any context that a web page could get a
152 // reference to the DOMWindow before the first page load.
153 bool CreateRenderViewForInitialEmptyDocument();
[email protected]4cc1ab52013-01-21 19:24:34154#endif
[email protected]276b37a22011-11-08 20:45:46155
[email protected]765187182012-01-11 23:59:28156 // Expose the render manager for testing.
[email protected]ee87c8be2014-03-05 00:35:38157 // TODO(creis): Remove this now that we can get to it via FrameTreeNode.
[email protected]b0936d22013-11-28 06:47:36158 RenderFrameHostManager* GetRenderManagerForTesting();
[email protected]765187182012-01-11 23:59:28159
lazyboy8e16ddfd2015-09-28 03:41:56160 // Returns the outer WebContents of this WebContents if any.
161 // Note that without --site-per-process, this will return the WebContents
162 // of the BrowserPluginEmbedder, if |this| is a guest.
163 WebContentsImpl* GetOuterWebContents();
164
[email protected]7a846df2012-09-20 19:17:39165 // Returns guest browser plugin object, or NULL if this WebContents is not a
166 // guest.
[email protected]f8497342013-02-05 22:15:02167 BrowserPluginGuest* GetBrowserPluginGuest() const;
[email protected]738f57a2013-06-29 21:06:54168
169 // Sets a BrowserPluginGuest object for this WebContents. If this WebContents
170 // has a BrowserPluginGuest then that implies that it is being hosted by
171 // a BrowserPlugin object in an embedder renderer process.
172 void SetBrowserPluginGuest(BrowserPluginGuest* guest);
173
[email protected]7a846df2012-09-20 19:17:39174 // Returns embedder browser plugin object, or NULL if this WebContents is not
175 // an embedder.
[email protected]f8497342013-02-05 22:15:02176 BrowserPluginEmbedder* GetBrowserPluginEmbedder() const;
[email protected]738f57a2013-06-29 21:06:54177
fsamuel60b42282015-03-10 03:29:14178 // Creates a BrowserPluginEmbedder object for this WebContents if one doesn't
179 // already exist.
180 void CreateBrowserPluginEmbedderIfNecessary();
181
creis89a0f782015-05-27 16:13:17182 // Cancels modal dialogs in this WebContents, as well as in any browser
183 // plugins it is hosting.
184 void CancelActiveAndPendingDialogs();
185
[email protected]cf200a562013-05-03 16:24:29186 // Informs the render view host and the BrowserPluginEmbedder, if present, of
187 // a Drag Source End.
paulmeyer8fc8ea92016-11-15 05:12:21188 void DragSourceEndedAt(int client_x,
189 int client_y,
190 int screen_x,
191 int screen_y,
Paul Meyer0c58c3712016-11-17 22:59:51192 blink::WebDragOperation operation,
193 RenderWidgetHost* source_rwh);
[email protected]cf200a562013-05-03 16:24:29194
jam73f892642016-09-11 06:04:06195 // Notification that the RenderViewHost's load state changed.
196 void LoadStateChanged(const GURL& url,
197 const net::LoadStateWithParam& load_state,
198 uint64_t upload_position,
199 uint64_t upload_size);
200
[email protected]d60f3702013-12-26 16:30:24201 // A response has been received for a resource request.
202 void DidGetResourceResponseStart(
203 const ResourceRequestDetails& details);
204
205 // A redirect was received while requesting a resource.
206 void DidGetRedirectForResourceRequest(
[email protected]d60f3702013-12-26 16:30:24207 const ResourceRedirectDetails& details);
208
calamity7fe55ce2015-04-10 03:59:37209 // Notify observers that the web contents has been focused.
210 void NotifyWebContentsFocused();
211
[email protected]fc2b46b2014-05-03 16:33:45212 WebContentsView* GetView() const;
213
leon.han552e9de2017-02-09 14:37:30214 void OnScreenOrientationChange();
215
216 ScreenOrientationProvider* GetScreenOrientationProviderForTesting() const {
217 return screen_orientation_provider_.get();
218 }
leon.hane4db177a2017-02-07 14:19:16219
[email protected]16620a92014-05-24 01:05:51220 bool should_normally_be_visible() { return should_normally_be_visible_; }
221
ccameron8807c38f2015-01-17 00:29:19222 // Indicate if the window has been occluded, and pass this to the views, only
223 // if there is no active capture going on (otherwise it is dropped on the
224 // floor).
225 void WasOccluded();
226 void WasUnOccluded();
227
[email protected]95640212014-07-26 18:14:30228 // Broadcasts the mode change to all frames.
229 void SetAccessibilityMode(AccessibilityMode mode);
230
231 // Adds the given accessibility mode to the current accessibility mode
232 // bitmap.
233 void AddAccessibilityMode(AccessibilityMode mode);
234
dmazzoni83ba5c82015-04-14 07:11:51235 // Request a one-time snapshot of the accessibility tree without changing
236 // the accessibility mode.
dmazzoniac6cdd02015-08-04 21:07:06237 using AXTreeSnapshotCallback =
dmazzoni329fd012015-10-22 20:05:35238 base::Callback<void(
239 const ui::AXTreeUpdate&)>;
dmazzoni83ba5c82015-04-14 07:11:51240 void RequestAXTreeSnapshot(AXTreeSnapshotCallback callback);
241
wjmaclean64951902016-04-29 20:59:12242 // Set a temporary zoom level for the frames associated with this WebContents.
243 // If |is_temporary| is true, we are setting a new temporary zoom level,
244 // otherwise we are clearing a previously set temporary zoom level.
245 void SetTemporaryZoomLevel(double level, bool temporary_zoom_enabled);
246
247 // Sets the zoom level for frames associated with this WebContents.
248 void UpdateZoom(double level);
249
250 // Sets the zoom level for frames associated with this WebContents if it
251 // matches |host| and (if non-empty) |scheme|. Matching is done on the
252 // last committed entry.
253 void UpdateZoomIfNecessary(const std::string& scheme,
254 const std::string& host,
255 double level);
256
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
[email protected]8ff00d72012-10-23 19:12:21271 // WebContents ------------------------------------------------------
dchengc2282aa2014-10-21 12:07:58272 WebContentsDelegate* GetDelegate() override;
273 void SetDelegate(WebContentsDelegate* delegate) override;
274 NavigationControllerImpl& GetController() override;
275 const NavigationControllerImpl& GetController() const override;
276 BrowserContext* GetBrowserContext() const override;
277 const GURL& GetURL() const override;
278 const GURL& GetVisibleURL() const override;
279 const GURL& GetLastCommittedURL() const override;
280 RenderProcessHost* GetRenderProcessHost() const override;
clamydf1975e2015-02-05 19:12:24281 RenderFrameHostImpl* GetMainFrame() override;
nick53d5cbf2015-04-23 22:50:14282 RenderFrameHostImpl* GetFocusedFrame() override;
rob3e2a0732016-01-06 21:22:09283 RenderFrameHostImpl* FindFrameByFrameTreeNodeId(
284 int frame_tree_node_id) override;
dchengc2282aa2014-10-21 12:07:58285 void ForEachFrame(
anand.ratn120b0b002014-10-07 15:49:32286 const base::Callback<void(RenderFrameHost*)>& on_frame) override;
dchengafb53e22016-02-04 08:11:08287 std::vector<RenderFrameHost*> GetAllFrames() override;
lukaszacbdf52e2016-01-15 21:19:51288 int SendToAllFrames(IPC::Message* message) override;
creisc014b402015-04-23 16:41:45289 RenderViewHostImpl* GetRenderViewHost() const override;
dchengc2282aa2014-10-21 12:07:58290 RenderWidgetHostView* GetRenderWidgetHostView() const override;
lfg265a2672016-04-23 03:11:02291 RenderWidgetHostView* GetTopLevelRenderWidgetHostView() override;
naskoc0fceff2015-04-30 15:53:52292 void ClosePage() override;
dchengc2282aa2014-10-21 12:07:58293 RenderWidgetHostView* GetFullscreenRenderWidgetHostView() const override;
yusufod41c5f92015-03-06 00:14:28294 SkColor GetThemeColor() const override;
avie865b1d2016-10-24 19:42:59295 std::unique_ptr<WebUI> CreateSubframeWebUI(
296 const GURL& url,
297 const std::string& frame_name) override;
dchengc2282aa2014-10-21 12:07:58298 WebUI* GetWebUI() const override;
299 WebUI* GetCommittedWebUI() const override;
300 void SetUserAgentOverride(const std::string& override) override;
301 const std::string& GetUserAgentOverride() const override;
dmazzonidd3d51a72016-12-14 18:41:01302 void EnableWebContentsOnlyAccessibilityMode() override;
303 bool IsWebContentsOnlyAccessibilityModeForTesting() const override;
dchengc2282aa2014-10-21 12:07:58304 bool IsFullAccessibilityModeForTesting() const override;
kouhei40f03cb2015-09-24 07:47:01305 const PageImportanceSignals& GetPageImportanceSignals() const override;
dchengc2282aa2014-10-21 12:07:58306 const base::string16& GetTitle() const override;
afakhry6f0c1ec22016-07-14 13:55:13307 void UpdateTitleForEntry(NavigationEntry* entry,
308 const base::string16& title) override;
dchengc2282aa2014-10-21 12:07:58309 SiteInstanceImpl* GetSiteInstance() const override;
310 SiteInstanceImpl* GetPendingSiteInstance() const override;
311 bool IsLoading() const override;
312 bool IsLoadingToDifferentDocument() const override;
313 bool IsWaitingForResponse() const override;
314 const net::LoadStateWithParam& GetLoadState() const override;
315 const base::string16& GetLoadStateHost() const override;
avib7348942015-12-25 20:57:10316 uint64_t GetUploadSize() const override;
317 uint64_t GetUploadPosition() const override;
dchengc2282aa2014-10-21 12:07:58318 const std::string& GetEncoding() const override;
dchengc2282aa2014-10-21 12:07:58319 void IncrementCapturerCount(const gfx::Size& capture_size) override;
320 void DecrementCapturerCount() override;
321 int GetCapturerCount() const override;
322 bool IsAudioMuted() const override;
323 void SetAudioMuted(bool mute) override;
ortunodf4d7982016-04-08 02:33:35324 bool IsConnectedToBluetoothDevice() const override;
dchengc2282aa2014-10-21 12:07:58325 bool IsCrashed() const override;
326 void SetIsCrashed(base::TerminationStatus status, int error_code) override;
327 base::TerminationStatus GetCrashedStatus() const override;
afakhry98241832016-03-11 19:27:47328 int GetCrashedErrorCode() const override;
dchengc2282aa2014-10-21 12:07:58329 bool IsBeingDestroyed() const override;
330 void NotifyNavigationStateChanged(InvalidateTypes changed_flags) override;
altiminec87fd1f2016-11-17 20:22:49331 void OnAudioStateChanged(bool is_audible) override;
gab0dccfef2015-05-20 18:43:39332 base::TimeTicks GetLastActiveTime() const override;
georgesak5582cbe2015-05-22 22:08:07333 void SetLastActiveTime(base::TimeTicks last_active_time) override;
hajimehoshic4f226a2016-10-21 09:01:57334 base::TimeTicks GetLastHiddenTime() const override;
dchengc2282aa2014-10-21 12:07:58335 void WasShown() override;
336 void WasHidden() override;
337 bool NeedToFireBeforeUnload() override;
nasko148bb0b92016-05-10 21:03:19338 void DispatchBeforeUnload() override;
lazyboy6ec48b2a2015-06-29 15:18:14339 void AttachToOuterWebContentsFrame(
340 WebContents* outer_web_contents,
341 RenderFrameHost* outer_contents_frame) override;
dalecurtis6c58ed02016-10-28 23:02:37342 void DidChangeVisibleSecurityState() override;
dchengc2282aa2014-10-21 12:07:58343 void Stop() override;
344 WebContents* Clone() override;
toyoshim24a4c7ab2016-04-05 09:24:14345 void ReloadFocusedFrame(bool bypass_cache) override;
dchengc2282aa2014-10-21 12:07:58346 void Undo() override;
347 void Redo() override;
348 void Cut() override;
349 void Copy() override;
350 void CopyToFindPboard() override;
351 void Paste() override;
352 void PasteAndMatchStyle() override;
353 void Delete() override;
354 void SelectAll() override;
yabinh351e7ec2017-03-10 02:43:24355 void CollapseSelection() override;
dchengc2282aa2014-10-21 12:07:58356 void Replace(const base::string16& word) override;
357 void ReplaceMisspelling(const base::string16& word) override;
358 void NotifyContextMenuClosed(
anand.ratn120b0b002014-10-07 15:49:32359 const CustomContextMenuContext& context) override;
megjablon3f5941072016-02-04 23:27:52360 void ReloadLoFiImages() override;
dchengc2282aa2014-10-21 12:07:58361 void ExecuteCustomContextMenuCommand(
362 int action,
363 const CustomContextMenuContext& context) override;
364 gfx::NativeView GetNativeView() override;
365 gfx::NativeView GetContentNativeView() override;
366 gfx::NativeWindow GetTopLevelNativeWindow() override;
367 gfx::Rect GetContainerBounds() override;
368 gfx::Rect GetViewBounds() override;
369 DropData* GetDropData() override;
370 void Focus() override;
371 void SetInitialFocus() override;
372 void StoreFocus() override;
373 void RestoreFocus() override;
374 void FocusThroughTabTraversal(bool reverse) override;
375 bool ShowingInterstitialPage() const override;
376 InterstitialPage* GetInterstitialPage() const override;
377 bool IsSavable() override;
378 void OnSavePage() override;
379 bool SavePage(const base::FilePath& main_file,
380 const base::FilePath& dir_path,
381 SavePageType save_type) override;
382 void SaveFrame(const GURL& url, const Referrer& referrer) override;
kundaji6c7f9692015-03-09 18:00:37383 void SaveFrameWithHeaders(const GURL& url,
384 const Referrer& referrer,
385 const std::string& headers) override;
dewittj6dc5747a2016-05-17 01:48:47386 void GenerateMHTML(const MHTMLGenerationParams& params,
avib7348942015-12-25 20:57:10387 const base::Callback<void(int64_t)>& callback) override;
dchengc2282aa2014-10-21 12:07:58388 const std::string& GetContentsMimeType() const override;
389 bool WillNotifyDisconnection() const override;
dchengc2282aa2014-10-21 12:07:58390 RendererPreferences* GetMutableRendererPrefs() override;
391 void Close() override;
Paul Meyer0c58c3712016-11-17 22:59:51392 void SystemDragEnded(RenderWidgetHost* source_rwh) override;
dchengc2282aa2014-10-21 12:07:58393 void UserGestureDone() override;
394 void SetClosedByUserGesture(bool value) override;
395 bool GetClosedByUserGesture() const override;
396 void ViewSource() override;
397 void ViewFrameSource(const GURL& url, const PageState& page_state) override;
398 int GetMinimumZoomPercent() const override;
399 int GetMaximumZoomPercent() const override;
mcnee432e47d2015-11-09 19:37:46400 void SetPageScale(float page_scale_factor) override;
dchengc2282aa2014-10-21 12:07:58401 gfx::Size GetPreferredSize() const override;
402 bool GotResponseToLockMouseRequest(bool allowed) override;
403 bool HasOpener() const override;
alexmose201c7cd2015-06-10 17:14:21404 WebContentsImpl* GetOpener() const override;
jochen6004a362017-02-04 00:11:40405 bool HasOriginalOpener() const override;
406 WebContents* GetOriginalOpener() const override;
dchengc2282aa2014-10-21 12:07:58407 void DidChooseColorInColorChooser(SkColor color) override;
408 void DidEndColorChooser() override;
409 int DownloadImage(const GURL& url,
410 bool is_favicon,
411 uint32_t max_bitmap_size,
pkotwiczfd773552015-03-16 00:29:14412 bool bypass_cache,
dchengc2282aa2014-10-21 12:07:58413 const ImageDownloadCallback& callback) override;
414 bool IsSubframe() const override;
415 void Find(int request_id,
416 const base::string16& search_text,
417 const blink::WebFindOptions& options) override;
418 void StopFinding(StopFindAction action) override;
dchengc2282aa2014-10-21 12:07:58419 bool WasRecentlyAudible() override;
dominickn6919ce32015-10-15 01:52:28420 void GetManifest(const GetManifestCallback& callback) override;
bokanece34a82016-01-28 19:49:46421 void ExitFullscreen(bool will_cause_resize) override;
mariakhomenko44bdc4732015-04-29 01:55:38422 void ResumeLoadingCreatedWebContents() override;
estark703f1b42016-10-10 21:37:15423 void OnPasswordInputShownOnHttp() override;
estarkfae6b5872016-11-04 05:20:31424 void OnAllPasswordInputsHiddenOnHttp() override;
estark703f1b42016-10-10 21:37:15425 void OnCreditCardInputShownOnHttp() override;
qinmin72e8bd02016-10-21 19:35:37426 void SetIsOverlayContent(bool is_overlay_content) override;
ekaramad5c1f9392017-01-25 02:05:23427 bool IsFocusedElementEditable() override;
428 void ClearFocusedElement() override;
mfomitchev2b8b066a2016-01-28 19:23:15429
mlamouri918734092016-03-12 04:47:52430#if defined(OS_ANDROID)
dcheng48d97c52015-02-04 20:03:20431 base::android::ScopedJavaLocalRef<jobject> GetJavaWebContents() override;
[email protected]0e813a52014-08-13 10:34:56432 virtual WebContentsAndroid* GetWebContentsAndroid();
paulmeyerc0b762b2016-04-13 11:55:17433 void ActivateNearestFindResult(float x, float y) override;
434 void RequestFindMatchRects(int current_version) override;
rockot400ea35b2016-10-15 19:15:32435 service_manager::InterfaceProvider* GetJavaInterfaces() override;
[email protected]fc2b46b2014-05-03 16:33:45436#elif defined(OS_MACOSX)
dchengc2282aa2014-10-21 12:07:58437 void SetAllowOtherViews(bool allow) override;
438 bool GetAllowOtherViews() override;
[email protected]155c7f22013-12-09 17:07:18439#endif
[email protected]0bfbf882011-12-22 18:19:27440
441 // Implementation of PageNavigator.
dchengc2282aa2014-10-21 12:07:58442 WebContents* OpenURL(const OpenURLParams& params) override;
[email protected]151a63d2011-12-20 22:32:52443
[email protected]6b618e62012-08-16 12:59:18444 // Implementation of IPC::Sender.
dchengc2282aa2014-10-21 12:07:58445 bool Send(IPC::Message* message) override;
[email protected]6b618e62012-08-16 12:59:18446
[email protected]92404c62013-12-04 16:40:46447 // RenderFrameHostDelegate ---------------------------------------------------
nicka0ac8382016-12-15 23:59:23448 bool OnMessageReceived(RenderFrameHostImpl* render_frame_host,
dchengc2282aa2014-10-21 12:07:58449 const IPC::Message& message) override;
rockotf62002a2016-09-15 00:08:59450 void OnAssociatedInterfaceRequest(
451 RenderFrameHost* render_frame_host,
452 const std::string& interface_name,
453 mojo::ScopedInterfaceEndpointHandle handle) override;
dchengc2282aa2014-10-21 12:07:58454 const GURL& GetMainFrameLastCommittedURL() const override;
455 void RenderFrameCreated(RenderFrameHost* render_frame_host) override;
456 void RenderFrameDeleted(RenderFrameHost* render_frame_host) override;
dchengc2282aa2014-10-21 12:07:58457 void ShowContextMenu(RenderFrameHost* render_frame_host,
458 const ContextMenuParams& params) override;
avi777ff452017-02-09 19:04:48459 void RunJavaScriptDialog(RenderFrameHost* render_frame_host,
460 const base::string16& message,
461 const base::string16& default_prompt,
462 const GURL& frame_url,
463 JavaScriptDialogType dialog_type,
464 IPC::Message* reply_msg) override;
dchengc2282aa2014-10-21 12:07:58465 void RunBeforeUnloadConfirm(RenderFrameHost* render_frame_host,
dchengc2282aa2014-10-21 12:07:58466 bool is_reload,
467 IPC::Message* reply_msg) override;
naskoada75b22016-06-11 16:09:46468 void RunFileChooser(RenderFrameHost* render_frame_host,
469 const FileChooserParams& params) override;
dchengc2282aa2014-10-21 12:07:58470 void DidAccessInitialDocument() override;
alexmosbe2f4c32015-03-10 02:30:23471 void DidChangeName(RenderFrameHost* render_frame_host,
472 const std::string& name) override;
dchengc2282aa2014-10-21 12:07:58473 void DocumentOnLoadCompleted(RenderFrameHost* render_frame_host) override;
creis8eb8ef22015-11-04 22:51:38474 void UpdateStateForFrame(RenderFrameHost* render_frame_host,
475 const PageState& page_state) override;
dchengc2282aa2014-10-21 12:07:58476 void UpdateTitle(RenderFrameHost* render_frame_host,
dchengc2282aa2014-10-21 12:07:58477 const base::string16& title,
478 base::i18n::TextDirection title_direction) override;
479 void UpdateEncoding(RenderFrameHost* render_frame_host,
480 const std::string& encoding) override;
481 WebContents* GetAsWebContents() override;
482 bool IsNeverVisible() override;
483 AccessibilityMode GetAccessibilityMode() const override;
484 void AccessibilityEventReceived(
anand.ratn120b0b002014-10-07 15:49:32485 const std::vector<AXEventNotificationDetails>& details) override;
dmazzoni2400c462016-08-23 15:07:13486 void AccessibilityLocationChangesReceived(
487 const std::vector<AXLocationChangeNotificationDetails>& details) override;
dchengc2282aa2014-10-21 12:07:58488 RenderFrameHost* GetGuestByInstanceID(
fsamuel833ee7c2015-02-13 23:40:40489 RenderFrameHost* render_frame_host,
dchengc2282aa2014-10-21 12:07:58490 int browser_plugin_instance_id) override;
mcasas4e216e72016-07-28 21:28:38491 device::GeolocationServiceContext* GetGeolocationServiceContext() override;
blundelle75a8f92017-03-27 08:11:17492 device::mojom::WakeLockContext* GetWakeLockServiceContext() override;
mlamouri7a78d6fd2015-01-17 13:23:53493 void EnterFullscreenMode(const GURL& origin) override;
bokanece34a82016-01-28 19:49:46494 void ExitFullscreenMode(bool will_cause_resize) override;
alexmose7da5a12015-04-09 02:22:16495 bool ShouldRouteMessageEvent(
496 RenderFrameHost* target_rfh,
497 SiteInstance* source_site_instance) const override;
alexmos58729042015-06-18 23:20:00498 void EnsureOpenerProxiesExist(RenderFrameHost* source_rfh) override;
dcheng59716272016-04-09 05:19:08499 std::unique_ptr<WebUIImpl> CreateWebUIForRenderFrameHost(
500 const GURL& url) override;
avallee0206f782016-07-28 18:55:33501 void SetFocusedFrame(FrameTreeNode* node, SiteInstance* source) override;
ekaramada110f642016-12-21 19:47:28502 void OnFocusedElementChangedInFrame(
503 RenderFrameHostImpl* frame,
504 const gfx::Rect& bounds_in_root_view) override;
nick5ae4d2d2017-01-06 01:18:35505 void CreateNewWindow(
csharrison95f01e922017-04-24 18:52:35506 RenderFrameHost* opener,
nick5ae4d2d2017-01-06 01:18:35507 int32_t render_view_route_id,
508 int32_t main_frame_route_id,
509 int32_t main_frame_widget_route_id,
510 const mojom::CreateNewWindowParams& params,
511 SessionStorageNamespace* session_storage_namespace) override;
512 void ShowCreatedWindow(int process_id,
513 int main_frame_widget_route_id,
514 WindowOpenDisposition disposition,
515 const gfx::Rect& initial_rect,
516 bool user_gesture) override;
carloskd9d97942017-02-16 08:58:09517 void DidDisplayInsecureContent() override;
518 void DidRunInsecureContent(const GURL& security_origin,
519 const GURL& target_url) override;
520 void PassiveInsecureContentFound(const GURL& resource_url) override;
521 bool ShouldAllowRunningInsecureContent(content::WebContents* web_contents,
522 bool allowed_per_prefs,
523 const url::Origin& origin,
524 const GURL& resource_url) override;
rob.buis300b0872017-03-10 20:43:58525#if defined(OS_ANDROID)
526 base::android::ScopedJavaLocalRef<jobject> GetJavaRenderFrameHostDelegate()
527 override;
528#endif
[email protected]952a68e2011-11-17 00:36:10529
[email protected]92404c62013-12-04 16:40:46530 // RenderViewHostDelegate ----------------------------------------------------
dchengc2282aa2014-10-21 12:07:58531 RenderViewHostDelegateView* GetDelegateView() override;
nicka0ac8382016-12-15 23:59:23532 bool OnMessageReceived(RenderViewHostImpl* render_view_host,
dchengc2282aa2014-10-21 12:07:58533 const IPC::Message& message) override;
[email protected]a86c0e962013-12-17 17:10:39534 // RenderFrameHostDelegate has the same method, so list it there because this
535 // interface is going away.
nick51208922015-04-24 21:38:37536 // WebContents* GetAsWebContents() override;
dchengc2282aa2014-10-21 12:07:58537 void RenderViewCreated(RenderViewHost* render_view_host) override;
538 void RenderViewReady(RenderViewHost* render_view_host) override;
539 void RenderViewTerminated(RenderViewHost* render_view_host,
540 base::TerminationStatus status,
541 int error_code) override;
542 void RenderViewDeleted(RenderViewHost* render_view_host) override;
sky8b00392d2015-01-10 00:30:28543 void UpdateTargetURL(RenderViewHost* render_view_host,
544 const GURL& url) override;
dchengc2282aa2014-10-21 12:07:58545 void Close(RenderViewHost* render_view_host) override;
546 void RequestMove(const gfx::Rect& new_bounds) override;
547 void DidCancelLoading() override;
548 void DocumentAvailableInMainFrame(RenderViewHost* render_view_host) override;
549 void RouteCloseEvent(RenderViewHost* rvh) override;
avia90ae4e2016-11-11 20:49:33550 bool DidAddMessageToConsole(int32_t level,
551 const base::string16& message,
552 int32_t line_no,
553 const base::string16& source_id) override;
dchengc2282aa2014-10-21 12:07:58554 RendererPreferences GetRendererPrefs(
anand.ratn120b0b002014-10-07 15:49:32555 BrowserContext* browser_context) const override;
dominickn9c7ceaa32016-02-27 01:52:53556 void OnUserInteraction(RenderWidgetHostImpl* render_widget_host,
557 const blink::WebInputEvent::Type type) override;
dchengc2282aa2014-10-21 12:07:58558 void OnIgnoredUIEvent() override;
dchengc2282aa2014-10-21 12:07:58559 void Activate() override;
dchengc2282aa2014-10-21 12:07:58560 void UpdatePreferredSize(const gfx::Size& pref_size) override;
avib7348942015-12-25 20:57:10561 void CreateNewWidget(int32_t render_process_id,
562 int32_t route_id,
dchengc2282aa2014-10-21 12:07:58563 blink::WebPopupType popup_type) override;
avib7348942015-12-25 20:57:10564 void CreateNewFullscreenWidget(int32_t render_process_id,
565 int32_t route_id) override;
alexmosc2a8cec2016-05-23 22:19:53566 void ShowCreatedWidget(int process_id,
567 int route_id,
568 const gfx::Rect& initial_rect) override;
569 void ShowCreatedFullscreenWidget(int process_id, int route_id) override;
dchengc2282aa2014-10-21 12:07:58570 void RequestMediaAccessPermission(
[email protected]33662e52013-01-07 21:31:09571 const MediaStreamRequest& request,
anand.ratn120b0b002014-10-07 15:49:32572 const MediaResponseCallback& callback) override;
dchengc2282aa2014-10-21 12:07:58573 bool CheckMediaAccessPermission(const GURL& security_origin,
574 MediaStreamType type) override;
guidou8a440b842017-01-30 13:58:43575 std::string GetDefaultMediaDeviceID(MediaStreamType type) override;
dchengc2282aa2014-10-21 12:07:58576 SessionStorageNamespace* GetSessionStorageNamespace(
anand.ratn120b0b002014-10-07 15:49:32577 SiteInstance* instance) override;
dchengc2282aa2014-10-21 12:07:58578 SessionStorageNamespaceMap GetSessionStorageNamespaceMap() override;
avi85ee8362016-10-08 02:09:08579 double GetPendingPageZoomLevel() override;
dchengc2282aa2014-10-21 12:07:58580 FrameTree* GetFrameTree() override;
lukendc35e7f2014-11-10 19:06:14581 void SetIsVirtualKeyboardRequested(bool requested) override;
582 bool IsVirtualKeyboardRequested() override;
aelias5252baa2016-04-10 01:18:02583 bool IsOverridingUserAgent() override;
avi85ee8362016-10-08 02:09:08584 bool IsJavaScriptDialogShowing() const override;
avic031d392017-03-03 03:09:42585 bool ShouldIgnoreUnresponsiveRenderer() override;
qinmin72e8bd02016-10-21 19:35:37586 bool HideDownloadUI() const override;
mlamouri5cd9ae82017-02-18 11:05:09587 bool HasPersistentVideo() const override;
lukendc35e7f2014-11-10 19:06:14588
[email protected]52913802013-12-10 05:52:18589 // NavigatorDelegate ---------------------------------------------------------
590
clamy0e119882015-07-31 16:12:33591 void DidStartNavigation(NavigationHandle* navigation_handle) override;
592 void DidRedirectNavigation(NavigationHandle* navigation_handle) override;
clamyefca29e2015-09-17 00:22:11593 void ReadyToCommitNavigation(NavigationHandle* navigation_handle) override;
clamy0e119882015-07-31 16:12:33594 void DidFinishNavigation(NavigationHandle* navigation_handle) override;
dchengc2282aa2014-10-21 12:07:58595 void DidFailLoadWithError(RenderFrameHostImpl* render_frame_host,
596 const GURL& url,
597 int error_code,
gsennton6fbb38692015-06-24 19:23:55598 const base::string16& error_description,
599 bool was_ignored_by_handler) override;
dchengc2282aa2014-10-21 12:07:58600 void DidNavigateMainFramePreCommit(bool navigation_is_within_page) override;
601 void DidNavigateMainFramePostCommit(
sky8b00392d2015-01-10 00:30:28602 RenderFrameHostImpl* render_frame_host,
[email protected]37567b432014-02-12 01:12:22603 const LoadCommittedDetails& details,
anand.ratn120b0b002014-10-07 15:49:32604 const FrameHostMsg_DidCommitProvisionalLoad_Params& params) override;
dchengc2282aa2014-10-21 12:07:58605 void DidNavigateAnyFramePostCommit(
[email protected]37567b432014-02-12 01:12:22606 RenderFrameHostImpl* render_frame_host,
607 const LoadCommittedDetails& details,
anand.ratn120b0b002014-10-07 15:49:32608 const FrameHostMsg_DidCommitProvisionalLoad_Params& params) override;
dchengc2282aa2014-10-21 12:07:58609 void SetMainFrameMimeType(const std::string& mime_type) override;
610 bool CanOverscrollContent() const override;
611 void NotifyChangedNavigationState(InvalidateTypes changed_flags) override;
toyoshim0df1d3a2016-09-09 09:52:48612 void DidStartNavigationToPendingEntry(const GURL& url,
613 ReloadType reload_type) override;
lukasza1d025732016-09-28 21:36:08614 bool ShouldTransferNavigation(bool is_main_frame_navigation) override;
dchengc2282aa2014-10-21 12:07:58615 bool ShouldPreserveAbortedURLs() override;
fdegansa696e5112015-04-17 01:57:59616 void DidStartLoading(FrameTreeNode* frame_tree_node,
617 bool to_different_document) override;
618 void DidStopLoading() override;
619 void DidChangeLoadProgress() override;
avid6d88b912017-01-13 00:16:00620 std::vector<std::unique_ptr<NavigationThrottle>> CreateThrottlesForNavigation(
clamycbf524d42016-09-27 12:48:35621 NavigationHandle* navigation_handle) override;
clamy1e5574e2016-09-29 16:48:44622 std::unique_ptr<NavigationUIData> GetNavigationUIData(
623 NavigationHandle* navigation_handle) override;
[email protected]52913802013-12-10 05:52:18624
[email protected]4ca76c02012-05-16 16:19:05625 // RenderWidgetHostDelegate --------------------------------------------------
626
lazyboy63f5b312015-11-23 20:19:52627 void RenderWidgetCreated(RenderWidgetHostImpl* render_widget_host) override;
dchengc2282aa2014-10-21 12:07:58628 void RenderWidgetDeleted(RenderWidgetHostImpl* render_widget_host) override;
miu9e14e492014-10-25 02:39:04629 void RenderWidgetGotFocus(RenderWidgetHostImpl* render_widget_host) override;
rouslan2f5993f2015-01-29 00:18:31630 void RenderWidgetWasResized(RenderWidgetHostImpl* render_widget_host,
631 bool width_changed) override;
avic3aa8422015-11-09 20:57:22632 void ResizeDueToAutoResize(RenderWidgetHostImpl* render_widget_host,
633 const gfx::Size& new_size) override;
paulmeyer9ef6e4462015-02-24 19:15:10634 void ScreenInfoChanged() override;
wjmaclean8a795f32016-08-11 23:49:58635 void UpdateDeviceScaleFactor(double device_scale_factor) override;
ccameron2f451532016-09-07 21:49:27636 void GetScreenInfo(ScreenInfo* screen_info) override;
skyf65d9bb2017-03-24 02:26:39637 KeyboardEventProcessingResult PreHandleKeyboardEvent(
638 const NativeWebKeyboardEvent& event) override;
dchengc2282aa2014-10-21 12:07:58639 void HandleKeyboardEvent(const NativeWebKeyboardEvent& event) override;
640 bool HandleWheelEvent(const blink::WebMouseWheelEvent& event) override;
641 bool PreHandleGestureEvent(const blink::WebGestureEvent& event) override;
dchengc2282aa2014-10-21 12:07:58642 BrowserAccessibilityManager* GetRootBrowserAccessibilityManager() override;
643 BrowserAccessibilityManager* GetOrCreateRootBrowserAccessibilityManager()
anand.ratn120b0b002014-10-07 15:49:32644 override;
lgarron145aaa82015-07-10 07:39:56645 // The following 4 functions are already listed under WebContents overrides:
mohsen7ab1ec16ec2015-07-02 18:26:23646 // void Cut() override;
647 // void Copy() override;
648 // void Paste() override;
lgarron145aaa82015-07-10 07:39:56649 // void SelectAll() override;
mohsen7ab1ec16ec2015-07-02 18:26:23650 void MoveRangeSelectionExtent(const gfx::Point& extent) override;
651 void SelectRange(const gfx::Point& base, const gfx::Point& extent) override;
aurimasab0319022015-07-10 21:57:38652 void AdjustSelectionByCharacterOffset(int start_adjust, int end_adjust)
653 override;
kenrb2a565f82015-09-02 20:24:59654 RenderWidgetHostInputEventRouter* GetInputEventRouter() override;
alexmos3fcd0ca2015-10-23 18:18:33655 void ReplicatePageFocus(bool is_focused) override;
alexmosc4cbacb2015-11-21 01:29:22656 RenderWidgetHostImpl* GetFocusedRenderWidgetHost(
657 RenderWidgetHostImpl* receiving_widget) override;
avallee9993fca2016-11-17 06:16:50658 RenderWidgetHostImpl* GetRenderWidgetHostWithPageFocus() override;
659 void FocusOwningWebContents(
660 RenderWidgetHostImpl* render_widget_host) override;
avice799302017-03-09 16:34:59661 void RendererUnresponsive(RenderWidgetHostImpl* render_widget_host) override;
avic3aa8422015-11-09 20:57:22662 void RendererResponsive(RenderWidgetHostImpl* render_widget_host) override;
663 void RequestToLockMouse(RenderWidgetHostImpl* render_widget_host,
664 bool user_gesture,
lfgad8244352016-07-13 16:55:51665 bool last_unlocked_by_target,
666 bool privileged) override;
alexmos5dd617d2016-06-07 04:21:15667 bool IsFullscreenForCurrentTab() const override;
avibf58fa0c2015-11-11 01:45:52668 blink::WebDisplayMode GetDisplayMode(
669 RenderWidgetHostImpl* render_widget_host) const override;
avi3e4b8512015-11-11 01:55:49670 void LostCapture(RenderWidgetHostImpl* render_widget_host) override;
671 void LostMouseLock(RenderWidgetHostImpl* render_widget_host) override;
lfgad8244352016-07-13 16:55:51672 bool HasMouseLock(RenderWidgetHostImpl* render_widget_host) override;
lfg84763c92017-02-16 18:55:15673 RenderWidgetHostImpl* GetMouseLockWidget() override;
ekaramada4f42692016-02-11 19:48:37674 void OnRenderFrameProxyVisibilityChanged(bool visible) override;
lfgbb9c28a2016-03-01 03:19:49675 void SendScreenRects() override;
ekaramadadd882292016-06-08 15:22:56676 TextInputManager* GetTextInputManager() override;
paulmeyer7f6f1d4f2016-11-15 00:00:27677 bool OnUpdateDragCursor() override;
kenrb11f213a2017-03-24 18:12:06678 bool IsWidgetForMainFrame(RenderWidgetHostImpl* render_widget_host) override;
nzolghadrd87a308d2016-12-07 15:45:56679 bool AddDomainInfoToRapporSample(rappor::Sample* sample) override;
ekaramada110f642016-12-21 19:47:28680 void FocusedNodeTouched(bool editable) override;
samans90fb8162017-04-04 22:30:45681 void DidReceiveCompositorFrame() override;
[email protected]4ca76c02012-05-16 16:19:05682
[email protected]b0936d22013-11-28 06:47:36683 // RenderFrameHostManager::Delegate ------------------------------------------
[email protected]0bfbf882011-12-22 18:19:27684
dchengc2282aa2014-10-21 12:07:58685 bool CreateRenderViewForRenderManager(
[email protected]bffc8302014-01-23 20:52:16686 RenderViewHost* render_view_host,
alexmos5ac402d2015-07-09 07:51:10687 int opener_frame_routing_id,
[email protected]5a7100d2014-05-19 01:29:04688 int proxy_routing_id,
lfgbede6392015-09-11 21:54:06689 const FrameReplicationState& replicated_frame_state) override;
690 void CreateRenderWidgetHostViewForRenderManager(
691 RenderViewHost* render_view_host) override;
alexmosa181efc2015-09-03 00:39:04692 bool CreateRenderFrameForRenderManager(
693 RenderFrameHost* render_frame_host,
694 int proxy_routing_id,
695 int opener_routing_id,
696 int parent_routing_id,
697 int previous_sibling_routing_id) override;
dchengc2282aa2014-10-21 12:07:58698 void BeforeUnloadFiredFromRenderManager(
699 bool proceed,
700 const base::TimeTicks& proceed_time,
anand.ratn120b0b002014-10-07 15:49:32701 bool* proceed_to_fire_unload) override;
dchengc2282aa2014-10-21 12:07:58702 void RenderProcessGoneFromRenderManager(
anand.ratn120b0b002014-10-07 15:49:32703 RenderViewHost* render_view_host) override;
dchengc2282aa2014-10-21 12:07:58704 void UpdateRenderViewSizeForRenderManager() override;
705 void CancelModalDialogsForRenderManager() override;
706 void NotifySwappedFromRenderManager(RenderFrameHost* old_host,
707 RenderFrameHost* new_host,
708 bool is_main_frame) override;
naskof5940b9f2015-03-02 23:04:05709 void NotifyMainFrameSwappedFromRenderManager(
710 RenderViewHost* old_host,
711 RenderViewHost* new_host) override;
dchengc2282aa2014-10-21 12:07:58712 NavigationControllerImpl& GetControllerForRenderManager() override;
dchengc2282aa2014-10-21 12:07:58713 NavigationEntry* GetLastCommittedNavigationEntryForRenderManager() override;
714 bool FocusLocationBarByDefault() override;
715 void SetFocusToLocationBar(bool select_all) override;
716 bool IsHidden() override;
rob97250742015-12-10 17:45:15717 int GetOuterDelegateFrameTreeNodeId() override;
ekaramadaeb3c5c2016-11-09 03:22:35718 RenderWidgetHostImpl* GetFullscreenRenderWidgetHost() const override;
[email protected]0bfbf882011-12-22 18:19:27719
[email protected]8ff00d72012-10-23 19:12:21720 // NotificationObserver ------------------------------------------------------
[email protected]14392a52012-05-02 20:28:44721
dchengc2282aa2014-10-21 12:07:58722 void Observe(int type,
723 const NotificationSource& source,
724 const NotificationDetails& details) override;
[email protected]14392a52012-05-02 20:28:44725
[email protected]ec6c05f2013-10-23 18:41:57726 // NavigationControllerDelegate ----------------------------------------------
727
dchengc2282aa2014-10-21 12:07:58728 WebContents* GetWebContents() override;
729 void NotifyNavigationEntryCommitted(
anand.ratn120b0b002014-10-07 15:49:32730 const LoadCommittedDetails& load_details) override;
[email protected]ec6c05f2013-10-23 18:41:57731
732 // Invoked before a form repost warning is shown.
dchengc2282aa2014-10-21 12:07:58733 void NotifyBeforeFormRepostWarningShow() override;
[email protected]ec6c05f2013-10-23 18:41:57734
735 // Activate this WebContents and show a form repost warning.
dchengc2282aa2014-10-21 12:07:58736 void ActivateAndShowRepostFormWarningDialog() override;
[email protected]ec6c05f2013-10-23 18:41:57737
[email protected]b4c84012014-04-28 19:51:10738 // Whether the initial empty page of this view has been accessed by another
739 // page, making it unsafe to show the pending URL. Always false after the
740 // first commit.
dchengc2282aa2014-10-21 12:07:58741 bool HasAccessedInitialDocument() override;
[email protected]b4c84012014-04-28 19:51:10742
avi2b177592014-12-10 02:08:02743 // Sets the history for this WebContentsImpl to |history_length| entries, with
alexmos136fd6e62016-08-15 20:58:41744 // an offset of |history_offset|. This notifies all renderers involved in
745 // rendering the current page about the new offset and length.
avi2b177592014-12-10 02:08:02746 void SetHistoryOffsetAndLength(int history_offset,
747 int history_length) override;
[email protected]553602e12011-04-05 17:01:18748
[email protected]a86c0e962013-12-17 17:10:39749 // Called by InterstitialPageImpl when it creates a RenderFrameHost.
dchengc2282aa2014-10-21 12:07:58750 void RenderFrameForInterstitialPageCreated(
anand.ratn120b0b002014-10-07 15:49:32751 RenderFrameHost* render_frame_host) override;
[email protected]561628ce2013-10-25 00:56:47752
753 // Sets the passed interstitial as the currently showing interstitial.
754 // No interstitial page should already be attached.
dchengc2282aa2014-10-21 12:07:58755 void AttachInterstitialPage(InterstitialPageImpl* interstitial_page) override;
[email protected]561628ce2013-10-25 00:56:47756
757 // Unsets the currently showing interstitial.
dchengc2282aa2014-10-21 12:07:58758 void DetachInterstitialPage() override;
[email protected]561628ce2013-10-25 00:56:47759
aelias5252baa2016-04-10 01:18:02760 void UpdateOverridingUserAgent() override;
761
clamy44e84ce2016-02-22 15:38:25762 // Unpause the throbber if it was paused.
763 void DidProceedOnInterstitial() override;
[email protected]561628ce2013-10-25 00:56:47764
[email protected]e4abd3b42013-11-12 18:28:47765 typedef base::Callback<void(WebContents*)> CreatedCallback;
[email protected]561628ce2013-10-25 00:56:47766
[email protected]34ff1cfc2014-08-20 06:16:05767 // Forces overscroll to be disabled (used by touch emulation).
768 void SetForceDisableOverscrollContent(bool force_disable);
769
avayvodcc85bbd2015-08-28 19:11:15770 AudioStreamMonitor* audio_stream_monitor() {
771 return &audio_stream_monitor_;
dalecurtisbc6572e12014-09-12 19:22:30772 }
773
dalecurtis88c240072015-12-09 02:11:18774 // Called by MediaWebContentsObserver when playback starts or stops. See the
775 // WebContentsObserver function stubs for more details.
billorr21c005d2016-11-17 03:57:04776 void MediaStartedPlaying(
777 const WebContentsObserver::MediaPlayerInfo& media_info,
778 const WebContentsObserver::MediaPlayerId& id);
779 void MediaStoppedPlaying(
780 const WebContentsObserver::MediaPlayerInfo& media_info,
781 const WebContentsObserver::MediaPlayerId& id);
782 int GetCurrentlyPlayingVideoCount() override;
783
784 bool IsFullscreen() override;
dalecurtisbc6572e12014-09-12 19:22:30785
qinmin58567c82015-01-07 21:00:20786 MediaWebContentsObserver* media_web_contents_observer() {
787 return media_web_contents_observer_.get();
788 }
qinmin58567c82015-01-07 21:00:20789
tapted65ff2ea72016-03-01 23:39:00790 // Update the web contents visibility.
791 void UpdateWebContentsVisibility(bool visible);
792
paulmeyerc0b762b2016-04-13 11:55:17793 // Called by FindRequestManager when find replies come in from a renderer
794 // process.
795 void NotifyFindReply(int request_id,
796 int number_of_matches,
797 const gfx::Rect& selection_rect,
798 int active_match_ordinal,
799 bool final_update);
800
ortuno467e5792016-06-10 04:32:39801 // Modify the counter of connected devices for this WebContents.
802 void IncrementBluetoothConnectedDeviceCount();
803 void DecrementBluetoothConnectedDeviceCount();
804
mlamouri5cd9ae82017-02-18 11:05:09805 // Called when the WebContents gains or loses a persistent video.
zqzhang8ac49002017-03-16 21:51:35806 void SetHasPersistentVideo(bool has_persistent_video);
mlamouri5cd9ae82017-02-18 11:05:09807
mlamourie52c1b542017-02-23 14:57:50808 // Whether the WebContents has an active player is effectively fullscreen.
809 // That means that the video is either fullscreen or it is the content of
810 // a fullscreen page (in other words, a fullscreen video with custom
811 // controls).
812 // |IsFullscreen| must return |true| when this method is called.
813 bool HasActiveEffectivelyFullscreenVideo() const;
814
lfg1453e412017-04-11 00:48:50815 // When inner or outer WebContents are present, become the focused
816 // WebContentsImpl. This will activate this content's main frame RenderWidget
817 // and indirectly all its subframe widgets. GetFocusedRenderWidgetHost will
818 // search this WebContentsImpl for a focused RenderWidgetHost. The previously
819 // focused WebContentsImpl, if any, will have its RenderWidgetHosts
820 // deactivated.
821 void SetAsFocusedWebContentsIfNecessary();
822
paulmeyerc0b762b2016-04-13 11:55:17823#if defined(OS_ANDROID)
824 // Called by FindRequestManager when all of the find match rects are in.
825 void NotifyFindMatchRectsReply(int version,
826 const std::vector<gfx::RectF>& rects,
827 const gfx::RectF& active_rect);
828#endif
829
lof84501da082016-05-23 21:22:54830 private:
[email protected]8ff00d72012-10-23 19:12:21831 friend class WebContentsObserver;
832 friend class WebContents; // To implement factory methods.
[email protected]0dd3a0ab2011-02-18 08:17:44833
[email protected]2db9bd72012-04-13 20:20:56834 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, NoJSMessageOnInterstitials);
835 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, UpdateTitle);
[email protected]45a22ad2013-02-21 03:25:00836 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, FindOpenerRVHWhenPending);
[email protected]2db9bd72012-04-13 20:20:56837 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest,
838 CrossSiteCantPreemptAfterUnload);
nick5ae4d2d2017-01-06 01:18:35839 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, PendingContentsDestroyed);
840 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, PendingContentsShown);
[email protected]50904452013-05-09 02:05:12841 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, FrameTreeShape);
[email protected]9a890452014-02-13 22:21:02842 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, GetLastActiveTime);
estarka5635c42015-07-14 00:06:53843 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest,
844 LoadResourceFromMemoryCacheWithBadSecurityInfo);
jwwf4684d12015-09-02 06:12:52845 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest,
jam91dd24e2016-08-12 17:16:42846 LoadResourceWithEmptySecurityInfo);
avid53461d2016-02-25 17:15:04847 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest,
848 ResetJavaScriptDialogOnUserNavigate);
[email protected]0dd3a0ab2011-02-18 08:17:44849 FRIEND_TEST_ALL_PREFIXES(FormStructureBrowserTest, HTMLFiles);
850 FRIEND_TEST_ALL_PREFIXES(NavigationControllerTest, HistoryNavigate);
[email protected]b0936d22013-11-28 06:47:36851 FRIEND_TEST_ALL_PREFIXES(RenderFrameHostManagerTest, PageDoesBackAndReload);
[email protected]de3c5d82014-05-28 22:12:59852 FRIEND_TEST_ALL_PREFIXES(SitePerProcessBrowserTest, CrossSiteIframe);
alexmosc2a8cec2016-05-23 22:19:53853 FRIEND_TEST_ALL_PREFIXES(SitePerProcessBrowserTest,
854 TwoSubframesCreatePopupsSimultaneously);
855 FRIEND_TEST_ALL_PREFIXES(SitePerProcessBrowserTest,
856 TwoSubframesCreatePopupMenuWidgetsSimultaneously);
dmazzoni0b5d2482014-09-10 19:45:57857 FRIEND_TEST_ALL_PREFIXES(SitePerProcessAccessibilityBrowserTest,
858 CrossSiteIframeAccessibility);
avic529387b2016-04-06 16:14:53859 FRIEND_TEST_ALL_PREFIXES(WebContentsImplBrowserTest,
860 JavaScriptDialogsInMainAndSubframes);
avi2d7d2c32017-03-15 21:55:02861 FRIEND_TEST_ALL_PREFIXES(RenderFrameHostImplBrowserTest,
862 IframeBeforeUnloadParentHang);
[email protected]0dd3a0ab2011-02-18 08:17:44863
paulmeyera41de3b2016-05-05 16:30:18864 // So |find_request_manager_| can be accessed for testing.
865 friend class FindRequestManagerTest;
866
[email protected]80e776ae2012-03-23 16:17:20867 // TODO(brettw) TestWebContents shouldn't exist!
[email protected]8ff00d72012-10-23 19:12:21868 friend class TestWebContents;
[email protected]0dd3a0ab2011-02-18 08:17:44869
[email protected]7fff43e2013-05-21 20:21:10870 class DestructionObserver;
871
lazyboy6ec48b2a2015-06-29 15:18:14872 // Represents a WebContents node in a tree of WebContents structure.
873 //
874 // Two WebContents with separate FrameTrees can be connected by
875 // outer/inner relationship using this class. Note that their FrameTrees
876 // still remain disjoint.
877 // The parent is referred to as "outer WebContents" and the descendents are
878 // referred to as "inner WebContents".
879 // For each inner WebContents, the outer WebContents will have a
880 // corresponding FrameTreeNode.
lfga3e2bdc2017-03-07 20:44:01881 class WebContentsTreeNode final : public FrameTreeNode::Observer {
lazyboy6ec48b2a2015-06-29 15:18:14882 public:
lfg601233692017-03-06 22:45:44883 explicit WebContentsTreeNode(WebContentsImpl* current_web_contents);
lfga3e2bdc2017-03-07 20:44:01884 ~WebContentsTreeNode() final;
lazyboy6ec48b2a2015-06-29 15:18:14885
lazyboy6ec48b2a2015-06-29 15:18:14886 void ConnectToOuterWebContents(WebContentsImpl* outer_web_contents,
887 RenderFrameHostImpl* outer_contents_frame);
888
lfg601233692017-03-06 22:45:44889 WebContentsImpl* outer_web_contents() const { return outer_web_contents_; }
avallee0206f782016-07-28 18:55:33890 int outer_contents_frame_tree_node_id() const {
lazyboy6ec48b2a2015-06-29 15:18:14891 return outer_contents_frame_tree_node_id_;
892 }
lfga3e2bdc2017-03-07 20:44:01893 FrameTreeNode* OuterContentsFrameTreeNode() const;
lazyboy6ec48b2a2015-06-29 15:18:14894
avallee0206f782016-07-28 18:55:33895 WebContentsImpl* focused_web_contents() { return focused_web_contents_; }
896 void SetFocusedWebContents(WebContentsImpl* web_contents);
897
lazyboy6ec48b2a2015-06-29 15:18:14898 private:
lfga3e2bdc2017-03-07 20:44:01899 // FrameTreeNode::Observer implementation.
900 void OnFrameTreeNodeDestroyed(FrameTreeNode* node) final;
lfg601233692017-03-06 22:45:44901
902 // The WebContents that owns this WebContentsTreeNode.
903 WebContentsImpl* const current_web_contents_;
904
905 // The outer WebContents of |current_web_contents_|, or nullptr if
906 // |current_web_contents_| is the outermost WebContents.
lazyboy6ec48b2a2015-06-29 15:18:14907 WebContentsImpl* outer_web_contents_;
lfg601233692017-03-06 22:45:44908
909 // The ID of the FrameTreeNode in the |outer_web_contents_| that hosts
910 // |current_web_contents_| as an inner WebContents.
lazyboy6ec48b2a2015-06-29 15:18:14911 int outer_contents_frame_tree_node_id_;
lfg601233692017-03-06 22:45:44912
avallee0206f782016-07-28 18:55:33913 // Only the root node should have this set. This indicates the WebContents
914 // whose frame tree has the focused frame. The WebContents tree could be
915 // arbitrarily deep.
916 WebContentsImpl* focused_web_contents_;
lazyboy6ec48b2a2015-06-29 15:18:14917 };
918
[email protected]d1198fd2012-08-13 22:50:19919 // See WebContents::Create for a description of these parameters.
alexmose201c7cd2015-06-10 17:14:21920 WebContentsImpl(BrowserContext* browser_context);
[email protected]d1198fd2012-08-13 22:50:19921
[email protected]e2225bf2013-11-15 16:09:38922 // Add and remove observers for page navigation notifications. The order in
923 // which notifications are sent to observers is undefined. Clients must be
924 // sure to remove the observer before they go away.
[email protected]8ff00d72012-10-23 19:12:21925 void AddObserver(WebContentsObserver* observer);
926 void RemoveObserver(WebContentsObserver* observer);
[email protected]d1198fd2012-08-13 22:50:19927
alexmose201c7cd2015-06-10 17:14:21928 // Clears a pending contents that has been closed before being shown.
[email protected]7fff43e2013-05-21 20:21:10929 void OnWebContentsDestroyed(WebContentsImpl* web_contents);
930
931 // Creates and adds to the map a destruction observer watching |web_contents|.
932 // No-op if such an observer already exists.
933 void AddDestructionObserver(WebContentsImpl* web_contents);
934
935 // Deletes and removes from the map a destruction observer
936 // watching |web_contents|. No-op if there is no such observer.
937 void RemoveDestructionObserver(WebContentsImpl* web_contents);
[email protected]14392a52012-05-02 20:28:44938
[email protected]de3c5d82014-05-28 22:12:59939 // Traverses all the RenderFrameHosts in the FrameTree and creates a set
[email protected]948481d2014-06-11 18:32:22940 // all the unique RenderWidgetHostViews.
941 std::set<RenderWidgetHostView*> GetRenderWidgetHostViewsInTree();
[email protected]de3c5d82014-05-28 22:12:59942
pkotwicz75ca8ffd2016-02-16 23:10:19943 // Called with the result of a DownloadImage() request.
944 void OnDidDownloadImage(const ImageDownloadCallback& callback,
945 int id,
946 const GURL& image_url,
leon.hancbc4bc3c2016-02-26 07:08:52947 int32_t http_status_code,
leon.hanc2228532016-08-16 05:59:18948 const std::vector<SkBitmap>& images,
949 const std::vector<gfx::Size>& original_image_sizes);
pkotwicz75ca8ffd2016-02-16 23:10:19950
[email protected]6fba26d2014-04-29 09:38:28951 // Callback function when showing JavaScript dialogs. Takes in a routing ID
952 // pair to identify the RenderFrameHost that opened the dialog, because it's
953 // possible for the RenderFrameHost to be deleted by the time this is called.
954 void OnDialogClosed(int render_process_id,
955 int render_frame_id,
[email protected]51da7e32012-01-30 19:24:52956 IPC::Message* reply_msg,
[email protected]87de04b02014-04-08 22:14:49957 bool dialog_was_suppressed,
[email protected]51da7e32012-01-30 19:24:52958 bool success,
[email protected]fcf75d42013-12-03 20:11:26959 const base::string16& user_input);
[email protected]51da7e32012-01-30 19:24:52960
[email protected]d0759f492012-04-19 22:50:50961 // IPC message handlers.
nicka0ac8382016-12-15 23:59:23962 void OnThemeColorChanged(RenderFrameHostImpl* source, SkColor theme_color);
963 void OnDidLoadResourceFromMemoryCache(RenderFrameHostImpl* source,
964 const GURL& url,
[email protected]70435962011-08-02 20:13:28965 const std::string& http_request,
[email protected]6d6cfb3a2012-05-23 22:53:18966 const std::string& mime_type,
[email protected]6c1e05212014-07-31 00:59:40967 ResourceType resource_type);
nicka0ac8382016-12-15 23:59:23968 void OnDidDisplayInsecureContent(RenderFrameHostImpl* source);
elawrenceb2ac2a232017-03-27 21:46:25969 void OnDidContainInsecureFormAction(RenderFrameHostImpl* source);
nicka0ac8382016-12-15 23:59:23970 void OnDidRunInsecureContent(RenderFrameHostImpl* source,
971 const GURL& security_origin,
[email protected]0dd3a0ab2011-02-18 08:17:44972 const GURL& target_url);
nicka0ac8382016-12-15 23:59:23973 void OnDidDisplayContentWithCertificateErrors(RenderFrameHostImpl* source,
974 const GURL& url);
975 void OnDidRunContentWithCertificateErrors(RenderFrameHostImpl* source,
976 const GURL& url);
977 void OnDocumentLoadedInFrame(RenderFrameHostImpl* source);
978 void OnDidFinishLoad(RenderFrameHostImpl* source, const GURL& url);
979 void OnGoToEntryAtOffset(RenderViewHostImpl* source, int offset);
980 void OnUpdateZoomLimits(RenderViewHostImpl* source,
981 int minimum_percent,
[email protected]fce823222014-05-30 16:24:30982 int maximum_percent);
nicka0ac8382016-12-15 23:59:23983 void OnPageScaleFactorChanged(RenderViewHostImpl* source,
984 float page_scale_factor);
985 void OnEnumerateDirectory(RenderViewHostImpl* source,
986 int request_id,
987 const base::FilePath& path);
[email protected]b7a756d42012-01-23 18:08:17988
nicka0ac8382016-12-15 23:59:23989 void OnRegisterProtocolHandler(RenderFrameHostImpl* source,
990 const std::string& protocol,
[email protected]7d189022011-08-25 22:54:20991 const GURL& url,
[email protected]fcf75d42013-12-03 20:11:26992 const base::string16& title,
[email protected]3a3b75a2012-06-01 08:38:36993 bool user_gesture);
nicka0ac8382016-12-15 23:59:23994 void OnUnregisterProtocolHandler(RenderFrameHostImpl* source,
995 const std::string& protocol,
[email protected]f5273e52014-07-14 16:30:20996 const GURL& url,
997 bool user_gesture);
nicka0ac8382016-12-15 23:59:23998 void OnFindReply(RenderFrameHostImpl* source,
999 int request_id,
[email protected]59363fc92012-09-05 03:46:311000 int number_of_matches,
1001 const gfx::Rect& selection_rect,
1002 int active_match_ordinal,
[email protected]b888919c2011-09-02 00:32:161003 bool final_update);
mfomitchev2b8b066a2016-01-28 19:23:151004#if defined(OS_ANDROID)
nicka0ac8382016-12-15 23:59:231005 void OnFindMatchRectsReply(RenderFrameHostImpl* source,
1006 int version,
[email protected]59363fc92012-09-05 03:46:311007 const std::vector<gfx::RectF>& rects,
1008 const gfx::RectF& active_rect);
nicka0ac8382016-12-15 23:59:231009 void OnGetNearestFindResultReply(RenderFrameHostImpl* source,
1010 int request_id,
1011 float distance);
[email protected]1ff427972013-02-07 21:14:071012 void OnOpenDateTimeDialog(
nicka0ac8382016-12-15 23:59:231013 RenderViewHostImpl* source,
[email protected]1ff427972013-02-07 21:14:071014 const ViewHostMsg_DateTimeDialogValue_Params& value);
[email protected]59363fc92012-09-05 03:46:311015#endif
nicka0ac8382016-12-15 23:59:231016 void OnDomOperationResponse(RenderFrameHostImpl* source,
1017 const std::string& json_string);
1018 void OnAppCacheAccessed(RenderViewHostImpl* source,
1019 const GURL& manifest_url,
1020 bool blocked_by_policy);
1021 void OnOpenColorChooser(RenderFrameHostImpl* source,
1022 int color_chooser_id,
[email protected]8bc5ff02013-11-29 06:34:031023 SkColor color,
1024 const std::vector<ColorSuggestion>& suggestions);
nicka0ac8382016-12-15 23:59:231025 void OnEndColorChooser(RenderFrameHostImpl* source, int color_chooser_id);
1026 void OnSetSelectedColorInColorChooser(RenderFrameHostImpl* source,
1027 int color_chooser_id,
1028 SkColor color);
1029 void OnWebUISend(RenderViewHostImpl* source,
1030 const GURL& source_url,
[email protected]d0759f492012-04-19 22:50:501031 const std::string& name,
1032 const base::ListValue& args);
nicka0ac8382016-12-15 23:59:231033 void OnUpdatePageImportanceSignals(RenderFrameHostImpl* source,
1034 const PageImportanceSignals& signals);
brettw4b461082016-11-19 18:55:161035#if BUILDFLAG(ENABLE_PLUGINS)
nicka0ac8382016-12-15 23:59:231036 void OnPepperInstanceCreated(RenderFrameHostImpl* source,
1037 int32_t pp_instance);
1038 void OnPepperInstanceDeleted(RenderFrameHostImpl* source,
1039 int32_t pp_instance);
1040 void OnPepperPluginHung(RenderFrameHostImpl* source,
1041 int plugin_child_id,
tommyclie6633ca72014-10-31 00:40:421042 const base::FilePath& path,
1043 bool is_hung);
nicka0ac8382016-12-15 23:59:231044 void OnPepperStartsPlayback(RenderFrameHostImpl* source, int32_t pp_instance);
1045 void OnPepperStopsPlayback(RenderFrameHostImpl* source, int32_t pp_instance);
1046 void OnPluginCrashed(RenderFrameHostImpl* source,
1047 const base::FilePath& plugin_path,
tommyclie6633ca72014-10-31 00:40:421048 base::ProcessId plugin_pid);
nicka0ac8382016-12-15 23:59:231049 void OnRequestPpapiBrokerPermission(RenderViewHostImpl* source,
1050 int ppb_broker_route_id,
[email protected]d8415ad92012-08-23 14:40:501051 const GURL& url,
[email protected]2dec8ec2013-02-07 19:20:341052 const base::FilePath& plugin_path);
tommyclie6633ca72014-10-31 00:40:421053
1054 // Callback function when requesting permission to access the PPAPI broker.
1055 // |result| is true if permission was granted.
nicka0ac8382016-12-15 23:59:231056 void SendPpapiBrokerPermissionResult(int process_id,
1057 int ppb_broker_route_id,
1058 bool result);
tommyclie6633ca72014-10-31 00:40:421059
fsamuel833ee7c2015-02-13 23:40:401060 void OnBrowserPluginMessage(RenderFrameHost* render_frame_host,
1061 const IPC::Message& message);
brettw4b461082016-11-19 18:55:161062#endif // BUILDFLAG(ENABLE_PLUGINS)
nicka0ac8382016-12-15 23:59:231063 void OnUpdateFaviconURL(RenderViewHostImpl* source,
1064 const std::vector<FaviconURL>& candidates);
1065 void OnFirstVisuallyNonEmptyPaint(RenderViewHostImpl* source);
1066 void OnShowValidationMessage(RenderViewHostImpl* source,
1067 const gfx::Rect& anchor_in_root_view,
[email protected]6ff9c8f2013-12-20 09:05:291068 const base::string16& main_text,
1069 const base::string16& sub_text);
nicka0ac8382016-12-15 23:59:231070 void OnHideValidationMessage(RenderViewHostImpl* source);
1071 void OnMoveValidationMessage(RenderViewHostImpl* source,
1072 const gfx::Rect& anchor_in_root_view);
[email protected]edc3af82013-12-12 21:24:071073
[email protected]0dd3a0ab2011-02-18 08:17:441074 // Called by derived classes to indicate that we're no longer waiting for a
1075 // response. This won't actually update the throbber, but it will get picked
1076 // up at the next animation step if the throbber is going.
1077 void SetNotWaitingForResponse() { waiting_for_response_ = false; }
1078
avallee9993fca2016-11-17 06:16:501079 // Inner WebContents Helpers -------------------------------------------------
1080 //
1081 // These functions are helpers in managing a hierarchy of WebContents
1082 // involved in rendering inner WebContents.
1083
1084 // When multiple WebContents are present within a tab or window, a single one
1085 // is focused and will route keyboard events in most cases to a RenderWidget
1086 // contained within it. |GetFocusedWebContents()|'s main frame widget will
1087 // receive page focus and blur events when the containing window changes focus
1088 // state.
1089
paulmeyerb6c7ab52017-04-10 20:13:311090 // Returns the focused WebContents.
1091 // If there are multiple inner/outer WebContents (when embedding <webview>,
1092 // <guestview>, ...) returns the single one containing the currently focused
1093 // frame. Otherwise, returns this WebContents.
1094 WebContentsImpl* GetFocusedWebContents();
1095
avallee9993fca2016-11-17 06:16:501096 // Returns true if |this| is the focused WebContents or an ancestor of the
1097 // focused WebContents.
1098 bool ContainsOrIsFocusedWebContents();
1099
avallee0206f782016-07-28 18:55:331100 // Returns the root of the WebContents tree.
1101 WebContentsImpl* GetOutermostWebContents();
1102
[email protected]0dd3a0ab2011-02-18 08:17:441103 // Navigation helpers --------------------------------------------------------
1104 //
1105 // These functions are helpers for Navigate() and DidNavigate().
1106
1107 // Handles post-navigation tasks in DidNavigate AFTER the entry has been
1108 // committed to the navigation controller. Note that the navigation entry is
1109 // not provided since it may be invalid/changed after being committed. The
1110 // current navigation entry is in the NavigationController at this point.
[email protected]2f7b3c5a2013-06-21 04:59:251111
[email protected]bafe6cd2012-05-23 23:09:501112 // Helper for CreateNewWidget/CreateNewFullscreenWidget.
avib7348942015-12-25 20:57:101113 void CreateNewWidget(int32_t render_process_id,
1114 int32_t route_id,
[email protected]bafe6cd2012-05-23 23:09:501115 bool is_fullscreen,
[email protected]180ef242013-11-07 06:50:461116 blink::WebPopupType popup_type);
[email protected]bafe6cd2012-05-23 23:09:501117
1118 // Helper for ShowCreatedWidget/ShowCreatedFullscreenWidget.
alexmosc2a8cec2016-05-23 22:19:531119 void ShowCreatedWidget(int process_id,
1120 int route_id,
[email protected]bafe6cd2012-05-23 23:09:501121 bool is_fullscreen,
bokan107a47f2015-02-03 23:23:391122 const gfx::Rect& initial_rect);
[email protected]bafe6cd2012-05-23 23:09:501123
1124 // Finds the new RenderWidgetHost and returns it. Note that this can only be
1125 // called once as this call also removes it from the internal map.
alexmosc2a8cec2016-05-23 22:19:531126 RenderWidgetHostView* GetCreatedWidget(int process_id, int route_id);
[email protected]bafe6cd2012-05-23 23:09:501127
nick5ae4d2d2017-01-06 01:18:351128 // Finds the new WebContentsImpl by |main_frame_widget_route_id|, initializes
1129 // it for renderer-initiated creation, and returns it. Note that this can only
1130 // be called once as this call also removes it from the internal map.
1131 WebContentsImpl* GetCreatedWindow(int process_id,
1132 int main_frame_widget_route_id);
[email protected]bafe6cd2012-05-23 23:09:501133
lfgdb5c4ed2016-03-04 23:09:071134 // Sends a Page message IPC.
1135 void SendPageMessage(IPC::Message* msg);
1136
[email protected]960b0372014-05-19 18:01:001137 // Tracking loading progress -------------------------------------------------
1138
fdegansa696e5112015-04-17 01:57:591139 // Resets the tracking state of the current load progress.
[email protected]960b0372014-05-19 18:01:001140 void ResetLoadProgressState();
1141
fdegansa696e5112015-04-17 01:57:591142 // Notifies the delegate that the load progress was updated.
1143 void SendChangeLoadProgress();
[email protected]960b0372014-05-19 18:01:001144
clamy44e84ce2016-02-22 15:38:251145 // Notifies the delegate of a change in loading state.
1146 // |details| is used to provide details on the load that just finished
1147 // (but can be null if not applicable).
1148 // |due_to_interstitial| is true if the change in load state occurred because
1149 // an interstitial page started showing/proceeded.
1150 void LoadingStateChanged(bool to_different_document,
1151 bool due_to_interstitial,
1152 LoadNotificationDetails* details);
1153
[email protected]0dd3a0ab2011-02-18 08:17:441154 // Misc non-view stuff -------------------------------------------------------
1155
avi2b177592014-12-10 02:08:021156 // Sets the history for a specified RenderViewHost to |history_length|
1157 // entries, with an offset of |history_offset|.
1158 void SetHistoryOffsetAndLengthForView(RenderViewHost* render_view_host,
1159 int history_offset,
1160 int history_length);
1161
[email protected]0dd3a0ab2011-02-18 08:17:441162 // Helper functions for sending notifications.
[email protected]02d7b6e2014-06-24 21:01:501163 void NotifyViewSwapped(RenderViewHost* old_host, RenderViewHost* new_host);
1164 void NotifyFrameSwapped(RenderFrameHost* old_host, RenderFrameHost* new_host);
[email protected]0dd3a0ab2011-02-18 08:17:441165 void NotifyDisconnected();
1166
[email protected]be1f56ab2011-12-22 06:55:311167 void SetEncoding(const std::string& encoding);
1168
[email protected]fa944cb82013-11-15 17:51:211169 // TODO(creis): This should take in a FrameTreeNode to know which node's
1170 // render manager to return. For now, we just return the root's.
[email protected]b0936d22013-11-28 06:47:361171 RenderFrameHostManager* GetRenderManager() const;
[email protected]fa944cb82013-11-15 17:51:211172
[email protected]7a846df2012-09-20 19:17:391173 // Removes browser plugin embedder if there is one.
1174 void RemoveBrowserPluginEmbedder();
1175
[email protected]dc0fd432013-08-27 15:29:211176 // Helper function to invoke WebContentsDelegate::GetSizeForNewRenderView().
[email protected]fc2b46b2014-05-03 16:33:451177 gfx::Size GetSizeForNewRenderView();
[email protected]dc0fd432013-08-27 15:29:211178
[email protected]ae7eeda2014-07-04 01:53:261179 void OnFrameRemoved(RenderFrameHost* render_frame_host);
[email protected]9b159a52013-10-03 17:24:551180
[email protected]222f5822014-02-05 23:40:491181 // Helper method that's called whenever |preferred_size_| or
1182 // |preferred_size_for_capture_| changes, to propagate the new value to the
1183 // |delegate_|.
1184 void OnPreferredSizeChanged(const gfx::Size& old_size);
1185
dbeama1b926a2015-08-31 23:17:511186 // Internal helper to create WebUI objects associated with |this|. |url| is
1187 // used to determine which WebUI should be created (if any). |frame_name|
1188 // corresponds to the name of a frame that the WebUI should be created for (or
1189 // the main frame if empty).
avie865b1d2016-10-24 19:42:591190 std::unique_ptr<WebUIImpl> CreateWebUI(const GURL& url,
1191 const std::string& frame_name);
dbeama1b926a2015-08-31 23:17:511192
avid53461d2016-02-25 17:15:041193 void SetJavaScriptDialogManagerForTesting(
1194 JavaScriptDialogManager* dialog_manager);
1195
paulmeyerb6c7ab52017-04-10 20:13:311196 // Returns the FindRequestManager, or creates one if it doesn't already exist.
paulmeyerc0b762b2016-04-13 11:55:171197 FindRequestManager* GetOrCreateFindRequestManager();
1198
rockotf62002a2016-09-15 00:08:591199 // Removes a registered WebContentsBindingSet by interface name.
1200 void RemoveBindingSet(const std::string& interface_name);
1201
falken52a56e32016-12-08 05:02:401202 // Prints a console warning when visiting a localhost site with a bad
1203 // certificate via --allow-insecure-localhost.
1204 void ShowInsecureLocalhostWarningIfNeeded();
1205
mlamouri5cd9ae82017-02-18 11:05:091206 // Notify this WebContents that the preferences have changed. This will send
1207 // an IPC to all the renderer process associated with this WebContents.
1208 void NotifyPreferencesChanged();
1209
[email protected]0dd3a0ab2011-02-18 08:17:441210 // Data for core operation ---------------------------------------------------
1211
1212 // Delegate for notifying our owner about stuff. Not owned by us.
[email protected]8ff00d72012-10-23 19:12:211213 WebContentsDelegate* delegate_;
[email protected]0dd3a0ab2011-02-18 08:17:441214
1215 // Handles the back/forward list and loading.
[email protected]d202a7c2012-01-04 07:53:471216 NavigationControllerImpl controller_;
[email protected]0dd3a0ab2011-02-18 08:17:441217
1218 // The corresponding view.
dcheng59716272016-04-09 05:19:081219 std::unique_ptr<WebContentsView> view_;
[email protected]0dd3a0ab2011-02-18 08:17:441220
[email protected]5a3bdf52012-05-24 15:12:571221 // The view of the RVHD. Usually this is our WebContentsView implementation,
1222 // but if an embedder uses a different WebContentsView, they'll need to
1223 // provide this.
[email protected]8ff00d72012-10-23 19:12:211224 RenderViewHostDelegateView* render_view_host_delegate_view_;
[email protected]5a3bdf52012-05-24 15:12:571225
[email protected]bafe6cd2012-05-23 23:09:501226 // Tracks created WebContentsImpl objects that have not been shown yet. They
alexmosc2a8cec2016-05-23 22:19:531227 // are identified by the process ID and routing ID passed to CreateNewWindow.
1228 typedef std::pair<int, int> ProcessRoutingIdPair;
1229 std::map<ProcessRoutingIdPair, WebContentsImpl*> pending_contents_;
[email protected]bafe6cd2012-05-23 23:09:501230
alexmosc2a8cec2016-05-23 22:19:531231 // This map holds widgets that were created on behalf of the renderer but
1232 // haven't been shown yet.
1233 std::map<ProcessRoutingIdPair, RenderWidgetHostView*> pending_widget_views_;
[email protected]bafe6cd2012-05-23 23:09:501234
avia8cf81982016-08-12 20:28:461235 std::map<WebContentsImpl*, std::unique_ptr<DestructionObserver>>
1236 destruction_observers_;
[email protected]7fff43e2013-05-21 20:21:101237
[email protected]996042972011-11-08 22:43:591238 // A list of observers notified when page state changes. Weak references.
[email protected]fa944cb82013-11-15 17:51:211239 // This MUST be listed above frame_tree_ since at destruction time the
[email protected]996042972011-11-08 22:43:591240 // latter might cause RenderViewHost's destructor to call us and we might use
1241 // the observer list then.
brettw236d3172015-06-03 16:31:431242 base::ObserverList<WebContentsObserver> observers_;
[email protected]996042972011-11-08 22:43:591243
rockotf62002a2016-09-15 00:08:591244 // Associated interface binding sets attached to this WebContents.
1245 std::map<std::string, WebContentsBindingSet*> binding_sets_;
1246
[email protected]c7c0d822014-04-16 20:19:491247 // True if this tab was opened by another tab. This is not unset if the opener
1248 // is closed.
1249 bool created_with_opener_;
1250
[email protected]0dd3a0ab2011-02-18 08:17:441251 // Helper classes ------------------------------------------------------------
1252
[email protected]fa944cb82013-11-15 17:51:211253 // Manages the frame tree of the page and process swaps in each node.
[email protected]9b159a52013-10-03 17:24:551254 FrameTree frame_tree_;
1255
lfg601233692017-03-06 22:45:441256 // Contains information about the WebContents tree structure.
1257 WebContentsTreeNode node_;
lazyboy6ec48b2a2015-06-29 15:18:141258
[email protected]c7dd2f62011-07-18 15:57:591259 // SavePackage, lazily created.
1260 scoped_refptr<SavePackage> save_package_;
1261
paulmeyerc8cb7cb2016-06-07 01:14:191262 // Manages/coordinates multi-process find-in-page requests. Created lazily.
dcheng18ec0b542016-04-26 19:28:531263 std::unique_ptr<FindRequestManager> find_request_manager_;
paulmeyerc0b762b2016-04-13 11:55:171264
[email protected]0dd3a0ab2011-02-18 08:17:441265 // Data for loading state ----------------------------------------------------
1266
[email protected]6dfed692014-05-22 04:18:031267 // Indicates whether the current load is to a different document. Only valid
1268 // if is_loading_ is true.
1269 bool is_load_to_different_document_;
1270
[email protected]0dd3a0ab2011-02-18 08:17:441271 // Indicates if the tab is considered crashed.
1272 base::TerminationStatus crashed_status_;
1273 int crashed_error_code_;
1274
[email protected]ca13a442012-04-17 14:00:121275 // Whether this WebContents is waiting for a first-response for the
[email protected]be1f56ab2011-12-22 06:55:311276 // main resource of the page. This controls whether the throbber state is
1277 // "waiting" or "loading."
[email protected]0dd3a0ab2011-02-18 08:17:441278 bool waiting_for_response_;
1279
[email protected]0dd3a0ab2011-02-18 08:17:441280 // The current load state and the URL associated with it.
[email protected]9c235f042011-08-10 22:28:211281 net::LoadStateWithParam load_state_;
[email protected]fcf75d42013-12-03 20:11:261282 base::string16 load_state_host_;
[email protected]960b0372014-05-19 18:01:001283
[email protected]960b0372014-05-19 18:01:001284 base::TimeTicks loading_last_progress_update_;
1285
[email protected]0dd3a0ab2011-02-18 08:17:441286 // Upload progress, for displaying in the status bar.
1287 // Set to zero when there is no significant upload happening.
avib7348942015-12-25 20:57:101288 uint64_t upload_size_;
1289 uint64_t upload_position_;
[email protected]0dd3a0ab2011-02-18 08:17:441290
dfalcantarae6b7b46752015-07-10 18:14:161291 // Tracks that this WebContents needs to unblock requests to the renderer.
1292 // See ResumeLoadingCreatedWebContents.
1293 bool is_resume_pending_;
1294
[email protected]0dd3a0ab2011-02-18 08:17:441295 // Data for current page -----------------------------------------------------
1296
[email protected]987fc3a2011-05-26 14:18:091297 // When a title cannot be taken from any entry, this title will be used.
[email protected]fcf75d42013-12-03 20:11:261298 base::string16 page_title_when_no_navigation_entry_;
[email protected]987fc3a2011-05-26 14:18:091299
[email protected]0dd3a0ab2011-02-18 08:17:441300 // When a navigation occurs, we record its contents MIME type. It can be
1301 // used to check whether we can do something for some special contents.
1302 std::string contents_mime_type_;
1303
[email protected]ef3adfc2014-05-11 00:04:541304 // The last reported character encoding, not canonicalized.
1305 std::string last_reported_encoding_;
1306
1307 // The canonicalized character encoding.
1308 std::string canonical_encoding_;
[email protected]0dd3a0ab2011-02-18 08:17:441309
[email protected]b4c84012014-04-28 19:51:101310 // Whether the initial empty page has been accessed by another page, making it
1311 // unsafe to show the pending URL. Usually false unless another window tries
1312 // to modify the blank page. Always false after the first commit.
1313 bool has_accessed_initial_document_;
1314
yusufod41c5f92015-03-06 00:14:281315 // The theme color for the underlying document as specified
1316 // by theme-color meta tag.
1317 SkColor theme_color_;
1318
1319 // The last published theme color.
1320 SkColor last_sent_theme_color_;
1321
peter90afaba2015-06-01 12:05:291322 // Whether the first visually non-empty paint has occurred.
1323 bool did_first_visually_non_empty_paint_;
1324
[email protected]0dd3a0ab2011-02-18 08:17:441325 // Data for misc internal state ----------------------------------------------
1326
[email protected]54597982013-02-06 01:59:551327 // When > 0, the WebContents is currently being captured (e.g., for
1328 // screenshots or mirroring); and the underlying RenderWidgetHost should not
1329 // be told it is hidden.
1330 int capturer_count_;
1331
1332 // Tracks whether RWHV should be visible once capturer_count_ becomes zero.
1333 bool should_normally_be_visible_;
[email protected]0dd3a0ab2011-02-18 08:17:441334
tapted65ff2ea72016-03-01 23:39:001335 // Tracks whether this WebContents was ever set to be visible. Used to
1336 // facilitate WebContents being loaded in the background by setting
1337 // |should_normally_be_visible_|. Ensures WasShown() will trigger when first
1338 // becoming visible to the user, and prevents premature unloading.
1339 bool did_first_set_visible_;
1340
[email protected]0dd3a0ab2011-02-18 08:17:441341 // See getter above.
1342 bool is_being_destroyed_;
1343
creis97867aa2017-02-17 18:39:451344 // Keep track of whether this WebContents is currently iterating over its list
1345 // of observers, during which time it should not be deleted.
1346 bool is_notifying_observers_;
1347
[email protected]0dd3a0ab2011-02-18 08:17:441348 // Indicates whether we should notify about disconnection of this
[email protected]b172aee2012-04-10 17:05:261349 // WebContentsImpl. This is used to ensure disconnection notifications only
[email protected]0dd3a0ab2011-02-18 08:17:441350 // happen if a connection notification has happened and that they happen only
1351 // once.
1352 bool notify_disconnection_;
1353
[email protected]71a88bb2013-02-01 22:05:151354 // Pointer to the JavaScript dialog manager, lazily assigned. Used because the
[email protected]b172aee2012-04-10 17:05:261355 // delegate of this WebContentsImpl is nulled before its destructor is called.
[email protected]71a88bb2013-02-01 22:05:151356 JavaScriptDialogManager* dialog_manager_;
[email protected]2e5b90c2011-08-16 21:11:551357
avi85ee8362016-10-08 02:09:081358 // Set to true when there is an active JavaScript dialog showing.
1359 bool is_showing_javascript_dialog_ = false;
1360
[email protected]0dd3a0ab2011-02-18 08:17:441361 // Set to true when there is an active "before unload" dialog. When true,
1362 // we've forced the throbber to start in Navigate, and we need to remember to
1363 // turn it off in OnJavaScriptMessageBoxClosed if the navigation is canceled.
1364 bool is_showing_before_unload_dialog_;
1365
[email protected]0dd3a0ab2011-02-18 08:17:441366 // Settings that get passed to the renderer process.
[email protected]8ff00d72012-10-23 19:12:211367 RendererPreferences renderer_preferences_;
[email protected]0dd3a0ab2011-02-18 08:17:441368
[email protected]9a890452014-02-13 22:21:021369 // The time that this WebContents was last made active. The initial value is
1370 // the WebContents creation time.
gab0dccfef2015-05-20 18:43:391371 base::TimeTicks last_active_time_;
[email protected]0dd3a0ab2011-02-18 08:17:441372
hajimehoshic4f226a2016-10-21 09:01:571373 // The time that this WebContents was last made hidden. The initial value is
1374 // zero.
1375 base::TimeTicks last_hidden_time_;
1376
[email protected]0dd3a0ab2011-02-18 08:17:441377 // See description above setter.
1378 bool closed_by_user_gesture_;
1379
1380 // Minimum/maximum zoom percent.
1381 int minimum_zoom_percent_;
1382 int maximum_zoom_percent_;
[email protected]0dd3a0ab2011-02-18 08:17:441383
w.shackleton49bcd392016-01-06 17:38:221384 // Used to correctly handle integer zooming through a smooth scroll device.
1385 float zoom_scroll_remainder_;
1386
[email protected]bcd2815602012-01-14 18:17:231387 // The intrinsic size of the page.
1388 gfx::Size preferred_size_;
1389
[email protected]222f5822014-02-05 23:40:491390 // The preferred size for content screen capture. When |capturer_count_| > 0,
1391 // this overrides |preferred_size_|.
1392 gfx::Size preferred_size_for_capture_;
1393
mfomitchev2b8b066a2016-01-28 19:23:151394#if defined(OS_ANDROID)
[email protected]583418cc2013-01-17 14:01:101395 // Date time chooser opened by this tab.
1396 // Only used in Android since all other platforms use a multi field UI.
dcheng59716272016-04-09 05:19:081397 std::unique_ptr<DateTimeChooserAndroid> date_time_chooser_;
[email protected]583418cc2013-01-17 14:01:101398#endif
1399
[email protected]8ed16472014-04-11 19:02:481400 // Holds information about a current color chooser dialog, if one is visible.
1401 struct ColorChooserInfo {
1402 ColorChooserInfo(int render_process_id,
1403 int render_frame_id,
1404 ColorChooser* chooser,
1405 int identifier);
1406 ~ColorChooserInfo();
[email protected]cb805452013-05-22 15:16:211407
nicka0ac8382016-12-15 23:59:231408 bool Matches(RenderFrameHostImpl* render_frame_host, int color_chooser_id);
1409
[email protected]8ed16472014-04-11 19:02:481410 int render_process_id;
1411 int render_frame_id;
1412
1413 // Color chooser that was opened by this tab.
dcheng59716272016-04-09 05:19:081414 std::unique_ptr<ColorChooser> chooser;
[email protected]8ed16472014-04-11 19:02:481415
1416 // A unique identifier for the current color chooser. Identifiers are
1417 // unique across a renderer process. This avoids race conditions in
1418 // synchronizing the browser and renderer processes. For example, if a
1419 // renderer closes one chooser and opens another, and simultaneously the
1420 // user picks a color in the first chooser, the IDs can be used to drop the
1421 // "chose a color" message rather than erroneously tell the renderer that
1422 // the user picked a color in the second chooser.
1423 int identifier;
1424 };
1425
dcheng59716272016-04-09 05:19:081426 std::unique_ptr<ColorChooserInfo> color_chooser_info_;
[email protected]da8543762012-03-20 08:52:201427
[email protected]7a846df2012-09-20 19:17:391428 // Manages the embedder state for browser plugins, if this WebContents is an
1429 // embedder; NULL otherwise.
dcheng59716272016-04-09 05:19:081430 std::unique_ptr<BrowserPluginEmbedder> browser_plugin_embedder_;
[email protected]7a846df2012-09-20 19:17:391431 // Manages the guest state for browser plugin, if this WebContents is a guest;
1432 // NULL otherwise.
dcheng59716272016-04-09 05:19:081433 std::unique_ptr<BrowserPluginGuest> browser_plugin_guest_;
[email protected]7a846df2012-09-20 19:17:391434
brettw4b461082016-11-19 18:55:161435#if BUILDFLAG(ENABLE_PLUGINS)
tommyclieb25b2a2014-11-03 19:45:091436 // Manages the whitelist of plugin content origins exempt from power saving.
dcheng59716272016-04-09 05:19:081437 std::unique_ptr<PluginContentOriginWhitelist>
1438 plugin_content_origin_whitelist_;
tommyclieb25b2a2014-11-03 19:45:091439#endif
1440
[email protected]f53a9f872012-05-24 02:07:061441 // This must be at the end, or else we might get notifications and use other
1442 // member variables that are gone.
[email protected]8ff00d72012-10-23 19:12:211443 NotificationRegistrar registrar_;
[email protected]f53a9f872012-05-24 02:07:061444
[email protected]b24b68a2012-09-24 21:57:261445 // All live RenderWidgetHostImpls that are created by this object and may
1446 // outlive it.
[email protected]8ff00d72012-10-23 19:12:211447 std::set<RenderWidgetHostImpl*> created_widgets_;
[email protected]b24b68a2012-09-24 21:57:261448
alexmosc9e76ec2016-05-16 22:59:371449 // Process id of the shown fullscreen widget, or kInvalidUniqueID if there is
1450 // no fullscreen widget.
1451 int fullscreen_widget_process_id_;
1452
[email protected]44470a22013-01-24 01:21:541453 // Routing id of the shown fullscreen widget or MSG_ROUTING_NONE otherwise.
1454 int fullscreen_widget_routing_id_;
1455
[email protected]0b431992014-06-24 00:08:031456 // At the time the fullscreen widget was being shut down, did it have focus?
1457 // This is used to restore focus to the WebContentsView after both: 1) the
1458 // fullscreen widget is destroyed, and 2) the WebContentsDelegate has
1459 // completed making layout changes to effect an exit from fullscreen mode.
1460 bool fullscreen_widget_had_focus_at_shutdown_;
1461
[email protected]0e584b5f2013-12-30 17:28:231462 // Whether this WebContents is responsible for displaying a subframe in a
[email protected]5dcaf8e2013-12-28 01:31:421463 // different process from its parent page.
1464 bool is_subframe_;
1465
mariakhomenkoa4971c12015-07-21 19:04:371466 // When a new tab is created asynchronously, stores the OpenURLParams needed
1467 // to continue loading the page once the tab is ready.
dcheng59716272016-04-09 05:19:081468 std::unique_ptr<OpenURLParams> delayed_open_url_params_;
mariakhomenkoa4971c12015-07-21 19:04:371469
[email protected]34ff1cfc2014-08-20 06:16:051470 // Whether overscroll should be unconditionally disabled.
1471 bool force_disable_overscroll_content_;
[email protected]e85165c642014-06-10 14:34:311472
[email protected]87de04b02014-04-08 22:14:491473 // Whether the last JavaScript dialog shown was suppressed. Used for testing.
1474 bool last_dialog_suppressed_;
1475
mcasas4e216e72016-07-28 21:28:381476 std::unique_ptr<device::GeolocationServiceContext>
1477 geolocation_service_context_;
blundellc57b93f2014-10-29 13:19:571478
blundelle75a8f92017-03-27 08:11:171479 std::unique_ptr<WakeLockContextHost> wake_lock_context_host_;
alogvinovf50445a2015-10-30 13:00:121480
leon.hane4db177a2017-02-07 14:19:161481 std::unique_ptr<ScreenOrientationProvider> screen_orientation_provider_;
[email protected]01f83f92014-06-17 14:41:541482
dcheng59716272016-04-09 05:19:081483 std::unique_ptr<ManifestManagerHost> manifest_manager_host_;
mlamouriefdca9d2014-09-16 16:55:401484
[email protected]95640212014-07-26 18:14:301485 // The accessibility mode for all frames. This is queried when each frame
1486 // is created, and broadcast to all frames when it changes.
1487 AccessibilityMode accessibility_mode_;
1488
avayvodcc85bbd2015-08-28 19:11:151489 // Monitors power levels for audio streams associated with this WebContents.
1490 AudioStreamMonitor audio_stream_monitor_;
1491
miu50f97892014-09-22 22:49:521492 // Created on-demand to mute all audio output from this WebContents.
dcheng59716272016-04-09 05:19:081493 std::unique_ptr<WebContentsAudioMuter> audio_muter_;
miu50f97892014-09-22 22:49:521494
ortunodf4d7982016-04-08 02:33:351495 size_t bluetooth_connected_device_count_;
ortuno32e7db3c2016-03-29 16:14:201496
lukendc35e7f2014-11-10 19:06:141497 bool virtual_keyboard_requested_;
1498
csharrisona2280cd2016-02-03 23:21:151499 // Notifies ResourceDispatcherHostImpl of various events related to loading.
dcheng59716272016-04-09 05:19:081500 std::unique_ptr<LoaderIOThreadNotifier> loader_io_thread_notifier_;
csharrisona2280cd2016-02-03 23:21:151501
dalecurtis88c240072015-12-09 02:11:181502 // Manages media players, CDMs, and power save blockers for media.
dcheng59716272016-04-09 05:19:081503 std::unique_ptr<MediaWebContentsObserver> media_web_contents_observer_;
qinmin58567c82015-01-07 21:00:201504
brettw4b461082016-11-19 18:55:161505#if BUILDFLAG(ENABLE_PLUGINS)
zqzhang181047e62016-07-01 13:37:171506 // Observes pepper playback changes, and notifies MediaSession.
1507 std::unique_ptr<PepperPlaybackObserver> pepper_playback_observer_;
brettw4b461082016-11-19 18:55:161508#endif // BUILDFLAG(ENABLE_PLUGINS)
zqzhang181047e62016-07-01 13:37:171509
scottmg276753cf2016-10-27 18:25:221510 std::unique_ptr<HostZoomMapObserver> host_zoom_map_observer_;
1511
dcheng59716272016-04-09 05:19:081512 std::unique_ptr<RenderWidgetHostInputEventRouter> rwh_input_event_router_;
kenrb2a565f82015-09-02 20:24:591513
kouhei40f03cb2015-09-24 07:47:011514 PageImportanceSignals page_importance_signals_;
1515
mcnee432e47d2015-11-09 19:37:461516 bool page_scale_factor_is_one_;
1517
ekaramadadd882292016-06-08 15:22:561518 // TextInputManager tracks the IME-related state for all the
1519 // RenderWidgetHostViews on this WebContents. Only exists on the outermost
1520 // WebContents and is automatically destroyed when a WebContents becomes an
1521 // inner WebContents by attaching to an outer WebContents. Then the
1522 // IME-related state for RenderWidgetHosts on the inner WebContents is tracked
1523 // by the TextInputManager in the outer WebContents.
1524 std::unique_ptr<TextInputManager> text_input_manager_;
1525
lfgbee1e0a2016-06-08 21:24:211526 // Stores the RenderWidgetHost that currently holds a mouse lock or nullptr if
1527 // there's no RenderWidgetHost holding a lock.
1528 RenderWidgetHostImpl* mouse_lock_widget_;
1529
sammcf5f1b0f2016-09-20 23:05:111530#if defined(OS_ANDROID)
rockot400ea35b2016-10-15 19:15:321531 std::unique_ptr<service_manager::InterfaceProvider> java_interfaces_;
sammcf5f1b0f2016-09-20 23:05:111532#endif
1533
qinmin72e8bd02016-10-21 19:35:371534 // Whether this WebContents is for content overlay.
1535 bool is_overlay_content_;
1536
billorr21c005d2016-11-17 03:57:041537 int currently_playing_video_count_ = 0;
1538
mlamouri5cd9ae82017-02-18 11:05:091539 bool has_persistent_video_ = false;
1540
mohan.reddyaae039a2014-11-21 17:39:501541 base::WeakPtrFactory<WebContentsImpl> loading_weak_factory_;
pkotwicz75ca8ffd2016-02-16 23:10:191542 base::WeakPtrFactory<WebContentsImpl> weak_factory_;
mohan.reddyaae039a2014-11-21 17:39:501543
[email protected]b172aee2012-04-10 17:05:261544 DISALLOW_COPY_AND_ASSIGN(WebContentsImpl);
[email protected]0dd3a0ab2011-02-18 08:17:441545};
1546
nickf9acfbe2014-12-23 19:12:371547// Dangerous methods which should never be made part of the public API, so we
1548// grant their use only to an explicit friend list (c++ attorney/client idiom).
benwells5e7260d2017-03-20 23:36:331549class CONTENT_EXPORT WebContentsImpl::FriendWrapper {
nickf9acfbe2014-12-23 19:12:371550 private:
1551 friend class TestNavigationObserver;
1552 friend class WebContentsAddedObserver;
1553 friend class ContentBrowserSanityChecker;
1554
benwells5e7260d2017-03-20 23:36:331555 FriendWrapper(); // Not instantiable.
nickf9acfbe2014-12-23 19:12:371556
1557 // Adds/removes a callback called on creation of each new WebContents.
1558 static void AddCreatedCallbackForTesting(const CreatedCallback& callback);
1559 static void RemoveCreatedCallbackForTesting(const CreatedCallback& callback);
1560
benwells5e7260d2017-03-20 23:36:331561 DISALLOW_COPY_AND_ASSIGN(FriendWrapper);
nickf9acfbe2014-12-23 19:12:371562};
1563
[email protected]8ff00d72012-10-23 19:12:211564} // namespace content
1565
[email protected]93ddb3c2012-04-11 21:44:291566#endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_