blob: 53b0ada6de20af675f052c2e297345df65181194 [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
[email protected]0dd3a0ab2011-02-18 08:17:448#include <map>
[email protected]b24b68a2012-09-24 21:57:269#include <set>
[email protected]0dd3a0ab2011-02-18 08:17:4410#include <string>
[email protected]0dd3a0ab2011-02-18 08:17:4411
[email protected]01d65172011-12-25 04:39:3012#include "base/compiler_specific.h"
[email protected]c9e3b202014-08-08 08:24:4213#include "base/containers/scoped_ptr_hash_map.h"
[email protected]0dd3a0ab2011-02-18 08:17:4414#include "base/gtest_prod_util.h"
[email protected]3b63f8f42011-03-28 01:54:1515#include "base/memory/scoped_ptr.h"
[email protected]6eac57a2011-07-12 21:15:0916#include "base/observer_list.h"
[email protected]fa20e002013-07-23 21:20:5417#include "base/process/process.h"
[email protected]738f57a2013-06-29 21:06:5418#include "base/values.h"
[email protected]d4a8ca482013-10-30 21:06:4019#include "content/browser/frame_host/frame_tree.h"
20#include "content/browser/frame_host/navigation_controller_delegate.h"
21#include "content/browser/frame_host/navigation_controller_impl.h"
[email protected]190b8c52013-11-09 01:35:4422#include "content/browser/frame_host/navigator_delegate.h"
[email protected]92404c62013-12-04 16:40:4623#include "content/browser/frame_host/render_frame_host_delegate.h"
[email protected]b0936d22013-11-28 06:47:3624#include "content/browser/frame_host/render_frame_host_manager.h"
dalecurtisbc6572e12014-09-12 19:22:3025#include "content/browser/media/audio_stream_monitor.h"
[email protected]2e3bf992012-05-24 17:36:2426#include "content/browser/renderer_host/render_view_host_delegate.h"
[email protected]4ca76c02012-05-16 16:19:0527#include "content/browser/renderer_host/render_widget_host_delegate.h"
[email protected]95640212014-07-26 18:14:3028#include "content/common/accessibility_mode_enums.h"
[email protected]8d128d62011-09-13 22:11:5729#include "content/common/content_export.h"
[email protected]8ed16472014-04-11 19:02:4830#include "content/public/browser/color_chooser.h"
[email protected]14392a52012-05-02 20:28:4431#include "content/public/browser/notification_observer.h"
32#include "content/public/browser/notification_registrar.h"
[email protected]58f5d562011-12-20 17:13:0333#include "content/public/browser/web_contents.h"
[email protected]daf82f82011-10-31 22:35:3134#include "content/public/common/renderer_preferences.h"
[email protected]7491ad02014-07-05 19:10:0735#include "content/public/common/resource_type.h"
[email protected]818915cd2012-11-20 13:14:1136#include "content/public/common/three_d_api_types.h"
[email protected]0dd3a0ab2011-02-18 08:17:4437#include "net/base/load_states.h"
[email protected]6f2ac772014-07-24 22:22:0838#include "net/http/http_response_headers.h"
[email protected]2255a9332013-06-17 05:12:3139#include "third_party/WebKit/public/web/WebDragOperation.h"
Sylvain Defresnec6ccc77d2014-09-19 10:19:3540#include "ui/base/page_transition_types.h"
[email protected]59363fc92012-09-05 03:46:3141#include "ui/gfx/rect_f.h"
[email protected]bcd2815602012-01-14 18:17:2342#include "ui/gfx/size.h"
[email protected]0dd3a0ab2011-02-18 08:17:4443
[email protected]92a01cc2012-09-29 14:13:5944struct BrowserPluginHostMsg_ResizeGuest_Params;
[email protected]1ff427972013-02-07 21:14:0745struct ViewHostMsg_DateTimeDialogValue_Params;
[email protected]f546640b2012-05-15 00:03:4946struct ViewMsg_PostMessage_Params;
[email protected]daf82f82011-10-31 22:35:3147
[email protected]e582fdd2011-12-20 16:48:1748namespace content {
[email protected]7a846df2012-09-20 19:17:3949class BrowserPluginEmbedder;
50class BrowserPluginGuest;
[email protected]8eb04562013-03-06 03:41:1451class BrowserPluginGuestManager;
[email protected]583418cc2013-01-17 14:01:1052class DateTimeChooserAndroid;
[email protected]e582fdd2011-12-20 16:48:1753class DownloadItem;
[email protected]f28ef9a32014-05-12 16:36:1054class GeolocationDispatcherHost;
[email protected]8ff00d72012-10-23 19:12:2155class InterstitialPageImpl;
[email protected]71a88bb2013-02-01 22:05:1556class JavaScriptDialogManager;
mlamouriefdca9d2014-09-16 16:55:4057class ManifestManagerHost;
[email protected]29998f92014-06-15 03:12:1458class MidiDispatcherHost;
[email protected]d9030b82013-07-19 08:26:0659class PowerSaveBlocker;
[email protected]eaabba22012-03-07 15:02:1160class RenderViewHost;
[email protected]5a3bdf52012-05-24 15:12:5761class RenderViewHostDelegateView;
[email protected]eaabba22012-03-07 15:02:1162class RenderViewHostImpl;
[email protected]b24b68a2012-09-24 21:57:2663class RenderWidgetHostImpl;
[email protected]35869622012-10-26 23:23:5564class SavePackage;
[email protected]01f83f92014-06-17 14:41:5465class ScreenOrientationDispatcherHost;
[email protected]09d31d52012-03-11 22:30:2766class SiteInstance;
[email protected]80e776ae2012-03-23 16:17:2067class TestWebContents;
miu50f97892014-09-22 22:49:5268class WebContentsAudioMuter;
[email protected]674bc592011-12-20 23:00:4269class WebContentsDelegate;
[email protected]8ff00d72012-10-23 19:12:2170class WebContentsImpl;
[email protected]51da7e32012-01-30 19:24:5271class WebContentsObserver;
[email protected]fc2b46b2014-05-03 16:33:4572class WebContentsView;
[email protected]f66df822012-05-18 16:52:1773class WebContentsViewDelegate;
[email protected]31a71eaf2014-03-13 01:47:3674struct AXEventNotificationDetails;
[email protected]8bc5ff02013-11-29 06:34:0375struct ColorSuggestion;
[email protected]795c28972012-12-06 06:13:3976struct FaviconURL;
[email protected]09d31d52012-03-11 22:30:2777struct LoadNotificationDetails;
[email protected]d60f3702013-12-26 16:30:2478struct ResourceRedirectDetails;
79struct ResourceRequestDetails;
[email protected]f66df822012-05-18 16:52:1780
[email protected]0e813a52014-08-13 10:34:5681#if defined(OS_ANDROID)
82class WebContentsAndroid;
83#endif
84
[email protected]f66df822012-05-18 16:52:1785// Factory function for the implementations that content knows about. Takes
86// ownership of |delegate|.
[email protected]fc2b46b2014-05-03 16:33:4587WebContentsView* CreateWebContentsView(
[email protected]5a3bdf52012-05-24 15:12:5788 WebContentsImpl* web_contents,
89 WebContentsViewDelegate* delegate,
90 RenderViewHostDelegateView** render_view_host_delegate_view);
[email protected]97714c82012-06-06 10:15:1391
[email protected]b172aee2012-04-10 17:05:2692class CONTENT_EXPORT WebContentsImpl
[email protected]8ff00d72012-10-23 19:12:2193 : public NON_EXPORTED_BASE(WebContents),
[email protected]92404c62013-12-04 16:40:4694 public NON_EXPORTED_BASE(RenderFrameHostDelegate),
[email protected]8ff00d72012-10-23 19:12:2195 public RenderViewHostDelegate,
96 public RenderWidgetHostDelegate,
[email protected]b0936d22013-11-28 06:47:3697 public RenderFrameHostManager::Delegate,
[email protected]ec6c05f2013-10-23 18:41:5798 public NotificationObserver,
[email protected]190b8c52013-11-09 01:35:4499 public NON_EXPORTED_BASE(NavigationControllerDelegate),
100 public NON_EXPORTED_BASE(NavigatorDelegate) {
[email protected]0dd3a0ab2011-02-18 08:17:44101 public:
[email protected]b172aee2012-04-10 17:05:26102 virtual ~WebContentsImpl();
[email protected]0dd3a0ab2011-02-18 08:17:44103
[email protected]d1198fd2012-08-13 22:50:19104 static WebContentsImpl* CreateWithOpener(
[email protected]54944cde2012-12-09 09:24:59105 const WebContents::CreateParams& params,
[email protected]d1198fd2012-08-13 22:50:19106 WebContentsImpl* opener);
107
[email protected]95640212014-07-26 18:14:30108 static std::vector<WebContentsImpl*> GetAllWebContents();
109
[email protected]3de10bb32013-01-08 21:57:33110 // Returns the opener WebContentsImpl, if any. This can be set to null if the
111 // opener is closed or the page clears its window.opener.
112 WebContentsImpl* opener() const { return opener_; }
113
[email protected]0eba810b2012-10-18 03:19:36114 // Creates a swapped out RenderView. This is used by the browser plugin to
115 // create a swapped out RenderView in the embedder render process for the
116 // guest, to expose the guest's window object to the embedder.
117 // This returns the routing ID of the newly created swapped out RenderView.
[email protected]8ff00d72012-10-23 19:12:21118 int CreateSwappedOutRenderView(SiteInstance* instance);
[email protected]0eba810b2012-10-18 03:19:36119
[email protected]d1198fd2012-08-13 22:50:19120 // Complex initialization here. Specifically needed to avoid having
121 // members call back into our virtual functions in the constructor.
[email protected]54944cde2012-12-09 09:24:59122 virtual void Init(const WebContents::CreateParams& params);
[email protected]d1198fd2012-08-13 22:50:19123
[email protected]c7dd2f62011-07-18 15:57:59124 // Returns the SavePackage which manages the page saving job. May be NULL.
125 SavePackage* save_package() const { return save_package_.get(); }
126
[email protected]c7654a232013-06-12 21:04:44127#if defined(OS_ANDROID)
[email protected]7d244f12013-08-22 21:41:51128 // In Android WebView, the RenderView needs created even there is no
129 // navigation entry, this allows Android WebViews to use
130 // javascript: URLs that load into the DOMWindow before the first page
131 // load. This is not safe to do in any context that a web page could get a
132 // reference to the DOMWindow before the first page load.
133 bool CreateRenderViewForInitialEmptyDocument();
[email protected]4cc1ab52013-01-21 19:24:34134#endif
[email protected]276b37a22011-11-08 20:45:46135
[email protected]765187182012-01-11 23:59:28136 // Expose the render manager for testing.
[email protected]ee87c8be2014-03-05 00:35:38137 // TODO(creis): Remove this now that we can get to it via FrameTreeNode.
[email protected]b0936d22013-11-28 06:47:36138 RenderFrameHostManager* GetRenderManagerForTesting();
[email protected]765187182012-01-11 23:59:28139
[email protected]7a846df2012-09-20 19:17:39140 // Returns guest browser plugin object, or NULL if this WebContents is not a
141 // guest.
[email protected]f8497342013-02-05 22:15:02142 BrowserPluginGuest* GetBrowserPluginGuest() const;
[email protected]738f57a2013-06-29 21:06:54143
144 // Sets a BrowserPluginGuest object for this WebContents. If this WebContents
145 // has a BrowserPluginGuest then that implies that it is being hosted by
146 // a BrowserPlugin object in an embedder renderer process.
147 void SetBrowserPluginGuest(BrowserPluginGuest* guest);
148
[email protected]7a846df2012-09-20 19:17:39149 // Returns embedder browser plugin object, or NULL if this WebContents is not
150 // an embedder.
[email protected]f8497342013-02-05 22:15:02151 BrowserPluginEmbedder* GetBrowserPluginEmbedder() const;
[email protected]738f57a2013-06-29 21:06:54152
[email protected]44470a22013-01-24 01:21:54153 // Gets the current fullscreen render widget's routing ID. Returns
154 // MSG_ROUTING_NONE when there is no fullscreen render widget.
155 int GetFullscreenWidgetRoutingID() const;
156
[email protected]e67ebf32013-02-13 11:07:19157 // Invoked when visible SSL state (as defined by SSLStatus) changes.
158 void DidChangeVisibleSSLState();
159
[email protected]cf200a562013-05-03 16:24:29160 // Informs the render view host and the BrowserPluginEmbedder, if present, of
161 // a Drag Source End.
162 void DragSourceEndedAt(int client_x, int client_y, int screen_x,
[email protected]180ef242013-11-07 06:50:46163 int screen_y, blink::WebDragOperation operation);
[email protected]cf200a562013-05-03 16:24:29164
[email protected]d60f3702013-12-26 16:30:24165 // A response has been received for a resource request.
166 void DidGetResourceResponseStart(
167 const ResourceRequestDetails& details);
168
169 // A redirect was received while requesting a resource.
170 void DidGetRedirectForResourceRequest(
171 RenderViewHost* render_view_host,
172 const ResourceRedirectDetails& details);
173
[email protected]fc2b46b2014-05-03 16:33:45174 WebContentsView* GetView() const;
175
[email protected]f28ef9a32014-05-12 16:36:10176 GeolocationDispatcherHost* geolocation_dispatcher_host() {
177 return geolocation_dispatcher_host_.get();
178 }
179
[email protected]6ccd6f92014-06-24 16:20:57180 ScreenOrientationDispatcherHost* screen_orientation_dispatcher_host() {
181 return screen_orientation_dispatcher_host_.get();
182 }
183
[email protected]16620a92014-05-24 01:05:51184 bool should_normally_be_visible() { return should_normally_be_visible_; }
185
[email protected]95640212014-07-26 18:14:30186 // Broadcasts the mode change to all frames.
187 void SetAccessibilityMode(AccessibilityMode mode);
188
189 // Adds the given accessibility mode to the current accessibility mode
190 // bitmap.
191 void AddAccessibilityMode(AccessibilityMode mode);
192
193 // Removes the given accessibility mode from the current accessibility
194 // mode bitmap, managing the bits that are shared with other modes such
195 // that a bit will only be turned off when all modes that depend on it
196 // have been removed.
197 void RemoveAccessibilityMode(AccessibilityMode mode);
198
[email protected]8ff00d72012-10-23 19:12:21199 // WebContents ------------------------------------------------------
anand.ratn120b0b002014-10-07 15:49:32200 virtual WebContentsDelegate* GetDelegate() override;
201 virtual void SetDelegate(WebContentsDelegate* delegate) override;
202 virtual NavigationControllerImpl& GetController() override;
203 virtual const NavigationControllerImpl& GetController() const override;
204 virtual BrowserContext* GetBrowserContext() const override;
205 virtual const GURL& GetURL() const override;
206 virtual const GURL& GetVisibleURL() const override;
207 virtual const GURL& GetLastCommittedURL() const override;
208 virtual RenderProcessHost* GetRenderProcessHost() const override;
209 virtual RenderFrameHost* GetMainFrame() override;
210 virtual RenderFrameHost* GetFocusedFrame() override;
[email protected]a86c0e962013-12-17 17:10:39211 virtual void ForEachFrame(
anand.ratn120b0b002014-10-07 15:49:32212 const base::Callback<void(RenderFrameHost*)>& on_frame) override;
213 virtual void SendToAllFrames(IPC::Message* message) override;
214 virtual RenderViewHost* GetRenderViewHost() const override;
215 virtual int GetRoutingID() const override;
216 virtual RenderWidgetHostView* GetRenderWidgetHostView() const override;
[email protected]4aebbca2013-09-17 22:26:49217 virtual RenderWidgetHostView* GetFullscreenRenderWidgetHostView() const
anand.ratn120b0b002014-10-07 15:49:32218 override;
219 virtual WebUI* CreateWebUI(const GURL& url) override;
220 virtual WebUI* GetWebUI() const override;
221 virtual WebUI* GetCommittedWebUI() const override;
222 virtual void SetUserAgentOverride(const std::string& override) override;
223 virtual const std::string& GetUserAgentOverride() const override;
224 virtual void EnableTreeOnlyAccessibilityMode() override;
225 virtual bool IsTreeOnlyAccessibilityModeForTesting() const override;
226 virtual bool IsFullAccessibilityModeForTesting() const override;
[email protected]2ceee8f2014-01-14 18:02:08227#if defined(OS_WIN)
[email protected]c73a2282013-04-29 21:10:41228 virtual void SetParentNativeViewAccessible(
anand.ratn120b0b002014-10-07 15:49:32229 gfx::NativeViewAccessible accessible_parent) override;
[email protected]c73a2282013-04-29 21:10:41230#endif
anand.ratn120b0b002014-10-07 15:49:32231 virtual const base::string16& GetTitle() const override;
232 virtual int32 GetMaxPageID() override;
[email protected]be1f56ab2011-12-22 06:55:31233 virtual int32 GetMaxPageIDForSiteInstance(
anand.ratn120b0b002014-10-07 15:49:32234 SiteInstance* site_instance) override;
235 virtual SiteInstanceImpl* GetSiteInstance() const override;
236 virtual SiteInstanceImpl* GetPendingSiteInstance() const override;
237 virtual bool IsLoading() const override;
238 virtual bool IsLoadingToDifferentDocument() const override;
239 virtual bool IsWaitingForResponse() const override;
240 virtual const net::LoadStateWithParam& GetLoadState() const override;
241 virtual const base::string16& GetLoadStateHost() const override;
242 virtual uint64 GetUploadSize() const override;
243 virtual uint64 GetUploadPosition() const override;
244 virtual std::set<GURL> GetSitesInTab() const override;
245 virtual const std::string& GetEncoding() const override;
246 virtual bool DisplayedInsecureContent() const override;
247 virtual void IncrementCapturerCount(const gfx::Size& capture_size) override;
248 virtual void DecrementCapturerCount() override;
249 virtual int GetCapturerCount() const override;
250 virtual bool IsAudioMuted() const override;
251 virtual void SetAudioMuted(bool mute) override;
252 virtual bool IsCrashed() const override;
[email protected]be1f56ab2011-12-22 06:55:31253 virtual void SetIsCrashed(base::TerminationStatus status,
anand.ratn120b0b002014-10-07 15:49:32254 int error_code) override;
255 virtual base::TerminationStatus GetCrashedStatus() const override;
256 virtual bool IsBeingDestroyed() const override;
[email protected]7f924832014-08-09 05:57:22257 virtual void NotifyNavigationStateChanged(
anand.ratn120b0b002014-10-07 15:49:32258 InvalidateTypes changed_flags) override;
259 virtual base::TimeTicks GetLastActiveTime() const override;
260 virtual void WasShown() override;
261 virtual void WasHidden() override;
262 virtual bool NeedToFireBeforeUnload() override;
263 virtual void DispatchBeforeUnload(bool for_cross_site_transition) override;
264 virtual void Stop() override;
265 virtual WebContents* Clone() override;
266 virtual void ReloadFocusedFrame(bool ignore_cache) override;
267 virtual void Undo() override;
268 virtual void Redo() override;
269 virtual void Cut() override;
270 virtual void Copy() override;
271 virtual void CopyToFindPboard() override;
272 virtual void Paste() override;
273 virtual void PasteAndMatchStyle() override;
274 virtual void Delete() override;
275 virtual void SelectAll() override;
276 virtual void Unselect() override;
277 virtual void Replace(const base::string16& word) override;
278 virtual void ReplaceMisspelling(const base::string16& word) override;
[email protected]959be4c2014-04-08 15:01:33279 virtual void NotifyContextMenuClosed(
anand.ratn120b0b002014-10-07 15:49:32280 const CustomContextMenuContext& context) override;
[email protected]959be4c2014-04-08 15:01:33281 virtual void ExecuteCustomContextMenuCommand(
anand.ratn120b0b002014-10-07 15:49:32282 int action, const CustomContextMenuContext& context) override;
283 virtual gfx::NativeView GetNativeView() override;
284 virtual gfx::NativeView GetContentNativeView() override;
285 virtual gfx::NativeWindow GetTopLevelNativeWindow() override;
286 virtual gfx::Rect GetContainerBounds() override;
287 virtual gfx::Rect GetViewBounds() override;
288 virtual DropData* GetDropData() override;
289 virtual void Focus() override;
290 virtual void SetInitialFocus() override;
291 virtual void StoreFocus() override;
292 virtual void RestoreFocus() override;
293 virtual void FocusThroughTabTraversal(bool reverse) override;
294 virtual bool ShowingInterstitialPage() const override;
295 virtual InterstitialPage* GetInterstitialPage() const override;
296 virtual bool IsSavable() override;
297 virtual void OnSavePage() override;
[email protected]2dec8ec2013-02-07 19:20:34298 virtual bool SavePage(const base::FilePath& main_file,
299 const base::FilePath& dir_path,
anand.ratn120b0b002014-10-07 15:49:32300 SavePageType save_type) override;
[email protected]3c71576ce2013-07-23 02:00:01301 virtual void SaveFrame(const GURL& url,
anand.ratn120b0b002014-10-07 15:49:32302 const Referrer& referrer) override;
[email protected]aa4f3972012-03-01 18:12:12303 virtual void GenerateMHTML(
[email protected]2dec8ec2013-02-07 19:20:34304 const base::FilePath& file,
[email protected]18516cf92013-08-28 18:19:48305 const base::Callback<void(int64)>& callback)
anand.ratn120b0b002014-10-07 15:49:32306 override;
307 virtual const std::string& GetContentsMimeType() const override;
308 virtual bool WillNotifyDisconnection() const override;
309 virtual void SetOverrideEncoding(const std::string& encoding) override;
310 virtual void ResetOverrideEncoding() override;
311 virtual RendererPreferences* GetMutableRendererPrefs() override;
312 virtual void Close() override;
313 virtual void SystemDragEnded() override;
314 virtual void UserGestureDone() override;
315 virtual void SetClosedByUserGesture(bool value) override;
316 virtual bool GetClosedByUserGesture() const override;
317 virtual void ViewSource() override;
[email protected]0bfbf882011-12-22 18:19:27318 virtual void ViewFrameSource(const GURL& url,
anand.ratn120b0b002014-10-07 15:49:32319 const PageState& page_state) override;
320 virtual int GetMinimumZoomPercent() const override;
321 virtual int GetMaximumZoomPercent() const override;
322 virtual gfx::Size GetPreferredSize() const override;
323 virtual bool GotResponseToLockMouseRequest(bool allowed) override;
324 virtual bool HasOpener() const override;
325 virtual void DidChooseColorInColorChooser(SkColor color) override;
326 virtual void DidEndColorChooser() override;
[email protected]41225fe2013-03-29 05:32:02327 virtual int DownloadImage(const GURL& url,
328 bool is_favicon,
[email protected]263cb08f2013-09-18 00:26:30329 uint32_t max_bitmap_size,
anand.ratn120b0b002014-10-07 15:49:32330 const ImageDownloadCallback& callback) override;
331 virtual bool IsSubframe() const override;
[email protected]36ec24f2014-01-09 00:32:08332 virtual void Find(int request_id,
333 const base::string16& search_text,
anand.ratn120b0b002014-10-07 15:49:32334 const blink::WebFindOptions& options) override;
335 virtual void StopFinding(StopFindAction action) override;
336 virtual void InsertCSS(const std::string& css) override;
337 virtual bool WasRecentlyAudible() override;
338 virtual void GetManifest(const GetManifestCallback&) override;
[email protected]155c7f22013-12-09 17:07:18339#if defined(OS_ANDROID)
340 virtual base::android::ScopedJavaLocalRef<jobject> GetJavaWebContents()
anand.ratn120b0b002014-10-07 15:49:32341 override;
[email protected]0e813a52014-08-13 10:34:56342 virtual WebContentsAndroid* GetWebContentsAndroid();
[email protected]fc2b46b2014-05-03 16:33:45343#elif defined(OS_MACOSX)
anand.ratn120b0b002014-10-07 15:49:32344 virtual void SetAllowOtherViews(bool allow) override;
345 virtual bool GetAllowOtherViews() override;
[email protected]155c7f22013-12-09 17:07:18346#endif
[email protected]0bfbf882011-12-22 18:19:27347
348 // Implementation of PageNavigator.
anand.ratn120b0b002014-10-07 15:49:32349 virtual WebContents* OpenURL(const OpenURLParams& params) override;
[email protected]151a63d2011-12-20 22:32:52350
[email protected]6b618e62012-08-16 12:59:18351 // Implementation of IPC::Sender.
anand.ratn120b0b002014-10-07 15:49:32352 virtual bool Send(IPC::Message* message) override;
[email protected]6b618e62012-08-16 12:59:18353
[email protected]92404c62013-12-04 16:40:46354 // RenderFrameHostDelegate ---------------------------------------------------
[email protected]f114fa42013-12-06 17:06:44355 virtual bool OnMessageReceived(RenderFrameHost* render_frame_host,
anand.ratn120b0b002014-10-07 15:49:32356 const IPC::Message& message) override;
357 virtual const GURL& GetMainFrameLastCommittedURL() const override;
358 virtual void RenderFrameCreated(RenderFrameHost* render_frame_host) override;
359 virtual void RenderFrameDeleted(RenderFrameHost* render_frame_host) override;
[email protected]e3b10d12014-03-28 16:06:09360 virtual void DidStartLoading(RenderFrameHost* render_frame_host,
anand.ratn120b0b002014-10-07 15:49:32361 bool to_different_document) override;
362 virtual void SwappedOut(RenderFrameHost* render_frame_host) override;
[email protected]6f2ac772014-07-24 22:22:08363 virtual void DidDeferAfterResponseStarted(
anand.ratn120b0b002014-10-07 15:49:32364 const TransitionLayerData& transition_data) override;
365 virtual bool WillHandleDeferAfterResponseStarted() override;
366 virtual void WorkerCrashed(RenderFrameHost* render_frame_host) override;
[email protected]a09d53ce2014-01-31 00:46:42367 virtual void ShowContextMenu(RenderFrameHost* render_frame_host,
anand.ratn120b0b002014-10-07 15:49:32368 const ContextMenuParams& params) override;
[email protected]39f2f9252014-05-03 00:54:01369 virtual void RunJavaScriptMessage(RenderFrameHost* render_frame_host,
[email protected]87de04b02014-04-08 22:14:49370 const base::string16& message,
371 const base::string16& default_prompt,
372 const GURL& frame_url,
373 JavaScriptMessageType type,
anand.ratn120b0b002014-10-07 15:49:32374 IPC::Message* reply_msg) override;
[email protected]39f2f9252014-05-03 00:54:01375 virtual void RunBeforeUnloadConfirm(RenderFrameHost* render_frame_host,
[email protected]87de04b02014-04-08 22:14:49376 const base::string16& message,
377 bool is_reload,
anand.ratn120b0b002014-10-07 15:49:32378 IPC::Message* reply_msg) override;
379 virtual void DidAccessInitialDocument() override;
380 virtual void DidDisownOpener(RenderFrameHost* render_frame_host) override;
[email protected]50279492014-05-05 23:24:29381 virtual void DocumentOnLoadCompleted(
anand.ratn120b0b002014-10-07 15:49:32382 RenderFrameHost* render_frame_host) override;
[email protected]ef3adfc2014-05-11 00:04:54383 virtual void UpdateTitle(RenderFrameHost* render_frame_host,
384 int32 page_id,
385 const base::string16& title,
anand.ratn120b0b002014-10-07 15:49:32386 base::i18n::TextDirection title_direction) override;
[email protected]ef3adfc2014-05-11 00:04:54387 virtual void UpdateEncoding(RenderFrameHost* render_frame_host,
anand.ratn120b0b002014-10-07 15:49:32388 const std::string& encoding) override;
389 virtual WebContents* GetAsWebContents() override;
390 virtual bool IsNeverVisible() override;
391 virtual AccessibilityMode GetAccessibilityMode() const override;
[email protected]95640212014-07-26 18:14:30392 virtual void AccessibilityEventReceived(
anand.ratn120b0b002014-10-07 15:49:32393 const std::vector<AXEventNotificationDetails>& details) override;
dmazzonia656928e2014-09-15 20:28:54394 virtual RenderFrameHost* GetGuestByInstanceID(int browser_plugin_instance_id)
anand.ratn120b0b002014-10-07 15:49:32395 override;
[email protected]95640212014-07-26 18:14:30396#if defined(OS_WIN)
anand.ratn120b0b002014-10-07 15:49:32397 virtual gfx::NativeViewAccessible GetParentNativeViewAccessible() override;
[email protected]95640212014-07-26 18:14:30398#endif
[email protected]952a68e2011-11-17 00:36:10399
[email protected]92404c62013-12-04 16:40:46400 // RenderViewHostDelegate ----------------------------------------------------
anand.ratn120b0b002014-10-07 15:49:32401 virtual RenderViewHostDelegateView* GetDelegateView() override;
[email protected]8ff00d72012-10-23 19:12:21402 virtual bool OnMessageReceived(RenderViewHost* render_view_host,
anand.ratn120b0b002014-10-07 15:49:32403 const IPC::Message& message) override;
[email protected]a86c0e962013-12-17 17:10:39404 // RenderFrameHostDelegate has the same method, so list it there because this
405 // interface is going away.
anand.ratn120b0b002014-10-07 15:49:32406 // virtual WebContents* GetAsWebContents() override;
407 virtual gfx::Rect GetRootWindowResizerRect() const override;
408 virtual void RenderViewCreated(RenderViewHost* render_view_host) override;
409 virtual void RenderViewReady(RenderViewHost* render_view_host) override;
[email protected]ec6a7eb2013-04-22 17:34:22410 virtual void RenderViewTerminated(RenderViewHost* render_view_host,
411 base::TerminationStatus status,
anand.ratn120b0b002014-10-07 15:49:32412 int error_code) override;
413 virtual void RenderViewDeleted(RenderViewHost* render_view_host) override;
[email protected]8ff00d72012-10-23 19:12:21414 virtual void UpdateState(RenderViewHost* render_view_host,
[email protected]952a68e2011-11-17 00:36:10415 int32 page_id,
anand.ratn120b0b002014-10-07 15:49:32416 const PageState& page_state) override;
417 virtual void UpdateTargetURL(const GURL& url) override;
418 virtual void Close(RenderViewHost* render_view_host) override;
419 virtual void RequestMove(const gfx::Rect& new_bounds) override;
420 virtual void DidCancelLoading() override;
[email protected]87717d0e2012-04-26 02:58:43421 virtual void DocumentAvailableInMainFrame(
anand.ratn120b0b002014-10-07 15:49:32422 RenderViewHost* render_view_host) override;
423 virtual void RouteCloseEvent(RenderViewHost* rvh) override;
[email protected]f546640b2012-05-15 00:03:49424 virtual void RouteMessageEvent(
[email protected]8ff00d72012-10-23 19:12:21425 RenderViewHost* rvh,
anand.ratn120b0b002014-10-07 15:49:32426 const ViewMsg_PostMessage_Params& params) override;
[email protected]a796f202012-05-30 14:14:25427 virtual bool AddMessageToConsole(int32 level,
[email protected]fcf75d42013-12-03 20:11:26428 const base::string16& message,
[email protected]a796f202012-05-30 14:14:25429 int32 line_no,
anand.ratn120b0b002014-10-07 15:49:32430 const base::string16& source_id) override;
[email protected]8ff00d72012-10-23 19:12:21431 virtual RendererPreferences GetRendererPrefs(
anand.ratn120b0b002014-10-07 15:49:32432 BrowserContext* browser_context) const override;
433 virtual WebPreferences ComputeWebkitPrefs() override;
434 virtual void OnUserGesture() override;
435 virtual void OnIgnoredUIEvent() override;
436 virtual void RendererUnresponsive(RenderViewHost* render_view_host) override;
437 virtual void RendererResponsive(RenderViewHost* render_view_host) override;
[email protected]952a68e2011-11-17 00:36:10438 virtual void LoadStateChanged(const GURL& url,
439 const net::LoadStateWithParam& load_state,
440 uint64 upload_position,
anand.ratn120b0b002014-10-07 15:49:32441 uint64 upload_size) override;
442 virtual void Activate() override;
443 virtual void Deactivate() override;
444 virtual void LostCapture() override;
445 virtual void HandleMouseDown() override;
446 virtual void HandleMouseUp() override;
447 virtual void HandlePointerActivate() override;
448 virtual void HandleGestureBegin() override;
449 virtual void HandleGestureEnd() override;
[email protected]edc64de2011-11-17 20:07:38450 virtual void RunFileChooser(
[email protected]8ff00d72012-10-23 19:12:21451 RenderViewHost* render_view_host,
anand.ratn120b0b002014-10-07 15:49:32452 const FileChooserParams& params) override;
453 virtual void ToggleFullscreenMode(bool enter_fullscreen) override;
454 virtual bool IsFullscreenForCurrentTab() const override;
455 virtual void UpdatePreferredSize(const gfx::Size& pref_size) override;
456 virtual void ResizeDueToAutoResize(const gfx::Size& new_size) override;
[email protected]a9c81f02012-06-01 00:15:44457 virtual void RequestToLockMouse(bool user_gesture,
anand.ratn120b0b002014-10-07 15:49:32458 bool last_unlocked_by_target) override;
459 virtual void LostMouseLock() override;
[email protected]bafe6cd2012-05-23 23:09:50460 virtual void CreateNewWindow(
[email protected]04cbd3d2013-12-04 04:58:20461 int render_process_id,
[email protected]bafe6cd2012-05-23 23:09:50462 int route_id,
[email protected]227692c52013-05-31 22:43:04463 int main_frame_route_id,
[email protected]97714c82012-06-06 10:15:13464 const ViewHostMsg_CreateWindow_Params& params,
anand.ratn120b0b002014-10-07 15:49:32465 SessionStorageNamespace* session_storage_namespace) override;
[email protected]a8504022013-12-04 20:23:51466 virtual void CreateNewWidget(int render_process_id,
467 int route_id,
anand.ratn120b0b002014-10-07 15:49:32468 blink::WebPopupType popup_type) override;
[email protected]a8504022013-12-04 20:23:51469 virtual void CreateNewFullscreenWidget(int render_process_id,
anand.ratn120b0b002014-10-07 15:49:32470 int route_id) override;
[email protected]bafe6cd2012-05-23 23:09:50471 virtual void ShowCreatedWindow(int route_id,
472 WindowOpenDisposition disposition,
473 const gfx::Rect& initial_pos,
anand.ratn120b0b002014-10-07 15:49:32474 bool user_gesture) override;
[email protected]bafe6cd2012-05-23 23:09:50475 virtual void ShowCreatedWidget(int route_id,
anand.ratn120b0b002014-10-07 15:49:32476 const gfx::Rect& initial_pos) override;
477 virtual void ShowCreatedFullscreenWidget(int route_id) override;
[email protected]f13b4202012-06-12 23:53:23478 virtual void RequestMediaAccessPermission(
[email protected]33662e52013-01-07 21:31:09479 const MediaStreamRequest& request,
anand.ratn120b0b002014-10-07 15:49:32480 const MediaResponseCallback& callback) override;
grunell657d4d82014-09-18 00:09:43481 virtual bool CheckMediaAccessPermission(const GURL& security_origin,
anand.ratn120b0b002014-10-07 15:49:32482 MediaStreamType type) override;
[email protected]cc9200432013-07-23 23:02:40483 virtual SessionStorageNamespace* GetSessionStorageNamespace(
anand.ratn120b0b002014-10-07 15:49:32484 SiteInstance* instance) override;
485 virtual SessionStorageNamespaceMap GetSessionStorageNamespaceMap() override;
486 virtual FrameTree* GetFrameTree() override;
[email protected]952a68e2011-11-17 00:36:10487
[email protected]52913802013-12-10 05:52:18488 // NavigatorDelegate ---------------------------------------------------------
489
490 virtual void DidStartProvisionalLoad(
491 RenderFrameHostImpl* render_frame_host,
[email protected]52913802013-12-10 05:52:18492 const GURL& validated_url,
493 bool is_error_page,
anand.ratn120b0b002014-10-07 15:49:32494 bool is_iframe_srcdoc) override;
[email protected]0c3c54f2014-07-31 01:29:00495 virtual void DidStartNavigationTransition(
anand.ratn120b0b002014-10-07 15:49:32496 RenderFrameHostImpl* render_frame_host) override;
[email protected]3109fbb72014-01-06 23:57:15497 virtual void DidFailProvisionalLoadWithError(
498 RenderFrameHostImpl* render_frame_host,
499 const FrameHostMsg_DidFailProvisionalLoadWithError_Params& params)
anand.ratn120b0b002014-10-07 15:49:32500 override;
[email protected]b80624c2014-02-09 02:46:55501 virtual void DidFailLoadWithError(
502 RenderFrameHostImpl* render_frame_host,
[email protected]b80624c2014-02-09 02:46:55503 const GURL& url,
[email protected]b80624c2014-02-09 02:46:55504 int error_code,
anand.ratn120b0b002014-10-07 15:49:32505 const base::string16& error_description) override;
[email protected]37567b432014-02-12 01:12:22506 virtual void DidCommitProvisionalLoad(
[email protected]27dd82fd2014-03-03 22:11:43507 RenderFrameHostImpl* render_frame_host,
[email protected]37567b432014-02-12 01:12:22508 const GURL& url,
anand.ratn120b0b002014-10-07 15:49:32509 ui::PageTransition transition_type) override;
[email protected]0d0f4c492014-04-02 06:42:57510 virtual void DidNavigateMainFramePreCommit(
anand.ratn120b0b002014-10-07 15:49:32511 bool navigation_is_within_page) override;
[email protected]37567b432014-02-12 01:12:22512 virtual void DidNavigateMainFramePostCommit(
513 const LoadCommittedDetails& details,
anand.ratn120b0b002014-10-07 15:49:32514 const FrameHostMsg_DidCommitProvisionalLoad_Params& params) override;
[email protected]37567b432014-02-12 01:12:22515 virtual void DidNavigateAnyFramePostCommit(
516 RenderFrameHostImpl* render_frame_host,
517 const LoadCommittedDetails& details,
anand.ratn120b0b002014-10-07 15:49:32518 const FrameHostMsg_DidCommitProvisionalLoad_Params& params) override;
519 virtual void SetMainFrameMimeType(const std::string& mime_type) override;
520 virtual bool CanOverscrollContent() const override;
[email protected]52913802013-12-10 05:52:18521 virtual void NotifyChangedNavigationState(
anand.ratn120b0b002014-10-07 15:49:32522 InvalidateTypes changed_flags) override;
[email protected]3691e5cf2014-01-22 10:16:20523 virtual void AboutToNavigateRenderFrame(
anand.ratn120b0b002014-10-07 15:49:32524 RenderFrameHostImpl* render_frame_host) override;
[email protected]3691e5cf2014-01-22 10:16:20525 virtual void DidStartNavigationToPendingEntry(
526 RenderFrameHostImpl* render_frame_host,
527 const GURL& url,
anand.ratn120b0b002014-10-07 15:49:32528 NavigationController::ReloadType reload_type) override;
[email protected]8cb834e2014-03-06 14:23:23529 virtual void RequestOpenURL(RenderFrameHostImpl* render_frame_host,
anand.ratn120b0b002014-10-07 15:49:32530 const OpenURLParams& params) override;
531 virtual bool ShouldPreserveAbortedURLs() override;
[email protected]52913802013-12-10 05:52:18532
[email protected]4ca76c02012-05-16 16:19:05533 // RenderWidgetHostDelegate --------------------------------------------------
534
[email protected]b24b68a2012-09-24 21:57:26535 virtual void RenderWidgetDeleted(
anand.ratn120b0b002014-10-07 15:49:32536 RenderWidgetHostImpl* render_widget_host) override;
[email protected]b87ee522012-05-18 15:16:54537 virtual bool PreHandleKeyboardEvent(
[email protected]8ff00d72012-10-23 19:12:21538 const NativeWebKeyboardEvent& event,
anand.ratn120b0b002014-10-07 15:49:32539 bool* is_keyboard_shortcut) override;
[email protected]4ca76c02012-05-16 16:19:05540 virtual void HandleKeyboardEvent(
anand.ratn120b0b002014-10-07 15:49:32541 const NativeWebKeyboardEvent& event) override;
[email protected]d92026ef2014-03-03 21:04:13542 virtual bool HandleWheelEvent(
anand.ratn120b0b002014-10-07 15:49:32543 const blink::WebMouseWheelEvent& event) override;
[email protected]04bce562014-01-30 05:34:54544 virtual bool PreHandleGestureEvent(
anand.ratn120b0b002014-10-07 15:49:32545 const blink::WebGestureEvent& event) override;
[email protected]bab38af2014-03-30 17:37:29546 virtual bool HandleGestureEvent(
anand.ratn120b0b002014-10-07 15:49:32547 const blink::WebGestureEvent& event) override;
548 virtual void DidSendScreenRects(RenderWidgetHostImpl* rwh) override;
[email protected]95640212014-07-26 18:14:30549 virtual BrowserAccessibilityManager* GetRootBrowserAccessibilityManager()
anand.ratn120b0b002014-10-07 15:49:32550 override;
[email protected]95640212014-07-26 18:14:30551 virtual BrowserAccessibilityManager*
anand.ratn120b0b002014-10-07 15:49:32552 GetOrCreateRootBrowserAccessibilityManager() override;
[email protected]4ca76c02012-05-16 16:19:05553
[email protected]b0936d22013-11-28 06:47:36554 // RenderFrameHostManager::Delegate ------------------------------------------
[email protected]0bfbf882011-12-22 18:19:27555
556 virtual bool CreateRenderViewForRenderManager(
[email protected]bffc8302014-01-23 20:52:16557 RenderViewHost* render_view_host,
558 int opener_route_id,
[email protected]5a7100d2014-05-19 01:29:04559 int proxy_routing_id,
anand.ratn120b0b002014-10-07 15:49:32560 bool for_main_frame_navigation) override;
[email protected]82307f6b2014-08-07 03:30:12561 virtual bool CreateRenderFrameForRenderManager(
562 RenderFrameHost* render_frame_host,
anand.ratn120b0b002014-10-07 15:49:32563 int parent_routing_id) override;
[email protected]0bfbf882011-12-22 18:19:27564 virtual void BeforeUnloadFiredFromRenderManager(
[email protected]feaded02012-09-25 19:12:55565 bool proceed, const base::TimeTicks& proceed_time,
anand.ratn120b0b002014-10-07 15:49:32566 bool* proceed_to_fire_unload) override;
[email protected]58d5cfe2013-07-10 02:40:52567 virtual void RenderProcessGoneFromRenderManager(
anand.ratn120b0b002014-10-07 15:49:32568 RenderViewHost* render_view_host) override;
569 virtual void UpdateRenderViewSizeForRenderManager() override;
570 virtual void CancelModalDialogsForRenderManager() override;
[email protected]02d7b6e2014-06-24 21:01:50571 virtual void NotifySwappedFromRenderManager(RenderFrameHost* old_host,
572 RenderFrameHost* new_host,
anand.ratn120b0b002014-10-07 15:49:32573 bool is_main_frame) override;
[email protected]14392a52012-05-02 20:28:44574 virtual int CreateOpenerRenderViewsForRenderManager(
anand.ratn120b0b002014-10-07 15:49:32575 SiteInstance* instance) override;
[email protected]8ff00d72012-10-23 19:12:21576 virtual NavigationControllerImpl&
anand.ratn120b0b002014-10-07 15:49:32577 GetControllerForRenderManager() override;
578 virtual WebUIImpl* CreateWebUIForRenderManager(const GURL& url) override;
[email protected]8ff00d72012-10-23 19:12:21579 virtual NavigationEntry*
anand.ratn120b0b002014-10-07 15:49:32580 GetLastCommittedNavigationEntryForRenderManager() override;
581 virtual bool FocusLocationBarByDefault() override;
582 virtual void SetFocusToLocationBar(bool select_all) override;
583 virtual void CreateViewAndSetSizeForRVH(RenderViewHost* rvh) override;
584 virtual bool IsHidden() override;
[email protected]0bfbf882011-12-22 18:19:27585
[email protected]8ff00d72012-10-23 19:12:21586 // NotificationObserver ------------------------------------------------------
[email protected]14392a52012-05-02 20:28:44587
588 virtual void Observe(int type,
[email protected]8ff00d72012-10-23 19:12:21589 const NotificationSource& source,
anand.ratn120b0b002014-10-07 15:49:32590 const NotificationDetails& details) override;
[email protected]14392a52012-05-02 20:28:44591
[email protected]ec6c05f2013-10-23 18:41:57592 // NavigationControllerDelegate ----------------------------------------------
593
anand.ratn120b0b002014-10-07 15:49:32594 virtual WebContents* GetWebContents() override;
[email protected]ec6c05f2013-10-23 18:41:57595 virtual void NotifyNavigationEntryCommitted(
anand.ratn120b0b002014-10-07 15:49:32596 const LoadCommittedDetails& load_details) override;
[email protected]ec6c05f2013-10-23 18:41:57597
598 // Invoked before a form repost warning is shown.
anand.ratn120b0b002014-10-07 15:49:32599 virtual void NotifyBeforeFormRepostWarningShow() override;
[email protected]ec6c05f2013-10-23 18:41:57600
601 // Activate this WebContents and show a form repost warning.
anand.ratn120b0b002014-10-07 15:49:32602 virtual void ActivateAndShowRepostFormWarningDialog() override;
[email protected]ec6c05f2013-10-23 18:41:57603
[email protected]b4c84012014-04-28 19:51:10604 // Whether the initial empty page of this view has been accessed by another
605 // page, making it unsafe to show the pending URL. Always false after the
606 // first commit.
anand.ratn120b0b002014-10-07 15:49:32607 virtual bool HasAccessedInitialDocument() override;
[email protected]b4c84012014-04-28 19:51:10608
[email protected]ec6c05f2013-10-23 18:41:57609 // Updates the max page ID for the current SiteInstance in this
610 // WebContentsImpl to be at least |page_id|.
anand.ratn120b0b002014-10-07 15:49:32611 virtual void UpdateMaxPageID(int32 page_id) override;
[email protected]ec6c05f2013-10-23 18:41:57612
613 // Updates the max page ID for the given SiteInstance in this WebContentsImpl
614 // to be at least |page_id|.
615 virtual void UpdateMaxPageIDForSiteInstance(SiteInstance* site_instance,
anand.ratn120b0b002014-10-07 15:49:32616 int32 page_id) override;
[email protected]ec6c05f2013-10-23 18:41:57617
618 // Copy the current map of SiteInstance ID to max page ID from another tab.
619 // This is necessary when this tab adopts the NavigationEntries from
620 // |web_contents|.
anand.ratn120b0b002014-10-07 15:49:32621 virtual void CopyMaxPageIDsFrom(WebContents* web_contents) override;
[email protected]ec6c05f2013-10-23 18:41:57622
623 // Called by the NavigationController to cause the WebContentsImpl to navigate
624 // to the current pending entry. The NavigationController should be called
625 // back with RendererDidNavigate on success or DiscardPendingEntry on failure.
626 // The callbacks can be inside of this function, or at some future time.
627 //
628 // The entry has a PageID of -1 if newly created (corresponding to navigation
629 // to a new URL).
630 //
631 // If this method returns false, then the navigation is discarded (equivalent
632 // to calling DiscardPendingEntry on the NavigationController).
633 virtual bool NavigateToPendingEntry(
anand.ratn120b0b002014-10-07 15:49:32634 NavigationController::ReloadType reload_type) override;
[email protected]ec6c05f2013-10-23 18:41:57635
636 // Sets the history for this WebContentsImpl to |history_length| entries, and
637 // moves the current page_id to the last entry in the list if it's valid.
638 // This is mainly used when a prerendered page is swapped into the current
639 // tab. The method is virtual for testing.
640 virtual void SetHistoryLengthAndPrune(
641 const SiteInstance* site_instance,
642 int merge_history_length,
anand.ratn120b0b002014-10-07 15:49:32643 int32 minimum_page_id) override;
[email protected]553602e12011-04-05 17:01:18644
[email protected]a86c0e962013-12-17 17:10:39645 // Called by InterstitialPageImpl when it creates a RenderFrameHost.
646 virtual void RenderFrameForInterstitialPageCreated(
anand.ratn120b0b002014-10-07 15:49:32647 RenderFrameHost* render_frame_host) override;
[email protected]561628ce2013-10-25 00:56:47648
649 // Sets the passed interstitial as the currently showing interstitial.
650 // No interstitial page should already be attached.
651 virtual void AttachInterstitialPage(
anand.ratn120b0b002014-10-07 15:49:32652 InterstitialPageImpl* interstitial_page) override;
[email protected]561628ce2013-10-25 00:56:47653
654 // Unsets the currently showing interstitial.
anand.ratn120b0b002014-10-07 15:49:32655 virtual void DetachInterstitialPage() override;
[email protected]561628ce2013-10-25 00:56:47656
657 // Changes the IsLoading state and notifies the delegate as needed.
658 // |details| is used to provide details on the load that just finished
659 // (but can be null if not applicable).
660 virtual void SetIsLoading(RenderViewHost* render_view_host,
661 bool is_loading,
[email protected]e3b10d12014-03-28 16:06:09662 bool to_different_document,
anand.ratn120b0b002014-10-07 15:49:32663 LoadNotificationDetails* details) override;
[email protected]561628ce2013-10-25 00:56:47664
[email protected]e4abd3b42013-11-12 18:28:47665 typedef base::Callback<void(WebContents*)> CreatedCallback;
[email protected]561628ce2013-10-25 00:56:47666
[email protected]959be4c2014-04-08 15:01:33667 // Requests the renderer to select the region between two points in the
668 // currently focused frame.
669 void SelectRange(const gfx::Point& start, const gfx::Point& end);
670
[email protected]23f41fd2014-06-21 05:29:17671 // Notifies the main frame that it can continue navigation (if it was deferred
672 // immediately at first response).
673 void ResumeResponseDeferredAtStart();
674
[email protected]34ff1cfc2014-08-20 06:16:05675 // Forces overscroll to be disabled (used by touch emulation).
676 void SetForceDisableOverscrollContent(bool force_disable);
677
dalecurtisbc6572e12014-09-12 19:22:30678 AudioStreamMonitor* audio_stream_monitor() {
679 return &audio_stream_monitor_;
680 }
681
682 bool has_audio_power_save_blocker_for_testing() const {
683 return audio_power_save_blocker_;
684 }
685
686 bool has_video_power_save_blocker_for_testing() const {
687 return video_power_save_blocker_;
688 }
689
[email protected]0dd3a0ab2011-02-18 08:17:44690 private:
[email protected]e4abd3b42013-11-12 18:28:47691 friend class TestNavigationObserver;
[email protected]3d1dc3a2014-05-17 17:17:26692 friend class WebContentsAddedObserver;
[email protected]8ff00d72012-10-23 19:12:21693 friend class WebContentsObserver;
694 friend class WebContents; // To implement factory methods.
[email protected]0dd3a0ab2011-02-18 08:17:44695
[email protected]2db9bd72012-04-13 20:20:56696 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, NoJSMessageOnInterstitials);
697 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, UpdateTitle);
[email protected]45a22ad2013-02-21 03:25:00698 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, FindOpenerRVHWhenPending);
[email protected]2db9bd72012-04-13 20:20:56699 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest,
700 CrossSiteCantPreemptAfterUnload);
[email protected]ceee8cd2013-03-08 04:59:51701 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, PendingContents);
[email protected]50904452013-05-09 02:05:12702 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, FrameTreeShape);
[email protected]9a890452014-02-13 22:21:02703 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, GetLastActiveTime);
[email protected]0dd3a0ab2011-02-18 08:17:44704 FRIEND_TEST_ALL_PREFIXES(FormStructureBrowserTest, HTMLFiles);
705 FRIEND_TEST_ALL_PREFIXES(NavigationControllerTest, HistoryNavigate);
[email protected]b0936d22013-11-28 06:47:36706 FRIEND_TEST_ALL_PREFIXES(RenderFrameHostManagerTest, PageDoesBackAndReload);
[email protected]de3c5d82014-05-28 22:12:59707 FRIEND_TEST_ALL_PREFIXES(SitePerProcessBrowserTest, CrossSiteIframe);
dmazzoni0b5d2482014-09-10 19:45:57708 FRIEND_TEST_ALL_PREFIXES(SitePerProcessAccessibilityBrowserTest,
709 CrossSiteIframeAccessibility);
[email protected]0dd3a0ab2011-02-18 08:17:44710
[email protected]cadaec52012-02-08 21:53:13711 // So InterstitialPageImpl can access SetIsLoading.
712 friend class InterstitialPageImpl;
[email protected]0dd3a0ab2011-02-18 08:17:44713
[email protected]80e776ae2012-03-23 16:17:20714 // TODO(brettw) TestWebContents shouldn't exist!
[email protected]8ff00d72012-10-23 19:12:21715 friend class TestWebContents;
[email protected]0dd3a0ab2011-02-18 08:17:44716
[email protected]7fff43e2013-05-21 20:21:10717 class DestructionObserver;
718
[email protected]d1198fd2012-08-13 22:50:19719 // See WebContents::Create for a description of these parameters.
[email protected]8ff00d72012-10-23 19:12:21720 WebContentsImpl(BrowserContext* browser_context,
[email protected]d1198fd2012-08-13 22:50:19721 WebContentsImpl* opener);
722
[email protected]e2225bf2013-11-15 16:09:38723 // Add and remove observers for page navigation notifications. The order in
724 // which notifications are sent to observers is undefined. Clients must be
725 // sure to remove the observer before they go away.
[email protected]8ff00d72012-10-23 19:12:21726 void AddObserver(WebContentsObserver* observer);
727 void RemoveObserver(WebContentsObserver* observer);
[email protected]d1198fd2012-08-13 22:50:19728
[email protected]14392a52012-05-02 20:28:44729 // Clears this tab's opener if it has been closed.
[email protected]7fff43e2013-05-21 20:21:10730 void OnWebContentsDestroyed(WebContentsImpl* web_contents);
731
732 // Creates and adds to the map a destruction observer watching |web_contents|.
733 // No-op if such an observer already exists.
734 void AddDestructionObserver(WebContentsImpl* web_contents);
735
736 // Deletes and removes from the map a destruction observer
737 // watching |web_contents|. No-op if there is no such observer.
738 void RemoveDestructionObserver(WebContentsImpl* web_contents);
[email protected]14392a52012-05-02 20:28:44739
[email protected]de3c5d82014-05-28 22:12:59740 // Traverses all the RenderFrameHosts in the FrameTree and creates a set
[email protected]948481d2014-06-11 18:32:22741 // all the unique RenderWidgetHostViews.
742 std::set<RenderWidgetHostView*> GetRenderWidgetHostViewsInTree();
[email protected]de3c5d82014-05-28 22:12:59743
[email protected]6fba26d2014-04-29 09:38:28744 // Callback function when showing JavaScript dialogs. Takes in a routing ID
745 // pair to identify the RenderFrameHost that opened the dialog, because it's
746 // possible for the RenderFrameHost to be deleted by the time this is called.
747 void OnDialogClosed(int render_process_id,
748 int render_frame_id,
[email protected]51da7e32012-01-30 19:24:52749 IPC::Message* reply_msg,
[email protected]87de04b02014-04-08 22:14:49750 bool dialog_was_suppressed,
[email protected]51da7e32012-01-30 19:24:52751 bool success,
[email protected]fcf75d42013-12-03 20:11:26752 const base::string16& user_input);
[email protected]51da7e32012-01-30 19:24:52753
[email protected]d8415ad92012-08-23 14:40:50754 // Callback function when requesting permission to access the PPAPI broker.
755 // |result| is true if permission was granted.
[email protected]ea0309c2013-08-06 19:35:44756 void OnPpapiBrokerPermissionResult(int routing_id, bool result);
[email protected]d8415ad92012-08-23 14:40:50757
[email protected]f114fa42013-12-06 17:06:44758 bool OnMessageReceived(RenderViewHost* render_view_host,
759 RenderFrameHost* render_frame_host,
760 const IPC::Message& message);
761
[email protected]d0759f492012-04-19 22:50:50762 // IPC message handlers.
[email protected]37b64c52014-07-11 21:14:05763 void OnThemeColorChanged(SkColor theme_color);
[email protected]0dd3a0ab2011-02-18 08:17:44764 void OnDidLoadResourceFromMemoryCache(const GURL& url,
[email protected]70435962011-08-02 20:13:28765 const std::string& security_info,
766 const std::string& http_request,
[email protected]6d6cfb3a2012-05-23 22:53:18767 const std::string& mime_type,
[email protected]6c1e05212014-07-31 00:59:40768 ResourceType resource_type);
[email protected]0dd3a0ab2011-02-18 08:17:44769 void OnDidDisplayInsecureContent();
770 void OnDidRunInsecureContent(const std::string& security_origin,
771 const GURL& target_url);
[email protected]501052ff2014-02-21 22:19:07772 void OnDocumentLoadedInFrame();
[email protected]61ac9e242014-03-21 20:55:26773 void OnDidFinishLoad(const GURL& url);
[email protected]960b0372014-05-19 18:01:00774 void OnDidStartLoading(bool to_different_document);
775 void OnDidStopLoading();
776 void OnDidChangeLoadProgress(double load_progress);
[email protected]0dd3a0ab2011-02-18 08:17:44777 void OnGoToEntryAtOffset(int offset);
[email protected]216813952011-05-19 22:21:26778 void OnUpdateZoomLimits(int minimum_percent,
[email protected]fce823222014-05-30 16:24:30779 int maximum_percent);
[email protected]2dec8ec2013-02-07 19:20:34780 void OnEnumerateDirectory(int request_id, const base::FilePath& path);
[email protected]b7a756d42012-01-23 18:08:17781
[email protected]7d189022011-08-25 22:54:20782 void OnRegisterProtocolHandler(const std::string& protocol,
783 const GURL& url,
[email protected]fcf75d42013-12-03 20:11:26784 const base::string16& title,
[email protected]3a3b75a2012-06-01 08:38:36785 bool user_gesture);
[email protected]f5273e52014-07-14 16:30:20786 void OnUnregisterProtocolHandler(const std::string& protocol,
787 const GURL& url,
788 bool user_gesture);
[email protected]59363fc92012-09-05 03:46:31789 void OnFindReply(int request_id,
790 int number_of_matches,
791 const gfx::Rect& selection_rect,
792 int active_match_ordinal,
[email protected]b888919c2011-09-02 00:32:16793 bool final_update);
[email protected]59363fc92012-09-05 03:46:31794#if defined(OS_ANDROID)
795 void OnFindMatchRectsReply(int version,
796 const std::vector<gfx::RectF>& rects,
797 const gfx::RectF& active_rect);
[email protected]583418cc2013-01-17 14:01:10798
[email protected]1ff427972013-02-07 21:14:07799 void OnOpenDateTimeDialog(
800 const ViewHostMsg_DateTimeDialogValue_Params& value);
[email protected]59363fc92012-09-05 03:46:31801#endif
[email protected]f114fa42013-12-06 17:06:44802 void OnPepperPluginHung(int plugin_child_id,
803 const base::FilePath& path,
804 bool is_hung);
805 void OnPluginCrashed(const base::FilePath& plugin_path,
[email protected]2dec8ec2013-02-07 19:20:34806 base::ProcessId plugin_pid);
[email protected]cfa856d62014-02-22 07:58:40807 void OnDomOperationResponse(const std::string& json_string,
808 int automation_id);
[email protected]7fc4bbb2011-09-08 21:23:10809 void OnAppCacheAccessed(const GURL& manifest_url, bool blocked_by_policy);
[email protected]8bc5ff02013-11-29 06:34:03810 void OnOpenColorChooser(int color_chooser_id,
811 SkColor color,
812 const std::vector<ColorSuggestion>& suggestions);
[email protected]da8543762012-03-20 08:52:20813 void OnEndColorChooser(int color_chooser_id);
[email protected]55578b0a2012-04-18 14:31:32814 void OnSetSelectedColorInColorChooser(int color_chooser_id, SkColor color);
[email protected]d0759f492012-04-19 22:50:50815 void OnWebUISend(const GURL& source_url,
816 const std::string& name,
817 const base::ListValue& args);
[email protected]ea0309c2013-08-06 19:35:44818 void OnRequestPpapiBrokerPermission(int routing_id,
[email protected]d8415ad92012-08-23 14:40:50819 const GURL& url,
[email protected]2dec8ec2013-02-07 19:20:34820 const base::FilePath& plugin_path);
[email protected]c4538072013-03-18 02:17:55821 void OnBrowserPluginMessage(const IPC::Message& message);
[email protected]41225fe2013-03-29 05:32:02822 void OnDidDownloadImage(int id,
[email protected]749fadd2013-05-15 08:37:48823 int http_status_code,
[email protected]41225fe2013-03-29 05:32:02824 const GURL& image_url,
[email protected]263cb08f2013-09-18 00:26:30825 const std::vector<SkBitmap>& bitmaps,
826 const std::vector<gfx::Size>& original_bitmap_sizes);
[email protected]50279492014-05-05 23:24:29827 void OnUpdateFaviconURL(const std::vector<FaviconURL>& candidates);
828 void OnFirstVisuallyNonEmptyPaint();
[email protected]1dd0bb752014-02-01 01:16:26829 void OnMediaPlayingNotification(int64 player_cookie,
830 bool has_video,
831 bool has_audio);
832 void OnMediaPausedNotification(int64 player_cookie);
[email protected]edc3af82013-12-12 21:24:07833 void OnShowValidationMessage(const gfx::Rect& anchor_in_root_view,
[email protected]6ff9c8f2013-12-20 09:05:29834 const base::string16& main_text,
835 const base::string16& sub_text);
[email protected]edc3af82013-12-12 21:24:07836 void OnHideValidationMessage();
837 void OnMoveValidationMessage(const gfx::Rect& anchor_in_root_view);
838
[email protected]0dd3a0ab2011-02-18 08:17:44839 // Called by derived classes to indicate that we're no longer waiting for a
840 // response. This won't actually update the throbber, but it will get picked
841 // up at the next animation step if the throbber is going.
842 void SetNotWaitingForResponse() { waiting_for_response_ = false; }
843
[email protected]0dd3a0ab2011-02-18 08:17:44844 // Navigation helpers --------------------------------------------------------
845 //
846 // These functions are helpers for Navigate() and DidNavigate().
847
848 // Handles post-navigation tasks in DidNavigate AFTER the entry has been
849 // committed to the navigation controller. Note that the navigation entry is
850 // not provided since it may be invalid/changed after being committed. The
851 // current navigation entry is in the NavigationController at this point.
[email protected]2f7b3c5a2013-06-21 04:59:25852
[email protected]74ce1ad2011-12-16 21:51:46853 // If our controller was restored, update the max page ID associated with the
854 // given RenderViewHost to be larger than the number of restored entries.
855 // This is called in CreateRenderView before any navigations in the RenderView
856 // have begun, to prevent any races in updating RenderView::next_page_id.
[email protected]8ff00d72012-10-23 19:12:21857 void UpdateMaxPageIDIfNecessary(RenderViewHost* rvh);
[email protected]0dd3a0ab2011-02-18 08:17:44858
[email protected]0dd3a0ab2011-02-18 08:17:44859 // Saves the given title to the navigation entry and does associated work. It
860 // will update history and the view for the new title, and also synthesize
861 // titles for file URLs that have none (so we require that the URL of the
862 // entry already be set).
863 //
864 // This is used as the backend for state updates, which include a new title,
865 // or the dedicated set title message. It returns true if the new title is
866 // different and was therefore updated.
[email protected]8ff00d72012-10-23 19:12:21867 bool UpdateTitleForEntry(NavigationEntryImpl* entry,
[email protected]fcf75d42013-12-03 20:11:26868 const base::string16& title);
[email protected]0dd3a0ab2011-02-18 08:17:44869
[email protected]14392a52012-05-02 20:28:44870 // Recursively creates swapped out RenderViews for this tab's opener chain
871 // (including this tab) in the given SiteInstance, allowing other tabs to send
872 // cross-process JavaScript calls to their opener(s). Returns the route ID of
873 // this tab's RenderView for |instance|.
[email protected]8ff00d72012-10-23 19:12:21874 int CreateOpenerRenderViews(SiteInstance* instance);
[email protected]14392a52012-05-02 20:28:44875
[email protected]bafe6cd2012-05-23 23:09:50876 // Helper for CreateNewWidget/CreateNewFullscreenWidget.
[email protected]a8504022013-12-04 20:23:51877 void CreateNewWidget(int render_process_id,
878 int route_id,
[email protected]bafe6cd2012-05-23 23:09:50879 bool is_fullscreen,
[email protected]180ef242013-11-07 06:50:46880 blink::WebPopupType popup_type);
[email protected]bafe6cd2012-05-23 23:09:50881
882 // Helper for ShowCreatedWidget/ShowCreatedFullscreenWidget.
883 void ShowCreatedWidget(int route_id,
884 bool is_fullscreen,
885 const gfx::Rect& initial_pos);
886
887 // Finds the new RenderWidgetHost and returns it. Note that this can only be
888 // called once as this call also removes it from the internal map.
[email protected]8ff00d72012-10-23 19:12:21889 RenderWidgetHostView* GetCreatedWidget(int route_id);
[email protected]bafe6cd2012-05-23 23:09:50890
891 // Finds the new WebContentsImpl by route_id, initializes it for
892 // renderer-initiated creation, and returns it. Note that this can only be
893 // called once as this call also removes it from the internal map.
894 WebContentsImpl* GetCreatedWindow(int route_id);
895
[email protected]960b0372014-05-19 18:01:00896 // Tracking loading progress -------------------------------------------------
897
898 // Resets the tracking state of the current load.
899 void ResetLoadProgressState();
900
901 // Calculates the progress of the current load and notifies the delegate.
902 void SendLoadProgressChanged();
903
904 // Called once when the last frame on the page has stopped loading.
905 void DidStopLoading(RenderFrameHost* render_frame_host);
906
[email protected]0dd3a0ab2011-02-18 08:17:44907 // Misc non-view stuff -------------------------------------------------------
908
909 // Helper functions for sending notifications.
[email protected]02d7b6e2014-06-24 21:01:50910 void NotifyViewSwapped(RenderViewHost* old_host, RenderViewHost* new_host);
911 void NotifyFrameSwapped(RenderFrameHost* old_host, RenderFrameHost* new_host);
[email protected]0dd3a0ab2011-02-18 08:17:44912 void NotifyDisconnected();
913
[email protected]be1f56ab2011-12-22 06:55:31914 void SetEncoding(const std::string& encoding);
915
[email protected]fa944cb82013-11-15 17:51:21916 // TODO(creis): This should take in a FrameTreeNode to know which node's
917 // render manager to return. For now, we just return the root's.
[email protected]b0936d22013-11-28 06:47:36918 RenderFrameHostManager* GetRenderManager() const;
[email protected]fa944cb82013-11-15 17:51:21919
[email protected]8ff00d72012-10-23 19:12:21920 RenderViewHostImpl* GetRenderViewHostImpl();
[email protected]9f76c1e2012-03-05 15:15:58921
[email protected]7a846df2012-09-20 19:17:39922 // Removes browser plugin embedder if there is one.
923 void RemoveBrowserPluginEmbedder();
924
dalecurtisbc6572e12014-09-12 19:22:30925 // Clear |render_frame_host|'s tracking entry for its power save blockers.
[email protected]96307312014-05-04 01:00:19926 void ClearPowerSaveBlockers(RenderFrameHost* render_frame_host);
[email protected]d9030b82013-07-19 08:26:06927
dalecurtisbc6572e12014-09-12 19:22:30928 // Clear tracking entries for all RenderFrameHosts, clears
929 // |audio_power_save_blocker_| and |video_power_save_blocker_|.
[email protected]d9030b82013-07-19 08:26:06930 void ClearAllPowerSaveBlockers();
931
dalecurtisbc6572e12014-09-12 19:22:30932 // Creates an audio or video power save blocker respectively.
933 void CreateAudioPowerSaveBlocker();
934 void CreateVideoPowerSaveBlocker();
935
936 // Releases the audio power save blockers if |active_audio_players_| is empty.
937 // Likewise, releases the video power save blockers if |active_video_players_|
938 // is empty.
939 void MaybeReleasePowerSaveBlockers();
940
[email protected]dc0fd432013-08-27 15:29:21941 // Helper function to invoke WebContentsDelegate::GetSizeForNewRenderView().
[email protected]fc2b46b2014-05-03 16:33:45942 gfx::Size GetSizeForNewRenderView();
[email protected]dc0fd432013-08-27 15:29:21943
[email protected]ae7eeda2014-07-04 01:53:26944 void OnFrameRemoved(RenderFrameHost* render_frame_host);
[email protected]9b159a52013-10-03 17:24:55945
[email protected]222f5822014-02-05 23:40:49946 // Helper method that's called whenever |preferred_size_| or
947 // |preferred_size_for_capture_| changes, to propagate the new value to the
948 // |delegate_|.
949 void OnPreferredSizeChanged(const gfx::Size& old_size);
950
dalecurtisbc6572e12014-09-12 19:22:30951 // Helper methods for adding or removing player entries in |player_map| under
952 // the key |render_frame_message_source_|.
953 typedef std::vector<int64> PlayerList;
954 typedef std::map<uintptr_t, PlayerList> ActiveMediaPlayerMap;
955 void AddMediaPlayerEntry(int64 player_cookie,
956 ActiveMediaPlayerMap* player_map);
957 void RemoveMediaPlayerEntry(int64 player_cookie,
958 ActiveMediaPlayerMap* player_map);
959 // Removes all entries from |player_map| for |render_frame_host|.
960 void RemoveAllMediaPlayerEntries(RenderFrameHost* render_frame_host,
961 ActiveMediaPlayerMap* player_map);
962
[email protected]e4abd3b42013-11-12 18:28:47963 // Adds/removes a callback called on creation of each new WebContents.
964 // Deprecated, about to remove.
965 static void AddCreatedCallback(const CreatedCallback& callback);
966 static void RemoveCreatedCallback(const CreatedCallback& callback);
967
[email protected]0dd3a0ab2011-02-18 08:17:44968 // Data for core operation ---------------------------------------------------
969
970 // Delegate for notifying our owner about stuff. Not owned by us.
[email protected]8ff00d72012-10-23 19:12:21971 WebContentsDelegate* delegate_;
[email protected]0dd3a0ab2011-02-18 08:17:44972
973 // Handles the back/forward list and loading.
[email protected]d202a7c2012-01-04 07:53:47974 NavigationControllerImpl controller_;
[email protected]0dd3a0ab2011-02-18 08:17:44975
976 // The corresponding view.
[email protected]fc2b46b2014-05-03 16:33:45977 scoped_ptr<WebContentsView> view_;
[email protected]0dd3a0ab2011-02-18 08:17:44978
[email protected]5a3bdf52012-05-24 15:12:57979 // The view of the RVHD. Usually this is our WebContentsView implementation,
980 // but if an embedder uses a different WebContentsView, they'll need to
981 // provide this.
[email protected]8ff00d72012-10-23 19:12:21982 RenderViewHostDelegateView* render_view_host_delegate_view_;
[email protected]5a3bdf52012-05-24 15:12:57983
[email protected]bafe6cd2012-05-23 23:09:50984 // Tracks created WebContentsImpl objects that have not been shown yet. They
985 // are identified by the route ID passed to CreateNewWindow.
986 typedef std::map<int, WebContentsImpl*> PendingContents;
987 PendingContents pending_contents_;
988
989 // These maps hold on to the widgets that we created on behalf of the renderer
990 // that haven't shown yet.
[email protected]8ff00d72012-10-23 19:12:21991 typedef std::map<int, RenderWidgetHostView*> PendingWidgetViews;
[email protected]bafe6cd2012-05-23 23:09:50992 PendingWidgetViews pending_widget_views_;
993
[email protected]7fff43e2013-05-21 20:21:10994 typedef std::map<WebContentsImpl*, DestructionObserver*> DestructionObservers;
995 DestructionObservers destruction_observers_;
996
[email protected]996042972011-11-08 22:43:59997 // A list of observers notified when page state changes. Weak references.
[email protected]fa944cb82013-11-15 17:51:21998 // This MUST be listed above frame_tree_ since at destruction time the
[email protected]996042972011-11-08 22:43:59999 // latter might cause RenderViewHost's destructor to call us and we might use
1000 // the observer list then.
[email protected]8ff00d72012-10-23 19:12:211001 ObserverList<WebContentsObserver> observers_;
[email protected]996042972011-11-08 22:43:591002
[email protected]14392a52012-05-02 20:28:441003 // The tab that opened this tab, if any. Will be set to null if the opener
1004 // is closed.
1005 WebContentsImpl* opener_;
1006
[email protected]c7c0d822014-04-16 20:19:491007 // True if this tab was opened by another tab. This is not unset if the opener
1008 // is closed.
1009 bool created_with_opener_;
1010
[email protected]2ceee8f2014-01-14 18:02:081011#if defined(OS_WIN)
[email protected]c73a2282013-04-29 21:10:411012 gfx::NativeViewAccessible accessible_parent_;
1013#endif
1014
[email protected]0dd3a0ab2011-02-18 08:17:441015 // Helper classes ------------------------------------------------------------
1016
dalecurtisbc6572e12014-09-12 19:22:301017 // Tracking variables and associated power save blockers for media playback.
1018 ActiveMediaPlayerMap active_audio_players_;
1019 ActiveMediaPlayerMap active_video_players_;
1020 scoped_ptr<PowerSaveBlocker> audio_power_save_blocker_;
1021 scoped_ptr<PowerSaveBlocker> video_power_save_blocker_;
[email protected]d9030b82013-07-19 08:26:061022
[email protected]fa944cb82013-11-15 17:51:211023 // Manages the frame tree of the page and process swaps in each node.
[email protected]9b159a52013-10-03 17:24:551024 FrameTree frame_tree_;
1025
[email protected]c7dd2f62011-07-18 15:57:591026 // SavePackage, lazily created.
1027 scoped_refptr<SavePackage> save_package_;
1028
[email protected]0dd3a0ab2011-02-18 08:17:441029 // Data for loading state ----------------------------------------------------
1030
1031 // Indicates whether we're currently loading a resource.
1032 bool is_loading_;
1033
[email protected]6dfed692014-05-22 04:18:031034 // Indicates whether the current load is to a different document. Only valid
1035 // if is_loading_ is true.
1036 bool is_load_to_different_document_;
1037
[email protected]0dd3a0ab2011-02-18 08:17:441038 // Indicates if the tab is considered crashed.
1039 base::TerminationStatus crashed_status_;
1040 int crashed_error_code_;
1041
[email protected]ca13a442012-04-17 14:00:121042 // Whether this WebContents is waiting for a first-response for the
[email protected]be1f56ab2011-12-22 06:55:311043 // main resource of the page. This controls whether the throbber state is
1044 // "waiting" or "loading."
[email protected]0dd3a0ab2011-02-18 08:17:441045 bool waiting_for_response_;
1046
[email protected]74ce1ad2011-12-16 21:51:461047 // Map of SiteInstance ID to max page ID for this tab. A page ID is specific
1048 // to a given tab and SiteInstance, and must be valid for the lifetime of the
[email protected]b172aee2012-04-10 17:05:261049 // WebContentsImpl.
[email protected]74ce1ad2011-12-16 21:51:461050 std::map<int32, int32> max_page_ids_;
[email protected]0dd3a0ab2011-02-18 08:17:441051
[email protected]0dd3a0ab2011-02-18 08:17:441052 // The current load state and the URL associated with it.
[email protected]9c235f042011-08-10 22:28:211053 net::LoadStateWithParam load_state_;
[email protected]fcf75d42013-12-03 20:11:261054 base::string16 load_state_host_;
[email protected]960b0372014-05-19 18:01:001055
1056 // LoadingProgressMap maps FrameTreeNode IDs to a double representing that
1057 // frame's completion (from 0 to 1).
1058 typedef base::hash_map<int64, double> LoadingProgressMap;
1059 LoadingProgressMap loading_progresses_;
1060 double loading_total_progress_;
1061
1062 base::TimeTicks loading_last_progress_update_;
1063
[email protected]960b0372014-05-19 18:01:001064 // Counter to track how many frames have sent start notifications but not
1065 // stop notifications.
1066 int loading_frames_in_progress_;
1067
[email protected]0dd3a0ab2011-02-18 08:17:441068 // Upload progress, for displaying in the status bar.
1069 // Set to zero when there is no significant upload happening.
1070 uint64 upload_size_;
1071 uint64 upload_position_;
1072
1073 // Data for current page -----------------------------------------------------
1074
[email protected]987fc3a2011-05-26 14:18:091075 // When a title cannot be taken from any entry, this title will be used.
[email protected]fcf75d42013-12-03 20:11:261076 base::string16 page_title_when_no_navigation_entry_;
[email protected]987fc3a2011-05-26 14:18:091077
[email protected]0dd3a0ab2011-02-18 08:17:441078 // When a navigation occurs, we record its contents MIME type. It can be
1079 // used to check whether we can do something for some special contents.
1080 std::string contents_mime_type_;
1081
[email protected]ef3adfc2014-05-11 00:04:541082 // The last reported character encoding, not canonicalized.
1083 std::string last_reported_encoding_;
1084
1085 // The canonicalized character encoding.
1086 std::string canonical_encoding_;
[email protected]0dd3a0ab2011-02-18 08:17:441087
[email protected]0dd3a0ab2011-02-18 08:17:441088 // True if this is a secure page which displayed insecure content.
1089 bool displayed_insecure_content_;
1090
[email protected]b4c84012014-04-28 19:51:101091 // Whether the initial empty page has been accessed by another page, making it
1092 // unsafe to show the pending URL. Usually false unless another window tries
1093 // to modify the blank page. Always false after the first commit.
1094 bool has_accessed_initial_document_;
1095
[email protected]0dd3a0ab2011-02-18 08:17:441096 // Data for misc internal state ----------------------------------------------
1097
[email protected]54597982013-02-06 01:59:551098 // When > 0, the WebContents is currently being captured (e.g., for
1099 // screenshots or mirroring); and the underlying RenderWidgetHost should not
1100 // be told it is hidden.
1101 int capturer_count_;
1102
1103 // Tracks whether RWHV should be visible once capturer_count_ becomes zero.
1104 bool should_normally_be_visible_;
[email protected]0dd3a0ab2011-02-18 08:17:441105
1106 // See getter above.
1107 bool is_being_destroyed_;
1108
1109 // Indicates whether we should notify about disconnection of this
[email protected]b172aee2012-04-10 17:05:261110 // WebContentsImpl. This is used to ensure disconnection notifications only
[email protected]0dd3a0ab2011-02-18 08:17:441111 // happen if a connection notification has happened and that they happen only
1112 // once.
1113 bool notify_disconnection_;
1114
[email protected]71a88bb2013-02-01 22:05:151115 // Pointer to the JavaScript dialog manager, lazily assigned. Used because the
[email protected]b172aee2012-04-10 17:05:261116 // delegate of this WebContentsImpl is nulled before its destructor is called.
[email protected]71a88bb2013-02-01 22:05:151117 JavaScriptDialogManager* dialog_manager_;
[email protected]2e5b90c2011-08-16 21:11:551118
[email protected]0dd3a0ab2011-02-18 08:17:441119 // Set to true when there is an active "before unload" dialog. When true,
1120 // we've forced the throbber to start in Navigate, and we need to remember to
1121 // turn it off in OnJavaScriptMessageBoxClosed if the navigation is canceled.
1122 bool is_showing_before_unload_dialog_;
1123
[email protected]0dd3a0ab2011-02-18 08:17:441124 // Settings that get passed to the renderer process.
[email protected]8ff00d72012-10-23 19:12:211125 RendererPreferences renderer_preferences_;
[email protected]0dd3a0ab2011-02-18 08:17:441126
[email protected]9a890452014-02-13 22:21:021127 // The time that this WebContents was last made active. The initial value is
1128 // the WebContents creation time.
1129 base::TimeTicks last_active_time_;
[email protected]0dd3a0ab2011-02-18 08:17:441130
[email protected]0dd3a0ab2011-02-18 08:17:441131 // See description above setter.
1132 bool closed_by_user_gesture_;
1133
1134 // Minimum/maximum zoom percent.
1135 int minimum_zoom_percent_;
1136 int maximum_zoom_percent_;
[email protected]0dd3a0ab2011-02-18 08:17:441137
[email protected]bab38af2014-03-30 17:37:291138 // The raw accumulated zoom value and the actual zoom increments made for an
1139 // an in-progress pinch gesture.
1140 float totalPinchGestureAmount_;
1141 int currentPinchZoomStepDelta_;
1142
[email protected]bcd2815602012-01-14 18:17:231143 // The intrinsic size of the page.
1144 gfx::Size preferred_size_;
1145
[email protected]222f5822014-02-05 23:40:491146 // The preferred size for content screen capture. When |capturer_count_| > 0,
1147 // this overrides |preferred_size_|.
1148 gfx::Size preferred_size_for_capture_;
1149
[email protected]583418cc2013-01-17 14:01:101150#if defined(OS_ANDROID)
1151 // Date time chooser opened by this tab.
1152 // Only used in Android since all other platforms use a multi field UI.
1153 scoped_ptr<DateTimeChooserAndroid> date_time_chooser_;
1154#endif
1155
[email protected]8ed16472014-04-11 19:02:481156 // Holds information about a current color chooser dialog, if one is visible.
1157 struct ColorChooserInfo {
1158 ColorChooserInfo(int render_process_id,
1159 int render_frame_id,
1160 ColorChooser* chooser,
1161 int identifier);
1162 ~ColorChooserInfo();
[email protected]cb805452013-05-22 15:16:211163
[email protected]8ed16472014-04-11 19:02:481164 int render_process_id;
1165 int render_frame_id;
1166
1167 // Color chooser that was opened by this tab.
1168 scoped_ptr<ColorChooser> chooser;
1169
1170 // A unique identifier for the current color chooser. Identifiers are
1171 // unique across a renderer process. This avoids race conditions in
1172 // synchronizing the browser and renderer processes. For example, if a
1173 // renderer closes one chooser and opens another, and simultaneously the
1174 // user picks a color in the first chooser, the IDs can be used to drop the
1175 // "chose a color" message rather than erroneously tell the renderer that
1176 // the user picked a color in the second chooser.
1177 int identifier;
1178 };
1179
1180 scoped_ptr<ColorChooserInfo> color_chooser_info_;
[email protected]da8543762012-03-20 08:52:201181
[email protected]7a846df2012-09-20 19:17:391182 // Manages the embedder state for browser plugins, if this WebContents is an
1183 // embedder; NULL otherwise.
[email protected]8ff00d72012-10-23 19:12:211184 scoped_ptr<BrowserPluginEmbedder> browser_plugin_embedder_;
[email protected]7a846df2012-09-20 19:17:391185 // Manages the guest state for browser plugin, if this WebContents is a guest;
1186 // NULL otherwise.
[email protected]8ff00d72012-10-23 19:12:211187 scoped_ptr<BrowserPluginGuest> browser_plugin_guest_;
[email protected]7a846df2012-09-20 19:17:391188
[email protected]f53a9f872012-05-24 02:07:061189 // This must be at the end, or else we might get notifications and use other
1190 // member variables that are gone.
[email protected]8ff00d72012-10-23 19:12:211191 NotificationRegistrar registrar_;
[email protected]f53a9f872012-05-24 02:07:061192
[email protected]1d62cf72014-02-07 21:31:571193 // Used during IPC message dispatching from the RenderView/RenderFrame so that
1194 // the handlers can get a pointer to the RVH through which the message was
[email protected]f114fa42013-12-06 17:06:441195 // received.
1196 RenderViewHost* render_view_message_source_;
[email protected]1d62cf72014-02-07 21:31:571197 RenderFrameHost* render_frame_message_source_;
[email protected]7bb761892012-07-20 09:32:471198
[email protected]b24b68a2012-09-24 21:57:261199 // All live RenderWidgetHostImpls that are created by this object and may
1200 // outlive it.
[email protected]8ff00d72012-10-23 19:12:211201 std::set<RenderWidgetHostImpl*> created_widgets_;
[email protected]b24b68a2012-09-24 21:57:261202
[email protected]44470a22013-01-24 01:21:541203 // Routing id of the shown fullscreen widget or MSG_ROUTING_NONE otherwise.
1204 int fullscreen_widget_routing_id_;
1205
[email protected]0b431992014-06-24 00:08:031206 // At the time the fullscreen widget was being shut down, did it have focus?
1207 // This is used to restore focus to the WebContentsView after both: 1) the
1208 // fullscreen widget is destroyed, and 2) the WebContentsDelegate has
1209 // completed making layout changes to effect an exit from fullscreen mode.
1210 bool fullscreen_widget_had_focus_at_shutdown_;
1211
[email protected]41225fe2013-03-29 05:32:021212 // Maps the ids of pending image downloads to their callbacks
1213 typedef std::map<int, ImageDownloadCallback> ImageDownloadMap;
1214 ImageDownloadMap image_download_map_;
[email protected]795c28972012-12-06 06:13:391215
[email protected]0e584b5f2013-12-30 17:28:231216 // Whether this WebContents is responsible for displaying a subframe in a
[email protected]5dcaf8e2013-12-28 01:31:421217 // different process from its parent page.
1218 bool is_subframe_;
1219
[email protected]34ff1cfc2014-08-20 06:16:051220 // Whether overscroll should be unconditionally disabled.
1221 bool force_disable_overscroll_content_;
[email protected]e85165c642014-06-10 14:34:311222
[email protected]87de04b02014-04-08 22:14:491223 // Whether the last JavaScript dialog shown was suppressed. Used for testing.
1224 bool last_dialog_suppressed_;
1225
[email protected]f28ef9a32014-05-12 16:36:101226 scoped_ptr<GeolocationDispatcherHost> geolocation_dispatcher_host_;
1227
[email protected]29998f92014-06-15 03:12:141228 scoped_ptr<MidiDispatcherHost> midi_dispatcher_host_;
1229
[email protected]01f83f92014-06-17 14:41:541230 scoped_ptr<ScreenOrientationDispatcherHost>
1231 screen_orientation_dispatcher_host_;
1232
mlamouriefdca9d2014-09-16 16:55:401233 scoped_ptr<ManifestManagerHost> manifest_manager_host_;
1234
[email protected]95640212014-07-26 18:14:301235 // The accessibility mode for all frames. This is queried when each frame
1236 // is created, and broadcast to all frames when it changes.
1237 AccessibilityMode accessibility_mode_;
1238
dalecurtisbc6572e12014-09-12 19:22:301239 // Monitors power levels for audio streams associated with this WebContents.
1240 AudioStreamMonitor audio_stream_monitor_;
1241
miu50f97892014-09-22 22:49:521242 // Created on-demand to mute all audio output from this WebContents.
1243 scoped_ptr<WebContentsAudioMuter> audio_muter_;
1244
mohan.reddy371ad9142014-09-17 08:01:461245 base::WeakPtrFactory<WebContentsImpl> loading_weak_factory_;
1246
[email protected]b172aee2012-04-10 17:05:261247 DISALLOW_COPY_AND_ASSIGN(WebContentsImpl);
[email protected]0dd3a0ab2011-02-18 08:17:441248};
1249
[email protected]8ff00d72012-10-23 19:12:211250} // namespace content
1251
[email protected]93ddb3c2012-04-11 21:44:291252#endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_