blob: 83f043709442a34bdc245f69b69f860da26c7d71 [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"
esprehnfbba1292016-04-15 17:59:5647#include "third_party/WebKit/public/platform/WebDragOperation.h"
Sylvain Defresnec6ccc77d2014-09-19 10:19:3548#include "ui/base/page_transition_types.h"
tfarina3b0452d2014-12-31 15:20:0949#include "ui/gfx/geometry/rect_f.h"
tfarinaebe974f02015-01-03 04:25:3250#include "ui/gfx/geometry/size.h"
[email protected]0dd3a0ab2011-02-18 08:17:4451
[email protected]1ff427972013-02-07 21:14:0752struct ViewHostMsg_DateTimeDialogValue_Params;
[email protected]daf82f82011-10-31 22:35:3153
rockot400ea35b2016-10-15 19:15:3254namespace service_manager {
sammcf5f1b0f2016-09-20 23:05:1155class InterfaceProvider;
56}
57
[email protected]e582fdd2011-12-20 16:48:1758namespace content {
[email protected]7a846df2012-09-20 19:17:3959class BrowserPluginEmbedder;
60class BrowserPluginGuest;
[email protected]583418cc2013-01-17 14:01:1061class DateTimeChooserAndroid;
paulmeyerc0b762b2016-04-13 11:55:1762class FindRequestManager;
scottmg276753cf2016-10-27 18:25:2263class HostZoomMapObserver;
[email protected]8ff00d72012-10-23 19:12:2164class InterstitialPageImpl;
[email protected]71a88bb2013-02-01 22:05:1565class JavaScriptDialogManager;
csharrisona2280cd2016-02-03 23:21:1566class LoaderIOThreadNotifier;
mlamouriefdca9d2014-09-16 16:55:4067class ManifestManagerHost;
qinmin58567c82015-01-07 21:00:2068class MediaWebContentsObserver;
tommyclieb25b2a2014-11-03 19:45:0969class PluginContentOriginWhitelist;
[email protected]eaabba22012-03-07 15:02:1170class RenderViewHost;
[email protected]5a3bdf52012-05-24 15:12:5771class RenderViewHostDelegateView;
[email protected]b24b68a2012-09-24 21:57:2672class RenderWidgetHostImpl;
kenrb2a565f82015-09-02 20:24:5973class RenderWidgetHostInputEventRouter;
[email protected]35869622012-10-26 23:23:5574class SavePackage;
[email protected]01f83f92014-06-17 14:41:5475class ScreenOrientationDispatcherHost;
[email protected]09d31d52012-03-11 22:30:2776class SiteInstance;
[email protected]80e776ae2012-03-23 16:17:2077class TestWebContents;
ekaramadadd882292016-06-08 15:22:5678class TextInputManager;
alogvinovf50445a2015-10-30 13:00:1279class WakeLockServiceContext;
miu50f97892014-09-22 22:49:5280class WebContentsAudioMuter;
rockotf62002a2016-09-15 00:08:5981class WebContentsBindingSet;
[email protected]674bc592011-12-20 23:00:4282class WebContentsDelegate;
[email protected]8ff00d72012-10-23 19:12:2183class WebContentsImpl;
[email protected]fc2b46b2014-05-03 16:33:4584class WebContentsView;
[email protected]f66df822012-05-18 16:52:1785class WebContentsViewDelegate;
[email protected]31a71eaf2014-03-13 01:47:3686struct AXEventNotificationDetails;
[email protected]8bc5ff02013-11-29 06:34:0387struct ColorSuggestion;
[email protected]795c28972012-12-06 06:13:3988struct FaviconURL;
[email protected]09d31d52012-03-11 22:30:2789struct LoadNotificationDetails;
dewittj6dc5747a2016-05-17 01:48:4790struct MHTMLGenerationParams;
[email protected]d60f3702013-12-26 16:30:2491struct ResourceRedirectDetails;
92struct ResourceRequestDetails;
[email protected]f66df822012-05-18 16:52:1793
rockot5c478a72016-09-28 23:14:1894namespace mojom {
95class CreateNewWindowParams;
96}
97
mfomitchev2b8b066a2016-01-28 19:23:1598#if defined(OS_ANDROID)
[email protected]0e813a52014-08-13 10:34:5699class WebContentsAndroid;
100#endif
101
zqzhang181047e62016-07-01 13:37:17102#if defined(ENABLE_PLUGINS)
103class PepperPlaybackObserver;
104#endif
105
[email protected]f66df822012-05-18 16:52:17106// Factory function for the implementations that content knows about. Takes
107// ownership of |delegate|.
[email protected]fc2b46b2014-05-03 16:33:45108WebContentsView* CreateWebContentsView(
[email protected]5a3bdf52012-05-24 15:12:57109 WebContentsImpl* web_contents,
110 WebContentsViewDelegate* delegate,
111 RenderViewHostDelegateView** render_view_host_delegate_view);
[email protected]97714c82012-06-06 10:15:13112
[email protected]b172aee2012-04-10 17:05:26113class CONTENT_EXPORT WebContentsImpl
[email protected]8ff00d72012-10-23 19:12:21114 : public NON_EXPORTED_BASE(WebContents),
[email protected]92404c62013-12-04 16:40:46115 public NON_EXPORTED_BASE(RenderFrameHostDelegate),
[email protected]8ff00d72012-10-23 19:12:21116 public RenderViewHostDelegate,
117 public RenderWidgetHostDelegate,
[email protected]b0936d22013-11-28 06:47:36118 public RenderFrameHostManager::Delegate,
[email protected]ec6c05f2013-10-23 18:41:57119 public NotificationObserver,
[email protected]190b8c52013-11-09 01:35:44120 public NON_EXPORTED_BASE(NavigationControllerDelegate),
121 public NON_EXPORTED_BASE(NavigatorDelegate) {
[email protected]0dd3a0ab2011-02-18 08:17:44122 public:
nickf9acfbe2014-12-23 19:12:37123 class FriendZone;
124
dchengc2282aa2014-10-21 12:07:58125 ~WebContentsImpl() override;
[email protected]0dd3a0ab2011-02-18 08:17:44126
[email protected]d1198fd2012-08-13 22:50:19127 static WebContentsImpl* CreateWithOpener(
[email protected]54944cde2012-12-09 09:24:59128 const WebContents::CreateParams& params,
alexmose201c7cd2015-06-10 17:14:21129 FrameTreeNode* opener);
[email protected]d1198fd2012-08-13 22:50:19130
[email protected]95640212014-07-26 18:14:30131 static std::vector<WebContentsImpl*> GetAllWebContents();
132
clamya16aa8172015-05-26 13:07:25133 static WebContentsImpl* FromFrameTreeNode(FrameTreeNode* frame_tree_node);
clamy0d32d6d2015-11-24 11:16:26134 static WebContents* FromRenderFrameHostID(int render_process_host_id,
135 int render_frame_host_id);
ananta4b7467a52016-09-23 01:42:38136 static WebContents* FromFrameTreeNodeId(int frame_tree_node_id);
clamya16aa8172015-05-26 13:07:25137
[email protected]d1198fd2012-08-13 22:50:19138 // Complex initialization here. Specifically needed to avoid having
139 // members call back into our virtual functions in the constructor.
[email protected]54944cde2012-12-09 09:24:59140 virtual void Init(const WebContents::CreateParams& params);
[email protected]d1198fd2012-08-13 22:50:19141
[email protected]c7dd2f62011-07-18 15:57:59142 // Returns the SavePackage which manages the page saving job. May be NULL.
143 SavePackage* save_package() const { return save_package_.get(); }
144
mfomitchev2b8b066a2016-01-28 19:23:15145#if defined(OS_ANDROID)
[email protected]7d244f12013-08-22 21:41:51146 // In Android WebView, the RenderView needs created even there is no
147 // navigation entry, this allows Android WebViews to use
148 // javascript: URLs that load into the DOMWindow before the first page
149 // load. This is not safe to do in any context that a web page could get a
150 // reference to the DOMWindow before the first page load.
151 bool CreateRenderViewForInitialEmptyDocument();
[email protected]4cc1ab52013-01-21 19:24:34152#endif
[email protected]276b37a22011-11-08 20:45:46153
[email protected]765187182012-01-11 23:59:28154 // Expose the render manager for testing.
[email protected]ee87c8be2014-03-05 00:35:38155 // TODO(creis): Remove this now that we can get to it via FrameTreeNode.
[email protected]b0936d22013-11-28 06:47:36156 RenderFrameHostManager* GetRenderManagerForTesting();
[email protected]765187182012-01-11 23:59:28157
lazyboy8e16ddfd2015-09-28 03:41:56158 // Returns the outer WebContents of this WebContents if any.
159 // Note that without --site-per-process, this will return the WebContents
160 // of the BrowserPluginEmbedder, if |this| is a guest.
161 WebContentsImpl* GetOuterWebContents();
162
[email protected]7a846df2012-09-20 19:17:39163 // Returns guest browser plugin object, or NULL if this WebContents is not a
164 // guest.
[email protected]f8497342013-02-05 22:15:02165 BrowserPluginGuest* GetBrowserPluginGuest() const;
[email protected]738f57a2013-06-29 21:06:54166
167 // Sets a BrowserPluginGuest object for this WebContents. If this WebContents
168 // has a BrowserPluginGuest then that implies that it is being hosted by
169 // a BrowserPlugin object in an embedder renderer process.
170 void SetBrowserPluginGuest(BrowserPluginGuest* guest);
171
[email protected]7a846df2012-09-20 19:17:39172 // Returns embedder browser plugin object, or NULL if this WebContents is not
173 // an embedder.
[email protected]f8497342013-02-05 22:15:02174 BrowserPluginEmbedder* GetBrowserPluginEmbedder() const;
[email protected]738f57a2013-06-29 21:06:54175
fsamuel60b42282015-03-10 03:29:14176 // Creates a BrowserPluginEmbedder object for this WebContents if one doesn't
177 // already exist.
178 void CreateBrowserPluginEmbedderIfNecessary();
179
creis89a0f782015-05-27 16:13:17180 // Cancels modal dialogs in this WebContents, as well as in any browser
181 // plugins it is hosting.
182 void CancelActiveAndPendingDialogs();
183
[email protected]cf200a562013-05-03 16:24:29184 // Informs the render view host and the BrowserPluginEmbedder, if present, of
185 // a Drag Source End.
paulmeyer8fc8ea92016-11-15 05:12:21186 void DragSourceEndedAt(int client_x,
187 int client_y,
188 int screen_x,
189 int screen_y,
190 blink::WebDragOperation operation);
[email protected]cf200a562013-05-03 16:24:29191
jam73f892642016-09-11 06:04:06192 // Notification that the RenderViewHost's load state changed.
193 void LoadStateChanged(const GURL& url,
194 const net::LoadStateWithParam& load_state,
195 uint64_t upload_position,
196 uint64_t upload_size);
197
[email protected]d60f3702013-12-26 16:30:24198 // A response has been received for a resource request.
199 void DidGetResourceResponseStart(
200 const ResourceRequestDetails& details);
201
202 // A redirect was received while requesting a resource.
203 void DidGetRedirectForResourceRequest(
[email protected]d60f3702013-12-26 16:30:24204 const ResourceRedirectDetails& details);
205
calamity7fe55ce2015-04-10 03:59:37206 // Notify observers that the web contents has been focused.
207 void NotifyWebContentsFocused();
208
[email protected]fc2b46b2014-05-03 16:33:45209 WebContentsView* GetView() const;
210
[email protected]6ccd6f92014-06-24 16:20:57211 ScreenOrientationDispatcherHost* screen_orientation_dispatcher_host() {
212 return screen_orientation_dispatcher_host_.get();
213 }
214
[email protected]16620a92014-05-24 01:05:51215 bool should_normally_be_visible() { return should_normally_be_visible_; }
216
ccameron8807c38f2015-01-17 00:29:19217 // Indicate if the window has been occluded, and pass this to the views, only
218 // if there is no active capture going on (otherwise it is dropped on the
219 // floor).
220 void WasOccluded();
221 void WasUnOccluded();
222
[email protected]95640212014-07-26 18:14:30223 // Broadcasts the mode change to all frames.
224 void SetAccessibilityMode(AccessibilityMode mode);
225
226 // Adds the given accessibility mode to the current accessibility mode
227 // bitmap.
228 void AddAccessibilityMode(AccessibilityMode mode);
229
230 // Removes the given accessibility mode from the current accessibility
231 // mode bitmap, managing the bits that are shared with other modes such
232 // that a bit will only be turned off when all modes that depend on it
233 // have been removed.
234 void RemoveAccessibilityMode(AccessibilityMode mode);
235
dmazzoni83ba5c82015-04-14 07:11:51236 // Request a one-time snapshot of the accessibility tree without changing
237 // the accessibility mode.
dmazzoniac6cdd02015-08-04 21:07:06238 using AXTreeSnapshotCallback =
dmazzoni329fd012015-10-22 20:05:35239 base::Callback<void(
240 const ui::AXTreeUpdate&)>;
dmazzoni83ba5c82015-04-14 07:11:51241 void RequestAXTreeSnapshot(AXTreeSnapshotCallback callback);
242
wjmaclean64951902016-04-29 20:59:12243 // Set a temporary zoom level for the frames associated with this WebContents.
244 // If |is_temporary| is true, we are setting a new temporary zoom level,
245 // otherwise we are clearing a previously set temporary zoom level.
246 void SetTemporaryZoomLevel(double level, bool temporary_zoom_enabled);
247
248 // Sets the zoom level for frames associated with this WebContents.
249 void UpdateZoom(double level);
250
251 // Sets the zoom level for frames associated with this WebContents if it
252 // matches |host| and (if non-empty) |scheme|. Matching is done on the
253 // last committed entry.
254 void UpdateZoomIfNecessary(const std::string& scheme,
255 const std::string& host,
256 double level);
257
rockotf62002a2016-09-15 00:08:59258 // Adds a new binding set to the WebContents. Returns a closure which may be
259 // used to remove the binding set at any time. The closure is safe to call
260 // even after WebContents destruction.
261 //
262 // |binding_set| is not owned and must either outlive this WebContents or be
263 // explicitly removed before being destroyed.
264 base::Closure AddBindingSet(const std::string& interface_name,
265 WebContentsBindingSet* binding_set);
266
[email protected]8ff00d72012-10-23 19:12:21267 // WebContents ------------------------------------------------------
dchengc2282aa2014-10-21 12:07:58268 WebContentsDelegate* GetDelegate() override;
269 void SetDelegate(WebContentsDelegate* delegate) override;
270 NavigationControllerImpl& GetController() override;
271 const NavigationControllerImpl& GetController() const override;
272 BrowserContext* GetBrowserContext() const override;
273 const GURL& GetURL() const override;
274 const GURL& GetVisibleURL() const override;
275 const GURL& GetLastCommittedURL() const override;
276 RenderProcessHost* GetRenderProcessHost() const override;
clamydf1975e2015-02-05 19:12:24277 RenderFrameHostImpl* GetMainFrame() override;
nick53d5cbf2015-04-23 22:50:14278 RenderFrameHostImpl* GetFocusedFrame() override;
rob3e2a0732016-01-06 21:22:09279 RenderFrameHostImpl* FindFrameByFrameTreeNodeId(
280 int frame_tree_node_id) override;
dchengc2282aa2014-10-21 12:07:58281 void ForEachFrame(
anand.ratn120b0b002014-10-07 15:49:32282 const base::Callback<void(RenderFrameHost*)>& on_frame) override;
dchengafb53e22016-02-04 08:11:08283 std::vector<RenderFrameHost*> GetAllFrames() override;
lukaszacbdf52e2016-01-15 21:19:51284 int SendToAllFrames(IPC::Message* message) override;
creisc014b402015-04-23 16:41:45285 RenderViewHostImpl* GetRenderViewHost() const override;
dchengc2282aa2014-10-21 12:07:58286 int GetRoutingID() const override;
287 RenderWidgetHostView* GetRenderWidgetHostView() const override;
lfg265a2672016-04-23 03:11:02288 RenderWidgetHostView* GetTopLevelRenderWidgetHostView() override;
naskoc0fceff2015-04-30 15:53:52289 void ClosePage() override;
dchengc2282aa2014-10-21 12:07:58290 RenderWidgetHostView* GetFullscreenRenderWidgetHostView() const override;
yusufod41c5f92015-03-06 00:14:28291 SkColor GetThemeColor() const override;
avie865b1d2016-10-24 19:42:59292 std::unique_ptr<WebUI> CreateSubframeWebUI(
293 const GURL& url,
294 const std::string& frame_name) override;
dchengc2282aa2014-10-21 12:07:58295 WebUI* GetWebUI() const override;
296 WebUI* GetCommittedWebUI() const override;
297 void SetUserAgentOverride(const std::string& override) override;
298 const std::string& GetUserAgentOverride() const override;
299 void EnableTreeOnlyAccessibilityMode() override;
300 bool IsTreeOnlyAccessibilityModeForTesting() const override;
301 bool IsFullAccessibilityModeForTesting() const override;
kouhei40f03cb2015-09-24 07:47:01302 const PageImportanceSignals& GetPageImportanceSignals() const override;
dchengc2282aa2014-10-21 12:07:58303 const base::string16& GetTitle() const override;
afakhry6f0c1ec22016-07-14 13:55:13304 void UpdateTitleForEntry(NavigationEntry* entry,
305 const base::string16& title) override;
dchengc2282aa2014-10-21 12:07:58306 SiteInstanceImpl* GetSiteInstance() const override;
307 SiteInstanceImpl* GetPendingSiteInstance() const override;
308 bool IsLoading() const override;
309 bool IsLoadingToDifferentDocument() const override;
310 bool IsWaitingForResponse() const override;
311 const net::LoadStateWithParam& GetLoadState() const override;
312 const base::string16& GetLoadStateHost() const override;
avib7348942015-12-25 20:57:10313 uint64_t GetUploadSize() const override;
314 uint64_t GetUploadPosition() const override;
dchengc2282aa2014-10-21 12:07:58315 const std::string& GetEncoding() const override;
dchengc2282aa2014-10-21 12:07:58316 void IncrementCapturerCount(const gfx::Size& capture_size) override;
317 void DecrementCapturerCount() override;
318 int GetCapturerCount() const override;
319 bool IsAudioMuted() const override;
320 void SetAudioMuted(bool mute) override;
ortunodf4d7982016-04-08 02:33:35321 bool IsConnectedToBluetoothDevice() const override;
dchengc2282aa2014-10-21 12:07:58322 bool IsCrashed() const override;
323 void SetIsCrashed(base::TerminationStatus status, int error_code) override;
324 base::TerminationStatus GetCrashedStatus() const override;
afakhry98241832016-03-11 19:27:47325 int GetCrashedErrorCode() const override;
dchengc2282aa2014-10-21 12:07:58326 bool IsBeingDestroyed() const override;
327 void NotifyNavigationStateChanged(InvalidateTypes changed_flags) override;
altimind8bd26c2016-11-04 11:44:54328 void OnAudioStateChanged(bool is_audio_playing) override;
gab0dccfef2015-05-20 18:43:39329 base::TimeTicks GetLastActiveTime() const override;
georgesak5582cbe2015-05-22 22:08:07330 void SetLastActiveTime(base::TimeTicks last_active_time) override;
hajimehoshic4f226a2016-10-21 09:01:57331 base::TimeTicks GetLastHiddenTime() const override;
dchengc2282aa2014-10-21 12:07:58332 void WasShown() override;
333 void WasHidden() override;
334 bool NeedToFireBeforeUnload() override;
nasko148bb0b92016-05-10 21:03:19335 void DispatchBeforeUnload() override;
lazyboy6ec48b2a2015-06-29 15:18:14336 void AttachToOuterWebContentsFrame(
337 WebContents* outer_web_contents,
338 RenderFrameHost* outer_contents_frame) override;
dalecurtis6c58ed02016-10-28 23:02:37339 void DidChangeVisibleSecurityState() override;
dchengc2282aa2014-10-21 12:07:58340 void Stop() override;
341 WebContents* Clone() override;
toyoshim24a4c7ab2016-04-05 09:24:14342 void ReloadFocusedFrame(bool bypass_cache) override;
dchengc2282aa2014-10-21 12:07:58343 void Undo() override;
344 void Redo() override;
345 void Cut() override;
346 void Copy() override;
347 void CopyToFindPboard() override;
348 void Paste() override;
349 void PasteAndMatchStyle() override;
350 void Delete() override;
351 void SelectAll() override;
352 void Unselect() override;
353 void Replace(const base::string16& word) override;
354 void ReplaceMisspelling(const base::string16& word) override;
355 void NotifyContextMenuClosed(
anand.ratn120b0b002014-10-07 15:49:32356 const CustomContextMenuContext& context) override;
megjablon3f5941072016-02-04 23:27:52357 void ReloadLoFiImages() override;
dchengc2282aa2014-10-21 12:07:58358 void ExecuteCustomContextMenuCommand(
359 int action,
360 const CustomContextMenuContext& context) override;
361 gfx::NativeView GetNativeView() override;
362 gfx::NativeView GetContentNativeView() override;
363 gfx::NativeWindow GetTopLevelNativeWindow() override;
364 gfx::Rect GetContainerBounds() override;
365 gfx::Rect GetViewBounds() override;
366 DropData* GetDropData() override;
367 void Focus() override;
368 void SetInitialFocus() override;
369 void StoreFocus() override;
370 void RestoreFocus() override;
371 void FocusThroughTabTraversal(bool reverse) override;
372 bool ShowingInterstitialPage() const override;
373 InterstitialPage* GetInterstitialPage() const override;
374 bool IsSavable() override;
375 void OnSavePage() override;
376 bool SavePage(const base::FilePath& main_file,
377 const base::FilePath& dir_path,
378 SavePageType save_type) override;
379 void SaveFrame(const GURL& url, const Referrer& referrer) override;
kundaji6c7f9692015-03-09 18:00:37380 void SaveFrameWithHeaders(const GURL& url,
381 const Referrer& referrer,
382 const std::string& headers) override;
dewittj6dc5747a2016-05-17 01:48:47383 void GenerateMHTML(const MHTMLGenerationParams& params,
avib7348942015-12-25 20:57:10384 const base::Callback<void(int64_t)>& callback) override;
dchengc2282aa2014-10-21 12:07:58385 const std::string& GetContentsMimeType() const override;
386 bool WillNotifyDisconnection() const override;
dchengc2282aa2014-10-21 12:07:58387 RendererPreferences* GetMutableRendererPrefs() override;
388 void Close() override;
389 void SystemDragEnded() override;
390 void UserGestureDone() override;
391 void SetClosedByUserGesture(bool value) override;
392 bool GetClosedByUserGesture() const override;
393 void ViewSource() override;
394 void ViewFrameSource(const GURL& url, const PageState& page_state) override;
395 int GetMinimumZoomPercent() const override;
396 int GetMaximumZoomPercent() const override;
mcnee432e47d2015-11-09 19:37:46397 void SetPageScale(float page_scale_factor) override;
dchengc2282aa2014-10-21 12:07:58398 gfx::Size GetPreferredSize() const override;
399 bool GotResponseToLockMouseRequest(bool allowed) override;
400 bool HasOpener() const override;
alexmose201c7cd2015-06-10 17:14:21401 WebContentsImpl* GetOpener() const override;
dchengc2282aa2014-10-21 12:07:58402 void DidChooseColorInColorChooser(SkColor color) override;
403 void DidEndColorChooser() override;
404 int DownloadImage(const GURL& url,
405 bool is_favicon,
406 uint32_t max_bitmap_size,
pkotwiczfd773552015-03-16 00:29:14407 bool bypass_cache,
dchengc2282aa2014-10-21 12:07:58408 const ImageDownloadCallback& callback) override;
409 bool IsSubframe() const override;
410 void Find(int request_id,
411 const base::string16& search_text,
412 const blink::WebFindOptions& options) override;
413 void StopFinding(StopFindAction action) override;
dchengc2282aa2014-10-21 12:07:58414 bool WasRecentlyAudible() override;
dominickn6919ce32015-10-15 01:52:28415 void GetManifest(const GetManifestCallback& callback) override;
bokanece34a82016-01-28 19:49:46416 void ExitFullscreen(bool will_cause_resize) override;
mariakhomenko44bdc4732015-04-29 01:55:38417 void ResumeLoadingCreatedWebContents() override;
estark703f1b42016-10-10 21:37:15418 void OnPasswordInputShownOnHttp() override;
estarkfae6b5872016-11-04 05:20:31419 void OnAllPasswordInputsHiddenOnHttp() override;
estark703f1b42016-10-10 21:37:15420 void OnCreditCardInputShownOnHttp() override;
qinmin72e8bd02016-10-21 19:35:37421 void SetIsOverlayContent(bool is_overlay_content) override;
mfomitchev2b8b066a2016-01-28 19:23:15422
mlamouri918734092016-03-12 04:47:52423#if defined(OS_ANDROID)
dcheng48d97c52015-02-04 20:03:20424 base::android::ScopedJavaLocalRef<jobject> GetJavaWebContents() override;
[email protected]0e813a52014-08-13 10:34:56425 virtual WebContentsAndroid* GetWebContentsAndroid();
paulmeyerc0b762b2016-04-13 11:55:17426 void ActivateNearestFindResult(float x, float y) override;
427 void RequestFindMatchRects(int current_version) override;
rockot400ea35b2016-10-15 19:15:32428 service_manager::InterfaceProvider* GetJavaInterfaces() override;
[email protected]fc2b46b2014-05-03 16:33:45429#elif defined(OS_MACOSX)
dchengc2282aa2014-10-21 12:07:58430 void SetAllowOtherViews(bool allow) override;
431 bool GetAllowOtherViews() override;
[email protected]155c7f22013-12-09 17:07:18432#endif
[email protected]0bfbf882011-12-22 18:19:27433
[email protected]0bfbf882011-12-22 18:19:27434 // Implementation of PageNavigator.
dchengc2282aa2014-10-21 12:07:58435 WebContents* OpenURL(const OpenURLParams& params) override;
[email protected]151a63d2011-12-20 22:32:52436
[email protected]6b618e62012-08-16 12:59:18437 // Implementation of IPC::Sender.
dchengc2282aa2014-10-21 12:07:58438 bool Send(IPC::Message* message) override;
[email protected]6b618e62012-08-16 12:59:18439
[email protected]92404c62013-12-04 16:40:46440 // RenderFrameHostDelegate ---------------------------------------------------
dchengc2282aa2014-10-21 12:07:58441 bool OnMessageReceived(RenderFrameHost* render_frame_host,
442 const IPC::Message& message) override;
rockotf62002a2016-09-15 00:08:59443 void OnAssociatedInterfaceRequest(
444 RenderFrameHost* render_frame_host,
445 const std::string& interface_name,
446 mojo::ScopedInterfaceEndpointHandle handle) override;
dchengc2282aa2014-10-21 12:07:58447 const GURL& GetMainFrameLastCommittedURL() const override;
448 void RenderFrameCreated(RenderFrameHost* render_frame_host) override;
449 void RenderFrameDeleted(RenderFrameHost* render_frame_host) override;
dchengc2282aa2014-10-21 12:07:58450 void ShowContextMenu(RenderFrameHost* render_frame_host,
451 const ContextMenuParams& params) override;
452 void RunJavaScriptMessage(RenderFrameHost* render_frame_host,
453 const base::string16& message,
454 const base::string16& default_prompt,
455 const GURL& frame_url,
456 JavaScriptMessageType type,
457 IPC::Message* reply_msg) override;
458 void RunBeforeUnloadConfirm(RenderFrameHost* render_frame_host,
dchengc2282aa2014-10-21 12:07:58459 bool is_reload,
460 IPC::Message* reply_msg) override;
naskoada75b22016-06-11 16:09:46461 void RunFileChooser(RenderFrameHost* render_frame_host,
462 const FileChooserParams& params) override;
dchengc2282aa2014-10-21 12:07:58463 void DidAccessInitialDocument() override;
alexmosbe2f4c32015-03-10 02:30:23464 void DidChangeName(RenderFrameHost* render_frame_host,
465 const std::string& name) override;
dchengc2282aa2014-10-21 12:07:58466 void DocumentOnLoadCompleted(RenderFrameHost* render_frame_host) override;
creis8eb8ef22015-11-04 22:51:38467 void UpdateStateForFrame(RenderFrameHost* render_frame_host,
468 const PageState& page_state) override;
dchengc2282aa2014-10-21 12:07:58469 void UpdateTitle(RenderFrameHost* render_frame_host,
dchengc2282aa2014-10-21 12:07:58470 const base::string16& title,
471 base::i18n::TextDirection title_direction) override;
472 void UpdateEncoding(RenderFrameHost* render_frame_host,
473 const std::string& encoding) override;
474 WebContents* GetAsWebContents() override;
475 bool IsNeverVisible() override;
476 AccessibilityMode GetAccessibilityMode() const override;
477 void AccessibilityEventReceived(
anand.ratn120b0b002014-10-07 15:49:32478 const std::vector<AXEventNotificationDetails>& details) override;
dmazzoni2400c462016-08-23 15:07:13479 void AccessibilityLocationChangesReceived(
480 const std::vector<AXLocationChangeNotificationDetails>& details) override;
dchengc2282aa2014-10-21 12:07:58481 RenderFrameHost* GetGuestByInstanceID(
fsamuel833ee7c2015-02-13 23:40:40482 RenderFrameHost* render_frame_host,
dchengc2282aa2014-10-21 12:07:58483 int browser_plugin_instance_id) override;
mcasas4e216e72016-07-28 21:28:38484 device::GeolocationServiceContext* GetGeolocationServiceContext() override;
blundelld46e8832016-10-07 10:34:27485 device::WakeLockServiceContext* GetWakeLockServiceContext() override;
mlamouri7a78d6fd2015-01-17 13:23:53486 void EnterFullscreenMode(const GURL& origin) override;
bokanece34a82016-01-28 19:49:46487 void ExitFullscreenMode(bool will_cause_resize) override;
alexmose7da5a12015-04-09 02:22:16488 bool ShouldRouteMessageEvent(
489 RenderFrameHost* target_rfh,
490 SiteInstance* source_site_instance) const override;
alexmos58729042015-06-18 23:20:00491 void EnsureOpenerProxiesExist(RenderFrameHost* source_rfh) override;
dcheng59716272016-04-09 05:19:08492 std::unique_ptr<WebUIImpl> CreateWebUIForRenderFrameHost(
493 const GURL& url) override;
avallee0206f782016-07-28 18:55:33494 void SetFocusedFrame(FrameTreeNode* node, SiteInstance* source) override;
[email protected]952a68e2011-11-17 00:36:10495
[email protected]92404c62013-12-04 16:40:46496 // RenderViewHostDelegate ----------------------------------------------------
dchengc2282aa2014-10-21 12:07:58497 RenderViewHostDelegateView* GetDelegateView() override;
498 bool OnMessageReceived(RenderViewHost* render_view_host,
499 const IPC::Message& message) override;
[email protected]a86c0e962013-12-17 17:10:39500 // RenderFrameHostDelegate has the same method, so list it there because this
501 // interface is going away.
nick51208922015-04-24 21:38:37502 // WebContents* GetAsWebContents() override;
dchengc2282aa2014-10-21 12:07:58503 void RenderViewCreated(RenderViewHost* render_view_host) override;
504 void RenderViewReady(RenderViewHost* render_view_host) override;
505 void RenderViewTerminated(RenderViewHost* render_view_host,
506 base::TerminationStatus status,
507 int error_code) override;
508 void RenderViewDeleted(RenderViewHost* render_view_host) override;
509 void UpdateState(RenderViewHost* render_view_host,
dchengc2282aa2014-10-21 12:07:58510 const PageState& page_state) override;
sky8b00392d2015-01-10 00:30:28511 void UpdateTargetURL(RenderViewHost* render_view_host,
512 const GURL& url) override;
dchengc2282aa2014-10-21 12:07:58513 void Close(RenderViewHost* render_view_host) override;
514 void RequestMove(const gfx::Rect& new_bounds) override;
515 void DidCancelLoading() override;
516 void DocumentAvailableInMainFrame(RenderViewHost* render_view_host) override;
517 void RouteCloseEvent(RenderViewHost* rvh) override;
avia90ae4e2016-11-11 20:49:33518 bool DidAddMessageToConsole(int32_t level,
519 const base::string16& message,
520 int32_t line_no,
521 const base::string16& source_id) override;
dchengc2282aa2014-10-21 12:07:58522 RendererPreferences GetRendererPrefs(
anand.ratn120b0b002014-10-07 15:49:32523 BrowserContext* browser_context) const override;
dominickn9c7ceaa32016-02-27 01:52:53524 void OnUserInteraction(RenderWidgetHostImpl* render_widget_host,
525 const blink::WebInputEvent::Type type) override;
dchengc2282aa2014-10-21 12:07:58526 void OnIgnoredUIEvent() override;
dchengc2282aa2014-10-21 12:07:58527 void Activate() override;
dchengc2282aa2014-10-21 12:07:58528 void UpdatePreferredSize(const gfx::Size& pref_size) override;
dchengc2282aa2014-10-21 12:07:58529 void CreateNewWindow(
alexmos4cf2aa32015-07-15 23:40:43530 SiteInstance* source_site_instance,
dcheng3ce04b62015-10-26 23:30:55531 int32_t route_id,
532 int32_t main_frame_route_id,
533 int32_t main_frame_widget_route_id,
rockot5c478a72016-09-28 23:14:18534 const mojom::CreateNewWindowParams& params,
anand.ratn120b0b002014-10-07 15:49:32535 SessionStorageNamespace* session_storage_namespace) override;
avib7348942015-12-25 20:57:10536 void CreateNewWidget(int32_t render_process_id,
537 int32_t route_id,
dchengc2282aa2014-10-21 12:07:58538 blink::WebPopupType popup_type) override;
avib7348942015-12-25 20:57:10539 void CreateNewFullscreenWidget(int32_t render_process_id,
540 int32_t route_id) override;
alexmosc2a8cec2016-05-23 22:19:53541 void ShowCreatedWindow(int process_id,
542 int route_id,
dchengc2282aa2014-10-21 12:07:58543 WindowOpenDisposition disposition,
bokan107a47f2015-02-03 23:23:39544 const gfx::Rect& initial_rect,
dchengc2282aa2014-10-21 12:07:58545 bool user_gesture) override;
alexmosc2a8cec2016-05-23 22:19:53546 void ShowCreatedWidget(int process_id,
547 int route_id,
548 const gfx::Rect& initial_rect) override;
549 void ShowCreatedFullscreenWidget(int process_id, int route_id) override;
dchengc2282aa2014-10-21 12:07:58550 void RequestMediaAccessPermission(
[email protected]33662e52013-01-07 21:31:09551 const MediaStreamRequest& request,
anand.ratn120b0b002014-10-07 15:49:32552 const MediaResponseCallback& callback) override;
dchengc2282aa2014-10-21 12:07:58553 bool CheckMediaAccessPermission(const GURL& security_origin,
554 MediaStreamType type) override;
555 SessionStorageNamespace* GetSessionStorageNamespace(
anand.ratn120b0b002014-10-07 15:49:32556 SiteInstance* instance) override;
dchengc2282aa2014-10-21 12:07:58557 SessionStorageNamespaceMap GetSessionStorageNamespaceMap() override;
avi85ee8362016-10-08 02:09:08558 double GetPendingPageZoomLevel() override;
dchengc2282aa2014-10-21 12:07:58559 FrameTree* GetFrameTree() override;
lukendc35e7f2014-11-10 19:06:14560 void SetIsVirtualKeyboardRequested(bool requested) override;
561 bool IsVirtualKeyboardRequested() override;
aelias5252baa2016-04-10 01:18:02562 bool IsOverridingUserAgent() override;
avi85ee8362016-10-08 02:09:08563 bool IsJavaScriptDialogShowing() const override;
qinmin72e8bd02016-10-21 19:35:37564 bool HideDownloadUI() const override;
lukendc35e7f2014-11-10 19:06:14565
[email protected]52913802013-12-10 05:52:18566 // NavigatorDelegate ---------------------------------------------------------
567
clamy0e119882015-07-31 16:12:33568 void DidStartNavigation(NavigationHandle* navigation_handle) override;
569 void DidRedirectNavigation(NavigationHandle* navigation_handle) override;
clamyefca29e2015-09-17 00:22:11570 void ReadyToCommitNavigation(NavigationHandle* navigation_handle) override;
clamy0e119882015-07-31 16:12:33571 void DidFinishNavigation(NavigationHandle* navigation_handle) override;
dchengc2282aa2014-10-21 12:07:58572 void DidStartProvisionalLoad(RenderFrameHostImpl* render_frame_host,
573 const GURL& validated_url,
574 bool is_error_page,
575 bool is_iframe_srcdoc) override;
lazyboy552a9382016-07-14 20:38:37576 void DidFailProvisionalLoadWithError(RenderFrameHostImpl* render_frame_host,
577 const GURL& validated_url,
578 int error_code,
579 const base::string16& error_description,
580 bool was_ignored_by_handler) override;
dchengc2282aa2014-10-21 12:07:58581 void DidFailLoadWithError(RenderFrameHostImpl* render_frame_host,
582 const GURL& url,
583 int error_code,
gsennton6fbb38692015-06-24 19:23:55584 const base::string16& error_description,
585 bool was_ignored_by_handler) override;
dchengc2282aa2014-10-21 12:07:58586 void DidCommitProvisionalLoad(RenderFrameHostImpl* render_frame_host,
587 const GURL& url,
588 ui::PageTransition transition_type) override;
589 void DidNavigateMainFramePreCommit(bool navigation_is_within_page) override;
590 void DidNavigateMainFramePostCommit(
sky8b00392d2015-01-10 00:30:28591 RenderFrameHostImpl* render_frame_host,
[email protected]37567b432014-02-12 01:12:22592 const LoadCommittedDetails& details,
anand.ratn120b0b002014-10-07 15:49:32593 const FrameHostMsg_DidCommitProvisionalLoad_Params& params) override;
dchengc2282aa2014-10-21 12:07:58594 void DidNavigateAnyFramePostCommit(
[email protected]37567b432014-02-12 01:12:22595 RenderFrameHostImpl* render_frame_host,
596 const LoadCommittedDetails& details,
anand.ratn120b0b002014-10-07 15:49:32597 const FrameHostMsg_DidCommitProvisionalLoad_Params& params) override;
dchengc2282aa2014-10-21 12:07:58598 void SetMainFrameMimeType(const std::string& mime_type) override;
599 bool CanOverscrollContent() const override;
600 void NotifyChangedNavigationState(InvalidateTypes changed_flags) override;
toyoshim0df1d3a2016-09-09 09:52:48601 void DidStartNavigationToPendingEntry(const GURL& url,
602 ReloadType reload_type) override;
dchengc2282aa2014-10-21 12:07:58603 void RequestOpenURL(RenderFrameHostImpl* render_frame_host,
604 const OpenURLParams& params) override;
lukasza1d025732016-09-28 21:36:08605 bool ShouldTransferNavigation(bool is_main_frame_navigation) override;
dchengc2282aa2014-10-21 12:07:58606 bool ShouldPreserveAbortedURLs() override;
fdegansa696e5112015-04-17 01:57:59607 void DidStartLoading(FrameTreeNode* frame_tree_node,
608 bool to_different_document) override;
609 void DidStopLoading() override;
610 void DidChangeLoadProgress() override;
clamycbf524d42016-09-27 12:48:35611 ScopedVector<NavigationThrottle> CreateThrottlesForNavigation(
612 NavigationHandle* navigation_handle) override;
clamy1e5574e2016-09-29 16:48:44613 std::unique_ptr<NavigationUIData> GetNavigationUIData(
614 NavigationHandle* navigation_handle) override;
[email protected]52913802013-12-10 05:52:18615
[email protected]4ca76c02012-05-16 16:19:05616 // RenderWidgetHostDelegate --------------------------------------------------
617
lazyboy63f5b312015-11-23 20:19:52618 void RenderWidgetCreated(RenderWidgetHostImpl* render_widget_host) override;
dchengc2282aa2014-10-21 12:07:58619 void RenderWidgetDeleted(RenderWidgetHostImpl* render_widget_host) override;
miu9e14e492014-10-25 02:39:04620 void RenderWidgetGotFocus(RenderWidgetHostImpl* render_widget_host) override;
rouslan2f5993f2015-01-29 00:18:31621 void RenderWidgetWasResized(RenderWidgetHostImpl* render_widget_host,
622 bool width_changed) override;
avic3aa8422015-11-09 20:57:22623 void ResizeDueToAutoResize(RenderWidgetHostImpl* render_widget_host,
624 const gfx::Size& new_size) override;
paulmeyer9ef6e4462015-02-24 19:15:10625 void ScreenInfoChanged() override;
wjmaclean8a795f32016-08-11 23:49:58626 void UpdateDeviceScaleFactor(double device_scale_factor) override;
ccameron2f451532016-09-07 21:49:27627 void GetScreenInfo(ScreenInfo* screen_info) override;
dchengc2282aa2014-10-21 12:07:58628 bool PreHandleKeyboardEvent(const NativeWebKeyboardEvent& event,
629 bool* is_keyboard_shortcut) override;
630 void HandleKeyboardEvent(const NativeWebKeyboardEvent& event) override;
631 bool HandleWheelEvent(const blink::WebMouseWheelEvent& event) override;
632 bool PreHandleGestureEvent(const blink::WebGestureEvent& event) override;
dchengc2282aa2014-10-21 12:07:58633 BrowserAccessibilityManager* GetRootBrowserAccessibilityManager() override;
634 BrowserAccessibilityManager* GetOrCreateRootBrowserAccessibilityManager()
anand.ratn120b0b002014-10-07 15:49:32635 override;
lgarron145aaa82015-07-10 07:39:56636 // The following 4 functions are already listed under WebContents overrides:
mohsen7ab1ec16ec2015-07-02 18:26:23637 // void Cut() override;
638 // void Copy() override;
639 // void Paste() override;
lgarron145aaa82015-07-10 07:39:56640 // void SelectAll() override;
mohsen7ab1ec16ec2015-07-02 18:26:23641 void MoveRangeSelectionExtent(const gfx::Point& extent) override;
642 void SelectRange(const gfx::Point& base, const gfx::Point& extent) override;
aurimasab0319022015-07-10 21:57:38643 void AdjustSelectionByCharacterOffset(int start_adjust, int end_adjust)
644 override;
kenrb2a565f82015-09-02 20:24:59645 RenderWidgetHostInputEventRouter* GetInputEventRouter() override;
alexmos3fcd0ca2015-10-23 18:18:33646 void ReplicatePageFocus(bool is_focused) override;
alexmosc4cbacb2015-11-21 01:29:22647 RenderWidgetHostImpl* GetFocusedRenderWidgetHost(
648 RenderWidgetHostImpl* receiving_widget) override;
dtapuskae99ec6e52016-10-18 00:15:42649 void RendererUnresponsive(RenderWidgetHostImpl* render_widget_host,
650 RendererUnresponsiveType type) override;
avic3aa8422015-11-09 20:57:22651 void RendererResponsive(RenderWidgetHostImpl* render_widget_host) override;
652 void RequestToLockMouse(RenderWidgetHostImpl* render_widget_host,
653 bool user_gesture,
lfgad8244352016-07-13 16:55:51654 bool last_unlocked_by_target,
655 bool privileged) override;
alexmos5dd617d2016-06-07 04:21:15656 bool IsFullscreenForCurrentTab() const override;
avibf58fa0c2015-11-11 01:45:52657 blink::WebDisplayMode GetDisplayMode(
658 RenderWidgetHostImpl* render_widget_host) const override;
avi3e4b8512015-11-11 01:55:49659 void LostCapture(RenderWidgetHostImpl* render_widget_host) override;
660 void LostMouseLock(RenderWidgetHostImpl* render_widget_host) override;
lfgad8244352016-07-13 16:55:51661 bool HasMouseLock(RenderWidgetHostImpl* render_widget_host) override;
dtrainor5ef644e2015-11-19 00:12:47662 void ForwardCompositorProto(RenderWidgetHostImpl* render_widget_host,
663 const std::vector<uint8_t>& proto) override;
ekaramada4f42692016-02-11 19:48:37664 void OnRenderFrameProxyVisibilityChanged(bool visible) override;
lfgbb9c28a2016-03-01 03:19:49665 void SendScreenRects() override;
khushalsagarf3b62b62016-05-26 21:54:23666 void OnFirstPaintAfterLoad(RenderWidgetHostImpl* render_widget_host) override;
ekaramadadd882292016-06-08 15:22:56667 TextInputManager* GetTextInputManager() override;
paulmeyer7f6f1d4f2016-11-15 00:00:27668 bool OnUpdateDragCursor() override;
[email protected]4ca76c02012-05-16 16:19:05669
[email protected]b0936d22013-11-28 06:47:36670 // RenderFrameHostManager::Delegate ------------------------------------------
[email protected]0bfbf882011-12-22 18:19:27671
dchengc2282aa2014-10-21 12:07:58672 bool CreateRenderViewForRenderManager(
[email protected]bffc8302014-01-23 20:52:16673 RenderViewHost* render_view_host,
alexmos5ac402d2015-07-09 07:51:10674 int opener_frame_routing_id,
[email protected]5a7100d2014-05-19 01:29:04675 int proxy_routing_id,
lfgbede6392015-09-11 21:54:06676 const FrameReplicationState& replicated_frame_state) override;
677 void CreateRenderWidgetHostViewForRenderManager(
678 RenderViewHost* render_view_host) override;
alexmosa181efc2015-09-03 00:39:04679 bool CreateRenderFrameForRenderManager(
680 RenderFrameHost* render_frame_host,
681 int proxy_routing_id,
682 int opener_routing_id,
683 int parent_routing_id,
684 int previous_sibling_routing_id) override;
dchengc2282aa2014-10-21 12:07:58685 void BeforeUnloadFiredFromRenderManager(
686 bool proceed,
687 const base::TimeTicks& proceed_time,
anand.ratn120b0b002014-10-07 15:49:32688 bool* proceed_to_fire_unload) override;
dchengc2282aa2014-10-21 12:07:58689 void RenderProcessGoneFromRenderManager(
anand.ratn120b0b002014-10-07 15:49:32690 RenderViewHost* render_view_host) override;
dchengc2282aa2014-10-21 12:07:58691 void UpdateRenderViewSizeForRenderManager() override;
692 void CancelModalDialogsForRenderManager() override;
693 void NotifySwappedFromRenderManager(RenderFrameHost* old_host,
694 RenderFrameHost* new_host,
695 bool is_main_frame) override;
naskof5940b9f2015-03-02 23:04:05696 void NotifyMainFrameSwappedFromRenderManager(
697 RenderViewHost* old_host,
698 RenderViewHost* new_host) override;
dchengc2282aa2014-10-21 12:07:58699 NavigationControllerImpl& GetControllerForRenderManager() override;
dchengc2282aa2014-10-21 12:07:58700 NavigationEntry* GetLastCommittedNavigationEntryForRenderManager() override;
701 bool FocusLocationBarByDefault() override;
702 void SetFocusToLocationBar(bool select_all) override;
703 bool IsHidden() override;
rob97250742015-12-10 17:45:15704 int GetOuterDelegateFrameTreeNodeId() override;
ekaramadaeb3c5c2016-11-09 03:22:35705 RenderWidgetHostImpl* GetFullscreenRenderWidgetHost() const override;
[email protected]0bfbf882011-12-22 18:19:27706
[email protected]8ff00d72012-10-23 19:12:21707 // NotificationObserver ------------------------------------------------------
[email protected]14392a52012-05-02 20:28:44708
dchengc2282aa2014-10-21 12:07:58709 void Observe(int type,
710 const NotificationSource& source,
711 const NotificationDetails& details) override;
[email protected]14392a52012-05-02 20:28:44712
[email protected]ec6c05f2013-10-23 18:41:57713 // NavigationControllerDelegate ----------------------------------------------
714
dchengc2282aa2014-10-21 12:07:58715 WebContents* GetWebContents() override;
716 void NotifyNavigationEntryCommitted(
anand.ratn120b0b002014-10-07 15:49:32717 const LoadCommittedDetails& load_details) override;
[email protected]ec6c05f2013-10-23 18:41:57718
719 // Invoked before a form repost warning is shown.
dchengc2282aa2014-10-21 12:07:58720 void NotifyBeforeFormRepostWarningShow() override;
[email protected]ec6c05f2013-10-23 18:41:57721
722 // Activate this WebContents and show a form repost warning.
dchengc2282aa2014-10-21 12:07:58723 void ActivateAndShowRepostFormWarningDialog() override;
[email protected]ec6c05f2013-10-23 18:41:57724
[email protected]b4c84012014-04-28 19:51:10725 // Whether the initial empty page of this view has been accessed by another
726 // page, making it unsafe to show the pending URL. Always false after the
727 // first commit.
dchengc2282aa2014-10-21 12:07:58728 bool HasAccessedInitialDocument() override;
[email protected]b4c84012014-04-28 19:51:10729
avi2b177592014-12-10 02:08:02730 // Sets the history for this WebContentsImpl to |history_length| entries, with
alexmos136fd6e62016-08-15 20:58:41731 // an offset of |history_offset|. This notifies all renderers involved in
732 // rendering the current page about the new offset and length.
avi2b177592014-12-10 02:08:02733 void SetHistoryOffsetAndLength(int history_offset,
734 int history_length) override;
[email protected]553602e12011-04-05 17:01:18735
[email protected]a86c0e962013-12-17 17:10:39736 // Called by InterstitialPageImpl when it creates a RenderFrameHost.
dchengc2282aa2014-10-21 12:07:58737 void RenderFrameForInterstitialPageCreated(
anand.ratn120b0b002014-10-07 15:49:32738 RenderFrameHost* render_frame_host) override;
[email protected]561628ce2013-10-25 00:56:47739
740 // Sets the passed interstitial as the currently showing interstitial.
741 // No interstitial page should already be attached.
dchengc2282aa2014-10-21 12:07:58742 void AttachInterstitialPage(InterstitialPageImpl* interstitial_page) override;
[email protected]561628ce2013-10-25 00:56:47743
744 // Unsets the currently showing interstitial.
dchengc2282aa2014-10-21 12:07:58745 void DetachInterstitialPage() override;
[email protected]561628ce2013-10-25 00:56:47746
aelias5252baa2016-04-10 01:18:02747 void UpdateOverridingUserAgent() override;
748
clamy44e84ce2016-02-22 15:38:25749 // Unpause the throbber if it was paused.
750 void DidProceedOnInterstitial() override;
[email protected]561628ce2013-10-25 00:56:47751
[email protected]e4abd3b42013-11-12 18:28:47752 typedef base::Callback<void(WebContents*)> CreatedCallback;
[email protected]561628ce2013-10-25 00:56:47753
[email protected]34ff1cfc2014-08-20 06:16:05754 // Forces overscroll to be disabled (used by touch emulation).
755 void SetForceDisableOverscrollContent(bool force_disable);
756
avayvodcc85bbd2015-08-28 19:11:15757 AudioStreamMonitor* audio_stream_monitor() {
758 return &audio_stream_monitor_;
dalecurtisbc6572e12014-09-12 19:22:30759 }
760
dalecurtis88c240072015-12-09 02:11:18761 // Called by MediaWebContentsObserver when playback starts or stops. See the
762 // WebContentsObserver function stubs for more details.
billorr21c005d2016-11-17 03:57:04763 void MediaStartedPlaying(
764 const WebContentsObserver::MediaPlayerInfo& media_info,
765 const WebContentsObserver::MediaPlayerId& id);
766 void MediaStoppedPlaying(
767 const WebContentsObserver::MediaPlayerInfo& media_info,
768 const WebContentsObserver::MediaPlayerId& id);
769 int GetCurrentlyPlayingVideoCount() override;
770
771 bool IsFullscreen() override;
dalecurtisbc6572e12014-09-12 19:22:30772
qinmin58567c82015-01-07 21:00:20773 MediaWebContentsObserver* media_web_contents_observer() {
774 return media_web_contents_observer_.get();
775 }
qinmin58567c82015-01-07 21:00:20776
tapted65ff2ea72016-03-01 23:39:00777 // Update the web contents visibility.
778 void UpdateWebContentsVisibility(bool visible);
779
paulmeyerc0b762b2016-04-13 11:55:17780 // Called by FindRequestManager when find replies come in from a renderer
781 // process.
782 void NotifyFindReply(int request_id,
783 int number_of_matches,
784 const gfx::Rect& selection_rect,
785 int active_match_ordinal,
786 bool final_update);
787
ortuno467e5792016-06-10 04:32:39788 // Modify the counter of connected devices for this WebContents.
789 void IncrementBluetoothConnectedDeviceCount();
790 void DecrementBluetoothConnectedDeviceCount();
791
paulmeyerc0b762b2016-04-13 11:55:17792#if defined(OS_ANDROID)
793 // Called by FindRequestManager when all of the find match rects are in.
794 void NotifyFindMatchRectsReply(int version,
795 const std::vector<gfx::RectF>& rects,
796 const gfx::RectF& active_rect);
797#endif
798
lof84501da082016-05-23 21:22:54799 private:
[email protected]8ff00d72012-10-23 19:12:21800 friend class WebContentsObserver;
801 friend class WebContents; // To implement factory methods.
[email protected]0dd3a0ab2011-02-18 08:17:44802
[email protected]2db9bd72012-04-13 20:20:56803 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, NoJSMessageOnInterstitials);
804 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, UpdateTitle);
[email protected]45a22ad2013-02-21 03:25:00805 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, FindOpenerRVHWhenPending);
[email protected]2db9bd72012-04-13 20:20:56806 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest,
807 CrossSiteCantPreemptAfterUnload);
[email protected]ceee8cd2013-03-08 04:59:51808 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, PendingContents);
[email protected]50904452013-05-09 02:05:12809 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, FrameTreeShape);
[email protected]9a890452014-02-13 22:21:02810 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, GetLastActiveTime);
estarka5635c42015-07-14 00:06:53811 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest,
812 LoadResourceFromMemoryCacheWithBadSecurityInfo);
jwwf4684d12015-09-02 06:12:52813 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest,
jam91dd24e2016-08-12 17:16:42814 LoadResourceWithEmptySecurityInfo);
avid53461d2016-02-25 17:15:04815 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest,
816 ResetJavaScriptDialogOnUserNavigate);
[email protected]0dd3a0ab2011-02-18 08:17:44817 FRIEND_TEST_ALL_PREFIXES(FormStructureBrowserTest, HTMLFiles);
818 FRIEND_TEST_ALL_PREFIXES(NavigationControllerTest, HistoryNavigate);
[email protected]b0936d22013-11-28 06:47:36819 FRIEND_TEST_ALL_PREFIXES(RenderFrameHostManagerTest, PageDoesBackAndReload);
[email protected]de3c5d82014-05-28 22:12:59820 FRIEND_TEST_ALL_PREFIXES(SitePerProcessBrowserTest, CrossSiteIframe);
alexmosc2a8cec2016-05-23 22:19:53821 FRIEND_TEST_ALL_PREFIXES(SitePerProcessBrowserTest,
822 TwoSubframesCreatePopupsSimultaneously);
823 FRIEND_TEST_ALL_PREFIXES(SitePerProcessBrowserTest,
824 TwoSubframesCreatePopupMenuWidgetsSimultaneously);
dmazzoni0b5d2482014-09-10 19:45:57825 FRIEND_TEST_ALL_PREFIXES(SitePerProcessAccessibilityBrowserTest,
826 CrossSiteIframeAccessibility);
avic529387b2016-04-06 16:14:53827 FRIEND_TEST_ALL_PREFIXES(WebContentsImplBrowserTest,
828 JavaScriptDialogsInMainAndSubframes);
[email protected]0dd3a0ab2011-02-18 08:17:44829
paulmeyera41de3b2016-05-05 16:30:18830 // So |find_request_manager_| can be accessed for testing.
831 friend class FindRequestManagerTest;
832
[email protected]80e776ae2012-03-23 16:17:20833 // TODO(brettw) TestWebContents shouldn't exist!
[email protected]8ff00d72012-10-23 19:12:21834 friend class TestWebContents;
[email protected]0dd3a0ab2011-02-18 08:17:44835
[email protected]7fff43e2013-05-21 20:21:10836 class DestructionObserver;
837
lazyboy6ec48b2a2015-06-29 15:18:14838 // Represents a WebContents node in a tree of WebContents structure.
839 //
840 // Two WebContents with separate FrameTrees can be connected by
841 // outer/inner relationship using this class. Note that their FrameTrees
842 // still remain disjoint.
843 // The parent is referred to as "outer WebContents" and the descendents are
844 // referred to as "inner WebContents".
845 // For each inner WebContents, the outer WebContents will have a
846 // corresponding FrameTreeNode.
847 struct WebContentsTreeNode {
848 public:
849 WebContentsTreeNode();
850 ~WebContentsTreeNode();
851
852 typedef std::set<WebContentsTreeNode*> ChildrenSet;
853
854 void ConnectToOuterWebContents(WebContentsImpl* outer_web_contents,
855 RenderFrameHostImpl* outer_contents_frame);
856
857 WebContentsImpl* outer_web_contents() { return outer_web_contents_; }
avallee0206f782016-07-28 18:55:33858 int outer_contents_frame_tree_node_id() const {
lazyboy6ec48b2a2015-06-29 15:18:14859 return outer_contents_frame_tree_node_id_;
860 }
861
avallee0206f782016-07-28 18:55:33862 WebContentsImpl* focused_web_contents() { return focused_web_contents_; }
863 void SetFocusedWebContents(WebContentsImpl* web_contents);
864
lazyboy6ec48b2a2015-06-29 15:18:14865 private:
paulmeyerc0b762b2016-04-13 11:55:17866 // The outer WebContents.
lazyboy6ec48b2a2015-06-29 15:18:14867 WebContentsImpl* outer_web_contents_;
868 // The ID of the FrameTreeNode in outer WebContents that is hosting us.
869 int outer_contents_frame_tree_node_id_;
870 // List of inner WebContents that we host.
871 ChildrenSet inner_web_contents_tree_nodes_;
avallee0206f782016-07-28 18:55:33872 // Only the root node should have this set. This indicates the WebContents
873 // whose frame tree has the focused frame. The WebContents tree could be
874 // arbitrarily deep.
875 WebContentsImpl* focused_web_contents_;
lazyboy6ec48b2a2015-06-29 15:18:14876 };
877
[email protected]d1198fd2012-08-13 22:50:19878 // See WebContents::Create for a description of these parameters.
alexmose201c7cd2015-06-10 17:14:21879 WebContentsImpl(BrowserContext* browser_context);
[email protected]d1198fd2012-08-13 22:50:19880
[email protected]e2225bf2013-11-15 16:09:38881 // Add and remove observers for page navigation notifications. The order in
882 // which notifications are sent to observers is undefined. Clients must be
883 // sure to remove the observer before they go away.
[email protected]8ff00d72012-10-23 19:12:21884 void AddObserver(WebContentsObserver* observer);
885 void RemoveObserver(WebContentsObserver* observer);
[email protected]d1198fd2012-08-13 22:50:19886
alexmose201c7cd2015-06-10 17:14:21887 // Clears a pending contents that has been closed before being shown.
[email protected]7fff43e2013-05-21 20:21:10888 void OnWebContentsDestroyed(WebContentsImpl* web_contents);
889
890 // Creates and adds to the map a destruction observer watching |web_contents|.
891 // No-op if such an observer already exists.
892 void AddDestructionObserver(WebContentsImpl* web_contents);
893
894 // Deletes and removes from the map a destruction observer
895 // watching |web_contents|. No-op if there is no such observer.
896 void RemoveDestructionObserver(WebContentsImpl* web_contents);
[email protected]14392a52012-05-02 20:28:44897
[email protected]de3c5d82014-05-28 22:12:59898 // Traverses all the RenderFrameHosts in the FrameTree and creates a set
[email protected]948481d2014-06-11 18:32:22899 // all the unique RenderWidgetHostViews.
900 std::set<RenderWidgetHostView*> GetRenderWidgetHostViewsInTree();
[email protected]de3c5d82014-05-28 22:12:59901
pkotwicz75ca8ffd2016-02-16 23:10:19902 // Called with the result of a DownloadImage() request.
903 void OnDidDownloadImage(const ImageDownloadCallback& callback,
904 int id,
905 const GURL& image_url,
leon.hancbc4bc3c2016-02-26 07:08:52906 int32_t http_status_code,
leon.hanc2228532016-08-16 05:59:18907 const std::vector<SkBitmap>& images,
908 const std::vector<gfx::Size>& original_image_sizes);
pkotwicz75ca8ffd2016-02-16 23:10:19909
[email protected]6fba26d2014-04-29 09:38:28910 // Callback function when showing JavaScript dialogs. Takes in a routing ID
911 // pair to identify the RenderFrameHost that opened the dialog, because it's
912 // possible for the RenderFrameHost to be deleted by the time this is called.
913 void OnDialogClosed(int render_process_id,
914 int render_frame_id,
[email protected]51da7e32012-01-30 19:24:52915 IPC::Message* reply_msg,
[email protected]87de04b02014-04-08 22:14:49916 bool dialog_was_suppressed,
[email protected]51da7e32012-01-30 19:24:52917 bool success,
[email protected]fcf75d42013-12-03 20:11:26918 const base::string16& user_input);
[email protected]51da7e32012-01-30 19:24:52919
[email protected]f114fa42013-12-06 17:06:44920 bool OnMessageReceived(RenderViewHost* render_view_host,
921 RenderFrameHost* render_frame_host,
922 const IPC::Message& message);
923
nasko907fcb62015-01-28 04:24:11924 // Checks whether render_frame_message_source_ is set to non-null value,
925 // otherwise it terminates the main frame renderer process.
926 bool HasValidFrameSource();
927
[email protected]d0759f492012-04-19 22:50:50928 // IPC message handlers.
[email protected]37b64c52014-07-11 21:14:05929 void OnThemeColorChanged(SkColor theme_color);
[email protected]0dd3a0ab2011-02-18 08:17:44930 void OnDidLoadResourceFromMemoryCache(const GURL& url,
[email protected]70435962011-08-02 20:13:28931 const std::string& http_request,
[email protected]6d6cfb3a2012-05-23 22:53:18932 const std::string& mime_type,
[email protected]6c1e05212014-07-31 00:59:40933 ResourceType resource_type);
[email protected]0dd3a0ab2011-02-18 08:17:44934 void OnDidDisplayInsecureContent();
estark910b4572015-12-09 20:55:41935 void OnDidRunInsecureContent(const GURL& security_origin,
[email protected]0dd3a0ab2011-02-18 08:17:44936 const GURL& target_url);
jama385e112016-07-22 00:07:58937 void OnDidDisplayContentWithCertificateErrors(const GURL& url);
938 void OnDidRunContentWithCertificateErrors(const GURL& url);
[email protected]501052ff2014-02-21 22:19:07939 void OnDocumentLoadedInFrame();
[email protected]61ac9e242014-03-21 20:55:26940 void OnDidFinishLoad(const GURL& url);
[email protected]0dd3a0ab2011-02-18 08:17:44941 void OnGoToEntryAtOffset(int offset);
[email protected]216813952011-05-19 22:21:26942 void OnUpdateZoomLimits(int minimum_percent,
[email protected]fce823222014-05-30 16:24:30943 int maximum_percent);
mcnee432e47d2015-11-09 19:37:46944 void OnPageScaleFactorChanged(float page_scale_factor);
[email protected]2dec8ec2013-02-07 19:20:34945 void OnEnumerateDirectory(int request_id, const base::FilePath& path);
[email protected]b7a756d42012-01-23 18:08:17946
[email protected]7d189022011-08-25 22:54:20947 void OnRegisterProtocolHandler(const std::string& protocol,
948 const GURL& url,
[email protected]fcf75d42013-12-03 20:11:26949 const base::string16& title,
[email protected]3a3b75a2012-06-01 08:38:36950 bool user_gesture);
[email protected]f5273e52014-07-14 16:30:20951 void OnUnregisterProtocolHandler(const std::string& protocol,
952 const GURL& url,
953 bool user_gesture);
[email protected]59363fc92012-09-05 03:46:31954 void OnFindReply(int request_id,
955 int number_of_matches,
956 const gfx::Rect& selection_rect,
957 int active_match_ordinal,
[email protected]b888919c2011-09-02 00:32:16958 bool final_update);
mfomitchev2b8b066a2016-01-28 19:23:15959#if defined(OS_ANDROID)
[email protected]59363fc92012-09-05 03:46:31960 void OnFindMatchRectsReply(int version,
961 const std::vector<gfx::RectF>& rects,
962 const gfx::RectF& active_rect);
paulmeyerc0b762b2016-04-13 11:55:17963 void OnGetNearestFindResultReply(int request_id, float distance);
[email protected]1ff427972013-02-07 21:14:07964 void OnOpenDateTimeDialog(
965 const ViewHostMsg_DateTimeDialogValue_Params& value);
[email protected]59363fc92012-09-05 03:46:31966#endif
avi60bd4902015-09-23 20:39:24967 void OnDomOperationResponse(const std::string& json_string);
[email protected]7fc4bbb2011-09-08 21:23:10968 void OnAppCacheAccessed(const GURL& manifest_url, bool blocked_by_policy);
[email protected]8bc5ff02013-11-29 06:34:03969 void OnOpenColorChooser(int color_chooser_id,
970 SkColor color,
971 const std::vector<ColorSuggestion>& suggestions);
[email protected]da8543762012-03-20 08:52:20972 void OnEndColorChooser(int color_chooser_id);
[email protected]55578b0a2012-04-18 14:31:32973 void OnSetSelectedColorInColorChooser(int color_chooser_id, SkColor color);
[email protected]d0759f492012-04-19 22:50:50974 void OnWebUISend(const GURL& source_url,
975 const std::string& name,
976 const base::ListValue& args);
kouhei40f03cb2015-09-24 07:47:01977 void OnUpdatePageImportanceSignals(const PageImportanceSignals& signals);
tommyclie6633ca72014-10-31 00:40:42978#if defined(ENABLE_PLUGINS)
zqzhang181047e62016-07-01 13:37:17979 void OnPepperInstanceCreated(int32_t pp_instance);
980 void OnPepperInstanceDeleted(int32_t pp_instance);
tommyclie6633ca72014-10-31 00:40:42981 void OnPepperPluginHung(int plugin_child_id,
982 const base::FilePath& path,
983 bool is_hung);
zqzhang181047e62016-07-01 13:37:17984 void OnPepperStartsPlayback(int32_t pp_instance);
985 void OnPepperStopsPlayback(int32_t pp_instance);
tommyclie6633ca72014-10-31 00:40:42986 void OnPluginCrashed(const base::FilePath& plugin_path,
987 base::ProcessId plugin_pid);
[email protected]ea0309c2013-08-06 19:35:44988 void OnRequestPpapiBrokerPermission(int routing_id,
[email protected]d8415ad92012-08-23 14:40:50989 const GURL& url,
[email protected]2dec8ec2013-02-07 19:20:34990 const base::FilePath& plugin_path);
tommyclie6633ca72014-10-31 00:40:42991
992 // Callback function when requesting permission to access the PPAPI broker.
993 // |result| is true if permission was granted.
994 void OnPpapiBrokerPermissionResult(int routing_id, bool result);
995
fsamuel833ee7c2015-02-13 23:40:40996 void OnBrowserPluginMessage(RenderFrameHost* render_frame_host,
997 const IPC::Message& message);
tommyclie6633ca72014-10-31 00:40:42998#endif // defined(ENABLE_PLUGINS)
[email protected]50279492014-05-05 23:24:29999 void OnUpdateFaviconURL(const std::vector<FaviconURL>& candidates);
1000 void OnFirstVisuallyNonEmptyPaint();
[email protected]edc3af82013-12-12 21:24:071001 void OnShowValidationMessage(const gfx::Rect& anchor_in_root_view,
[email protected]6ff9c8f2013-12-20 09:05:291002 const base::string16& main_text,
1003 const base::string16& sub_text);
[email protected]edc3af82013-12-12 21:24:071004 void OnHideValidationMessage();
1005 void OnMoveValidationMessage(const gfx::Rect& anchor_in_root_view);
1006
[email protected]0dd3a0ab2011-02-18 08:17:441007 // Called by derived classes to indicate that we're no longer waiting for a
1008 // response. This won't actually update the throbber, but it will get picked
1009 // up at the next animation step if the throbber is going.
1010 void SetNotWaitingForResponse() { waiting_for_response_ = false; }
1011
avallee0206f782016-07-28 18:55:331012 // Returns the focused WebContents.
1013 // If there are multiple inner/outer WebContents (when embedding <webview>,
1014 // <guestview>, ...) returns the single one containing the currently focused
1015 // frame. Otherwise, returns this WebContents.
1016 WebContentsImpl* GetFocusedWebContents();
1017
1018 // Returns the root of the WebContents tree.
1019 WebContentsImpl* GetOutermostWebContents();
1020
[email protected]0dd3a0ab2011-02-18 08:17:441021 // Navigation helpers --------------------------------------------------------
1022 //
1023 // These functions are helpers for Navigate() and DidNavigate().
1024
1025 // Handles post-navigation tasks in DidNavigate AFTER the entry has been
1026 // committed to the navigation controller. Note that the navigation entry is
1027 // not provided since it may be invalid/changed after being committed. The
1028 // current navigation entry is in the NavigationController at this point.
[email protected]2f7b3c5a2013-06-21 04:59:251029
[email protected]bafe6cd2012-05-23 23:09:501030 // Helper for CreateNewWidget/CreateNewFullscreenWidget.
avib7348942015-12-25 20:57:101031 void CreateNewWidget(int32_t render_process_id,
1032 int32_t route_id,
[email protected]bafe6cd2012-05-23 23:09:501033 bool is_fullscreen,
[email protected]180ef242013-11-07 06:50:461034 blink::WebPopupType popup_type);
[email protected]bafe6cd2012-05-23 23:09:501035
1036 // Helper for ShowCreatedWidget/ShowCreatedFullscreenWidget.
alexmosc2a8cec2016-05-23 22:19:531037 void ShowCreatedWidget(int process_id,
1038 int route_id,
[email protected]bafe6cd2012-05-23 23:09:501039 bool is_fullscreen,
bokan107a47f2015-02-03 23:23:391040 const gfx::Rect& initial_rect);
[email protected]bafe6cd2012-05-23 23:09:501041
1042 // Finds the new RenderWidgetHost and returns it. Note that this can only be
1043 // called once as this call also removes it from the internal map.
alexmosc2a8cec2016-05-23 22:19:531044 RenderWidgetHostView* GetCreatedWidget(int process_id, int route_id);
[email protected]bafe6cd2012-05-23 23:09:501045
1046 // Finds the new WebContentsImpl by route_id, initializes it for
1047 // renderer-initiated creation, and returns it. Note that this can only be
1048 // called once as this call also removes it from the internal map.
alexmosc2a8cec2016-05-23 22:19:531049 WebContentsImpl* GetCreatedWindow(int process_id, int route_id);
[email protected]bafe6cd2012-05-23 23:09:501050
lfgdb5c4ed2016-03-04 23:09:071051 // Sends a Page message IPC.
1052 void SendPageMessage(IPC::Message* msg);
1053
[email protected]960b0372014-05-19 18:01:001054 // Tracking loading progress -------------------------------------------------
1055
fdegansa696e5112015-04-17 01:57:591056 // Resets the tracking state of the current load progress.
[email protected]960b0372014-05-19 18:01:001057 void ResetLoadProgressState();
1058
fdegansa696e5112015-04-17 01:57:591059 // Notifies the delegate that the load progress was updated.
1060 void SendChangeLoadProgress();
[email protected]960b0372014-05-19 18:01:001061
clamy44e84ce2016-02-22 15:38:251062 // Notifies the delegate of a change in loading state.
1063 // |details| is used to provide details on the load that just finished
1064 // (but can be null if not applicable).
1065 // |due_to_interstitial| is true if the change in load state occurred because
1066 // an interstitial page started showing/proceeded.
1067 void LoadingStateChanged(bool to_different_document,
1068 bool due_to_interstitial,
1069 LoadNotificationDetails* details);
1070
[email protected]0dd3a0ab2011-02-18 08:17:441071 // Misc non-view stuff -------------------------------------------------------
1072
avi2b177592014-12-10 02:08:021073 // Sets the history for a specified RenderViewHost to |history_length|
1074 // entries, with an offset of |history_offset|.
1075 void SetHistoryOffsetAndLengthForView(RenderViewHost* render_view_host,
1076 int history_offset,
1077 int history_length);
1078
[email protected]0dd3a0ab2011-02-18 08:17:441079 // Helper functions for sending notifications.
[email protected]02d7b6e2014-06-24 21:01:501080 void NotifyViewSwapped(RenderViewHost* old_host, RenderViewHost* new_host);
1081 void NotifyFrameSwapped(RenderFrameHost* old_host, RenderFrameHost* new_host);
[email protected]0dd3a0ab2011-02-18 08:17:441082 void NotifyDisconnected();
1083
[email protected]be1f56ab2011-12-22 06:55:311084 void SetEncoding(const std::string& encoding);
1085
[email protected]fa944cb82013-11-15 17:51:211086 // TODO(creis): This should take in a FrameTreeNode to know which node's
1087 // render manager to return. For now, we just return the root's.
[email protected]b0936d22013-11-28 06:47:361088 RenderFrameHostManager* GetRenderManager() const;
[email protected]fa944cb82013-11-15 17:51:211089
[email protected]7a846df2012-09-20 19:17:391090 // Removes browser plugin embedder if there is one.
1091 void RemoveBrowserPluginEmbedder();
1092
[email protected]dc0fd432013-08-27 15:29:211093 // Helper function to invoke WebContentsDelegate::GetSizeForNewRenderView().
[email protected]fc2b46b2014-05-03 16:33:451094 gfx::Size GetSizeForNewRenderView();
[email protected]dc0fd432013-08-27 15:29:211095
[email protected]ae7eeda2014-07-04 01:53:261096 void OnFrameRemoved(RenderFrameHost* render_frame_host);
[email protected]9b159a52013-10-03 17:24:551097
[email protected]222f5822014-02-05 23:40:491098 // Helper method that's called whenever |preferred_size_| or
1099 // |preferred_size_for_capture_| changes, to propagate the new value to the
1100 // |delegate_|.
1101 void OnPreferredSizeChanged(const gfx::Size& old_size);
1102
dbeama1b926a2015-08-31 23:17:511103 // Internal helper to create WebUI objects associated with |this|. |url| is
1104 // used to determine which WebUI should be created (if any). |frame_name|
1105 // corresponds to the name of a frame that the WebUI should be created for (or
1106 // the main frame if empty).
avie865b1d2016-10-24 19:42:591107 std::unique_ptr<WebUIImpl> CreateWebUI(const GURL& url,
1108 const std::string& frame_name);
dbeama1b926a2015-08-31 23:17:511109
avid53461d2016-02-25 17:15:041110 void SetJavaScriptDialogManagerForTesting(
1111 JavaScriptDialogManager* dialog_manager);
1112
paulmeyerc0b762b2016-04-13 11:55:171113 // Returns the FindRequestManager, or creates one if it doesn't already exist.
1114 FindRequestManager* GetOrCreateFindRequestManager();
1115
rockotf62002a2016-09-15 00:08:591116 // Removes a registered WebContentsBindingSet by interface name.
1117 void RemoveBindingSet(const std::string& interface_name);
1118
[email protected]0dd3a0ab2011-02-18 08:17:441119 // Data for core operation ---------------------------------------------------
1120
1121 // Delegate for notifying our owner about stuff. Not owned by us.
[email protected]8ff00d72012-10-23 19:12:211122 WebContentsDelegate* delegate_;
[email protected]0dd3a0ab2011-02-18 08:17:441123
1124 // Handles the back/forward list and loading.
[email protected]d202a7c2012-01-04 07:53:471125 NavigationControllerImpl controller_;
[email protected]0dd3a0ab2011-02-18 08:17:441126
1127 // The corresponding view.
dcheng59716272016-04-09 05:19:081128 std::unique_ptr<WebContentsView> view_;
[email protected]0dd3a0ab2011-02-18 08:17:441129
[email protected]5a3bdf52012-05-24 15:12:571130 // The view of the RVHD. Usually this is our WebContentsView implementation,
1131 // but if an embedder uses a different WebContentsView, they'll need to
1132 // provide this.
[email protected]8ff00d72012-10-23 19:12:211133 RenderViewHostDelegateView* render_view_host_delegate_view_;
[email protected]5a3bdf52012-05-24 15:12:571134
[email protected]bafe6cd2012-05-23 23:09:501135 // Tracks created WebContentsImpl objects that have not been shown yet. They
alexmosc2a8cec2016-05-23 22:19:531136 // are identified by the process ID and routing ID passed to CreateNewWindow.
1137 typedef std::pair<int, int> ProcessRoutingIdPair;
1138 std::map<ProcessRoutingIdPair, WebContentsImpl*> pending_contents_;
[email protected]bafe6cd2012-05-23 23:09:501139
alexmosc2a8cec2016-05-23 22:19:531140 // This map holds widgets that were created on behalf of the renderer but
1141 // haven't been shown yet.
1142 std::map<ProcessRoutingIdPair, RenderWidgetHostView*> pending_widget_views_;
[email protected]bafe6cd2012-05-23 23:09:501143
avia8cf81982016-08-12 20:28:461144 std::map<WebContentsImpl*, std::unique_ptr<DestructionObserver>>
1145 destruction_observers_;
[email protected]7fff43e2013-05-21 20:21:101146
[email protected]996042972011-11-08 22:43:591147 // A list of observers notified when page state changes. Weak references.
[email protected]fa944cb82013-11-15 17:51:211148 // This MUST be listed above frame_tree_ since at destruction time the
[email protected]996042972011-11-08 22:43:591149 // latter might cause RenderViewHost's destructor to call us and we might use
1150 // the observer list then.
brettw236d3172015-06-03 16:31:431151 base::ObserverList<WebContentsObserver> observers_;
[email protected]996042972011-11-08 22:43:591152
rockotf62002a2016-09-15 00:08:591153 // Associated interface binding sets attached to this WebContents.
1154 std::map<std::string, WebContentsBindingSet*> binding_sets_;
1155
[email protected]c7c0d822014-04-16 20:19:491156 // True if this tab was opened by another tab. This is not unset if the opener
1157 // is closed.
1158 bool created_with_opener_;
1159
[email protected]0dd3a0ab2011-02-18 08:17:441160 // Helper classes ------------------------------------------------------------
1161
[email protected]fa944cb82013-11-15 17:51:211162 // Manages the frame tree of the page and process swaps in each node.
[email protected]9b159a52013-10-03 17:24:551163 FrameTree frame_tree_;
1164
lazyboy6ec48b2a2015-06-29 15:18:141165 // If this WebContents is part of a "tree of WebContents", then this contains
1166 // information about the structure.
dcheng59716272016-04-09 05:19:081167 std::unique_ptr<WebContentsTreeNode> node_;
lazyboy6ec48b2a2015-06-29 15:18:141168
[email protected]c7dd2f62011-07-18 15:57:591169 // SavePackage, lazily created.
1170 scoped_refptr<SavePackage> save_package_;
1171
paulmeyerc8cb7cb2016-06-07 01:14:191172 // Manages/coordinates multi-process find-in-page requests. Created lazily.
dcheng18ec0b542016-04-26 19:28:531173 std::unique_ptr<FindRequestManager> find_request_manager_;
paulmeyerc0b762b2016-04-13 11:55:171174
[email protected]0dd3a0ab2011-02-18 08:17:441175 // Data for loading state ----------------------------------------------------
1176
[email protected]6dfed692014-05-22 04:18:031177 // Indicates whether the current load is to a different document. Only valid
1178 // if is_loading_ is true.
1179 bool is_load_to_different_document_;
1180
[email protected]0dd3a0ab2011-02-18 08:17:441181 // Indicates if the tab is considered crashed.
1182 base::TerminationStatus crashed_status_;
1183 int crashed_error_code_;
1184
[email protected]ca13a442012-04-17 14:00:121185 // Whether this WebContents is waiting for a first-response for the
[email protected]be1f56ab2011-12-22 06:55:311186 // main resource of the page. This controls whether the throbber state is
1187 // "waiting" or "loading."
[email protected]0dd3a0ab2011-02-18 08:17:441188 bool waiting_for_response_;
1189
[email protected]0dd3a0ab2011-02-18 08:17:441190 // The current load state and the URL associated with it.
[email protected]9c235f042011-08-10 22:28:211191 net::LoadStateWithParam load_state_;
[email protected]fcf75d42013-12-03 20:11:261192 base::string16 load_state_host_;
[email protected]960b0372014-05-19 18:01:001193
[email protected]960b0372014-05-19 18:01:001194 base::TimeTicks loading_last_progress_update_;
1195
[email protected]0dd3a0ab2011-02-18 08:17:441196 // Upload progress, for displaying in the status bar.
1197 // Set to zero when there is no significant upload happening.
avib7348942015-12-25 20:57:101198 uint64_t upload_size_;
1199 uint64_t upload_position_;
[email protected]0dd3a0ab2011-02-18 08:17:441200
dfalcantarae6b7b46752015-07-10 18:14:161201 // Tracks that this WebContents needs to unblock requests to the renderer.
1202 // See ResumeLoadingCreatedWebContents.
1203 bool is_resume_pending_;
1204
[email protected]0dd3a0ab2011-02-18 08:17:441205 // Data for current page -----------------------------------------------------
1206
[email protected]987fc3a2011-05-26 14:18:091207 // When a title cannot be taken from any entry, this title will be used.
[email protected]fcf75d42013-12-03 20:11:261208 base::string16 page_title_when_no_navigation_entry_;
[email protected]987fc3a2011-05-26 14:18:091209
[email protected]0dd3a0ab2011-02-18 08:17:441210 // When a navigation occurs, we record its contents MIME type. It can be
1211 // used to check whether we can do something for some special contents.
1212 std::string contents_mime_type_;
1213
[email protected]ef3adfc2014-05-11 00:04:541214 // The last reported character encoding, not canonicalized.
1215 std::string last_reported_encoding_;
1216
1217 // The canonicalized character encoding.
1218 std::string canonical_encoding_;
[email protected]0dd3a0ab2011-02-18 08:17:441219
[email protected]b4c84012014-04-28 19:51:101220 // Whether the initial empty page has been accessed by another page, making it
1221 // unsafe to show the pending URL. Usually false unless another window tries
1222 // to modify the blank page. Always false after the first commit.
1223 bool has_accessed_initial_document_;
1224
yusufod41c5f92015-03-06 00:14:281225 // The theme color for the underlying document as specified
1226 // by theme-color meta tag.
1227 SkColor theme_color_;
1228
1229 // The last published theme color.
1230 SkColor last_sent_theme_color_;
1231
peter90afaba2015-06-01 12:05:291232 // Whether the first visually non-empty paint has occurred.
1233 bool did_first_visually_non_empty_paint_;
1234
[email protected]0dd3a0ab2011-02-18 08:17:441235 // Data for misc internal state ----------------------------------------------
1236
[email protected]54597982013-02-06 01:59:551237 // When > 0, the WebContents is currently being captured (e.g., for
1238 // screenshots or mirroring); and the underlying RenderWidgetHost should not
1239 // be told it is hidden.
1240 int capturer_count_;
1241
1242 // Tracks whether RWHV should be visible once capturer_count_ becomes zero.
1243 bool should_normally_be_visible_;
[email protected]0dd3a0ab2011-02-18 08:17:441244
tapted65ff2ea72016-03-01 23:39:001245 // Tracks whether this WebContents was ever set to be visible. Used to
1246 // facilitate WebContents being loaded in the background by setting
1247 // |should_normally_be_visible_|. Ensures WasShown() will trigger when first
1248 // becoming visible to the user, and prevents premature unloading.
1249 bool did_first_set_visible_;
1250
[email protected]0dd3a0ab2011-02-18 08:17:441251 // See getter above.
1252 bool is_being_destroyed_;
1253
1254 // Indicates whether we should notify about disconnection of this
[email protected]b172aee2012-04-10 17:05:261255 // WebContentsImpl. This is used to ensure disconnection notifications only
[email protected]0dd3a0ab2011-02-18 08:17:441256 // happen if a connection notification has happened and that they happen only
1257 // once.
1258 bool notify_disconnection_;
1259
[email protected]71a88bb2013-02-01 22:05:151260 // Pointer to the JavaScript dialog manager, lazily assigned. Used because the
[email protected]b172aee2012-04-10 17:05:261261 // delegate of this WebContentsImpl is nulled before its destructor is called.
[email protected]71a88bb2013-02-01 22:05:151262 JavaScriptDialogManager* dialog_manager_;
[email protected]2e5b90c2011-08-16 21:11:551263
avi85ee8362016-10-08 02:09:081264 // Set to true when there is an active JavaScript dialog showing.
1265 bool is_showing_javascript_dialog_ = false;
1266
[email protected]0dd3a0ab2011-02-18 08:17:441267 // Set to true when there is an active "before unload" dialog. When true,
1268 // we've forced the throbber to start in Navigate, and we need to remember to
1269 // turn it off in OnJavaScriptMessageBoxClosed if the navigation is canceled.
1270 bool is_showing_before_unload_dialog_;
1271
[email protected]0dd3a0ab2011-02-18 08:17:441272 // Settings that get passed to the renderer process.
[email protected]8ff00d72012-10-23 19:12:211273 RendererPreferences renderer_preferences_;
[email protected]0dd3a0ab2011-02-18 08:17:441274
[email protected]9a890452014-02-13 22:21:021275 // The time that this WebContents was last made active. The initial value is
1276 // the WebContents creation time.
gab0dccfef2015-05-20 18:43:391277 base::TimeTicks last_active_time_;
[email protected]0dd3a0ab2011-02-18 08:17:441278
hajimehoshic4f226a2016-10-21 09:01:571279 // The time that this WebContents was last made hidden. The initial value is
1280 // zero.
1281 base::TimeTicks last_hidden_time_;
1282
[email protected]0dd3a0ab2011-02-18 08:17:441283 // See description above setter.
1284 bool closed_by_user_gesture_;
1285
1286 // Minimum/maximum zoom percent.
1287 int minimum_zoom_percent_;
1288 int maximum_zoom_percent_;
[email protected]0dd3a0ab2011-02-18 08:17:441289
w.shackleton49bcd392016-01-06 17:38:221290 // Used to correctly handle integer zooming through a smooth scroll device.
1291 float zoom_scroll_remainder_;
1292
[email protected]bcd2815602012-01-14 18:17:231293 // The intrinsic size of the page.
1294 gfx::Size preferred_size_;
1295
[email protected]222f5822014-02-05 23:40:491296 // The preferred size for content screen capture. When |capturer_count_| > 0,
1297 // this overrides |preferred_size_|.
1298 gfx::Size preferred_size_for_capture_;
1299
mfomitchev2b8b066a2016-01-28 19:23:151300#if defined(OS_ANDROID)
[email protected]583418cc2013-01-17 14:01:101301 // Date time chooser opened by this tab.
1302 // Only used in Android since all other platforms use a multi field UI.
dcheng59716272016-04-09 05:19:081303 std::unique_ptr<DateTimeChooserAndroid> date_time_chooser_;
[email protected]583418cc2013-01-17 14:01:101304#endif
1305
[email protected]8ed16472014-04-11 19:02:481306 // Holds information about a current color chooser dialog, if one is visible.
1307 struct ColorChooserInfo {
1308 ColorChooserInfo(int render_process_id,
1309 int render_frame_id,
1310 ColorChooser* chooser,
1311 int identifier);
1312 ~ColorChooserInfo();
[email protected]cb805452013-05-22 15:16:211313
[email protected]8ed16472014-04-11 19:02:481314 int render_process_id;
1315 int render_frame_id;
1316
1317 // Color chooser that was opened by this tab.
dcheng59716272016-04-09 05:19:081318 std::unique_ptr<ColorChooser> chooser;
[email protected]8ed16472014-04-11 19:02:481319
1320 // A unique identifier for the current color chooser. Identifiers are
1321 // unique across a renderer process. This avoids race conditions in
1322 // synchronizing the browser and renderer processes. For example, if a
1323 // renderer closes one chooser and opens another, and simultaneously the
1324 // user picks a color in the first chooser, the IDs can be used to drop the
1325 // "chose a color" message rather than erroneously tell the renderer that
1326 // the user picked a color in the second chooser.
1327 int identifier;
1328 };
1329
dcheng59716272016-04-09 05:19:081330 std::unique_ptr<ColorChooserInfo> color_chooser_info_;
[email protected]da8543762012-03-20 08:52:201331
[email protected]7a846df2012-09-20 19:17:391332 // Manages the embedder state for browser plugins, if this WebContents is an
1333 // embedder; NULL otherwise.
dcheng59716272016-04-09 05:19:081334 std::unique_ptr<BrowserPluginEmbedder> browser_plugin_embedder_;
[email protected]7a846df2012-09-20 19:17:391335 // Manages the guest state for browser plugin, if this WebContents is a guest;
1336 // NULL otherwise.
dcheng59716272016-04-09 05:19:081337 std::unique_ptr<BrowserPluginGuest> browser_plugin_guest_;
[email protected]7a846df2012-09-20 19:17:391338
tommyclieb25b2a2014-11-03 19:45:091339#if defined(ENABLE_PLUGINS)
1340 // Manages the whitelist of plugin content origins exempt from power saving.
dcheng59716272016-04-09 05:19:081341 std::unique_ptr<PluginContentOriginWhitelist>
1342 plugin_content_origin_whitelist_;
tommyclieb25b2a2014-11-03 19:45:091343#endif
1344
[email protected]f53a9f872012-05-24 02:07:061345 // This must be at the end, or else we might get notifications and use other
1346 // member variables that are gone.
[email protected]8ff00d72012-10-23 19:12:211347 NotificationRegistrar registrar_;
[email protected]f53a9f872012-05-24 02:07:061348
[email protected]1d62cf72014-02-07 21:31:571349 // Used during IPC message dispatching from the RenderView/RenderFrame so that
1350 // the handlers can get a pointer to the RVH through which the message was
[email protected]f114fa42013-12-06 17:06:441351 // received.
1352 RenderViewHost* render_view_message_source_;
[email protected]1d62cf72014-02-07 21:31:571353 RenderFrameHost* render_frame_message_source_;
[email protected]7bb761892012-07-20 09:32:471354
[email protected]b24b68a2012-09-24 21:57:261355 // All live RenderWidgetHostImpls that are created by this object and may
1356 // outlive it.
[email protected]8ff00d72012-10-23 19:12:211357 std::set<RenderWidgetHostImpl*> created_widgets_;
[email protected]b24b68a2012-09-24 21:57:261358
alexmosc9e76ec2016-05-16 22:59:371359 // Process id of the shown fullscreen widget, or kInvalidUniqueID if there is
1360 // no fullscreen widget.
1361 int fullscreen_widget_process_id_;
1362
[email protected]44470a22013-01-24 01:21:541363 // Routing id of the shown fullscreen widget or MSG_ROUTING_NONE otherwise.
1364 int fullscreen_widget_routing_id_;
1365
[email protected]0b431992014-06-24 00:08:031366 // At the time the fullscreen widget was being shut down, did it have focus?
1367 // This is used to restore focus to the WebContentsView after both: 1) the
1368 // fullscreen widget is destroyed, and 2) the WebContentsDelegate has
1369 // completed making layout changes to effect an exit from fullscreen mode.
1370 bool fullscreen_widget_had_focus_at_shutdown_;
1371
[email protected]0e584b5f2013-12-30 17:28:231372 // Whether this WebContents is responsible for displaying a subframe in a
[email protected]5dcaf8e2013-12-28 01:31:421373 // different process from its parent page.
1374 bool is_subframe_;
1375
mariakhomenkoa4971c12015-07-21 19:04:371376 // When a new tab is created asynchronously, stores the OpenURLParams needed
1377 // to continue loading the page once the tab is ready.
dcheng59716272016-04-09 05:19:081378 std::unique_ptr<OpenURLParams> delayed_open_url_params_;
mariakhomenkoa4971c12015-07-21 19:04:371379
[email protected]34ff1cfc2014-08-20 06:16:051380 // Whether overscroll should be unconditionally disabled.
1381 bool force_disable_overscroll_content_;
[email protected]e85165c642014-06-10 14:34:311382
[email protected]87de04b02014-04-08 22:14:491383 // Whether the last JavaScript dialog shown was suppressed. Used for testing.
1384 bool last_dialog_suppressed_;
1385
mcasas4e216e72016-07-28 21:28:381386 std::unique_ptr<device::GeolocationServiceContext>
1387 geolocation_service_context_;
blundellc57b93f2014-10-29 13:19:571388
blundelld46e8832016-10-07 10:34:271389 std::unique_ptr<device::WakeLockServiceContext> wake_lock_service_context_;
alogvinovf50445a2015-10-30 13:00:121390
dcheng59716272016-04-09 05:19:081391 std::unique_ptr<ScreenOrientationDispatcherHost>
[email protected]01f83f92014-06-17 14:41:541392 screen_orientation_dispatcher_host_;
1393
dcheng59716272016-04-09 05:19:081394 std::unique_ptr<ManifestManagerHost> manifest_manager_host_;
mlamouriefdca9d2014-09-16 16:55:401395
[email protected]95640212014-07-26 18:14:301396 // The accessibility mode for all frames. This is queried when each frame
1397 // is created, and broadcast to all frames when it changes.
1398 AccessibilityMode accessibility_mode_;
1399
avayvodcc85bbd2015-08-28 19:11:151400 // Monitors power levels for audio streams associated with this WebContents.
1401 AudioStreamMonitor audio_stream_monitor_;
1402
miu50f97892014-09-22 22:49:521403 // Created on-demand to mute all audio output from this WebContents.
dcheng59716272016-04-09 05:19:081404 std::unique_ptr<WebContentsAudioMuter> audio_muter_;
miu50f97892014-09-22 22:49:521405
ortunodf4d7982016-04-08 02:33:351406 size_t bluetooth_connected_device_count_;
ortuno32e7db3c2016-03-29 16:14:201407
lukendc35e7f2014-11-10 19:06:141408 bool virtual_keyboard_requested_;
1409
csharrisona2280cd2016-02-03 23:21:151410 // Notifies ResourceDispatcherHostImpl of various events related to loading.
dcheng59716272016-04-09 05:19:081411 std::unique_ptr<LoaderIOThreadNotifier> loader_io_thread_notifier_;
csharrisona2280cd2016-02-03 23:21:151412
dalecurtis88c240072015-12-09 02:11:181413 // Manages media players, CDMs, and power save blockers for media.
dcheng59716272016-04-09 05:19:081414 std::unique_ptr<MediaWebContentsObserver> media_web_contents_observer_;
qinmin58567c82015-01-07 21:00:201415
zqzhang181047e62016-07-01 13:37:171416#if defined(ENABLE_PLUGINS)
1417 // Observes pepper playback changes, and notifies MediaSession.
1418 std::unique_ptr<PepperPlaybackObserver> pepper_playback_observer_;
1419#endif // defined(ENABLE_PLUGINS)
1420
scottmg276753cf2016-10-27 18:25:221421 std::unique_ptr<HostZoomMapObserver> host_zoom_map_observer_;
1422
dcheng59716272016-04-09 05:19:081423 std::unique_ptr<RenderWidgetHostInputEventRouter> rwh_input_event_router_;
kenrb2a565f82015-09-02 20:24:591424
kouhei40f03cb2015-09-24 07:47:011425 PageImportanceSignals page_importance_signals_;
1426
mcnee432e47d2015-11-09 19:37:461427 bool page_scale_factor_is_one_;
1428
ekaramadadd882292016-06-08 15:22:561429 // TextInputManager tracks the IME-related state for all the
1430 // RenderWidgetHostViews on this WebContents. Only exists on the outermost
1431 // WebContents and is automatically destroyed when a WebContents becomes an
1432 // inner WebContents by attaching to an outer WebContents. Then the
1433 // IME-related state for RenderWidgetHosts on the inner WebContents is tracked
1434 // by the TextInputManager in the outer WebContents.
1435 std::unique_ptr<TextInputManager> text_input_manager_;
1436
lfgbee1e0a2016-06-08 21:24:211437 // Stores the RenderWidgetHost that currently holds a mouse lock or nullptr if
1438 // there's no RenderWidgetHost holding a lock.
1439 RenderWidgetHostImpl* mouse_lock_widget_;
1440
sammcf5f1b0f2016-09-20 23:05:111441#if defined(OS_ANDROID)
rockot400ea35b2016-10-15 19:15:321442 std::unique_ptr<service_manager::InterfaceProvider> java_interfaces_;
sammcf5f1b0f2016-09-20 23:05:111443#endif
1444
qinmin72e8bd02016-10-21 19:35:371445 // Whether this WebContents is for content overlay.
1446 bool is_overlay_content_;
1447
billorr21c005d2016-11-17 03:57:041448 int currently_playing_video_count_ = 0;
1449
mohan.reddyaae039a2014-11-21 17:39:501450 base::WeakPtrFactory<WebContentsImpl> loading_weak_factory_;
pkotwicz75ca8ffd2016-02-16 23:10:191451 base::WeakPtrFactory<WebContentsImpl> weak_factory_;
mohan.reddyaae039a2014-11-21 17:39:501452
[email protected]b172aee2012-04-10 17:05:261453 DISALLOW_COPY_AND_ASSIGN(WebContentsImpl);
[email protected]0dd3a0ab2011-02-18 08:17:441454};
1455
nickf9acfbe2014-12-23 19:12:371456// Dangerous methods which should never be made part of the public API, so we
1457// grant their use only to an explicit friend list (c++ attorney/client idiom).
1458class CONTENT_EXPORT WebContentsImpl::FriendZone {
1459 private:
1460 friend class TestNavigationObserver;
1461 friend class WebContentsAddedObserver;
1462 friend class ContentBrowserSanityChecker;
1463
1464 FriendZone(); // Not instantiable.
1465
1466 // Adds/removes a callback called on creation of each new WebContents.
1467 static void AddCreatedCallbackForTesting(const CreatedCallback& callback);
1468 static void RemoveCreatedCallbackForTesting(const CreatedCallback& callback);
1469
1470 DISALLOW_COPY_AND_ASSIGN(FriendZone);
1471};
1472
[email protected]8ff00d72012-10-23 19:12:211473} // namespace content
1474
[email protected]93ddb3c2012-04-11 21:44:291475#endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_