Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(430)

Side by Side Diff: content/browser/web_contents/web_contents_impl.h

Issue 11231077: Move a bunch more code into the content namespace. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ 5 #ifndef CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_
6 #define CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ 6 #define CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_
7 7
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 15 matching lines...) Expand all
26 #include "content/public/common/renderer_preferences.h" 26 #include "content/public/common/renderer_preferences.h"
27 #include "net/base/load_states.h" 27 #include "net/base/load_states.h"
28 #include "ui/gfx/rect_f.h" 28 #include "ui/gfx/rect_f.h"
29 #include "ui/gfx/size.h" 29 #include "ui/gfx/size.h"
30 #include "webkit/glue/resource_type.h" 30 #include "webkit/glue/resource_type.h"
31 31
32 #if defined(OS_WIN) 32 #if defined(OS_WIN)
33 #include "base/win/scoped_handle.h" 33 #include "base/win/scoped_handle.h"
34 #endif 34 #endif
35 35
36 class InterstitialPageImpl;
37 class SavePackage; 36 class SavePackage;
38 class SessionStorageNamespaceImpl; 37 class SessionStorageNamespaceImpl;
39 class WebContentsImpl;
40 struct BrowserPluginHostMsg_ResizeGuest_Params; 38 struct BrowserPluginHostMsg_ResizeGuest_Params;
41 struct ViewMsg_PostMessage_Params; 39 struct ViewMsg_PostMessage_Params;
42 40
41 namespace webkit_glue {
42 struct WebIntentData;
43 struct WebIntentServiceData;
44 }
45
43 namespace content { 46 namespace content {
44 class BrowserPluginEmbedder; 47 class BrowserPluginEmbedder;
45 class BrowserPluginGuest; 48 class BrowserPluginGuest;
46 class ColorChooser; 49 class ColorChooser;
47 class DownloadItem; 50 class DownloadItem;
51 class InterstitialPageImpl;
48 class JavaScriptDialogCreator; 52 class JavaScriptDialogCreator;
49 class RenderViewHost; 53 class RenderViewHost;
50 class RenderViewHostDelegateView; 54 class RenderViewHostDelegateView;
51 class RenderViewHostImpl; 55 class RenderViewHostImpl;
52 class RenderWidgetHostImpl; 56 class RenderWidgetHostImpl;
53 class SiteInstance; 57 class SiteInstance;
54 class TestWebContents; 58 class TestWebContents;
55 class WebContentsDelegate; 59 class WebContentsDelegate;
60 class WebContentsImpl;
56 class WebContentsObserver; 61 class WebContentsObserver;
57 class WebContentsView; 62 class WebContentsView;
58 class WebContentsViewDelegate; 63 class WebContentsViewDelegate;
59 struct LoadNotificationDetails; 64 struct LoadNotificationDetails;
60 65
61 // Factory function for the implementations that content knows about. Takes 66 // Factory function for the implementations that content knows about. Takes
62 // ownership of |delegate|. 67 // ownership of |delegate|.
63 WebContentsView* CreateWebContentsView( 68 WebContentsView* CreateWebContentsView(
64 WebContentsImpl* web_contents, 69 WebContentsImpl* web_contents,
65 WebContentsViewDelegate* delegate, 70 WebContentsViewDelegate* delegate,
66 RenderViewHostDelegateView** render_view_host_delegate_view); 71 RenderViewHostDelegateView** render_view_host_delegate_view);
67 72
68 } // namespace content
69
70 namespace webkit_glue {
71 struct WebIntentData;
72 struct WebIntentServiceData;
73 }
74
75 class CONTENT_EXPORT WebContentsImpl 73 class CONTENT_EXPORT WebContentsImpl
76 : public NON_EXPORTED_BASE(content::WebContents), 74 : public NON_EXPORTED_BASE(WebContents),
77 public content::RenderViewHostDelegate, 75 public RenderViewHostDelegate,
78 public content::RenderWidgetHostDelegate, 76 public RenderWidgetHostDelegate,
79 public RenderViewHostManager::Delegate, 77 public RenderViewHostManager::Delegate,
80 public content::NotificationObserver { 78 public NotificationObserver {
81 public: 79 public:
82 virtual ~WebContentsImpl(); 80 virtual ~WebContentsImpl();
83 81
84 static WebContentsImpl* Create( 82 static WebContentsImpl* Create(
85 content::BrowserContext* browser_context, 83 BrowserContext* browser_context,
86 content::SiteInstance* site_instance, 84 SiteInstance* site_instance,
87 int routing_id, 85 int routing_id,
88 const WebContentsImpl* base_web_contents); 86 const WebContentsImpl* base_web_contents);
89 87
90 static WebContentsImpl* CreateWithOpener( 88 static WebContentsImpl* CreateWithOpener(
91 content::BrowserContext* browser_context, 89 BrowserContext* browser_context,
92 content::SiteInstance* site_instance, 90 SiteInstance* site_instance,
93 int routing_id, 91 int routing_id,
94 const WebContentsImpl* base_web_contents, 92 const WebContentsImpl* base_web_contents,
95 WebContentsImpl* opener); 93 WebContentsImpl* opener);
96 94
97 // Creates a WebContents to be used as a browser plugin guest. 95 // Creates a WebContents to be used as a browser plugin guest.
98 static WebContentsImpl* CreateGuest(content::BrowserContext* browser_context, 96 static WebContentsImpl* CreateGuest(BrowserContext* browser_context,
99 const std::string& host, 97 const std::string& host,
100 int guest_instance_id); 98 int guest_instance_id);
101 99
102 // Returns the content specific prefs for the given RVH. 100 // Returns the content specific prefs for the given RVH.
103 static webkit_glue::WebPreferences GetWebkitPrefs( 101 static webkit_glue::WebPreferences GetWebkitPrefs(
104 content::RenderViewHost* rvh, const GURL& url); 102 RenderViewHost* rvh, const GURL& url);
105 103
106 // Creates a swapped out RenderView. This is used by the browser plugin to 104 // Creates a swapped out RenderView. This is used by the browser plugin to
107 // create a swapped out RenderView in the embedder render process for the 105 // create a swapped out RenderView in the embedder render process for the
108 // guest, to expose the guest's window object to the embedder. 106 // guest, to expose the guest's window object to the embedder.
109 // This returns the routing ID of the newly created swapped out RenderView. 107 // This returns the routing ID of the newly created swapped out RenderView.
110 int CreateSwappedOutRenderView(content::SiteInstance* instance); 108 int CreateSwappedOutRenderView(SiteInstance* instance);
111 109
112 // Complex initialization here. Specifically needed to avoid having 110 // Complex initialization here. Specifically needed to avoid having
113 // members call back into our virtual functions in the constructor. 111 // members call back into our virtual functions in the constructor.
114 virtual void Init(content::BrowserContext* browser_context, 112 virtual void Init(BrowserContext* browser_context,
115 content::SiteInstance* site_instance, 113 SiteInstance* site_instance,
116 int routing_id, 114 int routing_id,
117 const content::WebContents* base_web_contents); 115 const WebContents* base_web_contents);
118 116
119 // Returns the SavePackage which manages the page saving job. May be NULL. 117 // Returns the SavePackage which manages the page saving job. May be NULL.
120 SavePackage* save_package() const { return save_package_.get(); } 118 SavePackage* save_package() const { return save_package_.get(); }
121 119
122 // Updates the max page ID for the current SiteInstance in this 120 // Updates the max page ID for the current SiteInstance in this
123 // WebContentsImpl to be at least |page_id|. 121 // WebContentsImpl to be at least |page_id|.
124 void UpdateMaxPageID(int32 page_id); 122 void UpdateMaxPageID(int32 page_id);
125 123
126 // Updates the max page ID for the given SiteInstance in this WebContentsImpl 124 // Updates the max page ID for the given SiteInstance in this WebContentsImpl
127 // to be at least |page_id|. 125 // to be at least |page_id|.
128 void UpdateMaxPageIDForSiteInstance(content::SiteInstance* site_instance, 126 void UpdateMaxPageIDForSiteInstance(SiteInstance* site_instance,
129 int32 page_id); 127 int32 page_id);
130 128
131 // Copy the current map of SiteInstance ID to max page ID from another tab. 129 // Copy the current map of SiteInstance ID to max page ID from another tab.
132 // This is necessary when this tab adopts the NavigationEntries from 130 // This is necessary when this tab adopts the NavigationEntries from
133 // |web_contents|. 131 // |web_contents|.
134 void CopyMaxPageIDsFrom(WebContentsImpl* web_contents); 132 void CopyMaxPageIDsFrom(WebContentsImpl* web_contents);
135 133
136 // Called by the NavigationController to cause the WebContentsImpl to navigate 134 // Called by the NavigationController to cause the WebContentsImpl to navigate
137 // to the current pending entry. The NavigationController should be called 135 // to the current pending entry. The NavigationController should be called
138 // back with RendererDidNavigate on success or DiscardPendingEntry on failure. 136 // back with RendererDidNavigate on success or DiscardPendingEntry on failure.
139 // The callbacks can be inside of this function, or at some future time. 137 // The callbacks can be inside of this function, or at some future time.
140 // 138 //
141 // The entry has a PageID of -1 if newly created (corresponding to navigation 139 // The entry has a PageID of -1 if newly created (corresponding to navigation
142 // to a new URL). 140 // to a new URL).
143 // 141 //
144 // If this method returns false, then the navigation is discarded (equivalent 142 // If this method returns false, then the navigation is discarded (equivalent
145 // to calling DiscardPendingEntry on the NavigationController). 143 // to calling DiscardPendingEntry on the NavigationController).
146 bool NavigateToPendingEntry( 144 bool NavigateToPendingEntry(NavigationController::ReloadType reload_type);
147 content::NavigationController::ReloadType reload_type);
148 145
149 // Called by InterstitialPageImpl when it creates a RenderViewHost. 146 // Called by InterstitialPageImpl when it creates a RenderViewHost.
150 void RenderViewForInterstitialPageCreated( 147 void RenderViewForInterstitialPageCreated(RenderViewHost* render_view_host);
151 content::RenderViewHost* render_view_host);
152 148
153 // Sets the passed passed interstitial as the currently showing interstitial. 149 // Sets the passed passed interstitial as the currently showing interstitial.
154 // |interstitial_page| should be non NULL (use the remove_interstitial_page 150 // |interstitial_page| should be non NULL (use the remove_interstitial_page
155 // method to unset the interstitial) and no interstitial page should be set 151 // method to unset the interstitial) and no interstitial page should be set
156 // when there is already a non NULL interstitial page set. 152 // when there is already a non NULL interstitial page set.
157 void set_interstitial_page(InterstitialPageImpl* interstitial_page) { 153 void set_interstitial_page(InterstitialPageImpl* interstitial_page) {
158 render_manager_.set_interstitial_page(interstitial_page); 154 render_manager_.set_interstitial_page(interstitial_page);
159 } 155 }
160 156
161 // Unsets the currently showing interstitial. 157 // Unsets the currently showing interstitial.
162 void remove_interstitial_page() { 158 void remove_interstitial_page() {
163 render_manager_.remove_interstitial_page(); 159 render_manager_.remove_interstitial_page();
164 } 160 }
165 161
166 void set_opener_web_ui_type(content::WebUI::TypeID opener_web_ui_type) { 162 void set_opener_web_ui_type(WebUI::TypeID opener_web_ui_type) {
167 opener_web_ui_type_ = opener_web_ui_type; 163 opener_web_ui_type_ = opener_web_ui_type;
168 } 164 }
169 165
170 JavaBridgeDispatcherHostManager* java_bridge_dispatcher_host_manager() const { 166 JavaBridgeDispatcherHostManager* java_bridge_dispatcher_host_manager() const {
171 return java_bridge_dispatcher_host_manager_.get(); 167 return java_bridge_dispatcher_host_manager_.get();
172 } 168 }
173 169
174 content::old::BrowserPluginHost* old_browser_plugin_host() const { 170 old::BrowserPluginHost* old_browser_plugin_host() const {
175 return old_browser_plugin_host_.get(); 171 return old_browser_plugin_host_.get();
176 } 172 }
177 173
178 // Expose the render manager for testing. 174 // Expose the render manager for testing.
179 RenderViewHostManager* GetRenderManagerForTesting(); 175 RenderViewHostManager* GetRenderManagerForTesting();
180 176
181 // Returns guest browser plugin object, or NULL if this WebContents is not a 177 // Returns guest browser plugin object, or NULL if this WebContents is not a
182 // guest. 178 // guest.
183 content::BrowserPluginGuest* GetBrowserPluginGuest(); 179 BrowserPluginGuest* GetBrowserPluginGuest();
184 // Returns embedder browser plugin object, or NULL if this WebContents is not 180 // Returns embedder browser plugin object, or NULL if this WebContents is not
185 // an embedder. 181 // an embedder.
186 content::BrowserPluginEmbedder* GetBrowserPluginEmbedder(); 182 BrowserPluginEmbedder* GetBrowserPluginEmbedder();
187 183
188 // content::WebContents ------------------------------------------------------ 184 // WebContents ------------------------------------------------------
189 virtual content::WebContentsDelegate* GetDelegate() OVERRIDE; 185 virtual WebContentsDelegate* GetDelegate() OVERRIDE;
190 virtual void SetDelegate(content::WebContentsDelegate* delegate) OVERRIDE; 186 virtual void SetDelegate(WebContentsDelegate* delegate) OVERRIDE;
191 virtual NavigationControllerImpl& GetController() OVERRIDE; 187 virtual NavigationControllerImpl& GetController() OVERRIDE;
192 virtual const NavigationControllerImpl& GetController() const OVERRIDE; 188 virtual const NavigationControllerImpl& GetController() const OVERRIDE;
193 virtual content::BrowserContext* GetBrowserContext() const OVERRIDE; 189 virtual BrowserContext* GetBrowserContext() const OVERRIDE;
194 virtual content::RenderProcessHost* GetRenderProcessHost() const OVERRIDE; 190 virtual RenderProcessHost* GetRenderProcessHost() const OVERRIDE;
195 virtual content::RenderViewHost* GetRenderViewHost() const OVERRIDE; 191 virtual RenderViewHost* GetRenderViewHost() const OVERRIDE;
196 virtual int GetRoutingID() const OVERRIDE; 192 virtual int GetRoutingID() const OVERRIDE;
197 virtual content::RenderWidgetHostView* 193 virtual RenderWidgetHostView* GetRenderWidgetHostView() const OVERRIDE;
198 GetRenderWidgetHostView() const OVERRIDE; 194 virtual WebContentsView* GetView() const OVERRIDE;
199 virtual content::WebContentsView* GetView() const OVERRIDE; 195 virtual WebUI* CreateWebUI(const GURL& url) OVERRIDE;
200 virtual content::WebUI* CreateWebUI(const GURL& url) OVERRIDE; 196 virtual WebUI* GetWebUI() const OVERRIDE;
201 virtual content::WebUI* GetWebUI() const OVERRIDE; 197 virtual WebUI* GetCommittedWebUI() const OVERRIDE;
202 virtual content::WebUI* GetCommittedWebUI() const OVERRIDE;
203 virtual void SetUserAgentOverride(const std::string& override) OVERRIDE; 198 virtual void SetUserAgentOverride(const std::string& override) OVERRIDE;
204 virtual const std::string& GetUserAgentOverride() const OVERRIDE; 199 virtual const std::string& GetUserAgentOverride() const OVERRIDE;
205 virtual const string16& GetTitle() const OVERRIDE; 200 virtual const string16& GetTitle() const OVERRIDE;
206 virtual int32 GetMaxPageID() OVERRIDE; 201 virtual int32 GetMaxPageID() OVERRIDE;
207 virtual int32 GetMaxPageIDForSiteInstance( 202 virtual int32 GetMaxPageIDForSiteInstance(
208 content::SiteInstance* site_instance) OVERRIDE; 203 SiteInstance* site_instance) OVERRIDE;
209 virtual content::SiteInstance* GetSiteInstance() const OVERRIDE; 204 virtual SiteInstance* GetSiteInstance() const OVERRIDE;
210 virtual content::SiteInstance* GetPendingSiteInstance() const OVERRIDE; 205 virtual SiteInstance* GetPendingSiteInstance() const OVERRIDE;
211 virtual bool IsLoading() const OVERRIDE; 206 virtual bool IsLoading() const OVERRIDE;
212 virtual bool IsWaitingForResponse() const OVERRIDE; 207 virtual bool IsWaitingForResponse() const OVERRIDE;
213 virtual const net::LoadStateWithParam& GetLoadState() const OVERRIDE; 208 virtual const net::LoadStateWithParam& GetLoadState() const OVERRIDE;
214 virtual const string16& GetLoadStateHost() const OVERRIDE; 209 virtual const string16& GetLoadStateHost() const OVERRIDE;
215 virtual uint64 GetUploadSize() const OVERRIDE; 210 virtual uint64 GetUploadSize() const OVERRIDE;
216 virtual uint64 GetUploadPosition() const OVERRIDE; 211 virtual uint64 GetUploadPosition() const OVERRIDE;
217 virtual const std::string& GetEncoding() const OVERRIDE; 212 virtual const std::string& GetEncoding() const OVERRIDE;
218 virtual bool DisplayedInsecureContent() const OVERRIDE; 213 virtual bool DisplayedInsecureContent() const OVERRIDE;
219 virtual void SetCapturingContents(bool cap) OVERRIDE; 214 virtual void SetCapturingContents(bool cap) OVERRIDE;
220 virtual bool IsCrashed() const OVERRIDE; 215 virtual bool IsCrashed() const OVERRIDE;
221 virtual void SetIsCrashed(base::TerminationStatus status, 216 virtual void SetIsCrashed(base::TerminationStatus status,
222 int error_code) OVERRIDE; 217 int error_code) OVERRIDE;
223 virtual base::TerminationStatus GetCrashedStatus() const OVERRIDE; 218 virtual base::TerminationStatus GetCrashedStatus() const OVERRIDE;
224 virtual bool IsBeingDestroyed() const OVERRIDE; 219 virtual bool IsBeingDestroyed() const OVERRIDE;
225 virtual void NotifyNavigationStateChanged(unsigned changed_flags) OVERRIDE; 220 virtual void NotifyNavigationStateChanged(unsigned changed_flags) OVERRIDE;
226 virtual base::TimeTicks GetLastSelectedTime() const OVERRIDE; 221 virtual base::TimeTicks GetLastSelectedTime() const OVERRIDE;
227 virtual void WasShown() OVERRIDE; 222 virtual void WasShown() OVERRIDE;
228 virtual void WasHidden() OVERRIDE; 223 virtual void WasHidden() OVERRIDE;
229 virtual bool NeedToFireBeforeUnload() OVERRIDE; 224 virtual bool NeedToFireBeforeUnload() OVERRIDE;
230 virtual void Stop() OVERRIDE; 225 virtual void Stop() OVERRIDE;
231 virtual content::WebContents* Clone() OVERRIDE; 226 virtual WebContents* Clone() OVERRIDE;
232 virtual gfx::NativeView GetContentNativeView() const OVERRIDE; 227 virtual gfx::NativeView GetContentNativeView() const OVERRIDE;
233 virtual gfx::NativeView GetNativeView() const OVERRIDE; 228 virtual gfx::NativeView GetNativeView() const OVERRIDE;
234 virtual void GetContainerBounds(gfx::Rect* out) const OVERRIDE; 229 virtual void GetContainerBounds(gfx::Rect* out) const OVERRIDE;
235 virtual void Focus() OVERRIDE; 230 virtual void Focus() OVERRIDE;
236 virtual void FocusThroughTabTraversal(bool reverse) OVERRIDE; 231 virtual void FocusThroughTabTraversal(bool reverse) OVERRIDE;
237 virtual bool ShowingInterstitialPage() const OVERRIDE; 232 virtual bool ShowingInterstitialPage() const OVERRIDE;
238 virtual content::InterstitialPage* GetInterstitialPage() const OVERRIDE; 233 virtual InterstitialPage* GetInterstitialPage() const OVERRIDE;
239 virtual bool IsSavable() OVERRIDE; 234 virtual bool IsSavable() OVERRIDE;
240 virtual void OnSavePage() OVERRIDE; 235 virtual void OnSavePage() OVERRIDE;
241 virtual bool SavePage(const FilePath& main_file, 236 virtual bool SavePage(const FilePath& main_file,
242 const FilePath& dir_path, 237 const FilePath& dir_path,
243 content::SavePageType save_type) OVERRIDE; 238 SavePageType save_type) OVERRIDE;
244 virtual void GenerateMHTML( 239 virtual void GenerateMHTML(
245 const FilePath& file, 240 const FilePath& file,
246 const base::Callback<void(const FilePath&, int64)>& callback) OVERRIDE; 241 const base::Callback<void(const FilePath&, int64)>& callback) OVERRIDE;
247 virtual bool IsActiveEntry(int32 page_id) OVERRIDE; 242 virtual bool IsActiveEntry(int32 page_id) OVERRIDE;
248 243
249 virtual const std::string& GetContentsMimeType() const OVERRIDE; 244 virtual const std::string& GetContentsMimeType() const OVERRIDE;
250 virtual bool WillNotifyDisconnection() const OVERRIDE; 245 virtual bool WillNotifyDisconnection() const OVERRIDE;
251 virtual void SetOverrideEncoding(const std::string& encoding) OVERRIDE; 246 virtual void SetOverrideEncoding(const std::string& encoding) OVERRIDE;
252 virtual void ResetOverrideEncoding() OVERRIDE; 247 virtual void ResetOverrideEncoding() OVERRIDE;
253 virtual content::RendererPreferences* GetMutableRendererPrefs() OVERRIDE; 248 virtual RendererPreferences* GetMutableRendererPrefs() OVERRIDE;
254 virtual void SetNewTabStartTime(const base::TimeTicks& time) OVERRIDE; 249 virtual void SetNewTabStartTime(const base::TimeTicks& time) OVERRIDE;
255 virtual base::TimeTicks GetNewTabStartTime() const OVERRIDE; 250 virtual base::TimeTicks GetNewTabStartTime() const OVERRIDE;
256 virtual void Close() OVERRIDE; 251 virtual void Close() OVERRIDE;
257 virtual void OnCloseStarted() OVERRIDE; 252 virtual void OnCloseStarted() OVERRIDE;
258 virtual bool ShouldAcceptDragAndDrop() const OVERRIDE; 253 virtual bool ShouldAcceptDragAndDrop() const OVERRIDE;
259 virtual void SystemDragEnded() OVERRIDE; 254 virtual void SystemDragEnded() OVERRIDE;
260 virtual void UserGestureDone() OVERRIDE; 255 virtual void UserGestureDone() OVERRIDE;
261 virtual void SetClosedByUserGesture(bool value) OVERRIDE; 256 virtual void SetClosedByUserGesture(bool value) OVERRIDE;
262 virtual bool GetClosedByUserGesture() const OVERRIDE; 257 virtual bool GetClosedByUserGesture() const OVERRIDE;
263 virtual double GetZoomLevel() const OVERRIDE; 258 virtual double GetZoomLevel() const OVERRIDE;
264 virtual int GetZoomPercent(bool* enable_increment, 259 virtual int GetZoomPercent(bool* enable_increment,
265 bool* enable_decrement) const OVERRIDE; 260 bool* enable_decrement) const OVERRIDE;
266 virtual void ViewSource() OVERRIDE; 261 virtual void ViewSource() OVERRIDE;
267 virtual void ViewFrameSource(const GURL& url, 262 virtual void ViewFrameSource(const GURL& url,
268 const std::string& content_state) OVERRIDE; 263 const std::string& content_state) OVERRIDE;
269 virtual int GetMinimumZoomPercent() const OVERRIDE; 264 virtual int GetMinimumZoomPercent() const OVERRIDE;
270 virtual int GetMaximumZoomPercent() const OVERRIDE; 265 virtual int GetMaximumZoomPercent() const OVERRIDE;
271 virtual gfx::Size GetPreferredSize() const OVERRIDE; 266 virtual gfx::Size GetPreferredSize() const OVERRIDE;
272 virtual int GetContentRestrictions() const OVERRIDE; 267 virtual int GetContentRestrictions() const OVERRIDE;
273 virtual content::WebUI::TypeID GetWebUITypeForCurrentState() OVERRIDE; 268 virtual WebUI::TypeID GetWebUITypeForCurrentState() OVERRIDE;
274 virtual content::WebUI* GetWebUIForCurrentState() OVERRIDE; 269 virtual WebUI* GetWebUIForCurrentState() OVERRIDE;
275 virtual bool GotResponseToLockMouseRequest(bool allowed) OVERRIDE; 270 virtual bool GotResponseToLockMouseRequest(bool allowed) OVERRIDE;
276 virtual bool HasOpener() const OVERRIDE; 271 virtual bool HasOpener() const OVERRIDE;
277 virtual void DidChooseColorInColorChooser(int color_chooser_id, 272 virtual void DidChooseColorInColorChooser(int color_chooser_id,
278 SkColor color) OVERRIDE; 273 SkColor color) OVERRIDE;
279 virtual void DidEndColorChooser(int color_chooser_id) OVERRIDE; 274 virtual void DidEndColorChooser(int color_chooser_id) OVERRIDE;
280 275
281 // Implementation of PageNavigator. 276 // Implementation of PageNavigator.
282 virtual content::WebContents* OpenURL( 277 virtual WebContents* OpenURL(const OpenURLParams& params) OVERRIDE;
283 const content::OpenURLParams& params) OVERRIDE;
284 278
285 // Implementation of IPC::Sender. 279 // Implementation of IPC::Sender.
286 virtual bool Send(IPC::Message* message) OVERRIDE; 280 virtual bool Send(IPC::Message* message) OVERRIDE;
287 281
288 // RenderViewHostDelegate ---------------------------------------------------- 282 // RenderViewHostDelegate ----------------------------------------------------
289 283
290 virtual content::RenderViewHostDelegateView* GetDelegateView() OVERRIDE; 284 virtual RenderViewHostDelegateView* GetDelegateView() OVERRIDE;
291 virtual content::RenderViewHostDelegate::RendererManagement* 285 virtual RenderViewHostDelegate::RendererManagement*
292 GetRendererManagementDelegate() OVERRIDE; 286 GetRendererManagementDelegate() OVERRIDE;
293 virtual bool OnMessageReceived(content::RenderViewHost* render_view_host, 287 virtual bool OnMessageReceived(RenderViewHost* render_view_host,
294 const IPC::Message& message) OVERRIDE; 288 const IPC::Message& message) OVERRIDE;
295 virtual const GURL& GetURL() const OVERRIDE; 289 virtual const GURL& GetURL() const OVERRIDE;
296 virtual content::WebContents* GetAsWebContents() OVERRIDE; 290 virtual WebContents* GetAsWebContents() OVERRIDE;
297 virtual gfx::Rect GetRootWindowResizerRect() const OVERRIDE; 291 virtual gfx::Rect GetRootWindowResizerRect() const OVERRIDE;
298 virtual void RenderViewCreated( 292 virtual void RenderViewCreated(RenderViewHost* render_view_host) OVERRIDE;
299 content::RenderViewHost* render_view_host) OVERRIDE; 293 virtual void RenderViewReady(RenderViewHost* render_view_host) OVERRIDE;
300 virtual void RenderViewReady( 294 virtual void RenderViewGone(RenderViewHost* render_view_host,
301 content::RenderViewHost* render_view_host) OVERRIDE;
302 virtual void RenderViewGone(content::RenderViewHost* render_view_host,
303 base::TerminationStatus status, 295 base::TerminationStatus status,
304 int error_code) OVERRIDE; 296 int error_code) OVERRIDE;
305 virtual void RenderViewDeleted( 297 virtual void RenderViewDeleted(RenderViewHost* render_view_host) OVERRIDE;
306 content::RenderViewHost* render_view_host) OVERRIDE;
307 virtual void DidStartProvisionalLoadForFrame( 298 virtual void DidStartProvisionalLoadForFrame(
308 content::RenderViewHost* render_view_host, 299 RenderViewHost* render_view_host,
309 int64 frame_id, 300 int64 frame_id,
310 int64 parent_frame_id, 301 int64 parent_frame_id,
311 bool main_frame, 302 bool main_frame,
312 const GURL& opener_url, 303 const GURL& opener_url,
313 const GURL& url) OVERRIDE; 304 const GURL& url) OVERRIDE;
314 virtual void DidRedirectProvisionalLoad( 305 virtual void DidRedirectProvisionalLoad(
315 content::RenderViewHost* render_view_host, 306 RenderViewHost* render_view_host,
316 int32 page_id, 307 int32 page_id,
317 const GURL& opener_url, 308 const GURL& opener_url,
318 const GURL& source_url, 309 const GURL& source_url,
319 const GURL& target_url) OVERRIDE; 310 const GURL& target_url) OVERRIDE;
320 virtual void DidFailProvisionalLoadWithError( 311 virtual void DidFailProvisionalLoadWithError(
321 content::RenderViewHost* render_view_host, 312 RenderViewHost* render_view_host,
322 const ViewHostMsg_DidFailProvisionalLoadWithError_Params& params) 313 const ViewHostMsg_DidFailProvisionalLoadWithError_Params& params)
323 OVERRIDE; 314 OVERRIDE;
324 virtual void DidNavigate( 315 virtual void DidNavigate(
325 content::RenderViewHost* render_view_host, 316 RenderViewHost* render_view_host,
326 const ViewHostMsg_FrameNavigate_Params& params) OVERRIDE; 317 const ViewHostMsg_FrameNavigate_Params& params) OVERRIDE;
327 virtual void UpdateState(content::RenderViewHost* render_view_host, 318 virtual void UpdateState(RenderViewHost* render_view_host,
328 int32 page_id, 319 int32 page_id,
329 const std::string& state) OVERRIDE; 320 const std::string& state) OVERRIDE;
330 virtual void UpdateTitle(content::RenderViewHost* render_view_host, 321 virtual void UpdateTitle(RenderViewHost* render_view_host,
331 int32 page_id, 322 int32 page_id,
332 const string16& title, 323 const string16& title,
333 base::i18n::TextDirection title_direction) OVERRIDE; 324 base::i18n::TextDirection title_direction) OVERRIDE;
334 virtual void UpdateEncoding(content::RenderViewHost* render_view_host, 325 virtual void UpdateEncoding(RenderViewHost* render_view_host,
335 const std::string& encoding) OVERRIDE; 326 const std::string& encoding) OVERRIDE;
336 virtual void UpdateTargetURL(int32 page_id, const GURL& url) OVERRIDE; 327 virtual void UpdateTargetURL(int32 page_id, const GURL& url) OVERRIDE;
337 virtual void Close(content::RenderViewHost* render_view_host) OVERRIDE; 328 virtual void Close(RenderViewHost* render_view_host) OVERRIDE;
338 virtual void RequestMove(const gfx::Rect& new_bounds) OVERRIDE; 329 virtual void RequestMove(const gfx::Rect& new_bounds) OVERRIDE;
339 virtual void SwappedOut(content::RenderViewHost* render_view_host) OVERRIDE; 330 virtual void SwappedOut(RenderViewHost* render_view_host) OVERRIDE;
340 virtual void DidStartLoading( 331 virtual void DidStartLoading(RenderViewHost* render_view_host) OVERRIDE;
341 content::RenderViewHost* render_view_host) OVERRIDE; 332 virtual void DidStopLoading(RenderViewHost* render_view_host) OVERRIDE;
342 virtual void DidStopLoading(
343 content::RenderViewHost* render_view_host) OVERRIDE;
344 virtual void DidCancelLoading() OVERRIDE; 333 virtual void DidCancelLoading() OVERRIDE;
345 virtual void DidChangeLoadProgress(double progress) OVERRIDE; 334 virtual void DidChangeLoadProgress(double progress) OVERRIDE;
346 virtual void DidUpdateFrameTree(content::RenderViewHost* rvh) OVERRIDE; 335 virtual void DidUpdateFrameTree(RenderViewHost* rvh) OVERRIDE;
347 virtual void DocumentAvailableInMainFrame( 336 virtual void DocumentAvailableInMainFrame(
348 content::RenderViewHost* render_view_host) OVERRIDE; 337 RenderViewHost* render_view_host) OVERRIDE;
349 virtual void DocumentOnLoadCompletedInMainFrame( 338 virtual void DocumentOnLoadCompletedInMainFrame(
350 content::RenderViewHost* render_view_host, 339 RenderViewHost* render_view_host,
351 int32 page_id) OVERRIDE; 340 int32 page_id) OVERRIDE;
352 virtual void RequestOpenURL(content::RenderViewHost* rvh, 341 virtual void RequestOpenURL(RenderViewHost* rvh,
353 const GURL& url, 342 const GURL& url,
354 const content::Referrer& referrer, 343 const Referrer& referrer,
355 WindowOpenDisposition disposition, 344 WindowOpenDisposition disposition,
356 int64 source_frame_id) OVERRIDE; 345 int64 source_frame_id) OVERRIDE;
357 virtual void RequestTransferURL( 346 virtual void RequestTransferURL(
358 const GURL& url, 347 const GURL& url,
359 const content::Referrer& referrer, 348 const Referrer& referrer,
360 WindowOpenDisposition disposition, 349 WindowOpenDisposition disposition,
361 int64 source_frame_id, 350 int64 source_frame_id,
362 const content::GlobalRequestID& transferred_global_request_id) OVERRIDE; 351 const GlobalRequestID& transferred_global_request_id) OVERRIDE;
363 virtual void RouteCloseEvent(content::RenderViewHost* rvh) OVERRIDE; 352 virtual void RouteCloseEvent(RenderViewHost* rvh) OVERRIDE;
364 virtual void RouteMessageEvent( 353 virtual void RouteMessageEvent(
365 content::RenderViewHost* rvh, 354 RenderViewHost* rvh,
366 const ViewMsg_PostMessage_Params& params) OVERRIDE; 355 const ViewMsg_PostMessage_Params& params) OVERRIDE;
367 virtual void RunJavaScriptMessage(content::RenderViewHost* rvh, 356 virtual void RunJavaScriptMessage(RenderViewHost* rvh,
368 const string16& message, 357 const string16& message,
369 const string16& default_prompt, 358 const string16& default_prompt,
370 const GURL& frame_url, 359 const GURL& frame_url,
371 content::JavaScriptMessageType type, 360 JavaScriptMessageType type,
372 IPC::Message* reply_msg, 361 IPC::Message* reply_msg,
373 bool* did_suppress_message) OVERRIDE; 362 bool* did_suppress_message) OVERRIDE;
374 virtual void RunBeforeUnloadConfirm(content::RenderViewHost* rvh, 363 virtual void RunBeforeUnloadConfirm(RenderViewHost* rvh,
375 const string16& message, 364 const string16& message,
376 bool is_reload, 365 bool is_reload,
377 IPC::Message* reply_msg) OVERRIDE; 366 IPC::Message* reply_msg) OVERRIDE;
378 virtual bool AddMessageToConsole(int32 level, 367 virtual bool AddMessageToConsole(int32 level,
379 const string16& message, 368 const string16& message,
380 int32 line_no, 369 int32 line_no,
381 const string16& source_id) OVERRIDE; 370 const string16& source_id) OVERRIDE;
382 virtual content::RendererPreferences GetRendererPrefs( 371 virtual RendererPreferences GetRendererPrefs(
383 content::BrowserContext* browser_context) const OVERRIDE; 372 BrowserContext* browser_context) const OVERRIDE;
384 virtual webkit_glue::WebPreferences GetWebkitPrefs() OVERRIDE; 373 virtual webkit_glue::WebPreferences GetWebkitPrefs() OVERRIDE;
385 virtual void OnUserGesture() OVERRIDE; 374 virtual void OnUserGesture() OVERRIDE;
386 virtual void OnIgnoredUIEvent() OVERRIDE; 375 virtual void OnIgnoredUIEvent() OVERRIDE;
387 virtual void RendererUnresponsive(content::RenderViewHost* render_view_host, 376 virtual void RendererUnresponsive(RenderViewHost* render_view_host,
388 bool is_during_unload) OVERRIDE; 377 bool is_during_unload) OVERRIDE;
389 virtual void RendererResponsive( 378 virtual void RendererResponsive(RenderViewHost* render_view_host) OVERRIDE;
390 content::RenderViewHost* render_view_host) OVERRIDE;
391 virtual void LoadStateChanged(const GURL& url, 379 virtual void LoadStateChanged(const GURL& url,
392 const net::LoadStateWithParam& load_state, 380 const net::LoadStateWithParam& load_state,
393 uint64 upload_position, 381 uint64 upload_position,
394 uint64 upload_size) OVERRIDE; 382 uint64 upload_size) OVERRIDE;
395 virtual void WorkerCrashed() OVERRIDE; 383 virtual void WorkerCrashed() OVERRIDE;
396 virtual void Activate() OVERRIDE; 384 virtual void Activate() OVERRIDE;
397 virtual void Deactivate() OVERRIDE; 385 virtual void Deactivate() OVERRIDE;
398 virtual void LostCapture() OVERRIDE; 386 virtual void LostCapture() OVERRIDE;
399 virtual void HandleMouseDown() OVERRIDE; 387 virtual void HandleMouseDown() OVERRIDE;
400 virtual void HandleMouseUp() OVERRIDE; 388 virtual void HandleMouseUp() OVERRIDE;
401 virtual void HandlePointerActivate() OVERRIDE; 389 virtual void HandlePointerActivate() OVERRIDE;
402 virtual void HandleGestureBegin() OVERRIDE; 390 virtual void HandleGestureBegin() OVERRIDE;
403 virtual void HandleGestureEnd() OVERRIDE; 391 virtual void HandleGestureEnd() OVERRIDE;
404 virtual void RunFileChooser( 392 virtual void RunFileChooser(
405 content::RenderViewHost* render_view_host, 393 RenderViewHost* render_view_host,
406 const content::FileChooserParams& params) OVERRIDE; 394 const FileChooserParams& params) OVERRIDE;
407 virtual void ToggleFullscreenMode(bool enter_fullscreen) OVERRIDE; 395 virtual void ToggleFullscreenMode(bool enter_fullscreen) OVERRIDE;
408 virtual bool IsFullscreenForCurrentTab() const OVERRIDE; 396 virtual bool IsFullscreenForCurrentTab() const OVERRIDE;
409 virtual void UpdatePreferredSize(const gfx::Size& pref_size) OVERRIDE; 397 virtual void UpdatePreferredSize(const gfx::Size& pref_size) OVERRIDE;
410 virtual void ResizeDueToAutoResize(const gfx::Size& new_size) OVERRIDE; 398 virtual void ResizeDueToAutoResize(const gfx::Size& new_size) OVERRIDE;
411 virtual void RequestToLockMouse(bool user_gesture, 399 virtual void RequestToLockMouse(bool user_gesture,
412 bool last_unlocked_by_target) OVERRIDE; 400 bool last_unlocked_by_target) OVERRIDE;
413 virtual void LostMouseLock() OVERRIDE; 401 virtual void LostMouseLock() OVERRIDE;
414 virtual void CreateNewWindow( 402 virtual void CreateNewWindow(
415 int route_id, 403 int route_id,
416 const ViewHostMsg_CreateWindow_Params& params, 404 const ViewHostMsg_CreateWindow_Params& params,
417 content::SessionStorageNamespace* session_storage_namespace) OVERRIDE; 405 SessionStorageNamespace* session_storage_namespace) OVERRIDE;
418 virtual void CreateNewWidget(int route_id, 406 virtual void CreateNewWidget(int route_id,
419 WebKit::WebPopupType popup_type) OVERRIDE; 407 WebKit::WebPopupType popup_type) OVERRIDE;
420 virtual void CreateNewFullscreenWidget(int route_id) OVERRIDE; 408 virtual void CreateNewFullscreenWidget(int route_id) OVERRIDE;
421 virtual void ShowCreatedWindow(int route_id, 409 virtual void ShowCreatedWindow(int route_id,
422 WindowOpenDisposition disposition, 410 WindowOpenDisposition disposition,
423 const gfx::Rect& initial_pos, 411 const gfx::Rect& initial_pos,
424 bool user_gesture) OVERRIDE; 412 bool user_gesture) OVERRIDE;
425 virtual void ShowCreatedWidget(int route_id, 413 virtual void ShowCreatedWidget(int route_id,
426 const gfx::Rect& initial_pos) OVERRIDE; 414 const gfx::Rect& initial_pos) OVERRIDE;
427 virtual void ShowCreatedFullscreenWidget(int route_id) OVERRIDE; 415 virtual void ShowCreatedFullscreenWidget(int route_id) OVERRIDE;
428 virtual void ShowContextMenu( 416 virtual void ShowContextMenu(
429 const content::ContextMenuParams& params, 417 const ContextMenuParams& params,
430 content::ContextMenuSourceType type) OVERRIDE; 418 ContextMenuSourceType type) OVERRIDE;
431 virtual void RequestMediaAccessPermission( 419 virtual void RequestMediaAccessPermission(
432 const content::MediaStreamRequest* request, 420 const MediaStreamRequest* request,
433 const content::MediaResponseCallback& callback) OVERRIDE; 421 const MediaResponseCallback& callback) OVERRIDE;
434 422
435 #if defined(OS_ANDROID) 423 #if defined(OS_ANDROID)
436 virtual void AttachLayer(WebKit::WebLayer* layer) OVERRIDE; 424 virtual void AttachLayer(WebKit::WebLayer* layer) OVERRIDE;
437 virtual void RemoveLayer(WebKit::WebLayer* layer) OVERRIDE; 425 virtual void RemoveLayer(WebKit::WebLayer* layer) OVERRIDE;
438 #endif 426 #endif
439 427
440 // RenderWidgetHostDelegate -------------------------------------------------- 428 // RenderWidgetHostDelegate --------------------------------------------------
441 429
442 virtual void RenderWidgetDeleted( 430 virtual void RenderWidgetDeleted(
443 content::RenderWidgetHostImpl* render_widget_host) OVERRIDE; 431 RenderWidgetHostImpl* render_widget_host) OVERRIDE;
444 virtual bool PreHandleKeyboardEvent( 432 virtual bool PreHandleKeyboardEvent(
445 const content::NativeWebKeyboardEvent& event, 433 const NativeWebKeyboardEvent& event,
446 bool* is_keyboard_shortcut) OVERRIDE; 434 bool* is_keyboard_shortcut) OVERRIDE;
447 virtual void HandleKeyboardEvent( 435 virtual void HandleKeyboardEvent(
448 const content::NativeWebKeyboardEvent& event) OVERRIDE; 436 const NativeWebKeyboardEvent& event) OVERRIDE;
449 437
450 // RenderViewHostManager::Delegate ------------------------------------------- 438 // RenderViewHostManager::Delegate -------------------------------------------
451 439
452 virtual bool CreateRenderViewForRenderManager( 440 virtual bool CreateRenderViewForRenderManager(
453 content::RenderViewHost* render_view_host, int opener_route_id) OVERRIDE; 441 RenderViewHost* render_view_host, int opener_route_id) OVERRIDE;
454 virtual void BeforeUnloadFiredFromRenderManager( 442 virtual void BeforeUnloadFiredFromRenderManager(
455 bool proceed, const base::TimeTicks& proceed_time, 443 bool proceed, const base::TimeTicks& proceed_time,
456 bool* proceed_to_fire_unload) OVERRIDE; 444 bool* proceed_to_fire_unload) OVERRIDE;
457 virtual void RenderViewGoneFromRenderManager( 445 virtual void RenderViewGoneFromRenderManager(
458 content::RenderViewHost* render_view_host) OVERRIDE; 446 RenderViewHost* render_view_host) OVERRIDE;
459 virtual void UpdateRenderViewSizeForRenderManager() OVERRIDE; 447 virtual void UpdateRenderViewSizeForRenderManager() OVERRIDE;
460 virtual void NotifySwappedFromRenderManager() OVERRIDE; 448 virtual void NotifySwappedFromRenderManager() OVERRIDE;
461 virtual int CreateOpenerRenderViewsForRenderManager( 449 virtual int CreateOpenerRenderViewsForRenderManager(
462 content::SiteInstance* instance) OVERRIDE; 450 SiteInstance* instance) OVERRIDE;
463 virtual NavigationControllerImpl& GetControllerForRenderManager() OVERRIDE; 451 virtual NavigationControllerImpl&
452 GetControllerForRenderManager() OVERRIDE;
464 virtual WebUIImpl* CreateWebUIForRenderManager(const GURL& url) OVERRIDE; 453 virtual WebUIImpl* CreateWebUIForRenderManager(const GURL& url) OVERRIDE;
465 virtual content::NavigationEntry* 454 virtual NavigationEntry*
466 GetLastCommittedNavigationEntryForRenderManager() OVERRIDE; 455 GetLastCommittedNavigationEntryForRenderManager() OVERRIDE;
467 virtual bool FocusLocationBarByDefault() OVERRIDE; 456 virtual bool FocusLocationBarByDefault() OVERRIDE;
468 virtual void SetFocusToLocationBar(bool select_all) OVERRIDE; 457 virtual void SetFocusToLocationBar(bool select_all) OVERRIDE;
469 virtual void CreateViewAndSetSizeForRVH( 458 virtual void CreateViewAndSetSizeForRVH(RenderViewHost* rvh) OVERRIDE;
470 content::RenderViewHost* rvh) OVERRIDE;
471 459
472 // content::NotificationObserver --------------------------------------------- 460 // NotificationObserver ------------------------------------------------------
473 461
474 virtual void Observe(int type, 462 virtual void Observe(int type,
475 const content::NotificationSource& source, 463 const NotificationSource& source,
476 const content::NotificationDetails& details) OVERRIDE; 464 const NotificationDetails& details) OVERRIDE;
477 465
478 466
479 private: 467 private:
480 friend class NavigationControllerImpl; 468 friend class NavigationControllerImpl;
481 friend class content::WebContentsObserver; 469 friend class WebContentsObserver;
482 friend class content::WebContents; // To implement factory methods. 470 friend class WebContents; // To implement factory methods.
483 471
484 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, NoJSMessageOnInterstitials); 472 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, NoJSMessageOnInterstitials);
485 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, UpdateTitle); 473 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, UpdateTitle);
486 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, 474 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest,
487 CrossSiteCantPreemptAfterUnload); 475 CrossSiteCantPreemptAfterUnload);
488 FRIEND_TEST_ALL_PREFIXES(FormStructureBrowserTest, HTMLFiles); 476 FRIEND_TEST_ALL_PREFIXES(FormStructureBrowserTest, HTMLFiles);
489 FRIEND_TEST_ALL_PREFIXES(NavigationControllerTest, HistoryNavigate); 477 FRIEND_TEST_ALL_PREFIXES(NavigationControllerTest, HistoryNavigate);
490 FRIEND_TEST_ALL_PREFIXES(RenderViewHostManagerTest, PageDoesBackAndReload); 478 FRIEND_TEST_ALL_PREFIXES(RenderViewHostManagerTest, PageDoesBackAndReload);
491 479
492 // So InterstitialPageImpl can access SetIsLoading. 480 // So InterstitialPageImpl can access SetIsLoading.
493 friend class InterstitialPageImpl; 481 friend class InterstitialPageImpl;
494 482
495 // TODO(brettw) TestWebContents shouldn't exist! 483 // TODO(brettw) TestWebContents shouldn't exist!
496 friend class content::TestWebContents; 484 friend class TestWebContents;
497 485
498 // See WebContents::Create for a description of these parameters. 486 // See WebContents::Create for a description of these parameters.
499 WebContentsImpl(content::BrowserContext* browser_context, 487 WebContentsImpl(BrowserContext* browser_context,
500 WebContentsImpl* opener); 488 WebContentsImpl* opener);
501 489
502 // Add and remove observers for page navigation notifications. Adding or 490 // Add and remove observers for page navigation notifications. Adding or
503 // removing multiple times has no effect. The order in which notifications 491 // removing multiple times has no effect. The order in which notifications
504 // are sent to observers is undefined. Clients must be sure to remove the 492 // are sent to observers is undefined. Clients must be sure to remove the
505 // observer before they go away. 493 // observer before they go away.
506 void AddObserver(content::WebContentsObserver* observer); 494 void AddObserver(WebContentsObserver* observer);
507 void RemoveObserver(content::WebContentsObserver* observer); 495 void RemoveObserver(WebContentsObserver* observer);
508 496
509 // Clears this tab's opener if it has been closed. 497 // Clears this tab's opener if it has been closed.
510 void OnWebContentsDestroyed(content::WebContents* web_contents); 498 void OnWebContentsDestroyed(WebContents* web_contents);
511 499
512 // Callback function when showing JS dialogs. 500 // Callback function when showing JS dialogs.
513 void OnDialogClosed(content::RenderViewHost* rvh, 501 void OnDialogClosed(RenderViewHost* rvh,
514 IPC::Message* reply_msg, 502 IPC::Message* reply_msg,
515 bool success, 503 bool success,
516 const string16& user_input); 504 const string16& user_input);
517 505
518 // Callback function when requesting permission to access the PPAPI broker. 506 // Callback function when requesting permission to access the PPAPI broker.
519 // |result| is true if permission was granted. 507 // |result| is true if permission was granted.
520 void OnPpapiBrokerPermissionResult(int request_id, bool result); 508 void OnPpapiBrokerPermissionResult(int request_id, bool result);
521 509
522 // IPC message handlers. 510 // IPC message handlers.
523 void OnRegisterIntentService(const webkit_glue::WebIntentServiceData& data, 511 void OnRegisterIntentService(const webkit_glue::WebIntentServiceData& data,
(...skipping 15 matching lines...) Expand all
539 void OnDidFailLoadWithError(int64 frame_id, 527 void OnDidFailLoadWithError(int64 frame_id,
540 const GURL& validated_url, 528 const GURL& validated_url,
541 bool is_main_frame, 529 bool is_main_frame,
542 int error_code, 530 int error_code,
543 const string16& error_description); 531 const string16& error_description);
544 void OnUpdateContentRestrictions(int restrictions); 532 void OnUpdateContentRestrictions(int restrictions);
545 void OnGoToEntryAtOffset(int offset); 533 void OnGoToEntryAtOffset(int offset);
546 void OnUpdateZoomLimits(int minimum_percent, 534 void OnUpdateZoomLimits(int minimum_percent,
547 int maximum_percent, 535 int maximum_percent,
548 bool remember); 536 bool remember);
549 void OnSaveURL(const GURL& url, const content::Referrer& referrer); 537 void OnSaveURL(const GURL& url, const Referrer& referrer);
550 void OnEnumerateDirectory(int request_id, const FilePath& path); 538 void OnEnumerateDirectory(int request_id, const FilePath& path);
551 void OnJSOutOfMemory(); 539 void OnJSOutOfMemory();
552 540
553 void OnRegisterProtocolHandler(const std::string& protocol, 541 void OnRegisterProtocolHandler(const std::string& protocol,
554 const GURL& url, 542 const GURL& url,
555 const string16& title, 543 const string16& title,
556 bool user_gesture); 544 bool user_gesture);
557 void OnFindReply(int request_id, 545 void OnFindReply(int request_id,
558 int number_of_matches, 546 int number_of_matches,
559 const gfx::Rect& selection_rect, 547 const gfx::Rect& selection_rect,
(...skipping 19 matching lines...) Expand all
579 const GURL& url, 567 const GURL& url,
580 const FilePath& plugin_path); 568 const FilePath& plugin_path);
581 void OnBrowserPluginCreateGuest(int instance_id, 569 void OnBrowserPluginCreateGuest(int instance_id,
582 const std::string& storage_partition_id, 570 const std::string& storage_partition_id,
583 bool persist_storage); 571 bool persist_storage);
584 572
585 // Changes the IsLoading state and notifies delegate as needed 573 // Changes the IsLoading state and notifies delegate as needed
586 // |details| is used to provide details on the load that just finished 574 // |details| is used to provide details on the load that just finished
587 // (but can be null if not applicable). Can be overridden. 575 // (but can be null if not applicable). Can be overridden.
588 void SetIsLoading(bool is_loading, 576 void SetIsLoading(bool is_loading,
589 content::LoadNotificationDetails* details); 577 LoadNotificationDetails* details);
590 578
591 // Called by derived classes to indicate that we're no longer waiting for a 579 // Called by derived classes to indicate that we're no longer waiting for a
592 // response. This won't actually update the throbber, but it will get picked 580 // response. This won't actually update the throbber, but it will get picked
593 // up at the next animation step if the throbber is going. 581 // up at the next animation step if the throbber is going.
594 void SetNotWaitingForResponse() { waiting_for_response_ = false; } 582 void SetNotWaitingForResponse() { waiting_for_response_ = false; }
595 583
596 // Navigation helpers -------------------------------------------------------- 584 // Navigation helpers --------------------------------------------------------
597 // 585 //
598 // These functions are helpers for Navigate() and DidNavigate(). 586 // These functions are helpers for Navigate() and DidNavigate().
599 587
600 // Handles post-navigation tasks in DidNavigate AFTER the entry has been 588 // Handles post-navigation tasks in DidNavigate AFTER the entry has been
601 // committed to the navigation controller. Note that the navigation entry is 589 // committed to the navigation controller. Note that the navigation entry is
602 // not provided since it may be invalid/changed after being committed. The 590 // not provided since it may be invalid/changed after being committed. The
603 // current navigation entry is in the NavigationController at this point. 591 // current navigation entry is in the NavigationController at this point.
604 void DidNavigateMainFramePostCommit( 592 void DidNavigateMainFramePostCommit(
605 const content::LoadCommittedDetails& details, 593 const LoadCommittedDetails& details,
606 const ViewHostMsg_FrameNavigate_Params& params); 594 const ViewHostMsg_FrameNavigate_Params& params);
607 void DidNavigateAnyFramePostCommit( 595 void DidNavigateAnyFramePostCommit(
608 content::RenderViewHost* render_view_host, 596 RenderViewHost* render_view_host,
609 const content::LoadCommittedDetails& details, 597 const LoadCommittedDetails& details,
610 const ViewHostMsg_FrameNavigate_Params& params); 598 const ViewHostMsg_FrameNavigate_Params& params);
611 599
612 // If our controller was restored, update the max page ID associated with the 600 // If our controller was restored, update the max page ID associated with the
613 // given RenderViewHost to be larger than the number of restored entries. 601 // given RenderViewHost to be larger than the number of restored entries.
614 // This is called in CreateRenderView before any navigations in the RenderView 602 // This is called in CreateRenderView before any navigations in the RenderView
615 // have begun, to prevent any races in updating RenderView::next_page_id. 603 // have begun, to prevent any races in updating RenderView::next_page_id.
616 void UpdateMaxPageIDIfNecessary(content::RenderViewHost* rvh); 604 void UpdateMaxPageIDIfNecessary(RenderViewHost* rvh);
617 605
618 // Saves the given title to the navigation entry and does associated work. It 606 // Saves the given title to the navigation entry and does associated work. It
619 // will update history and the view for the new title, and also synthesize 607 // will update history and the view for the new title, and also synthesize
620 // titles for file URLs that have none (so we require that the URL of the 608 // titles for file URLs that have none (so we require that the URL of the
621 // entry already be set). 609 // entry already be set).
622 // 610 //
623 // This is used as the backend for state updates, which include a new title, 611 // This is used as the backend for state updates, which include a new title,
624 // or the dedicated set title message. It returns true if the new title is 612 // or the dedicated set title message. It returns true if the new title is
625 // different and was therefore updated. 613 // different and was therefore updated.
626 bool UpdateTitleForEntry(content::NavigationEntryImpl* entry, 614 bool UpdateTitleForEntry(NavigationEntryImpl* entry,
627 const string16& title); 615 const string16& title);
628 616
629 // Causes the WebContentsImpl to navigate in the right renderer to |entry|, 617 // Causes the WebContentsImpl to navigate in the right renderer to |entry|,
630 // which must be already part of the entries in the navigation controller. 618 // which must be already part of the entries in the navigation controller.
631 // This does not change the NavigationController state. 619 // This does not change the NavigationController state.
632 bool NavigateToEntry(const content::NavigationEntryImpl& entry, 620 bool NavigateToEntry(const NavigationEntryImpl& entry,
633 content::NavigationController::ReloadType reload_type); 621 NavigationController::ReloadType reload_type);
634 622
635 // Sets the history for this WebContentsImpl to |history_length| entries, and 623 // Sets the history for this WebContentsImpl to |history_length| entries, and
636 // moves the current page_id to the last entry in the list if it's valid. 624 // moves the current page_id to the last entry in the list if it's valid.
637 // This is mainly used when a prerendered page is swapped into the current 625 // This is mainly used when a prerendered page is swapped into the current
638 // tab. The method is virtual for testing. 626 // tab. The method is virtual for testing.
639 virtual void SetHistoryLengthAndPrune( 627 virtual void SetHistoryLengthAndPrune(
640 const content::SiteInstance* site_instance, 628 const SiteInstance* site_instance,
641 int merge_history_length, 629 int merge_history_length,
642 int32 minimum_page_id); 630 int32 minimum_page_id);
643 631
644 // Recursively creates swapped out RenderViews for this tab's opener chain 632 // Recursively creates swapped out RenderViews for this tab's opener chain
645 // (including this tab) in the given SiteInstance, allowing other tabs to send 633 // (including this tab) in the given SiteInstance, allowing other tabs to send
646 // cross-process JavaScript calls to their opener(s). Returns the route ID of 634 // cross-process JavaScript calls to their opener(s). Returns the route ID of
647 // this tab's RenderView for |instance|. 635 // this tab's RenderView for |instance|.
648 int CreateOpenerRenderViews(content::SiteInstance* instance); 636 int CreateOpenerRenderViews(SiteInstance* instance);
649 637
650 // Helper for CreateNewWidget/CreateNewFullscreenWidget. 638 // Helper for CreateNewWidget/CreateNewFullscreenWidget.
651 void CreateNewWidget(int route_id, 639 void CreateNewWidget(int route_id,
652 bool is_fullscreen, 640 bool is_fullscreen,
653 WebKit::WebPopupType popup_type); 641 WebKit::WebPopupType popup_type);
654 642
655 // Helper for ShowCreatedWidget/ShowCreatedFullscreenWidget. 643 // Helper for ShowCreatedWidget/ShowCreatedFullscreenWidget.
656 void ShowCreatedWidget(int route_id, 644 void ShowCreatedWidget(int route_id,
657 bool is_fullscreen, 645 bool is_fullscreen,
658 const gfx::Rect& initial_pos); 646 const gfx::Rect& initial_pos);
659 647
660 // Finds the new RenderWidgetHost and returns it. Note that this can only be 648 // Finds the new RenderWidgetHost and returns it. Note that this can only be
661 // called once as this call also removes it from the internal map. 649 // called once as this call also removes it from the internal map.
662 content::RenderWidgetHostView* GetCreatedWidget(int route_id); 650 RenderWidgetHostView* GetCreatedWidget(int route_id);
663 651
664 // Finds the new WebContentsImpl by route_id, initializes it for 652 // Finds the new WebContentsImpl by route_id, initializes it for
665 // renderer-initiated creation, and returns it. Note that this can only be 653 // renderer-initiated creation, and returns it. Note that this can only be
666 // called once as this call also removes it from the internal map. 654 // called once as this call also removes it from the internal map.
667 WebContentsImpl* GetCreatedWindow(int route_id); 655 WebContentsImpl* GetCreatedWindow(int route_id);
668 656
669 // Misc non-view stuff ------------------------------------------------------- 657 // Misc non-view stuff -------------------------------------------------------
670 658
671 // Helper functions for sending notifications. 659 // Helper functions for sending notifications.
672 void NotifySwapped(); 660 void NotifySwapped();
673 void NotifyConnected(); 661 void NotifyConnected();
674 void NotifyDisconnected(); 662 void NotifyDisconnected();
675 663
676 void SetEncoding(const std::string& encoding); 664 void SetEncoding(const std::string& encoding);
677 665
678 // Save a URL to the local filesystem. 666 // Save a URL to the local filesystem.
679 void SaveURL(const GURL& url, 667 void SaveURL(const GURL& url,
680 const content::Referrer& referrer, 668 const Referrer& referrer,
681 bool is_main_frame); 669 bool is_main_frame);
682 670
683 content::RenderViewHostImpl* GetRenderViewHostImpl(); 671 RenderViewHostImpl* GetRenderViewHostImpl();
684 672
685 void GetBrowserPluginEmbedderInfo(content::RenderViewHost* render_view_host, 673 void GetBrowserPluginEmbedderInfo(RenderViewHost* render_view_host,
686 std::string* embedder_channel_name, 674 std::string* embedder_channel_name,
687 int* embedder_container_id); 675 int* embedder_container_id);
688 676
689 // Removes browser plugin embedder if there is one. 677 // Removes browser plugin embedder if there is one.
690 void RemoveBrowserPluginEmbedder(); 678 void RemoveBrowserPluginEmbedder();
691 679
692 // Data for core operation --------------------------------------------------- 680 // Data for core operation ---------------------------------------------------
693 681
694 // Delegate for notifying our owner about stuff. Not owned by us. 682 // Delegate for notifying our owner about stuff. Not owned by us.
695 content::WebContentsDelegate* delegate_; 683 WebContentsDelegate* delegate_;
696 684
697 // Handles the back/forward list and loading. 685 // Handles the back/forward list and loading.
698 NavigationControllerImpl controller_; 686 NavigationControllerImpl controller_;
699 687
700 // The corresponding view. 688 // The corresponding view.
701 scoped_ptr<content::WebContentsView> view_; 689 scoped_ptr<WebContentsView> view_;
702 690
703 // The view of the RVHD. Usually this is our WebContentsView implementation, 691 // The view of the RVHD. Usually this is our WebContentsView implementation,
704 // but if an embedder uses a different WebContentsView, they'll need to 692 // but if an embedder uses a different WebContentsView, they'll need to
705 // provide this. 693 // provide this.
706 content::RenderViewHostDelegateView* render_view_host_delegate_view_; 694 RenderViewHostDelegateView* render_view_host_delegate_view_;
707 695
708 // Tracks created WebContentsImpl objects that have not been shown yet. They 696 // Tracks created WebContentsImpl objects that have not been shown yet. They
709 // are identified by the route ID passed to CreateNewWindow. 697 // are identified by the route ID passed to CreateNewWindow.
710 typedef std::map<int, WebContentsImpl*> PendingContents; 698 typedef std::map<int, WebContentsImpl*> PendingContents;
711 PendingContents pending_contents_; 699 PendingContents pending_contents_;
712 700
713 // These maps hold on to the widgets that we created on behalf of the renderer 701 // These maps hold on to the widgets that we created on behalf of the renderer
714 // that haven't shown yet. 702 // that haven't shown yet.
715 typedef std::map<int, content::RenderWidgetHostView*> PendingWidgetViews; 703 typedef std::map<int, RenderWidgetHostView*> PendingWidgetViews;
716 PendingWidgetViews pending_widget_views_; 704 PendingWidgetViews pending_widget_views_;
717 705
718 // A list of observers notified when page state changes. Weak references. 706 // A list of observers notified when page state changes. Weak references.
719 // This MUST be listed above render_manager_ since at destruction time the 707 // This MUST be listed above render_manager_ since at destruction time the
720 // latter might cause RenderViewHost's destructor to call us and we might use 708 // latter might cause RenderViewHost's destructor to call us and we might use
721 // the observer list then. 709 // the observer list then.
722 ObserverList<content::WebContentsObserver> observers_; 710 ObserverList<WebContentsObserver> observers_;
723 711
724 // The tab that opened this tab, if any. Will be set to null if the opener 712 // The tab that opened this tab, if any. Will be set to null if the opener
725 // is closed. 713 // is closed.
726 WebContentsImpl* opener_; 714 WebContentsImpl* opener_;
727 715
728 // Helper classes ------------------------------------------------------------ 716 // Helper classes ------------------------------------------------------------
729 717
730 // Manages creation and swapping of render views. 718 // Manages creation and swapping of render views.
731 RenderViewHostManager render_manager_; 719 RenderViewHostManager render_manager_;
732 720
733 // Manages injecting Java objects into all RenderViewHosts associated with 721 // Manages injecting Java objects into all RenderViewHosts associated with
734 // this WebContentsImpl. 722 // this WebContentsImpl.
735 scoped_ptr<JavaBridgeDispatcherHostManager> 723 scoped_ptr<JavaBridgeDispatcherHostManager>
736 java_bridge_dispatcher_host_manager_; 724 java_bridge_dispatcher_host_manager_;
737 725
738 // TODO(fsamuel): Remove this once upstreaming of the new browser plugin 726 // TODO(fsamuel): Remove this once upstreaming of the new browser plugin
739 // implementation is complete. 727 // implementation is complete.
740 // Manages the browser plugin instances hosted by this WebContents. 728 // Manages the browser plugin instances hosted by this WebContents.
741 scoped_ptr<content::old::BrowserPluginHost> old_browser_plugin_host_; 729 scoped_ptr<old::BrowserPluginHost> old_browser_plugin_host_;
742 730
743 // SavePackage, lazily created. 731 // SavePackage, lazily created.
744 scoped_refptr<SavePackage> save_package_; 732 scoped_refptr<SavePackage> save_package_;
745 733
746 // Data for loading state ---------------------------------------------------- 734 // Data for loading state ----------------------------------------------------
747 735
748 // Indicates whether we're currently loading a resource. 736 // Indicates whether we're currently loading a resource.
749 bool is_loading_; 737 bool is_loading_;
750 738
751 // Indicates if the tab is considered crashed. 739 // Indicates if the tab is considered crashed.
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
797 bool is_being_destroyed_; 785 bool is_being_destroyed_;
798 786
799 // Indicates whether we should notify about disconnection of this 787 // Indicates whether we should notify about disconnection of this
800 // WebContentsImpl. This is used to ensure disconnection notifications only 788 // WebContentsImpl. This is used to ensure disconnection notifications only
801 // happen if a connection notification has happened and that they happen only 789 // happen if a connection notification has happened and that they happen only
802 // once. 790 // once.
803 bool notify_disconnection_; 791 bool notify_disconnection_;
804 792
805 // Pointer to the JavaScript dialog creator, lazily assigned. Used because the 793 // Pointer to the JavaScript dialog creator, lazily assigned. Used because the
806 // delegate of this WebContentsImpl is nulled before its destructor is called. 794 // delegate of this WebContentsImpl is nulled before its destructor is called.
807 content::JavaScriptDialogCreator* dialog_creator_; 795 JavaScriptDialogCreator* dialog_creator_;
808 796
809 #if defined(OS_WIN) 797 #if defined(OS_WIN)
810 // Handle to an event that's set when the page is showing a message box (or 798 // Handle to an event that's set when the page is showing a message box (or
811 // equivalent constrained window). Plugin processes check this to know if 799 // equivalent constrained window). Plugin processes check this to know if
812 // they should pump messages then. 800 // they should pump messages then.
813 base::win::ScopedHandle message_box_active_; 801 base::win::ScopedHandle message_box_active_;
814 #endif 802 #endif
815 803
816 // Set to true when there is an active "before unload" dialog. When true, 804 // Set to true when there is an active "before unload" dialog. When true,
817 // we've forced the throbber to start in Navigate, and we need to remember to 805 // we've forced the throbber to start in Navigate, and we need to remember to
818 // turn it off in OnJavaScriptMessageBoxClosed if the navigation is canceled. 806 // turn it off in OnJavaScriptMessageBoxClosed if the navigation is canceled.
819 bool is_showing_before_unload_dialog_; 807 bool is_showing_before_unload_dialog_;
820 808
821 // Settings that get passed to the renderer process. 809 // Settings that get passed to the renderer process.
822 content::RendererPreferences renderer_preferences_; 810 RendererPreferences renderer_preferences_;
823 811
824 // If this tab was created from a renderer using window.open, this will be 812 // If this tab was created from a renderer using window.open, this will be
825 // non-NULL and represent the WebUI of the opening renderer. 813 // non-NULL and represent the WebUI of the opening renderer.
826 content::WebUI::TypeID opener_web_ui_type_; 814 WebUI::TypeID opener_web_ui_type_;
827 815
828 // The time that we started to create the new tab page. 816 // The time that we started to create the new tab page.
829 base::TimeTicks new_tab_start_time_; 817 base::TimeTicks new_tab_start_time_;
830 818
831 // The time that we started to close this WebContents. 819 // The time that we started to close this WebContents.
832 base::TimeTicks close_start_time_; 820 base::TimeTicks close_start_time_;
833 821
834 // The time when onbeforeunload ended. 822 // The time when onbeforeunload ended.
835 base::TimeTicks before_unload_end_time_; 823 base::TimeTicks before_unload_end_time_;
836 824
(...skipping 12 matching lines...) Expand all
849 bool temporary_zoom_settings_; 837 bool temporary_zoom_settings_;
850 838
851 // The intrinsic size of the page. 839 // The intrinsic size of the page.
852 gfx::Size preferred_size_; 840 gfx::Size preferred_size_;
853 841
854 // Content restrictions, used to disable print/copy etc based on content's 842 // Content restrictions, used to disable print/copy etc based on content's
855 // (full-page plugins for now only) permissions. 843 // (full-page plugins for now only) permissions.
856 int content_restrictions_; 844 int content_restrictions_;
857 845
858 // Color chooser that was opened by this tab. 846 // Color chooser that was opened by this tab.
859 content::ColorChooser* color_chooser_; 847 ColorChooser* color_chooser_;
860 848
861 // Manages the embedder state for browser plugins, if this WebContents is an 849 // Manages the embedder state for browser plugins, if this WebContents is an
862 // embedder; NULL otherwise. 850 // embedder; NULL otherwise.
863 scoped_ptr<content::BrowserPluginEmbedder> browser_plugin_embedder_; 851 scoped_ptr<BrowserPluginEmbedder> browser_plugin_embedder_;
864 // Manages the guest state for browser plugin, if this WebContents is a guest; 852 // Manages the guest state for browser plugin, if this WebContents is a guest;
865 // NULL otherwise. 853 // NULL otherwise.
866 scoped_ptr<content::BrowserPluginGuest> browser_plugin_guest_; 854 scoped_ptr<BrowserPluginGuest> browser_plugin_guest_;
867 855
868 // This must be at the end, or else we might get notifications and use other 856 // This must be at the end, or else we might get notifications and use other
869 // member variables that are gone. 857 // member variables that are gone.
870 content::NotificationRegistrar registrar_; 858 NotificationRegistrar registrar_;
871 859
872 // Used during IPC message dispatching so that the handlers can get a pointer 860 // Used during IPC message dispatching so that the handlers can get a pointer
873 // to the RVH through which the message was received. 861 // to the RVH through which the message was received.
874 content::RenderViewHost* message_source_; 862 RenderViewHost* message_source_;
875 863
876 // All live RenderWidgetHostImpls that are created by this object and may 864 // All live RenderWidgetHostImpls that are created by this object and may
877 // outlive it. 865 // outlive it.
878 std::set<content::RenderWidgetHostImpl*> created_widgets_; 866 std::set<RenderWidgetHostImpl*> created_widgets_;
879 867
880 DISALLOW_COPY_AND_ASSIGN(WebContentsImpl); 868 DISALLOW_COPY_AND_ASSIGN(WebContentsImpl);
881 }; 869 };
882 870
871 } // namespace content
872
883 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ 873 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_
OLDNEW
« no previous file with comments | « content/browser/web_contents/web_contents_delegate_unittest.cc ('k') | content/browser/web_contents/web_contents_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698