blob: 05474f499613e6bcc32637a6aeb2adcfcfde8a87 [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]c9e3b202014-08-08 08:24:4217#include "base/containers/scoped_ptr_hash_map.h"
[email protected]0dd3a0ab2011-02-18 08:17:4418#include "base/gtest_prod_util.h"
avib7348942015-12-25 20:57:1019#include "base/macros.h"
[email protected]6eac57a2011-07-12 21:15:0920#include "base/observer_list.h"
[email protected]fa20e002013-07-23 21:20:5421#include "base/process/process.h"
[email protected]738f57a2013-06-29 21:06:5422#include "base/values.h"
avib7348942015-12-25 20:57:1023#include "build/build_config.h"
[email protected]d4a8ca482013-10-30 21:06:4024#include "content/browser/frame_host/frame_tree.h"
25#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"
[email protected]95640212014-07-26 18:14:3034#include "content/common/accessibility_mode_enums.h"
[email protected]8d128d62011-09-13 22:11:5735#include "content/common/content_export.h"
[email protected]8ed16472014-04-11 19:02:4836#include "content/public/browser/color_chooser.h"
[email protected]14392a52012-05-02 20:28:4437#include "content/public/browser/notification_observer.h"
38#include "content/public/browser/notification_registrar.h"
[email protected]58f5d562011-12-20 17:13:0339#include "content/public/browser/web_contents.h"
dalecurtis88c240072015-12-09 02:11:1840#include "content/public/browser/web_contents_observer.h"
kouhei40f03cb2015-09-24 07:47:0141#include "content/public/common/page_importance_signals.h"
[email protected]daf82f82011-10-31 22:35:3142#include "content/public/common/renderer_preferences.h"
[email protected]7491ad02014-07-05 19:10:0743#include "content/public/common/resource_type.h"
[email protected]818915cd2012-11-20 13:14:1144#include "content/public/common/three_d_api_types.h"
[email protected]0dd3a0ab2011-02-18 08:17:4445#include "net/base/load_states.h"
[email protected]6f2ac772014-07-24 22:22:0846#include "net/http/http_response_headers.h"
brettw4b461082016-11-19 18:55:1647#include "ppapi/features/features.h"
esprehnfbba1292016-04-15 17:59:5648#include "third_party/WebKit/public/platform/WebDragOperation.h"
Sylvain Defresnec6ccc77d2014-09-19 10:19:3549#include "ui/base/page_transition_types.h"
tfarina3b0452d2014-12-31 15:20:0950#include "ui/gfx/geometry/rect_f.h"
tfarinaebe974f02015-01-03 04:25:3251#include "ui/gfx/geometry/size.h"
[email protected]0dd3a0ab2011-02-18 08:17:4452
[email protected]1ff427972013-02-07 21:14:0753struct ViewHostMsg_DateTimeDialogValue_Params;
[email protected]daf82f82011-10-31 22:35:3154
rockot400ea35b2016-10-15 19:15:3255namespace service_manager {
sammcf5f1b0f2016-09-20 23:05:1156class InterfaceProvider;
57}
58
[email protected]e582fdd2011-12-20 16:48:1759namespace content {
[email protected]7a846df2012-09-20 19:17:3960class BrowserPluginEmbedder;
61class BrowserPluginGuest;
[email protected]583418cc2013-01-17 14:01:1062class DateTimeChooserAndroid;
paulmeyerc0b762b2016-04-13 11:55:1763class FindRequestManager;
scottmg276753cf2016-10-27 18:25:2264class HostZoomMapObserver;
[email protected]8ff00d72012-10-23 19:12:2165class InterstitialPageImpl;
[email protected]71a88bb2013-02-01 22:05:1566class JavaScriptDialogManager;
csharrisona2280cd2016-02-03 23:21:1567class LoaderIOThreadNotifier;
mlamouriefdca9d2014-09-16 16:55:4068class ManifestManagerHost;
qinmin58567c82015-01-07 21:00:2069class MediaWebContentsObserver;
tommyclieb25b2a2014-11-03 19:45:0970class PluginContentOriginWhitelist;
[email protected]eaabba22012-03-07 15:02:1171class RenderViewHost;
[email protected]5a3bdf52012-05-24 15:12:5772class RenderViewHostDelegateView;
[email protected]b24b68a2012-09-24 21:57:2673class RenderWidgetHostImpl;
kenrb2a565f82015-09-02 20:24:5974class RenderWidgetHostInputEventRouter;
[email protected]35869622012-10-26 23:23:5575class SavePackage;
lunalud4a2cc82016-11-22 00:27:2376class ScreenOrientation;
77class ScreenOrientationProvider;
[email protected]09d31d52012-03-11 22:30:2778class SiteInstance;
[email protected]80e776ae2012-03-23 16:17:2079class TestWebContents;
ekaramadadd882292016-06-08 15:22:5680class TextInputManager;
alogvinovf50445a2015-10-30 13:00:1281class WakeLockServiceContext;
miu50f97892014-09-22 22:49:5282class WebContentsAudioMuter;
rockotf62002a2016-09-15 00:08:5983class WebContentsBindingSet;
[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:
nickf9acfbe2014-12-23 19:12:37125 class FriendZone;
126
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
clamya16aa8172015-05-26 13:07:25135 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
[email protected]16620a92014-05-24 01:05:51214 bool should_normally_be_visible() { return should_normally_be_visible_; }
215
ccameron8807c38f2015-01-17 00:29:19216 // Indicate if the window has been occluded, and pass this to the views, only
217 // if there is no active capture going on (otherwise it is dropped on the
218 // floor).
219 void WasOccluded();
220 void WasUnOccluded();
221
[email protected]95640212014-07-26 18:14:30222 // Broadcasts the mode change to all frames.
223 void SetAccessibilityMode(AccessibilityMode mode);
224
225 // Adds the given accessibility mode to the current accessibility mode
226 // bitmap.
227 void AddAccessibilityMode(AccessibilityMode mode);
228
229 // Removes the given accessibility mode from the current accessibility
230 // mode bitmap, managing the bits that are shared with other modes such
231 // that a bit will only be turned off when all modes that depend on it
232 // have been removed.
233 void RemoveAccessibilityMode(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
[email protected]8ff00d72012-10-23 19:12:21266 // WebContents ------------------------------------------------------
dchengc2282aa2014-10-21 12:07:58267 WebContentsDelegate* GetDelegate() override;
268 void SetDelegate(WebContentsDelegate* delegate) override;
269 NavigationControllerImpl& GetController() override;
270 const NavigationControllerImpl& GetController() const override;
271 BrowserContext* GetBrowserContext() const override;
272 const GURL& GetURL() const override;
273 const GURL& GetVisibleURL() const override;
274 const GURL& GetLastCommittedURL() const override;
275 RenderProcessHost* GetRenderProcessHost() const override;
clamydf1975e2015-02-05 19:12:24276 RenderFrameHostImpl* GetMainFrame() override;
nick53d5cbf2015-04-23 22:50:14277 RenderFrameHostImpl* GetFocusedFrame() override;
rob3e2a0732016-01-06 21:22:09278 RenderFrameHostImpl* FindFrameByFrameTreeNodeId(
279 int frame_tree_node_id) override;
dchengc2282aa2014-10-21 12:07:58280 void ForEachFrame(
anand.ratn120b0b002014-10-07 15:49:32281 const base::Callback<void(RenderFrameHost*)>& on_frame) override;
dchengafb53e22016-02-04 08:11:08282 std::vector<RenderFrameHost*> GetAllFrames() override;
lukaszacbdf52e2016-01-15 21:19:51283 int SendToAllFrames(IPC::Message* message) override;
creisc014b402015-04-23 16:41:45284 RenderViewHostImpl* GetRenderViewHost() const override;
dchengc2282aa2014-10-21 12:07:58285 RenderWidgetHostView* GetRenderWidgetHostView() const override;
lfg265a2672016-04-23 03:11:02286 RenderWidgetHostView* GetTopLevelRenderWidgetHostView() override;
naskoc0fceff2015-04-30 15:53:52287 void ClosePage() override;
dchengc2282aa2014-10-21 12:07:58288 RenderWidgetHostView* GetFullscreenRenderWidgetHostView() const override;
yusufod41c5f92015-03-06 00:14:28289 SkColor GetThemeColor() const override;
avie865b1d2016-10-24 19:42:59290 std::unique_ptr<WebUI> CreateSubframeWebUI(
291 const GURL& url,
292 const std::string& frame_name) override;
dchengc2282aa2014-10-21 12:07:58293 WebUI* GetWebUI() const override;
294 WebUI* GetCommittedWebUI() const override;
295 void SetUserAgentOverride(const std::string& override) override;
296 const std::string& GetUserAgentOverride() const override;
297 void EnableTreeOnlyAccessibilityMode() override;
298 bool IsTreeOnlyAccessibilityModeForTesting() const override;
299 bool IsFullAccessibilityModeForTesting() const override;
kouhei40f03cb2015-09-24 07:47:01300 const PageImportanceSignals& GetPageImportanceSignals() const override;
dchengc2282aa2014-10-21 12:07:58301 const base::string16& GetTitle() const override;
afakhry6f0c1ec22016-07-14 13:55:13302 void UpdateTitleForEntry(NavigationEntry* entry,
303 const base::string16& title) override;
dchengc2282aa2014-10-21 12:07:58304 SiteInstanceImpl* GetSiteInstance() const override;
305 SiteInstanceImpl* GetPendingSiteInstance() const override;
306 bool IsLoading() const override;
307 bool IsLoadingToDifferentDocument() const override;
308 bool IsWaitingForResponse() const override;
309 const net::LoadStateWithParam& GetLoadState() const override;
310 const base::string16& GetLoadStateHost() const override;
avib7348942015-12-25 20:57:10311 uint64_t GetUploadSize() const override;
312 uint64_t GetUploadPosition() const override;
dchengc2282aa2014-10-21 12:07:58313 const std::string& GetEncoding() const override;
dchengc2282aa2014-10-21 12:07:58314 void IncrementCapturerCount(const gfx::Size& capture_size) override;
315 void DecrementCapturerCount() override;
316 int GetCapturerCount() const override;
317 bool IsAudioMuted() const override;
318 void SetAudioMuted(bool mute) override;
ortunodf4d7982016-04-08 02:33:35319 bool IsConnectedToBluetoothDevice() const override;
dchengc2282aa2014-10-21 12:07:58320 bool IsCrashed() const override;
321 void SetIsCrashed(base::TerminationStatus status, int error_code) override;
322 base::TerminationStatus GetCrashedStatus() const override;
afakhry98241832016-03-11 19:27:47323 int GetCrashedErrorCode() const override;
dchengc2282aa2014-10-21 12:07:58324 bool IsBeingDestroyed() const override;
325 void NotifyNavigationStateChanged(InvalidateTypes changed_flags) override;
altiminec87fd1f2016-11-17 20:22:49326 void OnAudioStateChanged(bool is_audible) override;
gab0dccfef2015-05-20 18:43:39327 base::TimeTicks GetLastActiveTime() const override;
georgesak5582cbe2015-05-22 22:08:07328 void SetLastActiveTime(base::TimeTicks last_active_time) override;
hajimehoshic4f226a2016-10-21 09:01:57329 base::TimeTicks GetLastHiddenTime() const override;
dchengc2282aa2014-10-21 12:07:58330 void WasShown() override;
331 void WasHidden() override;
332 bool NeedToFireBeforeUnload() override;
nasko148bb0b92016-05-10 21:03:19333 void DispatchBeforeUnload() override;
lazyboy6ec48b2a2015-06-29 15:18:14334 void AttachToOuterWebContentsFrame(
335 WebContents* outer_web_contents,
336 RenderFrameHost* outer_contents_frame) override;
dalecurtis6c58ed02016-10-28 23:02:37337 void DidChangeVisibleSecurityState() override;
dchengc2282aa2014-10-21 12:07:58338 void Stop() override;
339 WebContents* Clone() override;
toyoshim24a4c7ab2016-04-05 09:24:14340 void ReloadFocusedFrame(bool bypass_cache) override;
dchengc2282aa2014-10-21 12:07:58341 void Undo() override;
342 void Redo() override;
343 void Cut() override;
344 void Copy() override;
345 void CopyToFindPboard() override;
346 void Paste() override;
347 void PasteAndMatchStyle() override;
348 void Delete() override;
349 void SelectAll() override;
350 void Unselect() override;
351 void Replace(const base::string16& word) override;
352 void ReplaceMisspelling(const base::string16& word) override;
353 void NotifyContextMenuClosed(
anand.ratn120b0b002014-10-07 15:49:32354 const CustomContextMenuContext& context) override;
megjablon3f5941072016-02-04 23:27:52355 void ReloadLoFiImages() override;
dchengc2282aa2014-10-21 12:07:58356 void ExecuteCustomContextMenuCommand(
357 int action,
358 const CustomContextMenuContext& context) override;
359 gfx::NativeView GetNativeView() override;
360 gfx::NativeView GetContentNativeView() override;
361 gfx::NativeWindow GetTopLevelNativeWindow() override;
362 gfx::Rect GetContainerBounds() override;
363 gfx::Rect GetViewBounds() override;
364 DropData* GetDropData() override;
365 void Focus() override;
366 void SetInitialFocus() override;
367 void StoreFocus() override;
368 void RestoreFocus() override;
369 void FocusThroughTabTraversal(bool reverse) override;
370 bool ShowingInterstitialPage() const override;
371 InterstitialPage* GetInterstitialPage() const override;
372 bool IsSavable() override;
373 void OnSavePage() override;
374 bool SavePage(const base::FilePath& main_file,
375 const base::FilePath& dir_path,
376 SavePageType save_type) override;
377 void SaveFrame(const GURL& url, const Referrer& referrer) override;
kundaji6c7f9692015-03-09 18:00:37378 void SaveFrameWithHeaders(const GURL& url,
379 const Referrer& referrer,
380 const std::string& headers) override;
dewittj6dc5747a2016-05-17 01:48:47381 void GenerateMHTML(const MHTMLGenerationParams& params,
avib7348942015-12-25 20:57:10382 const base::Callback<void(int64_t)>& callback) override;
dchengc2282aa2014-10-21 12:07:58383 const std::string& GetContentsMimeType() const override;
384 bool WillNotifyDisconnection() const override;
dchengc2282aa2014-10-21 12:07:58385 RendererPreferences* GetMutableRendererPrefs() override;
386 void Close() override;
Paul Meyer0c58c3712016-11-17 22:59:51387 void SystemDragEnded(RenderWidgetHost* source_rwh) override;
dchengc2282aa2014-10-21 12:07:58388 void UserGestureDone() override;
389 void SetClosedByUserGesture(bool value) override;
390 bool GetClosedByUserGesture() const override;
391 void ViewSource() override;
392 void ViewFrameSource(const GURL& url, const PageState& page_state) override;
393 int GetMinimumZoomPercent() const override;
394 int GetMaximumZoomPercent() const override;
mcnee432e47d2015-11-09 19:37:46395 void SetPageScale(float page_scale_factor) override;
dchengc2282aa2014-10-21 12:07:58396 gfx::Size GetPreferredSize() const override;
397 bool GotResponseToLockMouseRequest(bool allowed) override;
398 bool HasOpener() const override;
alexmose201c7cd2015-06-10 17:14:21399 WebContentsImpl* GetOpener() const override;
dchengc2282aa2014-10-21 12:07:58400 void DidChooseColorInColorChooser(SkColor color) override;
401 void DidEndColorChooser() override;
402 int DownloadImage(const GURL& url,
403 bool is_favicon,
404 uint32_t max_bitmap_size,
pkotwiczfd773552015-03-16 00:29:14405 bool bypass_cache,
dchengc2282aa2014-10-21 12:07:58406 const ImageDownloadCallback& callback) override;
407 bool IsSubframe() const override;
408 void Find(int request_id,
409 const base::string16& search_text,
410 const blink::WebFindOptions& options) override;
411 void StopFinding(StopFindAction action) override;
dchengc2282aa2014-10-21 12:07:58412 bool WasRecentlyAudible() override;
dominickn6919ce32015-10-15 01:52:28413 void GetManifest(const GetManifestCallback& callback) override;
bokanece34a82016-01-28 19:49:46414 void ExitFullscreen(bool will_cause_resize) override;
mariakhomenko44bdc4732015-04-29 01:55:38415 void ResumeLoadingCreatedWebContents() override;
estark703f1b42016-10-10 21:37:15416 void OnPasswordInputShownOnHttp() override;
estarkfae6b5872016-11-04 05:20:31417 void OnAllPasswordInputsHiddenOnHttp() override;
estark703f1b42016-10-10 21:37:15418 void OnCreditCardInputShownOnHttp() override;
qinmin72e8bd02016-10-21 19:35:37419 void SetIsOverlayContent(bool is_overlay_content) override;
mfomitchev2b8b066a2016-01-28 19:23:15420
mlamouri918734092016-03-12 04:47:52421#if defined(OS_ANDROID)
dcheng48d97c52015-02-04 20:03:20422 base::android::ScopedJavaLocalRef<jobject> GetJavaWebContents() override;
[email protected]0e813a52014-08-13 10:34:56423 virtual WebContentsAndroid* GetWebContentsAndroid();
paulmeyerc0b762b2016-04-13 11:55:17424 void ActivateNearestFindResult(float x, float y) override;
425 void RequestFindMatchRects(int current_version) override;
rockot400ea35b2016-10-15 19:15:32426 service_manager::InterfaceProvider* GetJavaInterfaces() override;
[email protected]fc2b46b2014-05-03 16:33:45427#elif defined(OS_MACOSX)
dchengc2282aa2014-10-21 12:07:58428 void SetAllowOtherViews(bool allow) override;
429 bool GetAllowOtherViews() override;
[email protected]155c7f22013-12-09 17:07:18430#endif
[email protected]0bfbf882011-12-22 18:19:27431
[email protected]0bfbf882011-12-22 18:19:27432 // Implementation of PageNavigator.
dchengc2282aa2014-10-21 12:07:58433 WebContents* OpenURL(const OpenURLParams& params) override;
[email protected]151a63d2011-12-20 22:32:52434
[email protected]6b618e62012-08-16 12:59:18435 // Implementation of IPC::Sender.
dchengc2282aa2014-10-21 12:07:58436 bool Send(IPC::Message* message) override;
[email protected]6b618e62012-08-16 12:59:18437
[email protected]92404c62013-12-04 16:40:46438 // RenderFrameHostDelegate ---------------------------------------------------
dchengc2282aa2014-10-21 12:07:58439 bool OnMessageReceived(RenderFrameHost* render_frame_host,
440 const IPC::Message& message) override;
rockotf62002a2016-09-15 00:08:59441 void OnAssociatedInterfaceRequest(
442 RenderFrameHost* render_frame_host,
443 const std::string& interface_name,
444 mojo::ScopedInterfaceEndpointHandle handle) override;
dchengc2282aa2014-10-21 12:07:58445 const GURL& GetMainFrameLastCommittedURL() const override;
446 void RenderFrameCreated(RenderFrameHost* render_frame_host) override;
447 void RenderFrameDeleted(RenderFrameHost* render_frame_host) override;
dchengc2282aa2014-10-21 12:07:58448 void ShowContextMenu(RenderFrameHost* render_frame_host,
449 const ContextMenuParams& params) override;
450 void RunJavaScriptMessage(RenderFrameHost* render_frame_host,
451 const base::string16& message,
452 const base::string16& default_prompt,
453 const GURL& frame_url,
454 JavaScriptMessageType type,
455 IPC::Message* reply_msg) override;
456 void RunBeforeUnloadConfirm(RenderFrameHost* render_frame_host,
dchengc2282aa2014-10-21 12:07:58457 bool is_reload,
458 IPC::Message* reply_msg) override;
naskoada75b22016-06-11 16:09:46459 void RunFileChooser(RenderFrameHost* render_frame_host,
460 const FileChooserParams& params) override;
dchengc2282aa2014-10-21 12:07:58461 void DidAccessInitialDocument() override;
alexmosbe2f4c32015-03-10 02:30:23462 void DidChangeName(RenderFrameHost* render_frame_host,
463 const std::string& name) override;
dchengc2282aa2014-10-21 12:07:58464 void DocumentOnLoadCompleted(RenderFrameHost* render_frame_host) override;
creis8eb8ef22015-11-04 22:51:38465 void UpdateStateForFrame(RenderFrameHost* render_frame_host,
466 const PageState& page_state) override;
dchengc2282aa2014-10-21 12:07:58467 void UpdateTitle(RenderFrameHost* render_frame_host,
dchengc2282aa2014-10-21 12:07:58468 const base::string16& title,
469 base::i18n::TextDirection title_direction) override;
470 void UpdateEncoding(RenderFrameHost* render_frame_host,
471 const std::string& encoding) override;
472 WebContents* GetAsWebContents() override;
473 bool IsNeverVisible() override;
474 AccessibilityMode GetAccessibilityMode() const override;
475 void AccessibilityEventReceived(
anand.ratn120b0b002014-10-07 15:49:32476 const std::vector<AXEventNotificationDetails>& details) override;
dmazzoni2400c462016-08-23 15:07:13477 void AccessibilityLocationChangesReceived(
478 const std::vector<AXLocationChangeNotificationDetails>& details) override;
dchengc2282aa2014-10-21 12:07:58479 RenderFrameHost* GetGuestByInstanceID(
fsamuel833ee7c2015-02-13 23:40:40480 RenderFrameHost* render_frame_host,
dchengc2282aa2014-10-21 12:07:58481 int browser_plugin_instance_id) override;
mcasas4e216e72016-07-28 21:28:38482 device::GeolocationServiceContext* GetGeolocationServiceContext() override;
blundelld46e8832016-10-07 10:34:27483 device::WakeLockServiceContext* GetWakeLockServiceContext() override;
lunalud4a2cc82016-11-22 00:27:23484 ScreenOrientationProvider* GetScreenOrientationProvider() override;
mlamouri7a78d6fd2015-01-17 13:23:53485 void EnterFullscreenMode(const GURL& origin) override;
bokanece34a82016-01-28 19:49:46486 void ExitFullscreenMode(bool will_cause_resize) override;
alexmose7da5a12015-04-09 02:22:16487 bool ShouldRouteMessageEvent(
488 RenderFrameHost* target_rfh,
489 SiteInstance* source_site_instance) const override;
alexmos58729042015-06-18 23:20:00490 void EnsureOpenerProxiesExist(RenderFrameHost* source_rfh) override;
dcheng59716272016-04-09 05:19:08491 std::unique_ptr<WebUIImpl> CreateWebUIForRenderFrameHost(
492 const GURL& url) override;
avallee0206f782016-07-28 18:55:33493 void SetFocusedFrame(FrameTreeNode* node, SiteInstance* source) override;
[email protected]952a68e2011-11-17 00:36:10494
[email protected]92404c62013-12-04 16:40:46495 // RenderViewHostDelegate ----------------------------------------------------
dchengc2282aa2014-10-21 12:07:58496 RenderViewHostDelegateView* GetDelegateView() override;
497 bool OnMessageReceived(RenderViewHost* render_view_host,
498 const IPC::Message& message) override;
[email protected]a86c0e962013-12-17 17:10:39499 // RenderFrameHostDelegate has the same method, so list it there because this
500 // interface is going away.
nick51208922015-04-24 21:38:37501 // WebContents* GetAsWebContents() override;
dchengc2282aa2014-10-21 12:07:58502 void RenderViewCreated(RenderViewHost* render_view_host) override;
503 void RenderViewReady(RenderViewHost* render_view_host) override;
504 void RenderViewTerminated(RenderViewHost* render_view_host,
505 base::TerminationStatus status,
506 int error_code) override;
507 void RenderViewDeleted(RenderViewHost* render_view_host) override;
508 void UpdateState(RenderViewHost* render_view_host,
dchengc2282aa2014-10-21 12:07:58509 const PageState& page_state) override;
sky8b00392d2015-01-10 00:30:28510 void UpdateTargetURL(RenderViewHost* render_view_host,
511 const GURL& url) override;
dchengc2282aa2014-10-21 12:07:58512 void Close(RenderViewHost* render_view_host) override;
513 void RequestMove(const gfx::Rect& new_bounds) override;
514 void DidCancelLoading() override;
515 void DocumentAvailableInMainFrame(RenderViewHost* render_view_host) override;
516 void RouteCloseEvent(RenderViewHost* rvh) override;
avia90ae4e2016-11-11 20:49:33517 bool DidAddMessageToConsole(int32_t level,
518 const base::string16& message,
519 int32_t line_no,
520 const base::string16& source_id) override;
dchengc2282aa2014-10-21 12:07:58521 RendererPreferences GetRendererPrefs(
anand.ratn120b0b002014-10-07 15:49:32522 BrowserContext* browser_context) const override;
dominickn9c7ceaa32016-02-27 01:52:53523 void OnUserInteraction(RenderWidgetHostImpl* render_widget_host,
524 const blink::WebInputEvent::Type type) override;
dchengc2282aa2014-10-21 12:07:58525 void OnIgnoredUIEvent() override;
dchengc2282aa2014-10-21 12:07:58526 void Activate() override;
dchengc2282aa2014-10-21 12:07:58527 void UpdatePreferredSize(const gfx::Size& pref_size) override;
dchengc2282aa2014-10-21 12:07:58528 void CreateNewWindow(
alexmos4cf2aa32015-07-15 23:40:43529 SiteInstance* source_site_instance,
dcheng3ce04b62015-10-26 23:30:55530 int32_t route_id,
531 int32_t main_frame_route_id,
532 int32_t main_frame_widget_route_id,
rockot5c478a72016-09-28 23:14:18533 const mojom::CreateNewWindowParams& params,
anand.ratn120b0b002014-10-07 15:49:32534 SessionStorageNamespace* session_storage_namespace) override;
avib7348942015-12-25 20:57:10535 void CreateNewWidget(int32_t render_process_id,
536 int32_t route_id,
dchengc2282aa2014-10-21 12:07:58537 blink::WebPopupType popup_type) override;
avib7348942015-12-25 20:57:10538 void CreateNewFullscreenWidget(int32_t render_process_id,
539 int32_t route_id) override;
alexmosc2a8cec2016-05-23 22:19:53540 void ShowCreatedWindow(int process_id,
541 int route_id,
dchengc2282aa2014-10-21 12:07:58542 WindowOpenDisposition disposition,
bokan107a47f2015-02-03 23:23:39543 const gfx::Rect& initial_rect,
dchengc2282aa2014-10-21 12:07:58544 bool user_gesture) override;
alexmosc2a8cec2016-05-23 22:19:53545 void ShowCreatedWidget(int process_id,
546 int route_id,
547 const gfx::Rect& initial_rect) override;
548 void ShowCreatedFullscreenWidget(int process_id, int route_id) override;
dchengc2282aa2014-10-21 12:07:58549 void RequestMediaAccessPermission(
[email protected]33662e52013-01-07 21:31:09550 const MediaStreamRequest& request,
anand.ratn120b0b002014-10-07 15:49:32551 const MediaResponseCallback& callback) override;
dchengc2282aa2014-10-21 12:07:58552 bool CheckMediaAccessPermission(const GURL& security_origin,
553 MediaStreamType type) override;
554 SessionStorageNamespace* GetSessionStorageNamespace(
anand.ratn120b0b002014-10-07 15:49:32555 SiteInstance* instance) override;
dchengc2282aa2014-10-21 12:07:58556 SessionStorageNamespaceMap GetSessionStorageNamespaceMap() override;
avi85ee8362016-10-08 02:09:08557 double GetPendingPageZoomLevel() override;
dchengc2282aa2014-10-21 12:07:58558 FrameTree* GetFrameTree() override;
lukendc35e7f2014-11-10 19:06:14559 void SetIsVirtualKeyboardRequested(bool requested) override;
560 bool IsVirtualKeyboardRequested() override;
aelias5252baa2016-04-10 01:18:02561 bool IsOverridingUserAgent() override;
avi85ee8362016-10-08 02:09:08562 bool IsJavaScriptDialogShowing() const override;
qinmin72e8bd02016-10-21 19:35:37563 bool HideDownloadUI() const override;
lukendc35e7f2014-11-10 19:06:14564
[email protected]52913802013-12-10 05:52:18565 // NavigatorDelegate ---------------------------------------------------------
566
clamy0e119882015-07-31 16:12:33567 void DidStartNavigation(NavigationHandle* navigation_handle) override;
568 void DidRedirectNavigation(NavigationHandle* navigation_handle) override;
clamyefca29e2015-09-17 00:22:11569 void ReadyToCommitNavigation(NavigationHandle* navigation_handle) override;
clamy0e119882015-07-31 16:12:33570 void DidFinishNavigation(NavigationHandle* navigation_handle) override;
dchengc2282aa2014-10-21 12:07:58571 void DidStartProvisionalLoad(RenderFrameHostImpl* render_frame_host,
572 const GURL& validated_url,
arthursonzogniee7f43b2016-12-06 10:52:29573 bool is_error_page) override;
lazyboy552a9382016-07-14 20:38:37574 void DidFailProvisionalLoadWithError(RenderFrameHostImpl* render_frame_host,
575 const GURL& validated_url,
576 int error_code,
577 const base::string16& error_description,
578 bool was_ignored_by_handler) override;
dchengc2282aa2014-10-21 12:07:58579 void DidFailLoadWithError(RenderFrameHostImpl* render_frame_host,
580 const GURL& url,
581 int error_code,
gsennton6fbb38692015-06-24 19:23:55582 const base::string16& error_description,
583 bool was_ignored_by_handler) override;
dchengc2282aa2014-10-21 12:07:58584 void DidCommitProvisionalLoad(RenderFrameHostImpl* render_frame_host,
585 const GURL& url,
586 ui::PageTransition transition_type) override;
587 void DidNavigateMainFramePreCommit(bool navigation_is_within_page) override;
588 void DidNavigateMainFramePostCommit(
sky8b00392d2015-01-10 00:30:28589 RenderFrameHostImpl* render_frame_host,
[email protected]37567b432014-02-12 01:12:22590 const LoadCommittedDetails& details,
anand.ratn120b0b002014-10-07 15:49:32591 const FrameHostMsg_DidCommitProvisionalLoad_Params& params) override;
dchengc2282aa2014-10-21 12:07:58592 void DidNavigateAnyFramePostCommit(
[email protected]37567b432014-02-12 01:12:22593 RenderFrameHostImpl* render_frame_host,
594 const LoadCommittedDetails& details,
anand.ratn120b0b002014-10-07 15:49:32595 const FrameHostMsg_DidCommitProvisionalLoad_Params& params) override;
dchengc2282aa2014-10-21 12:07:58596 void SetMainFrameMimeType(const std::string& mime_type) override;
597 bool CanOverscrollContent() const override;
598 void NotifyChangedNavigationState(InvalidateTypes changed_flags) override;
toyoshim0df1d3a2016-09-09 09:52:48599 void DidStartNavigationToPendingEntry(const GURL& url,
600 ReloadType reload_type) override;
dchengc2282aa2014-10-21 12:07:58601 void RequestOpenURL(RenderFrameHostImpl* render_frame_host,
602 const OpenURLParams& params) override;
lukasza1d025732016-09-28 21:36:08603 bool ShouldTransferNavigation(bool is_main_frame_navigation) override;
dchengc2282aa2014-10-21 12:07:58604 bool ShouldPreserveAbortedURLs() override;
fdegansa696e5112015-04-17 01:57:59605 void DidStartLoading(FrameTreeNode* frame_tree_node,
606 bool to_different_document) override;
607 void DidStopLoading() override;
608 void DidChangeLoadProgress() override;
clamycbf524d42016-09-27 12:48:35609 ScopedVector<NavigationThrottle> CreateThrottlesForNavigation(
610 NavigationHandle* navigation_handle) override;
clamy1e5574e2016-09-29 16:48:44611 std::unique_ptr<NavigationUIData> GetNavigationUIData(
612 NavigationHandle* navigation_handle) override;
[email protected]52913802013-12-10 05:52:18613
[email protected]4ca76c02012-05-16 16:19:05614 // RenderWidgetHostDelegate --------------------------------------------------
615
lazyboy63f5b312015-11-23 20:19:52616 void RenderWidgetCreated(RenderWidgetHostImpl* render_widget_host) override;
dchengc2282aa2014-10-21 12:07:58617 void RenderWidgetDeleted(RenderWidgetHostImpl* render_widget_host) override;
miu9e14e492014-10-25 02:39:04618 void RenderWidgetGotFocus(RenderWidgetHostImpl* render_widget_host) override;
rouslan2f5993f2015-01-29 00:18:31619 void RenderWidgetWasResized(RenderWidgetHostImpl* render_widget_host,
620 bool width_changed) override;
avic3aa8422015-11-09 20:57:22621 void ResizeDueToAutoResize(RenderWidgetHostImpl* render_widget_host,
622 const gfx::Size& new_size) override;
paulmeyer9ef6e4462015-02-24 19:15:10623 void ScreenInfoChanged() override;
wjmaclean8a795f32016-08-11 23:49:58624 void UpdateDeviceScaleFactor(double device_scale_factor) override;
ccameron2f451532016-09-07 21:49:27625 void GetScreenInfo(ScreenInfo* screen_info) override;
dchengc2282aa2014-10-21 12:07:58626 bool PreHandleKeyboardEvent(const NativeWebKeyboardEvent& event,
627 bool* is_keyboard_shortcut) override;
628 void HandleKeyboardEvent(const NativeWebKeyboardEvent& event) override;
629 bool HandleWheelEvent(const blink::WebMouseWheelEvent& event) override;
630 bool PreHandleGestureEvent(const blink::WebGestureEvent& event) override;
dchengc2282aa2014-10-21 12:07:58631 BrowserAccessibilityManager* GetRootBrowserAccessibilityManager() override;
632 BrowserAccessibilityManager* GetOrCreateRootBrowserAccessibilityManager()
anand.ratn120b0b002014-10-07 15:49:32633 override;
lgarron145aaa82015-07-10 07:39:56634 // The following 4 functions are already listed under WebContents overrides:
mohsen7ab1ec16ec2015-07-02 18:26:23635 // void Cut() override;
636 // void Copy() override;
637 // void Paste() override;
lgarron145aaa82015-07-10 07:39:56638 // void SelectAll() override;
mohsen7ab1ec16ec2015-07-02 18:26:23639 void MoveRangeSelectionExtent(const gfx::Point& extent) override;
640 void SelectRange(const gfx::Point& base, const gfx::Point& extent) override;
aurimasab0319022015-07-10 21:57:38641 void AdjustSelectionByCharacterOffset(int start_adjust, int end_adjust)
642 override;
kenrb2a565f82015-09-02 20:24:59643 RenderWidgetHostInputEventRouter* GetInputEventRouter() override;
alexmos3fcd0ca2015-10-23 18:18:33644 void ReplicatePageFocus(bool is_focused) override;
alexmosc4cbacb2015-11-21 01:29:22645 RenderWidgetHostImpl* GetFocusedRenderWidgetHost(
646 RenderWidgetHostImpl* receiving_widget) override;
avallee9993fca2016-11-17 06:16:50647 RenderWidgetHostImpl* GetRenderWidgetHostWithPageFocus() override;
648 void FocusOwningWebContents(
649 RenderWidgetHostImpl* render_widget_host) override;
dtapuskae99ec6e52016-10-18 00:15:42650 void RendererUnresponsive(RenderWidgetHostImpl* render_widget_host,
651 RendererUnresponsiveType type) override;
avic3aa8422015-11-09 20:57:22652 void RendererResponsive(RenderWidgetHostImpl* render_widget_host) override;
653 void RequestToLockMouse(RenderWidgetHostImpl* render_widget_host,
654 bool user_gesture,
lfgad8244352016-07-13 16:55:51655 bool last_unlocked_by_target,
656 bool privileged) override;
alexmos5dd617d2016-06-07 04:21:15657 bool IsFullscreenForCurrentTab() const override;
avibf58fa0c2015-11-11 01:45:52658 blink::WebDisplayMode GetDisplayMode(
659 RenderWidgetHostImpl* render_widget_host) const override;
avi3e4b8512015-11-11 01:55:49660 void LostCapture(RenderWidgetHostImpl* render_widget_host) override;
661 void LostMouseLock(RenderWidgetHostImpl* render_widget_host) override;
lfgad8244352016-07-13 16:55:51662 bool HasMouseLock(RenderWidgetHostImpl* render_widget_host) override;
dtrainor5ef644e2015-11-19 00:12:47663 void ForwardCompositorProto(RenderWidgetHostImpl* render_widget_host,
664 const std::vector<uint8_t>& proto) override;
ekaramada4f42692016-02-11 19:48:37665 void OnRenderFrameProxyVisibilityChanged(bool visible) override;
lfgbb9c28a2016-03-01 03:19:49666 void SendScreenRects() override;
khushalsagarf3b62b62016-05-26 21:54:23667 void OnFirstPaintAfterLoad(RenderWidgetHostImpl* render_widget_host) override;
ekaramadadd882292016-06-08 15:22:56668 TextInputManager* GetTextInputManager() override;
paulmeyer7f6f1d4f2016-11-15 00:00:27669 bool OnUpdateDragCursor() override;
nzolghadrd87a308d2016-12-07 15:45:56670 bool AddDomainInfoToRapporSample(rappor::Sample* sample) override;
[email protected]4ca76c02012-05-16 16:19:05671
[email protected]b0936d22013-11-28 06:47:36672 // RenderFrameHostManager::Delegate ------------------------------------------
[email protected]0bfbf882011-12-22 18:19:27673
dchengc2282aa2014-10-21 12:07:58674 bool CreateRenderViewForRenderManager(
[email protected]bffc8302014-01-23 20:52:16675 RenderViewHost* render_view_host,
alexmos5ac402d2015-07-09 07:51:10676 int opener_frame_routing_id,
[email protected]5a7100d2014-05-19 01:29:04677 int proxy_routing_id,
lfgbede6392015-09-11 21:54:06678 const FrameReplicationState& replicated_frame_state) override;
679 void CreateRenderWidgetHostViewForRenderManager(
680 RenderViewHost* render_view_host) override;
alexmosa181efc2015-09-03 00:39:04681 bool CreateRenderFrameForRenderManager(
682 RenderFrameHost* render_frame_host,
683 int proxy_routing_id,
684 int opener_routing_id,
685 int parent_routing_id,
686 int previous_sibling_routing_id) override;
dchengc2282aa2014-10-21 12:07:58687 void BeforeUnloadFiredFromRenderManager(
688 bool proceed,
689 const base::TimeTicks& proceed_time,
anand.ratn120b0b002014-10-07 15:49:32690 bool* proceed_to_fire_unload) override;
dchengc2282aa2014-10-21 12:07:58691 void RenderProcessGoneFromRenderManager(
anand.ratn120b0b002014-10-07 15:49:32692 RenderViewHost* render_view_host) override;
dchengc2282aa2014-10-21 12:07:58693 void UpdateRenderViewSizeForRenderManager() override;
694 void CancelModalDialogsForRenderManager() override;
695 void NotifySwappedFromRenderManager(RenderFrameHost* old_host,
696 RenderFrameHost* new_host,
697 bool is_main_frame) override;
naskof5940b9f2015-03-02 23:04:05698 void NotifyMainFrameSwappedFromRenderManager(
699 RenderViewHost* old_host,
700 RenderViewHost* new_host) override;
dchengc2282aa2014-10-21 12:07:58701 NavigationControllerImpl& GetControllerForRenderManager() override;
dchengc2282aa2014-10-21 12:07:58702 NavigationEntry* GetLastCommittedNavigationEntryForRenderManager() override;
703 bool FocusLocationBarByDefault() override;
704 void SetFocusToLocationBar(bool select_all) override;
705 bool IsHidden() override;
rob97250742015-12-10 17:45:15706 int GetOuterDelegateFrameTreeNodeId() override;
ekaramadaeb3c5c2016-11-09 03:22:35707 RenderWidgetHostImpl* GetFullscreenRenderWidgetHost() const override;
[email protected]0bfbf882011-12-22 18:19:27708
[email protected]8ff00d72012-10-23 19:12:21709 // NotificationObserver ------------------------------------------------------
[email protected]14392a52012-05-02 20:28:44710
dchengc2282aa2014-10-21 12:07:58711 void Observe(int type,
712 const NotificationSource& source,
713 const NotificationDetails& details) override;
[email protected]14392a52012-05-02 20:28:44714
[email protected]ec6c05f2013-10-23 18:41:57715 // NavigationControllerDelegate ----------------------------------------------
716
dchengc2282aa2014-10-21 12:07:58717 WebContents* GetWebContents() override;
718 void NotifyNavigationEntryCommitted(
anand.ratn120b0b002014-10-07 15:49:32719 const LoadCommittedDetails& load_details) override;
[email protected]ec6c05f2013-10-23 18:41:57720
721 // Invoked before a form repost warning is shown.
dchengc2282aa2014-10-21 12:07:58722 void NotifyBeforeFormRepostWarningShow() override;
[email protected]ec6c05f2013-10-23 18:41:57723
724 // Activate this WebContents and show a form repost warning.
dchengc2282aa2014-10-21 12:07:58725 void ActivateAndShowRepostFormWarningDialog() override;
[email protected]ec6c05f2013-10-23 18:41:57726
[email protected]b4c84012014-04-28 19:51:10727 // Whether the initial empty page of this view has been accessed by another
728 // page, making it unsafe to show the pending URL. Always false after the
729 // first commit.
dchengc2282aa2014-10-21 12:07:58730 bool HasAccessedInitialDocument() override;
[email protected]b4c84012014-04-28 19:51:10731
avi2b177592014-12-10 02:08:02732 // Sets the history for this WebContentsImpl to |history_length| entries, with
alexmos136fd6e62016-08-15 20:58:41733 // an offset of |history_offset|. This notifies all renderers involved in
734 // rendering the current page about the new offset and length.
avi2b177592014-12-10 02:08:02735 void SetHistoryOffsetAndLength(int history_offset,
736 int history_length) override;
[email protected]553602e12011-04-05 17:01:18737
[email protected]a86c0e962013-12-17 17:10:39738 // Called by InterstitialPageImpl when it creates a RenderFrameHost.
dchengc2282aa2014-10-21 12:07:58739 void RenderFrameForInterstitialPageCreated(
anand.ratn120b0b002014-10-07 15:49:32740 RenderFrameHost* render_frame_host) override;
[email protected]561628ce2013-10-25 00:56:47741
742 // Sets the passed interstitial as the currently showing interstitial.
743 // No interstitial page should already be attached.
dchengc2282aa2014-10-21 12:07:58744 void AttachInterstitialPage(InterstitialPageImpl* interstitial_page) override;
[email protected]561628ce2013-10-25 00:56:47745
746 // Unsets the currently showing interstitial.
dchengc2282aa2014-10-21 12:07:58747 void DetachInterstitialPage() override;
[email protected]561628ce2013-10-25 00:56:47748
aelias5252baa2016-04-10 01:18:02749 void UpdateOverridingUserAgent() override;
750
clamy44e84ce2016-02-22 15:38:25751 // Unpause the throbber if it was paused.
752 void DidProceedOnInterstitial() override;
[email protected]561628ce2013-10-25 00:56:47753
[email protected]e4abd3b42013-11-12 18:28:47754 typedef base::Callback<void(WebContents*)> CreatedCallback;
[email protected]561628ce2013-10-25 00:56:47755
[email protected]34ff1cfc2014-08-20 06:16:05756 // Forces overscroll to be disabled (used by touch emulation).
757 void SetForceDisableOverscrollContent(bool force_disable);
758
avayvodcc85bbd2015-08-28 19:11:15759 AudioStreamMonitor* audio_stream_monitor() {
760 return &audio_stream_monitor_;
dalecurtisbc6572e12014-09-12 19:22:30761 }
762
dalecurtis88c240072015-12-09 02:11:18763 // Called by MediaWebContentsObserver when playback starts or stops. See the
764 // WebContentsObserver function stubs for more details.
billorr21c005d2016-11-17 03:57:04765 void MediaStartedPlaying(
766 const WebContentsObserver::MediaPlayerInfo& media_info,
767 const WebContentsObserver::MediaPlayerId& id);
768 void MediaStoppedPlaying(
769 const WebContentsObserver::MediaPlayerInfo& media_info,
770 const WebContentsObserver::MediaPlayerId& id);
771 int GetCurrentlyPlayingVideoCount() override;
772
773 bool IsFullscreen() override;
dalecurtisbc6572e12014-09-12 19:22:30774
qinmin58567c82015-01-07 21:00:20775 MediaWebContentsObserver* media_web_contents_observer() {
776 return media_web_contents_observer_.get();
777 }
qinmin58567c82015-01-07 21:00:20778
tapted65ff2ea72016-03-01 23:39:00779 // Update the web contents visibility.
780 void UpdateWebContentsVisibility(bool visible);
781
paulmeyerc0b762b2016-04-13 11:55:17782 // Called by FindRequestManager when find replies come in from a renderer
783 // process.
784 void NotifyFindReply(int request_id,
785 int number_of_matches,
786 const gfx::Rect& selection_rect,
787 int active_match_ordinal,
788 bool final_update);
789
ortuno467e5792016-06-10 04:32:39790 // Modify the counter of connected devices for this WebContents.
791 void IncrementBluetoothConnectedDeviceCount();
792 void DecrementBluetoothConnectedDeviceCount();
793
paulmeyerc0b762b2016-04-13 11:55:17794#if defined(OS_ANDROID)
795 // Called by FindRequestManager when all of the find match rects are in.
796 void NotifyFindMatchRectsReply(int version,
797 const std::vector<gfx::RectF>& rects,
798 const gfx::RectF& active_rect);
799#endif
800
lof84501da082016-05-23 21:22:54801 private:
[email protected]8ff00d72012-10-23 19:12:21802 friend class WebContentsObserver;
803 friend class WebContents; // To implement factory methods.
[email protected]0dd3a0ab2011-02-18 08:17:44804
[email protected]2db9bd72012-04-13 20:20:56805 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, NoJSMessageOnInterstitials);
806 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, UpdateTitle);
[email protected]45a22ad2013-02-21 03:25:00807 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, FindOpenerRVHWhenPending);
[email protected]2db9bd72012-04-13 20:20:56808 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest,
809 CrossSiteCantPreemptAfterUnload);
[email protected]ceee8cd2013-03-08 04:59:51810 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, PendingContents);
[email protected]50904452013-05-09 02:05:12811 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, FrameTreeShape);
[email protected]9a890452014-02-13 22:21:02812 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, GetLastActiveTime);
estarka5635c42015-07-14 00:06:53813 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest,
814 LoadResourceFromMemoryCacheWithBadSecurityInfo);
jwwf4684d12015-09-02 06:12:52815 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest,
jam91dd24e2016-08-12 17:16:42816 LoadResourceWithEmptySecurityInfo);
avid53461d2016-02-25 17:15:04817 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest,
818 ResetJavaScriptDialogOnUserNavigate);
[email protected]0dd3a0ab2011-02-18 08:17:44819 FRIEND_TEST_ALL_PREFIXES(FormStructureBrowserTest, HTMLFiles);
820 FRIEND_TEST_ALL_PREFIXES(NavigationControllerTest, HistoryNavigate);
[email protected]b0936d22013-11-28 06:47:36821 FRIEND_TEST_ALL_PREFIXES(RenderFrameHostManagerTest, PageDoesBackAndReload);
[email protected]de3c5d82014-05-28 22:12:59822 FRIEND_TEST_ALL_PREFIXES(SitePerProcessBrowserTest, CrossSiteIframe);
alexmosc2a8cec2016-05-23 22:19:53823 FRIEND_TEST_ALL_PREFIXES(SitePerProcessBrowserTest,
824 TwoSubframesCreatePopupsSimultaneously);
825 FRIEND_TEST_ALL_PREFIXES(SitePerProcessBrowserTest,
826 TwoSubframesCreatePopupMenuWidgetsSimultaneously);
dmazzoni0b5d2482014-09-10 19:45:57827 FRIEND_TEST_ALL_PREFIXES(SitePerProcessAccessibilityBrowserTest,
828 CrossSiteIframeAccessibility);
avic529387b2016-04-06 16:14:53829 FRIEND_TEST_ALL_PREFIXES(WebContentsImplBrowserTest,
830 JavaScriptDialogsInMainAndSubframes);
[email protected]0dd3a0ab2011-02-18 08:17:44831
paulmeyera41de3b2016-05-05 16:30:18832 // So |find_request_manager_| can be accessed for testing.
833 friend class FindRequestManagerTest;
834
[email protected]80e776ae2012-03-23 16:17:20835 // TODO(brettw) TestWebContents shouldn't exist!
[email protected]8ff00d72012-10-23 19:12:21836 friend class TestWebContents;
[email protected]0dd3a0ab2011-02-18 08:17:44837
[email protected]7fff43e2013-05-21 20:21:10838 class DestructionObserver;
839
lazyboy6ec48b2a2015-06-29 15:18:14840 // Represents a WebContents node in a tree of WebContents structure.
841 //
842 // Two WebContents with separate FrameTrees can be connected by
843 // outer/inner relationship using this class. Note that their FrameTrees
844 // still remain disjoint.
845 // The parent is referred to as "outer WebContents" and the descendents are
846 // referred to as "inner WebContents".
847 // For each inner WebContents, the outer WebContents will have a
848 // corresponding FrameTreeNode.
849 struct WebContentsTreeNode {
850 public:
851 WebContentsTreeNode();
852 ~WebContentsTreeNode();
853
854 typedef std::set<WebContentsTreeNode*> ChildrenSet;
855
856 void ConnectToOuterWebContents(WebContentsImpl* outer_web_contents,
857 RenderFrameHostImpl* outer_contents_frame);
858
859 WebContentsImpl* outer_web_contents() { return outer_web_contents_; }
avallee0206f782016-07-28 18:55:33860 int outer_contents_frame_tree_node_id() const {
lazyboy6ec48b2a2015-06-29 15:18:14861 return outer_contents_frame_tree_node_id_;
862 }
863
avallee0206f782016-07-28 18:55:33864 WebContentsImpl* focused_web_contents() { return focused_web_contents_; }
865 void SetFocusedWebContents(WebContentsImpl* web_contents);
866
lazyboy6ec48b2a2015-06-29 15:18:14867 private:
paulmeyerc0b762b2016-04-13 11:55:17868 // The outer WebContents.
lazyboy6ec48b2a2015-06-29 15:18:14869 WebContentsImpl* outer_web_contents_;
870 // The ID of the FrameTreeNode in outer WebContents that is hosting us.
871 int outer_contents_frame_tree_node_id_;
872 // List of inner WebContents that we host.
873 ChildrenSet inner_web_contents_tree_nodes_;
avallee0206f782016-07-28 18:55:33874 // Only the root node should have this set. This indicates the WebContents
875 // whose frame tree has the focused frame. The WebContents tree could be
876 // arbitrarily deep.
877 WebContentsImpl* focused_web_contents_;
lazyboy6ec48b2a2015-06-29 15:18:14878 };
879
[email protected]d1198fd2012-08-13 22:50:19880 // See WebContents::Create for a description of these parameters.
alexmose201c7cd2015-06-10 17:14:21881 WebContentsImpl(BrowserContext* browser_context);
[email protected]d1198fd2012-08-13 22:50:19882
[email protected]e2225bf2013-11-15 16:09:38883 // Add and remove observers for page navigation notifications. The order in
884 // which notifications are sent to observers is undefined. Clients must be
885 // sure to remove the observer before they go away.
[email protected]8ff00d72012-10-23 19:12:21886 void AddObserver(WebContentsObserver* observer);
887 void RemoveObserver(WebContentsObserver* observer);
[email protected]d1198fd2012-08-13 22:50:19888
alexmose201c7cd2015-06-10 17:14:21889 // Clears a pending contents that has been closed before being shown.
[email protected]7fff43e2013-05-21 20:21:10890 void OnWebContentsDestroyed(WebContentsImpl* web_contents);
891
892 // Creates and adds to the map a destruction observer watching |web_contents|.
893 // No-op if such an observer already exists.
894 void AddDestructionObserver(WebContentsImpl* web_contents);
895
896 // Deletes and removes from the map a destruction observer
897 // watching |web_contents|. No-op if there is no such observer.
898 void RemoveDestructionObserver(WebContentsImpl* web_contents);
[email protected]14392a52012-05-02 20:28:44899
[email protected]de3c5d82014-05-28 22:12:59900 // Traverses all the RenderFrameHosts in the FrameTree and creates a set
[email protected]948481d2014-06-11 18:32:22901 // all the unique RenderWidgetHostViews.
902 std::set<RenderWidgetHostView*> GetRenderWidgetHostViewsInTree();
[email protected]de3c5d82014-05-28 22:12:59903
pkotwicz75ca8ffd2016-02-16 23:10:19904 // Called with the result of a DownloadImage() request.
905 void OnDidDownloadImage(const ImageDownloadCallback& callback,
906 int id,
907 const GURL& image_url,
leon.hancbc4bc3c2016-02-26 07:08:52908 int32_t http_status_code,
leon.hanc2228532016-08-16 05:59:18909 const std::vector<SkBitmap>& images,
910 const std::vector<gfx::Size>& original_image_sizes);
pkotwicz75ca8ffd2016-02-16 23:10:19911
[email protected]6fba26d2014-04-29 09:38:28912 // Callback function when showing JavaScript dialogs. Takes in a routing ID
913 // pair to identify the RenderFrameHost that opened the dialog, because it's
914 // possible for the RenderFrameHost to be deleted by the time this is called.
915 void OnDialogClosed(int render_process_id,
916 int render_frame_id,
[email protected]51da7e32012-01-30 19:24:52917 IPC::Message* reply_msg,
[email protected]87de04b02014-04-08 22:14:49918 bool dialog_was_suppressed,
[email protected]51da7e32012-01-30 19:24:52919 bool success,
[email protected]fcf75d42013-12-03 20:11:26920 const base::string16& user_input);
[email protected]51da7e32012-01-30 19:24:52921
[email protected]f114fa42013-12-06 17:06:44922 bool OnMessageReceived(RenderViewHost* render_view_host,
923 RenderFrameHost* render_frame_host,
924 const IPC::Message& message);
925
nasko907fcb62015-01-28 04:24:11926 // Checks whether render_frame_message_source_ is set to non-null value,
927 // otherwise it terminates the main frame renderer process.
928 bool HasValidFrameSource();
929
[email protected]d0759f492012-04-19 22:50:50930 // IPC message handlers.
[email protected]37b64c52014-07-11 21:14:05931 void OnThemeColorChanged(SkColor theme_color);
[email protected]0dd3a0ab2011-02-18 08:17:44932 void OnDidLoadResourceFromMemoryCache(const GURL& url,
[email protected]70435962011-08-02 20:13:28933 const std::string& http_request,
[email protected]6d6cfb3a2012-05-23 22:53:18934 const std::string& mime_type,
[email protected]6c1e05212014-07-31 00:59:40935 ResourceType resource_type);
[email protected]0dd3a0ab2011-02-18 08:17:44936 void OnDidDisplayInsecureContent();
estark910b4572015-12-09 20:55:41937 void OnDidRunInsecureContent(const GURL& security_origin,
[email protected]0dd3a0ab2011-02-18 08:17:44938 const GURL& target_url);
jama385e112016-07-22 00:07:58939 void OnDidDisplayContentWithCertificateErrors(const GURL& url);
940 void OnDidRunContentWithCertificateErrors(const GURL& url);
[email protected]501052ff2014-02-21 22:19:07941 void OnDocumentLoadedInFrame();
[email protected]61ac9e242014-03-21 20:55:26942 void OnDidFinishLoad(const GURL& url);
[email protected]0dd3a0ab2011-02-18 08:17:44943 void OnGoToEntryAtOffset(int offset);
[email protected]216813952011-05-19 22:21:26944 void OnUpdateZoomLimits(int minimum_percent,
[email protected]fce823222014-05-30 16:24:30945 int maximum_percent);
mcnee432e47d2015-11-09 19:37:46946 void OnPageScaleFactorChanged(float page_scale_factor);
[email protected]2dec8ec2013-02-07 19:20:34947 void OnEnumerateDirectory(int request_id, const base::FilePath& path);
[email protected]b7a756d42012-01-23 18:08:17948
[email protected]7d189022011-08-25 22:54:20949 void OnRegisterProtocolHandler(const std::string& protocol,
950 const GURL& url,
[email protected]fcf75d42013-12-03 20:11:26951 const base::string16& title,
[email protected]3a3b75a2012-06-01 08:38:36952 bool user_gesture);
[email protected]f5273e52014-07-14 16:30:20953 void OnUnregisterProtocolHandler(const std::string& protocol,
954 const GURL& url,
955 bool user_gesture);
[email protected]59363fc92012-09-05 03:46:31956 void OnFindReply(int request_id,
957 int number_of_matches,
958 const gfx::Rect& selection_rect,
959 int active_match_ordinal,
[email protected]b888919c2011-09-02 00:32:16960 bool final_update);
mfomitchev2b8b066a2016-01-28 19:23:15961#if defined(OS_ANDROID)
[email protected]59363fc92012-09-05 03:46:31962 void OnFindMatchRectsReply(int version,
963 const std::vector<gfx::RectF>& rects,
964 const gfx::RectF& active_rect);
paulmeyerc0b762b2016-04-13 11:55:17965 void OnGetNearestFindResultReply(int request_id, float distance);
[email protected]1ff427972013-02-07 21:14:07966 void OnOpenDateTimeDialog(
967 const ViewHostMsg_DateTimeDialogValue_Params& value);
[email protected]59363fc92012-09-05 03:46:31968#endif
avi60bd4902015-09-23 20:39:24969 void OnDomOperationResponse(const std::string& json_string);
[email protected]7fc4bbb2011-09-08 21:23:10970 void OnAppCacheAccessed(const GURL& manifest_url, bool blocked_by_policy);
[email protected]8bc5ff02013-11-29 06:34:03971 void OnOpenColorChooser(int color_chooser_id,
972 SkColor color,
973 const std::vector<ColorSuggestion>& suggestions);
[email protected]da8543762012-03-20 08:52:20974 void OnEndColorChooser(int color_chooser_id);
[email protected]55578b0a2012-04-18 14:31:32975 void OnSetSelectedColorInColorChooser(int color_chooser_id, SkColor color);
[email protected]d0759f492012-04-19 22:50:50976 void OnWebUISend(const GURL& source_url,
977 const std::string& name,
978 const base::ListValue& args);
kouhei40f03cb2015-09-24 07:47:01979 void OnUpdatePageImportanceSignals(const PageImportanceSignals& signals);
brettw4b461082016-11-19 18:55:16980#if BUILDFLAG(ENABLE_PLUGINS)
zqzhang181047e62016-07-01 13:37:17981 void OnPepperInstanceCreated(int32_t pp_instance);
982 void OnPepperInstanceDeleted(int32_t pp_instance);
tommyclie6633ca72014-10-31 00:40:42983 void OnPepperPluginHung(int plugin_child_id,
984 const base::FilePath& path,
985 bool is_hung);
zqzhang181047e62016-07-01 13:37:17986 void OnPepperStartsPlayback(int32_t pp_instance);
987 void OnPepperStopsPlayback(int32_t pp_instance);
tommyclie6633ca72014-10-31 00:40:42988 void OnPluginCrashed(const base::FilePath& plugin_path,
989 base::ProcessId plugin_pid);
[email protected]ea0309c2013-08-06 19:35:44990 void OnRequestPpapiBrokerPermission(int routing_id,
[email protected]d8415ad92012-08-23 14:40:50991 const GURL& url,
[email protected]2dec8ec2013-02-07 19:20:34992 const base::FilePath& plugin_path);
tommyclie6633ca72014-10-31 00:40:42993
994 // Callback function when requesting permission to access the PPAPI broker.
995 // |result| is true if permission was granted.
996 void OnPpapiBrokerPermissionResult(int routing_id, bool result);
997
fsamuel833ee7c2015-02-13 23:40:40998 void OnBrowserPluginMessage(RenderFrameHost* render_frame_host,
999 const IPC::Message& message);
brettw4b461082016-11-19 18:55:161000#endif // BUILDFLAG(ENABLE_PLUGINS)
[email protected]50279492014-05-05 23:24:291001 void OnUpdateFaviconURL(const std::vector<FaviconURL>& candidates);
1002 void OnFirstVisuallyNonEmptyPaint();
[email protected]edc3af82013-12-12 21:24:071003 void OnShowValidationMessage(const gfx::Rect& anchor_in_root_view,
[email protected]6ff9c8f2013-12-20 09:05:291004 const base::string16& main_text,
1005 const base::string16& sub_text);
[email protected]edc3af82013-12-12 21:24:071006 void OnHideValidationMessage();
1007 void OnMoveValidationMessage(const gfx::Rect& anchor_in_root_view);
1008
[email protected]0dd3a0ab2011-02-18 08:17:441009 // Called by derived classes to indicate that we're no longer waiting for a
1010 // response. This won't actually update the throbber, but it will get picked
1011 // up at the next animation step if the throbber is going.
1012 void SetNotWaitingForResponse() { waiting_for_response_ = false; }
1013
avallee9993fca2016-11-17 06:16:501014 // Inner WebContents Helpers -------------------------------------------------
1015 //
1016 // These functions are helpers in managing a hierarchy of WebContents
1017 // involved in rendering inner WebContents.
1018
1019 // When multiple WebContents are present within a tab or window, a single one
1020 // is focused and will route keyboard events in most cases to a RenderWidget
1021 // contained within it. |GetFocusedWebContents()|'s main frame widget will
1022 // receive page focus and blur events when the containing window changes focus
1023 // state.
1024
avallee0206f782016-07-28 18:55:331025 // Returns the focused WebContents.
1026 // If there are multiple inner/outer WebContents (when embedding <webview>,
1027 // <guestview>, ...) returns the single one containing the currently focused
1028 // frame. Otherwise, returns this WebContents.
1029 WebContentsImpl* GetFocusedWebContents();
1030
avallee9993fca2016-11-17 06:16:501031 // Returns true if |this| is the focused WebContents or an ancestor of the
1032 // focused WebContents.
1033 bool ContainsOrIsFocusedWebContents();
1034
1035 // When inner or outer WebContents are present, become the focused
1036 // WebContentsImpl. This will activate this content's main frame RenderWidget
1037 // and indirectly all its subframe widgets. GetFocusedRenderWidgetHost will
1038 // search this WebContentsImpl for a focused RenderWidgetHost. The previously
1039 // focused WebContentsImpl, if any, will have its RenderWidgetHosts
1040 // deactivated.
1041 void SetAsFocusedWebContentsIfNecessary();
1042
avallee0206f782016-07-28 18:55:331043 // Returns the root of the WebContents tree.
1044 WebContentsImpl* GetOutermostWebContents();
1045
[email protected]0dd3a0ab2011-02-18 08:17:441046 // Navigation helpers --------------------------------------------------------
1047 //
1048 // These functions are helpers for Navigate() and DidNavigate().
1049
1050 // Handles post-navigation tasks in DidNavigate AFTER the entry has been
1051 // committed to the navigation controller. Note that the navigation entry is
1052 // not provided since it may be invalid/changed after being committed. The
1053 // current navigation entry is in the NavigationController at this point.
[email protected]2f7b3c5a2013-06-21 04:59:251054
[email protected]bafe6cd2012-05-23 23:09:501055 // Helper for CreateNewWidget/CreateNewFullscreenWidget.
avib7348942015-12-25 20:57:101056 void CreateNewWidget(int32_t render_process_id,
1057 int32_t route_id,
[email protected]bafe6cd2012-05-23 23:09:501058 bool is_fullscreen,
[email protected]180ef242013-11-07 06:50:461059 blink::WebPopupType popup_type);
[email protected]bafe6cd2012-05-23 23:09:501060
1061 // Helper for ShowCreatedWidget/ShowCreatedFullscreenWidget.
alexmosc2a8cec2016-05-23 22:19:531062 void ShowCreatedWidget(int process_id,
1063 int route_id,
[email protected]bafe6cd2012-05-23 23:09:501064 bool is_fullscreen,
bokan107a47f2015-02-03 23:23:391065 const gfx::Rect& initial_rect);
[email protected]bafe6cd2012-05-23 23:09:501066
1067 // Finds the new RenderWidgetHost and returns it. Note that this can only be
1068 // called once as this call also removes it from the internal map.
alexmosc2a8cec2016-05-23 22:19:531069 RenderWidgetHostView* GetCreatedWidget(int process_id, int route_id);
[email protected]bafe6cd2012-05-23 23:09:501070
1071 // Finds the new WebContentsImpl by route_id, initializes it for
1072 // renderer-initiated creation, and returns it. Note that this can only be
1073 // called once as this call also removes it from the internal map.
alexmosc2a8cec2016-05-23 22:19:531074 WebContentsImpl* GetCreatedWindow(int process_id, int route_id);
[email protected]bafe6cd2012-05-23 23:09:501075
lfgdb5c4ed2016-03-04 23:09:071076 // Sends a Page message IPC.
1077 void SendPageMessage(IPC::Message* msg);
1078
[email protected]960b0372014-05-19 18:01:001079 // Tracking loading progress -------------------------------------------------
1080
fdegansa696e5112015-04-17 01:57:591081 // Resets the tracking state of the current load progress.
[email protected]960b0372014-05-19 18:01:001082 void ResetLoadProgressState();
1083
fdegansa696e5112015-04-17 01:57:591084 // Notifies the delegate that the load progress was updated.
1085 void SendChangeLoadProgress();
[email protected]960b0372014-05-19 18:01:001086
clamy44e84ce2016-02-22 15:38:251087 // Notifies the delegate of a change in loading state.
1088 // |details| is used to provide details on the load that just finished
1089 // (but can be null if not applicable).
1090 // |due_to_interstitial| is true if the change in load state occurred because
1091 // an interstitial page started showing/proceeded.
1092 void LoadingStateChanged(bool to_different_document,
1093 bool due_to_interstitial,
1094 LoadNotificationDetails* details);
1095
[email protected]0dd3a0ab2011-02-18 08:17:441096 // Misc non-view stuff -------------------------------------------------------
1097
avi2b177592014-12-10 02:08:021098 // Sets the history for a specified RenderViewHost to |history_length|
1099 // entries, with an offset of |history_offset|.
1100 void SetHistoryOffsetAndLengthForView(RenderViewHost* render_view_host,
1101 int history_offset,
1102 int history_length);
1103
[email protected]0dd3a0ab2011-02-18 08:17:441104 // Helper functions for sending notifications.
[email protected]02d7b6e2014-06-24 21:01:501105 void NotifyViewSwapped(RenderViewHost* old_host, RenderViewHost* new_host);
1106 void NotifyFrameSwapped(RenderFrameHost* old_host, RenderFrameHost* new_host);
[email protected]0dd3a0ab2011-02-18 08:17:441107 void NotifyDisconnected();
1108
[email protected]be1f56ab2011-12-22 06:55:311109 void SetEncoding(const std::string& encoding);
1110
[email protected]fa944cb82013-11-15 17:51:211111 // TODO(creis): This should take in a FrameTreeNode to know which node's
1112 // render manager to return. For now, we just return the root's.
[email protected]b0936d22013-11-28 06:47:361113 RenderFrameHostManager* GetRenderManager() const;
[email protected]fa944cb82013-11-15 17:51:211114
[email protected]7a846df2012-09-20 19:17:391115 // Removes browser plugin embedder if there is one.
1116 void RemoveBrowserPluginEmbedder();
1117
[email protected]dc0fd432013-08-27 15:29:211118 // Helper function to invoke WebContentsDelegate::GetSizeForNewRenderView().
[email protected]fc2b46b2014-05-03 16:33:451119 gfx::Size GetSizeForNewRenderView();
[email protected]dc0fd432013-08-27 15:29:211120
[email protected]ae7eeda2014-07-04 01:53:261121 void OnFrameRemoved(RenderFrameHost* render_frame_host);
[email protected]9b159a52013-10-03 17:24:551122
[email protected]222f5822014-02-05 23:40:491123 // Helper method that's called whenever |preferred_size_| or
1124 // |preferred_size_for_capture_| changes, to propagate the new value to the
1125 // |delegate_|.
1126 void OnPreferredSizeChanged(const gfx::Size& old_size);
1127
dbeama1b926a2015-08-31 23:17:511128 // Internal helper to create WebUI objects associated with |this|. |url| is
1129 // used to determine which WebUI should be created (if any). |frame_name|
1130 // corresponds to the name of a frame that the WebUI should be created for (or
1131 // the main frame if empty).
avie865b1d2016-10-24 19:42:591132 std::unique_ptr<WebUIImpl> CreateWebUI(const GURL& url,
1133 const std::string& frame_name);
dbeama1b926a2015-08-31 23:17:511134
avid53461d2016-02-25 17:15:041135 void SetJavaScriptDialogManagerForTesting(
1136 JavaScriptDialogManager* dialog_manager);
1137
paulmeyerc0b762b2016-04-13 11:55:171138 // Returns the FindRequestManager, or creates one if it doesn't already exist.
1139 FindRequestManager* GetOrCreateFindRequestManager();
1140
rockotf62002a2016-09-15 00:08:591141 // Removes a registered WebContentsBindingSet by interface name.
1142 void RemoveBindingSet(const std::string& interface_name);
1143
[email protected]0dd3a0ab2011-02-18 08:17:441144 // Data for core operation ---------------------------------------------------
1145
1146 // Delegate for notifying our owner about stuff. Not owned by us.
[email protected]8ff00d72012-10-23 19:12:211147 WebContentsDelegate* delegate_;
[email protected]0dd3a0ab2011-02-18 08:17:441148
1149 // Handles the back/forward list and loading.
[email protected]d202a7c2012-01-04 07:53:471150 NavigationControllerImpl controller_;
[email protected]0dd3a0ab2011-02-18 08:17:441151
1152 // The corresponding view.
dcheng59716272016-04-09 05:19:081153 std::unique_ptr<WebContentsView> view_;
[email protected]0dd3a0ab2011-02-18 08:17:441154
[email protected]5a3bdf52012-05-24 15:12:571155 // The view of the RVHD. Usually this is our WebContentsView implementation,
1156 // but if an embedder uses a different WebContentsView, they'll need to
1157 // provide this.
[email protected]8ff00d72012-10-23 19:12:211158 RenderViewHostDelegateView* render_view_host_delegate_view_;
[email protected]5a3bdf52012-05-24 15:12:571159
[email protected]bafe6cd2012-05-23 23:09:501160 // Tracks created WebContentsImpl objects that have not been shown yet. They
alexmosc2a8cec2016-05-23 22:19:531161 // are identified by the process ID and routing ID passed to CreateNewWindow.
1162 typedef std::pair<int, int> ProcessRoutingIdPair;
1163 std::map<ProcessRoutingIdPair, WebContentsImpl*> pending_contents_;
[email protected]bafe6cd2012-05-23 23:09:501164
alexmosc2a8cec2016-05-23 22:19:531165 // This map holds widgets that were created on behalf of the renderer but
1166 // haven't been shown yet.
1167 std::map<ProcessRoutingIdPair, RenderWidgetHostView*> pending_widget_views_;
[email protected]bafe6cd2012-05-23 23:09:501168
avia8cf81982016-08-12 20:28:461169 std::map<WebContentsImpl*, std::unique_ptr<DestructionObserver>>
1170 destruction_observers_;
[email protected]7fff43e2013-05-21 20:21:101171
[email protected]996042972011-11-08 22:43:591172 // A list of observers notified when page state changes. Weak references.
[email protected]fa944cb82013-11-15 17:51:211173 // This MUST be listed above frame_tree_ since at destruction time the
[email protected]996042972011-11-08 22:43:591174 // latter might cause RenderViewHost's destructor to call us and we might use
1175 // the observer list then.
brettw236d3172015-06-03 16:31:431176 base::ObserverList<WebContentsObserver> observers_;
[email protected]996042972011-11-08 22:43:591177
rockotf62002a2016-09-15 00:08:591178 // Associated interface binding sets attached to this WebContents.
1179 std::map<std::string, WebContentsBindingSet*> binding_sets_;
1180
[email protected]c7c0d822014-04-16 20:19:491181 // True if this tab was opened by another tab. This is not unset if the opener
1182 // is closed.
1183 bool created_with_opener_;
1184
[email protected]0dd3a0ab2011-02-18 08:17:441185 // Helper classes ------------------------------------------------------------
1186
[email protected]fa944cb82013-11-15 17:51:211187 // Manages the frame tree of the page and process swaps in each node.
[email protected]9b159a52013-10-03 17:24:551188 FrameTree frame_tree_;
1189
lazyboy6ec48b2a2015-06-29 15:18:141190 // If this WebContents is part of a "tree of WebContents", then this contains
1191 // information about the structure.
dcheng59716272016-04-09 05:19:081192 std::unique_ptr<WebContentsTreeNode> node_;
lazyboy6ec48b2a2015-06-29 15:18:141193
[email protected]c7dd2f62011-07-18 15:57:591194 // SavePackage, lazily created.
1195 scoped_refptr<SavePackage> save_package_;
1196
paulmeyerc8cb7cb2016-06-07 01:14:191197 // Manages/coordinates multi-process find-in-page requests. Created lazily.
dcheng18ec0b542016-04-26 19:28:531198 std::unique_ptr<FindRequestManager> find_request_manager_;
paulmeyerc0b762b2016-04-13 11:55:171199
[email protected]0dd3a0ab2011-02-18 08:17:441200 // Data for loading state ----------------------------------------------------
1201
[email protected]6dfed692014-05-22 04:18:031202 // Indicates whether the current load is to a different document. Only valid
1203 // if is_loading_ is true.
1204 bool is_load_to_different_document_;
1205
[email protected]0dd3a0ab2011-02-18 08:17:441206 // Indicates if the tab is considered crashed.
1207 base::TerminationStatus crashed_status_;
1208 int crashed_error_code_;
1209
[email protected]ca13a442012-04-17 14:00:121210 // Whether this WebContents is waiting for a first-response for the
[email protected]be1f56ab2011-12-22 06:55:311211 // main resource of the page. This controls whether the throbber state is
1212 // "waiting" or "loading."
[email protected]0dd3a0ab2011-02-18 08:17:441213 bool waiting_for_response_;
1214
[email protected]0dd3a0ab2011-02-18 08:17:441215 // The current load state and the URL associated with it.
[email protected]9c235f042011-08-10 22:28:211216 net::LoadStateWithParam load_state_;
[email protected]fcf75d42013-12-03 20:11:261217 base::string16 load_state_host_;
[email protected]960b0372014-05-19 18:01:001218
[email protected]960b0372014-05-19 18:01:001219 base::TimeTicks loading_last_progress_update_;
1220
[email protected]0dd3a0ab2011-02-18 08:17:441221 // Upload progress, for displaying in the status bar.
1222 // Set to zero when there is no significant upload happening.
avib7348942015-12-25 20:57:101223 uint64_t upload_size_;
1224 uint64_t upload_position_;
[email protected]0dd3a0ab2011-02-18 08:17:441225
dfalcantarae6b7b46752015-07-10 18:14:161226 // Tracks that this WebContents needs to unblock requests to the renderer.
1227 // See ResumeLoadingCreatedWebContents.
1228 bool is_resume_pending_;
1229
[email protected]0dd3a0ab2011-02-18 08:17:441230 // Data for current page -----------------------------------------------------
1231
[email protected]987fc3a2011-05-26 14:18:091232 // When a title cannot be taken from any entry, this title will be used.
[email protected]fcf75d42013-12-03 20:11:261233 base::string16 page_title_when_no_navigation_entry_;
[email protected]987fc3a2011-05-26 14:18:091234
[email protected]0dd3a0ab2011-02-18 08:17:441235 // When a navigation occurs, we record its contents MIME type. It can be
1236 // used to check whether we can do something for some special contents.
1237 std::string contents_mime_type_;
1238
[email protected]ef3adfc2014-05-11 00:04:541239 // The last reported character encoding, not canonicalized.
1240 std::string last_reported_encoding_;
1241
1242 // The canonicalized character encoding.
1243 std::string canonical_encoding_;
[email protected]0dd3a0ab2011-02-18 08:17:441244
[email protected]b4c84012014-04-28 19:51:101245 // Whether the initial empty page has been accessed by another page, making it
1246 // unsafe to show the pending URL. Usually false unless another window tries
1247 // to modify the blank page. Always false after the first commit.
1248 bool has_accessed_initial_document_;
1249
yusufod41c5f92015-03-06 00:14:281250 // The theme color for the underlying document as specified
1251 // by theme-color meta tag.
1252 SkColor theme_color_;
1253
1254 // The last published theme color.
1255 SkColor last_sent_theme_color_;
1256
peter90afaba2015-06-01 12:05:291257 // Whether the first visually non-empty paint has occurred.
1258 bool did_first_visually_non_empty_paint_;
1259
[email protected]0dd3a0ab2011-02-18 08:17:441260 // Data for misc internal state ----------------------------------------------
1261
[email protected]54597982013-02-06 01:59:551262 // When > 0, the WebContents is currently being captured (e.g., for
1263 // screenshots or mirroring); and the underlying RenderWidgetHost should not
1264 // be told it is hidden.
1265 int capturer_count_;
1266
1267 // Tracks whether RWHV should be visible once capturer_count_ becomes zero.
1268 bool should_normally_be_visible_;
[email protected]0dd3a0ab2011-02-18 08:17:441269
tapted65ff2ea72016-03-01 23:39:001270 // Tracks whether this WebContents was ever set to be visible. Used to
1271 // facilitate WebContents being loaded in the background by setting
1272 // |should_normally_be_visible_|. Ensures WasShown() will trigger when first
1273 // becoming visible to the user, and prevents premature unloading.
1274 bool did_first_set_visible_;
1275
[email protected]0dd3a0ab2011-02-18 08:17:441276 // See getter above.
1277 bool is_being_destroyed_;
1278
1279 // Indicates whether we should notify about disconnection of this
[email protected]b172aee2012-04-10 17:05:261280 // WebContentsImpl. This is used to ensure disconnection notifications only
[email protected]0dd3a0ab2011-02-18 08:17:441281 // happen if a connection notification has happened and that they happen only
1282 // once.
1283 bool notify_disconnection_;
1284
[email protected]71a88bb2013-02-01 22:05:151285 // Pointer to the JavaScript dialog manager, lazily assigned. Used because the
[email protected]b172aee2012-04-10 17:05:261286 // delegate of this WebContentsImpl is nulled before its destructor is called.
[email protected]71a88bb2013-02-01 22:05:151287 JavaScriptDialogManager* dialog_manager_;
[email protected]2e5b90c2011-08-16 21:11:551288
avi85ee8362016-10-08 02:09:081289 // Set to true when there is an active JavaScript dialog showing.
1290 bool is_showing_javascript_dialog_ = false;
1291
[email protected]0dd3a0ab2011-02-18 08:17:441292 // Set to true when there is an active "before unload" dialog. When true,
1293 // we've forced the throbber to start in Navigate, and we need to remember to
1294 // turn it off in OnJavaScriptMessageBoxClosed if the navigation is canceled.
1295 bool is_showing_before_unload_dialog_;
1296
[email protected]0dd3a0ab2011-02-18 08:17:441297 // Settings that get passed to the renderer process.
[email protected]8ff00d72012-10-23 19:12:211298 RendererPreferences renderer_preferences_;
[email protected]0dd3a0ab2011-02-18 08:17:441299
[email protected]9a890452014-02-13 22:21:021300 // The time that this WebContents was last made active. The initial value is
1301 // the WebContents creation time.
gab0dccfef2015-05-20 18:43:391302 base::TimeTicks last_active_time_;
[email protected]0dd3a0ab2011-02-18 08:17:441303
hajimehoshic4f226a2016-10-21 09:01:571304 // The time that this WebContents was last made hidden. The initial value is
1305 // zero.
1306 base::TimeTicks last_hidden_time_;
1307
[email protected]0dd3a0ab2011-02-18 08:17:441308 // See description above setter.
1309 bool closed_by_user_gesture_;
1310
1311 // Minimum/maximum zoom percent.
1312 int minimum_zoom_percent_;
1313 int maximum_zoom_percent_;
[email protected]0dd3a0ab2011-02-18 08:17:441314
w.shackleton49bcd392016-01-06 17:38:221315 // Used to correctly handle integer zooming through a smooth scroll device.
1316 float zoom_scroll_remainder_;
1317
[email protected]bcd2815602012-01-14 18:17:231318 // The intrinsic size of the page.
1319 gfx::Size preferred_size_;
1320
[email protected]222f5822014-02-05 23:40:491321 // The preferred size for content screen capture. When |capturer_count_| > 0,
1322 // this overrides |preferred_size_|.
1323 gfx::Size preferred_size_for_capture_;
1324
mfomitchev2b8b066a2016-01-28 19:23:151325#if defined(OS_ANDROID)
[email protected]583418cc2013-01-17 14:01:101326 // Date time chooser opened by this tab.
1327 // Only used in Android since all other platforms use a multi field UI.
dcheng59716272016-04-09 05:19:081328 std::unique_ptr<DateTimeChooserAndroid> date_time_chooser_;
[email protected]583418cc2013-01-17 14:01:101329#endif
1330
[email protected]8ed16472014-04-11 19:02:481331 // Holds information about a current color chooser dialog, if one is visible.
1332 struct ColorChooserInfo {
1333 ColorChooserInfo(int render_process_id,
1334 int render_frame_id,
1335 ColorChooser* chooser,
1336 int identifier);
1337 ~ColorChooserInfo();
[email protected]cb805452013-05-22 15:16:211338
[email protected]8ed16472014-04-11 19:02:481339 int render_process_id;
1340 int render_frame_id;
1341
1342 // Color chooser that was opened by this tab.
dcheng59716272016-04-09 05:19:081343 std::unique_ptr<ColorChooser> chooser;
[email protected]8ed16472014-04-11 19:02:481344
1345 // A unique identifier for the current color chooser. Identifiers are
1346 // unique across a renderer process. This avoids race conditions in
1347 // synchronizing the browser and renderer processes. For example, if a
1348 // renderer closes one chooser and opens another, and simultaneously the
1349 // user picks a color in the first chooser, the IDs can be used to drop the
1350 // "chose a color" message rather than erroneously tell the renderer that
1351 // the user picked a color in the second chooser.
1352 int identifier;
1353 };
1354
dcheng59716272016-04-09 05:19:081355 std::unique_ptr<ColorChooserInfo> color_chooser_info_;
[email protected]da8543762012-03-20 08:52:201356
[email protected]7a846df2012-09-20 19:17:391357 // Manages the embedder state for browser plugins, if this WebContents is an
1358 // embedder; NULL otherwise.
dcheng59716272016-04-09 05:19:081359 std::unique_ptr<BrowserPluginEmbedder> browser_plugin_embedder_;
[email protected]7a846df2012-09-20 19:17:391360 // Manages the guest state for browser plugin, if this WebContents is a guest;
1361 // NULL otherwise.
dcheng59716272016-04-09 05:19:081362 std::unique_ptr<BrowserPluginGuest> browser_plugin_guest_;
[email protected]7a846df2012-09-20 19:17:391363
brettw4b461082016-11-19 18:55:161364#if BUILDFLAG(ENABLE_PLUGINS)
tommyclieb25b2a2014-11-03 19:45:091365 // Manages the whitelist of plugin content origins exempt from power saving.
dcheng59716272016-04-09 05:19:081366 std::unique_ptr<PluginContentOriginWhitelist>
1367 plugin_content_origin_whitelist_;
tommyclieb25b2a2014-11-03 19:45:091368#endif
1369
[email protected]f53a9f872012-05-24 02:07:061370 // This must be at the end, or else we might get notifications and use other
1371 // member variables that are gone.
[email protected]8ff00d72012-10-23 19:12:211372 NotificationRegistrar registrar_;
[email protected]f53a9f872012-05-24 02:07:061373
[email protected]1d62cf72014-02-07 21:31:571374 // Used during IPC message dispatching from the RenderView/RenderFrame so that
1375 // the handlers can get a pointer to the RVH through which the message was
[email protected]f114fa42013-12-06 17:06:441376 // received.
1377 RenderViewHost* render_view_message_source_;
[email protected]1d62cf72014-02-07 21:31:571378 RenderFrameHost* render_frame_message_source_;
[email protected]7bb761892012-07-20 09:32:471379
[email protected]b24b68a2012-09-24 21:57:261380 // All live RenderWidgetHostImpls that are created by this object and may
1381 // outlive it.
[email protected]8ff00d72012-10-23 19:12:211382 std::set<RenderWidgetHostImpl*> created_widgets_;
[email protected]b24b68a2012-09-24 21:57:261383
alexmosc9e76ec2016-05-16 22:59:371384 // Process id of the shown fullscreen widget, or kInvalidUniqueID if there is
1385 // no fullscreen widget.
1386 int fullscreen_widget_process_id_;
1387
[email protected]44470a22013-01-24 01:21:541388 // Routing id of the shown fullscreen widget or MSG_ROUTING_NONE otherwise.
1389 int fullscreen_widget_routing_id_;
1390
[email protected]0b431992014-06-24 00:08:031391 // At the time the fullscreen widget was being shut down, did it have focus?
1392 // This is used to restore focus to the WebContentsView after both: 1) the
1393 // fullscreen widget is destroyed, and 2) the WebContentsDelegate has
1394 // completed making layout changes to effect an exit from fullscreen mode.
1395 bool fullscreen_widget_had_focus_at_shutdown_;
1396
[email protected]0e584b5f2013-12-30 17:28:231397 // Whether this WebContents is responsible for displaying a subframe in a
[email protected]5dcaf8e2013-12-28 01:31:421398 // different process from its parent page.
1399 bool is_subframe_;
1400
mariakhomenkoa4971c12015-07-21 19:04:371401 // When a new tab is created asynchronously, stores the OpenURLParams needed
1402 // to continue loading the page once the tab is ready.
dcheng59716272016-04-09 05:19:081403 std::unique_ptr<OpenURLParams> delayed_open_url_params_;
mariakhomenkoa4971c12015-07-21 19:04:371404
[email protected]34ff1cfc2014-08-20 06:16:051405 // Whether overscroll should be unconditionally disabled.
1406 bool force_disable_overscroll_content_;
[email protected]e85165c642014-06-10 14:34:311407
[email protected]87de04b02014-04-08 22:14:491408 // Whether the last JavaScript dialog shown was suppressed. Used for testing.
1409 bool last_dialog_suppressed_;
1410
mcasas4e216e72016-07-28 21:28:381411 std::unique_ptr<device::GeolocationServiceContext>
1412 geolocation_service_context_;
blundellc57b93f2014-10-29 13:19:571413
blundelld46e8832016-10-07 10:34:271414 std::unique_ptr<device::WakeLockServiceContext> wake_lock_service_context_;
alogvinovf50445a2015-10-30 13:00:121415
lunalud4a2cc82016-11-22 00:27:231416 std::unique_ptr<ScreenOrientation> screen_orientation_;
[email protected]01f83f92014-06-17 14:41:541417
dcheng59716272016-04-09 05:19:081418 std::unique_ptr<ManifestManagerHost> manifest_manager_host_;
mlamouriefdca9d2014-09-16 16:55:401419
[email protected]95640212014-07-26 18:14:301420 // The accessibility mode for all frames. This is queried when each frame
1421 // is created, and broadcast to all frames when it changes.
1422 AccessibilityMode accessibility_mode_;
1423
avayvodcc85bbd2015-08-28 19:11:151424 // Monitors power levels for audio streams associated with this WebContents.
1425 AudioStreamMonitor audio_stream_monitor_;
1426
miu50f97892014-09-22 22:49:521427 // Created on-demand to mute all audio output from this WebContents.
dcheng59716272016-04-09 05:19:081428 std::unique_ptr<WebContentsAudioMuter> audio_muter_;
miu50f97892014-09-22 22:49:521429
ortunodf4d7982016-04-08 02:33:351430 size_t bluetooth_connected_device_count_;
ortuno32e7db3c2016-03-29 16:14:201431
lukendc35e7f2014-11-10 19:06:141432 bool virtual_keyboard_requested_;
1433
csharrisona2280cd2016-02-03 23:21:151434 // Notifies ResourceDispatcherHostImpl of various events related to loading.
dcheng59716272016-04-09 05:19:081435 std::unique_ptr<LoaderIOThreadNotifier> loader_io_thread_notifier_;
csharrisona2280cd2016-02-03 23:21:151436
dalecurtis88c240072015-12-09 02:11:181437 // Manages media players, CDMs, and power save blockers for media.
dcheng59716272016-04-09 05:19:081438 std::unique_ptr<MediaWebContentsObserver> media_web_contents_observer_;
qinmin58567c82015-01-07 21:00:201439
brettw4b461082016-11-19 18:55:161440#if BUILDFLAG(ENABLE_PLUGINS)
zqzhang181047e62016-07-01 13:37:171441 // Observes pepper playback changes, and notifies MediaSession.
1442 std::unique_ptr<PepperPlaybackObserver> pepper_playback_observer_;
brettw4b461082016-11-19 18:55:161443#endif // BUILDFLAG(ENABLE_PLUGINS)
zqzhang181047e62016-07-01 13:37:171444
scottmg276753cf2016-10-27 18:25:221445 std::unique_ptr<HostZoomMapObserver> host_zoom_map_observer_;
1446
dcheng59716272016-04-09 05:19:081447 std::unique_ptr<RenderWidgetHostInputEventRouter> rwh_input_event_router_;
kenrb2a565f82015-09-02 20:24:591448
kouhei40f03cb2015-09-24 07:47:011449 PageImportanceSignals page_importance_signals_;
1450
mcnee432e47d2015-11-09 19:37:461451 bool page_scale_factor_is_one_;
1452
ekaramadadd882292016-06-08 15:22:561453 // TextInputManager tracks the IME-related state for all the
1454 // RenderWidgetHostViews on this WebContents. Only exists on the outermost
1455 // WebContents and is automatically destroyed when a WebContents becomes an
1456 // inner WebContents by attaching to an outer WebContents. Then the
1457 // IME-related state for RenderWidgetHosts on the inner WebContents is tracked
1458 // by the TextInputManager in the outer WebContents.
1459 std::unique_ptr<TextInputManager> text_input_manager_;
1460
lfgbee1e0a2016-06-08 21:24:211461 // Stores the RenderWidgetHost that currently holds a mouse lock or nullptr if
1462 // there's no RenderWidgetHost holding a lock.
1463 RenderWidgetHostImpl* mouse_lock_widget_;
1464
sammcf5f1b0f2016-09-20 23:05:111465#if defined(OS_ANDROID)
rockot400ea35b2016-10-15 19:15:321466 std::unique_ptr<service_manager::InterfaceProvider> java_interfaces_;
sammcf5f1b0f2016-09-20 23:05:111467#endif
1468
qinmin72e8bd02016-10-21 19:35:371469 // Whether this WebContents is for content overlay.
1470 bool is_overlay_content_;
1471
billorr21c005d2016-11-17 03:57:041472 int currently_playing_video_count_ = 0;
1473
mohan.reddyaae039a2014-11-21 17:39:501474 base::WeakPtrFactory<WebContentsImpl> loading_weak_factory_;
pkotwicz75ca8ffd2016-02-16 23:10:191475 base::WeakPtrFactory<WebContentsImpl> weak_factory_;
mohan.reddyaae039a2014-11-21 17:39:501476
[email protected]b172aee2012-04-10 17:05:261477 DISALLOW_COPY_AND_ASSIGN(WebContentsImpl);
[email protected]0dd3a0ab2011-02-18 08:17:441478};
1479
nickf9acfbe2014-12-23 19:12:371480// Dangerous methods which should never be made part of the public API, so we
1481// grant their use only to an explicit friend list (c++ attorney/client idiom).
1482class CONTENT_EXPORT WebContentsImpl::FriendZone {
1483 private:
1484 friend class TestNavigationObserver;
1485 friend class WebContentsAddedObserver;
1486 friend class ContentBrowserSanityChecker;
1487
1488 FriendZone(); // Not instantiable.
1489
1490 // Adds/removes a callback called on creation of each new WebContents.
1491 static void AddCreatedCallbackForTesting(const CreatedCallback& callback);
1492 static void RemoveCreatedCallbackForTesting(const CreatedCallback& callback);
1493
1494 DISALLOW_COPY_AND_ASSIGN(FriendZone);
1495};
1496
[email protected]8ff00d72012-10-23 19:12:211497} // namespace content
1498
[email protected]93ddb3c2012-04-11 21:44:291499#endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_