df48e6d92488eae0b5583e58f5770aad834708a5
[platform/framework/web/crosswalk.git] / src / content / browser / web_contents / web_contents_impl.h
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
3 // found in the LICENSE file.
4
5 #ifndef CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_
6 #define CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_
7
8 #include <map>
9 #include <set>
10 #include <string>
11
12 #include "base/compiler_specific.h"
13 #include "base/gtest_prod_util.h"
14 #include "base/memory/scoped_ptr.h"
15 #include "base/observer_list.h"
16 #include "base/process/process.h"
17 #include "base/values.h"
18 #include "content/browser/frame_host/frame_tree.h"
19 #include "content/browser/frame_host/navigation_controller_delegate.h"
20 #include "content/browser/frame_host/navigation_controller_impl.h"
21 #include "content/browser/frame_host/navigator_delegate.h"
22 #include "content/browser/frame_host/render_frame_host_delegate.h"
23 #include "content/browser/frame_host/render_frame_host_manager.h"
24 #include "content/browser/renderer_host/render_view_host_delegate.h"
25 #include "content/browser/renderer_host/render_widget_host_delegate.h"
26 #include "content/common/content_export.h"
27 #include "content/public/browser/ax_event_notification_details.h"
28 #include "content/public/browser/notification_observer.h"
29 #include "content/public/browser/notification_registrar.h"
30 #include "content/public/browser/web_contents.h"
31 #include "content/public/common/page_transition_types.h"
32 #include "content/public/common/renderer_preferences.h"
33 #include "content/public/common/three_d_api_types.h"
34 #include "net/base/load_states.h"
35 #include "third_party/WebKit/public/web/WebDragOperation.h"
36 #include "ui/gfx/rect_f.h"
37 #include "ui/gfx/size.h"
38 #include "webkit/common/resource_type.h"
39
40 struct BrowserPluginHostMsg_ResizeGuest_Params;
41 struct ViewHostMsg_DateTimeDialogValue_Params;
42 struct ViewMsg_PostMessage_Params;
43
44 namespace content {
45 class BrowserPluginEmbedder;
46 class BrowserPluginGuest;
47 class BrowserPluginGuestManager;
48 class ColorChooser;
49 class DateTimeChooserAndroid;
50 class DownloadItem;
51 class InterstitialPageImpl;
52 class JavaBridgeDispatcherHostManager;
53 class JavaScriptDialogManager;
54 class PowerSaveBlocker;
55 class RenderViewHost;
56 class RenderViewHostDelegateView;
57 class RenderViewHostImpl;
58 class RenderWidgetHostImpl;
59 class RenderWidgetHostViewPort;
60 class SavePackage;
61 class SessionStorageNamespaceImpl;
62 class SiteInstance;
63 class TestWebContents;
64 class WebContentsDelegate;
65 class WebContentsImpl;
66 class WebContentsObserver;
67 class WebContentsViewPort;
68 class WebContentsViewDelegate;
69 struct AXEventNotificationDetails;
70 struct ColorSuggestion;
71 struct FaviconURL;
72 struct LoadNotificationDetails;
73 struct ResourceRedirectDetails;
74 struct ResourceRequestDetails;
75
76 // Factory function for the implementations that content knows about. Takes
77 // ownership of |delegate|.
78 WebContentsViewPort* CreateWebContentsView(
79     WebContentsImpl* web_contents,
80     WebContentsViewDelegate* delegate,
81     RenderViewHostDelegateView** render_view_host_delegate_view);
82
83 class CONTENT_EXPORT WebContentsImpl
84     : public NON_EXPORTED_BASE(WebContents),
85       public NON_EXPORTED_BASE(RenderFrameHostDelegate),
86       public RenderViewHostDelegate,
87       public RenderWidgetHostDelegate,
88       public RenderFrameHostManager::Delegate,
89       public NotificationObserver,
90       public NON_EXPORTED_BASE(NavigationControllerDelegate),
91       public NON_EXPORTED_BASE(NavigatorDelegate) {
92  public:
93   virtual ~WebContentsImpl();
94
95   static WebContentsImpl* CreateWithOpener(
96       const WebContents::CreateParams& params,
97       WebContentsImpl* opener);
98
99   // Returns the opener WebContentsImpl, if any. This can be set to null if the
100   // opener is closed or the page clears its window.opener.
101   WebContentsImpl* opener() const { return opener_; }
102
103   // Creates a WebContents to be used as a browser plugin guest.
104   static BrowserPluginGuest* CreateGuest(
105       BrowserContext* browser_context,
106       content::SiteInstance* site_instance,
107       int guest_instance_id,
108       scoped_ptr<base::DictionaryValue> extra_params);
109
110   // Creates a swapped out RenderView. This is used by the browser plugin to
111   // create a swapped out RenderView in the embedder render process for the
112   // guest, to expose the guest's window object to the embedder.
113   // This returns the routing ID of the newly created swapped out RenderView.
114   int CreateSwappedOutRenderView(SiteInstance* instance);
115
116   // Complex initialization here. Specifically needed to avoid having
117   // members call back into our virtual functions in the constructor.
118   virtual void Init(const WebContents::CreateParams& params);
119
120   // Returns the SavePackage which manages the page saving job. May be NULL.
121   SavePackage* save_package() const { return save_package_.get(); }
122
123 #if defined(OS_ANDROID)
124   JavaBridgeDispatcherHostManager* java_bridge_dispatcher_host_manager() const {
125     return java_bridge_dispatcher_host_manager_.get();
126   }
127
128   // 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();
134 #endif
135
136   // Expose the render manager for testing.
137   // TODO(creis): Remove this now that we can get to it via FrameTreeNode.
138   RenderFrameHostManager* GetRenderManagerForTesting();
139
140   // Returns guest browser plugin object, or NULL if this WebContents is not a
141   // guest.
142   BrowserPluginGuest* GetBrowserPluginGuest() const;
143
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
149   // Returns embedder browser plugin object, or NULL if this WebContents is not
150   // an embedder.
151   BrowserPluginEmbedder* GetBrowserPluginEmbedder() const;
152
153   // Returns the BrowserPluginGuestManager object, or NULL if this web contents
154   // does not have a BrowserPluginGuestManager.
155   BrowserPluginGuestManager* GetBrowserPluginGuestManager() const;
156
157   // Gets the current fullscreen render widget's routing ID. Returns
158   // MSG_ROUTING_NONE when there is no fullscreen render widget.
159   int GetFullscreenWidgetRoutingID() const;
160
161   // Invoked when visible SSL state (as defined by SSLStatus) changes.
162   void DidChangeVisibleSSLState();
163
164   // Informs the render view host and the BrowserPluginEmbedder, if present, of
165   // a Drag Source End.
166   void DragSourceEndedAt(int client_x, int client_y, int screen_x,
167       int screen_y, blink::WebDragOperation operation);
168
169   // Informs the render view host and the BrowserPluginEmbedder, if present, of
170   // a Drag Source Move.
171   void DragSourceMovedTo(int client_x, int client_y,
172                          int screen_x, int screen_y);
173
174   // A response has been received for a resource request.
175   void DidGetResourceResponseStart(
176       const ResourceRequestDetails& details);
177
178   // A redirect was received while requesting a resource.
179   void DidGetRedirectForResourceRequest(
180       RenderViewHost* render_view_host,
181       const ResourceRedirectDetails& details);
182
183   // WebContents ------------------------------------------------------
184   virtual WebContentsDelegate* GetDelegate() OVERRIDE;
185   virtual void SetDelegate(WebContentsDelegate* delegate) OVERRIDE;
186   virtual NavigationControllerImpl& GetController() OVERRIDE;
187   virtual const NavigationControllerImpl& GetController() const OVERRIDE;
188   virtual BrowserContext* GetBrowserContext() const OVERRIDE;
189   virtual RenderProcessHost* GetRenderProcessHost() const OVERRIDE;
190   virtual RenderFrameHost* GetMainFrame() OVERRIDE;
191   virtual RenderFrameHost* GetFocusedFrame() OVERRIDE;
192   virtual void ForEachFrame(
193       const base::Callback<void(RenderFrameHost*)>& on_frame) OVERRIDE;
194   virtual void SendToAllFrames(IPC::Message* message) OVERRIDE;
195   virtual RenderViewHost* GetRenderViewHost() const OVERRIDE;
196   virtual WebContents* GetEmbedderWebContents() const OVERRIDE;
197   virtual int GetEmbeddedInstanceID() const OVERRIDE;
198   virtual int GetRoutingID() const OVERRIDE;
199   virtual RenderWidgetHostView* GetRenderWidgetHostView() const OVERRIDE;
200   virtual RenderWidgetHostView* GetFullscreenRenderWidgetHostView() const
201       OVERRIDE;
202   virtual WebContentsView* GetView() const OVERRIDE;
203   virtual WebUI* CreateWebUI(const GURL& url) OVERRIDE;
204   virtual WebUI* GetWebUI() const OVERRIDE;
205   virtual WebUI* GetCommittedWebUI() const OVERRIDE;
206   virtual void SetUserAgentOverride(const std::string& override) OVERRIDE;
207   virtual const std::string& GetUserAgentOverride() const OVERRIDE;
208 #if defined(OS_WIN)
209   virtual void SetParentNativeViewAccessible(
210       gfx::NativeViewAccessible accessible_parent) OVERRIDE;
211 #endif
212   virtual const base::string16& GetTitle() const OVERRIDE;
213   virtual int32 GetMaxPageID() OVERRIDE;
214   virtual int32 GetMaxPageIDForSiteInstance(
215       SiteInstance* site_instance) OVERRIDE;
216   virtual SiteInstance* GetSiteInstance() const OVERRIDE;
217   virtual SiteInstance* GetPendingSiteInstance() const OVERRIDE;
218   virtual bool IsLoading() const OVERRIDE;
219   virtual bool IsWaitingForResponse() const OVERRIDE;
220   virtual const net::LoadStateWithParam& GetLoadState() const OVERRIDE;
221   virtual const base::string16& GetLoadStateHost() const OVERRIDE;
222   virtual uint64 GetUploadSize() const OVERRIDE;
223   virtual uint64 GetUploadPosition() const OVERRIDE;
224   virtual std::set<GURL> GetSitesInTab() const OVERRIDE;
225   virtual const std::string& GetEncoding() const OVERRIDE;
226   virtual bool DisplayedInsecureContent() const OVERRIDE;
227   virtual void IncrementCapturerCount(const gfx::Size& capture_size) OVERRIDE;
228   virtual void DecrementCapturerCount() OVERRIDE;
229   virtual int GetCapturerCount() const OVERRIDE;
230   virtual bool IsCrashed() const OVERRIDE;
231   virtual void SetIsCrashed(base::TerminationStatus status,
232                             int error_code) OVERRIDE;
233   virtual base::TerminationStatus GetCrashedStatus() const OVERRIDE;
234   virtual bool IsBeingDestroyed() const OVERRIDE;
235   virtual void NotifyNavigationStateChanged(unsigned changed_flags) OVERRIDE;
236   virtual base::TimeTicks GetLastActiveTime() const OVERRIDE;
237   virtual void WasShown() OVERRIDE;
238   virtual void WasHidden() OVERRIDE;
239   virtual bool NeedToFireBeforeUnload() OVERRIDE;
240   virtual void Stop() OVERRIDE;
241   virtual WebContents* Clone() OVERRIDE;
242   virtual void FocusThroughTabTraversal(bool reverse) OVERRIDE;
243   virtual bool ShowingInterstitialPage() const OVERRIDE;
244   virtual InterstitialPage* GetInterstitialPage() const OVERRIDE;
245   virtual bool IsSavable() OVERRIDE;
246   virtual void OnSavePage() OVERRIDE;
247   virtual bool SavePage(const base::FilePath& main_file,
248                         const base::FilePath& dir_path,
249                         SavePageType save_type) OVERRIDE;
250   virtual void SaveFrame(const GURL& url,
251                          const Referrer& referrer) OVERRIDE;
252   virtual void GenerateMHTML(
253       const base::FilePath& file,
254       const base::Callback<void(int64)>& callback)
255           OVERRIDE;
256   virtual bool IsActiveEntry(int32 page_id) OVERRIDE;
257
258   virtual const std::string& GetContentsMimeType() const OVERRIDE;
259   virtual bool WillNotifyDisconnection() const OVERRIDE;
260   virtual void SetOverrideEncoding(const std::string& encoding) OVERRIDE;
261   virtual void ResetOverrideEncoding() OVERRIDE;
262   virtual RendererPreferences* GetMutableRendererPrefs() OVERRIDE;
263   virtual void Close() OVERRIDE;
264   virtual void SystemDragEnded() OVERRIDE;
265   virtual void UserGestureDone() OVERRIDE;
266   virtual void SetClosedByUserGesture(bool value) OVERRIDE;
267   virtual bool GetClosedByUserGesture() const OVERRIDE;
268   virtual double GetZoomLevel() const OVERRIDE;
269   virtual int GetZoomPercent(bool* enable_increment,
270                              bool* enable_decrement) const OVERRIDE;
271   virtual void ViewSource() OVERRIDE;
272   virtual void ViewFrameSource(const GURL& url,
273                                const PageState& page_state) OVERRIDE;
274   virtual int GetMinimumZoomPercent() const OVERRIDE;
275   virtual int GetMaximumZoomPercent() const OVERRIDE;
276   virtual gfx::Size GetPreferredSize() const OVERRIDE;
277   virtual bool GotResponseToLockMouseRequest(bool allowed) OVERRIDE;
278   virtual bool HasOpener() const OVERRIDE;
279   virtual void DidChooseColorInColorChooser(SkColor color) OVERRIDE;
280   virtual void DidEndColorChooser() OVERRIDE;
281   virtual int DownloadImage(const GURL& url,
282                             bool is_favicon,
283                             uint32_t max_bitmap_size,
284                             const ImageDownloadCallback& callback) OVERRIDE;
285   virtual bool IsSubframe() const OVERRIDE;
286   virtual void Find(int request_id,
287                     const base::string16& search_text,
288                     const blink::WebFindOptions& options) OVERRIDE;
289   virtual void SetZoomLevel(double level) OVERRIDE;
290   virtual void StopFinding(StopFindAction action) OVERRIDE;
291 #if defined(OS_ANDROID)
292   virtual base::android::ScopedJavaLocalRef<jobject> GetJavaWebContents()
293       OVERRIDE;
294 #endif
295
296   // Implementation of PageNavigator.
297   virtual WebContents* OpenURL(const OpenURLParams& params) OVERRIDE;
298
299   // Implementation of IPC::Sender.
300   virtual bool Send(IPC::Message* message) OVERRIDE;
301
302   // RenderFrameHostDelegate ---------------------------------------------------
303   virtual bool OnMessageReceived(RenderFrameHost* render_frame_host,
304                                  const IPC::Message& message) OVERRIDE;
305   virtual void RenderFrameCreated(RenderFrameHost* render_frame_host) OVERRIDE;
306   virtual void RenderFrameDeleted(RenderFrameHost* render_frame_host) OVERRIDE;
307   virtual void DidStartLoading(RenderFrameHost* render_frame_host,
308                                bool to_different_document) OVERRIDE;
309   virtual void DidStopLoading(RenderFrameHost* render_frame_host) OVERRIDE;
310   virtual void SwappedOut(RenderFrameHost* render_frame_host) OVERRIDE;
311   virtual void WorkerCrashed(RenderFrameHost* render_frame_host) OVERRIDE;
312   virtual void ShowContextMenu(RenderFrameHost* render_frame_host,
313                                const ContextMenuParams& params) OVERRIDE;
314   virtual WebContents* GetAsWebContents() OVERRIDE;
315
316   // RenderViewHostDelegate ----------------------------------------------------
317   virtual RenderViewHostDelegateView* GetDelegateView() OVERRIDE;
318   virtual bool OnMessageReceived(RenderViewHost* render_view_host,
319                                  const IPC::Message& message) OVERRIDE;
320   virtual const GURL& GetURL() const OVERRIDE;
321   virtual const GURL& GetVisibleURL() const OVERRIDE;
322   virtual const GURL& GetLastCommittedURL() const OVERRIDE;
323   // RenderFrameHostDelegate has the same method, so list it there because this
324   // interface is going away.
325   // virtual WebContents* GetAsWebContents() OVERRIDE;
326   virtual gfx::Rect GetRootWindowResizerRect() const OVERRIDE;
327   virtual void RenderViewCreated(RenderViewHost* render_view_host) OVERRIDE;
328   virtual void RenderViewReady(RenderViewHost* render_view_host) OVERRIDE;
329   virtual void RenderViewTerminated(RenderViewHost* render_view_host,
330                                     base::TerminationStatus status,
331                                     int error_code) OVERRIDE;
332   virtual void RenderViewDeleted(RenderViewHost* render_view_host) OVERRIDE;
333   virtual void UpdateState(RenderViewHost* render_view_host,
334                            int32 page_id,
335                            const PageState& page_state) OVERRIDE;
336   virtual void UpdateTitle(RenderViewHost* render_view_host,
337                            int32 page_id,
338                            const base::string16& title,
339                            base::i18n::TextDirection title_direction) OVERRIDE;
340   virtual void UpdateEncoding(RenderViewHost* render_view_host,
341                               const std::string& encoding) OVERRIDE;
342   virtual void UpdateTargetURL(int32 page_id, const GURL& url) OVERRIDE;
343   virtual void Close(RenderViewHost* render_view_host) OVERRIDE;
344   virtual void RequestMove(const gfx::Rect& new_bounds) OVERRIDE;
345   virtual void DidCancelLoading() OVERRIDE;
346   virtual void DidChangeLoadProgress(double progress) OVERRIDE;
347   virtual void DidDisownOpener(RenderViewHost* rvh) OVERRIDE;
348   virtual void DidAccessInitialDocument() OVERRIDE;
349   virtual void DocumentAvailableInMainFrame(
350       RenderViewHost* render_view_host) OVERRIDE;
351   virtual void DocumentOnLoadCompletedInMainFrame(
352       RenderViewHost* render_view_host,
353       int32 page_id) OVERRIDE;
354   virtual void RouteCloseEvent(RenderViewHost* rvh) OVERRIDE;
355   virtual void RouteMessageEvent(
356       RenderViewHost* rvh,
357       const ViewMsg_PostMessage_Params& params) OVERRIDE;
358   virtual void RunJavaScriptMessage(RenderViewHost* rvh,
359                                     const base::string16& message,
360                                     const base::string16& default_prompt,
361                                     const GURL& frame_url,
362                                     JavaScriptMessageType type,
363                                     IPC::Message* reply_msg,
364                                     bool* did_suppress_message) OVERRIDE;
365   virtual void RunBeforeUnloadConfirm(RenderViewHost* rvh,
366                                       const base::string16& message,
367                                       bool is_reload,
368                                       IPC::Message* reply_msg) OVERRIDE;
369   virtual bool AddMessageToConsole(int32 level,
370                                    const base::string16& message,
371                                    int32 line_no,
372                                    const base::string16& source_id) OVERRIDE;
373   virtual RendererPreferences GetRendererPrefs(
374       BrowserContext* browser_context) const OVERRIDE;
375   virtual WebPreferences GetWebkitPrefs() OVERRIDE;
376   virtual void OnUserGesture() OVERRIDE;
377   virtual void OnIgnoredUIEvent() OVERRIDE;
378   virtual void RendererUnresponsive(RenderViewHost* render_view_host,
379                                     bool is_during_beforeunload,
380                                     bool is_during_unload) OVERRIDE;
381   virtual void RendererResponsive(RenderViewHost* render_view_host) OVERRIDE;
382   virtual void LoadStateChanged(const GURL& url,
383                                 const net::LoadStateWithParam& load_state,
384                                 uint64 upload_position,
385                                 uint64 upload_size) OVERRIDE;
386   virtual void Activate() OVERRIDE;
387   virtual void Deactivate() OVERRIDE;
388   virtual void LostCapture() OVERRIDE;
389   virtual void HandleMouseDown() OVERRIDE;
390   virtual void HandleMouseUp() OVERRIDE;
391   virtual void HandlePointerActivate() OVERRIDE;
392   virtual void HandleGestureBegin() OVERRIDE;
393   virtual void HandleGestureEnd() OVERRIDE;
394   virtual void RunFileChooser(
395       RenderViewHost* render_view_host,
396       const FileChooserParams& params) OVERRIDE;
397   virtual void ToggleFullscreenMode(bool enter_fullscreen) OVERRIDE;
398   virtual bool IsFullscreenForCurrentTab() const OVERRIDE;
399   virtual void UpdatePreferredSize(const gfx::Size& pref_size) OVERRIDE;
400   virtual void ResizeDueToAutoResize(const gfx::Size& new_size) OVERRIDE;
401   virtual void RequestToLockMouse(bool user_gesture,
402                                   bool last_unlocked_by_target) OVERRIDE;
403   virtual void LostMouseLock() OVERRIDE;
404   virtual void CreateNewWindow(
405       int render_process_id,
406       int route_id,
407       int main_frame_route_id,
408       const ViewHostMsg_CreateWindow_Params& params,
409       SessionStorageNamespace* session_storage_namespace) OVERRIDE;
410   virtual void CreateNewWidget(int render_process_id,
411                                int route_id,
412                                blink::WebPopupType popup_type) OVERRIDE;
413   virtual void CreateNewFullscreenWidget(int render_process_id,
414                                          int route_id) OVERRIDE;
415   virtual void ShowCreatedWindow(int route_id,
416                                  WindowOpenDisposition disposition,
417                                  const gfx::Rect& initial_pos,
418                                  bool user_gesture) OVERRIDE;
419   virtual void ShowCreatedWidget(int route_id,
420                                  const gfx::Rect& initial_pos) OVERRIDE;
421   virtual void ShowCreatedFullscreenWidget(int route_id) OVERRIDE;
422   virtual void RequestMediaAccessPermission(
423       const MediaStreamRequest& request,
424       const MediaResponseCallback& callback) OVERRIDE;
425   virtual SessionStorageNamespace* GetSessionStorageNamespace(
426       SiteInstance* instance) OVERRIDE;
427   virtual FrameTree* GetFrameTree() OVERRIDE;
428   virtual void AccessibilityEventReceived(
429       const std::vector<AXEventNotificationDetails>& details) OVERRIDE;
430
431   // NavigatorDelegate ---------------------------------------------------------
432
433   virtual void DidStartProvisionalLoad(
434       RenderFrameHostImpl* render_frame_host,
435       int parent_routing_id,
436       const GURL& validated_url,
437       bool is_error_page,
438       bool is_iframe_srcdoc) OVERRIDE;
439   virtual void DidFailProvisionalLoadWithError(
440       RenderFrameHostImpl* render_frame_host,
441       const FrameHostMsg_DidFailProvisionalLoadWithError_Params& params)
442       OVERRIDE;
443   virtual void DidFailLoadWithError(
444       RenderFrameHostImpl* render_frame_host,
445       const GURL& url,
446       int error_code,
447       const base::string16& error_description) OVERRIDE;
448   virtual void DidRedirectProvisionalLoad(
449       RenderFrameHostImpl* render_frame_host,
450       const GURL& validated_target_url) OVERRIDE;
451   virtual void DidCommitProvisionalLoad(
452       RenderFrameHostImpl* render_frame_host,
453       const base::string16& frame_unique_name,
454       bool is_main_frame,
455       const GURL& url,
456       PageTransition transition_type) OVERRIDE;
457   virtual void DidNavigateMainFramePostCommit(
458       const LoadCommittedDetails& details,
459       const FrameHostMsg_DidCommitProvisionalLoad_Params& params) OVERRIDE;
460   virtual void DidNavigateAnyFramePostCommit(
461       RenderFrameHostImpl* render_frame_host,
462       const LoadCommittedDetails& details,
463       const FrameHostMsg_DidCommitProvisionalLoad_Params& params) OVERRIDE;
464   virtual void SetMainFrameMimeType(const std::string& mime_type) OVERRIDE;
465   virtual bool CanOverscrollContent() OVERRIDE;
466   virtual void NotifyChangedNavigationState(
467       InvalidateTypes changed_flags) OVERRIDE;
468   virtual void AboutToNavigateRenderFrame(
469       RenderFrameHostImpl* render_frame_host) OVERRIDE;
470   virtual void DidStartNavigationToPendingEntry(
471       RenderFrameHostImpl* render_frame_host,
472       const GURL& url,
473       NavigationController::ReloadType reload_type) OVERRIDE;
474   virtual void RequestOpenURL(RenderFrameHostImpl* render_frame_host,
475                               const OpenURLParams& params) OVERRIDE;
476
477   // RenderWidgetHostDelegate --------------------------------------------------
478
479   virtual void RenderWidgetDeleted(
480       RenderWidgetHostImpl* render_widget_host) OVERRIDE;
481   virtual bool PreHandleKeyboardEvent(
482       const NativeWebKeyboardEvent& event,
483       bool* is_keyboard_shortcut) OVERRIDE;
484   virtual void HandleKeyboardEvent(
485       const NativeWebKeyboardEvent& event) OVERRIDE;
486   virtual bool HandleWheelEvent(
487       const blink::WebMouseWheelEvent& event) OVERRIDE;
488   virtual bool PreHandleGestureEvent(
489       const blink::WebGestureEvent& event) OVERRIDE;
490   virtual void DidSendScreenRects(RenderWidgetHostImpl* rwh) OVERRIDE;
491 #if defined(OS_WIN)
492   virtual gfx::NativeViewAccessible GetParentNativeViewAccessible() OVERRIDE;
493 #endif
494
495   // RenderFrameHostManager::Delegate ------------------------------------------
496
497   virtual bool CreateRenderViewForRenderManager(
498       RenderViewHost* render_view_host,
499       int opener_route_id,
500       CrossProcessFrameConnector* frame_connector) OVERRIDE;
501   virtual void BeforeUnloadFiredFromRenderManager(
502       bool proceed, const base::TimeTicks& proceed_time,
503       bool* proceed_to_fire_unload) OVERRIDE;
504   virtual void RenderProcessGoneFromRenderManager(
505       RenderViewHost* render_view_host) OVERRIDE;
506   virtual void UpdateRenderViewSizeForRenderManager() OVERRIDE;
507   virtual void CancelModalDialogsForRenderManager() OVERRIDE;
508   virtual void NotifySwappedFromRenderManager(
509       RenderViewHost* old_host, RenderViewHost* new_host) OVERRIDE;
510   virtual int CreateOpenerRenderViewsForRenderManager(
511       SiteInstance* instance) OVERRIDE;
512   virtual NavigationControllerImpl&
513       GetControllerForRenderManager() OVERRIDE;
514   virtual WebUIImpl* CreateWebUIForRenderManager(const GURL& url) OVERRIDE;
515   virtual NavigationEntry*
516       GetLastCommittedNavigationEntryForRenderManager() OVERRIDE;
517   virtual bool FocusLocationBarByDefault() OVERRIDE;
518   virtual void SetFocusToLocationBar(bool select_all) OVERRIDE;
519   virtual void CreateViewAndSetSizeForRVH(RenderViewHost* rvh) OVERRIDE;
520   virtual bool IsHidden() OVERRIDE;
521
522   // NotificationObserver ------------------------------------------------------
523
524   virtual void Observe(int type,
525                        const NotificationSource& source,
526                        const NotificationDetails& details) OVERRIDE;
527
528   // NavigationControllerDelegate ----------------------------------------------
529
530   virtual WebContents* GetWebContents() OVERRIDE;
531   virtual void NotifyNavigationEntryCommitted(
532       const LoadCommittedDetails& load_details) OVERRIDE;
533
534   // Invoked before a form repost warning is shown.
535   virtual void NotifyBeforeFormRepostWarningShow() OVERRIDE;
536
537   // Activate this WebContents and show a form repost warning.
538   virtual void ActivateAndShowRepostFormWarningDialog() OVERRIDE;
539
540   // Updates the max page ID for the current SiteInstance in this
541   // WebContentsImpl to be at least |page_id|.
542   virtual void UpdateMaxPageID(int32 page_id) OVERRIDE;
543
544   // Updates the max page ID for the given SiteInstance in this WebContentsImpl
545   // to be at least |page_id|.
546   virtual void UpdateMaxPageIDForSiteInstance(SiteInstance* site_instance,
547                                               int32 page_id) OVERRIDE;
548
549   // Copy the current map of SiteInstance ID to max page ID from another tab.
550   // This is necessary when this tab adopts the NavigationEntries from
551   // |web_contents|.
552   virtual void CopyMaxPageIDsFrom(WebContents* web_contents) OVERRIDE;
553
554   // Called by the NavigationController to cause the WebContentsImpl to navigate
555   // to the current pending entry. The NavigationController should be called
556   // back with RendererDidNavigate on success or DiscardPendingEntry on failure.
557   // The callbacks can be inside of this function, or at some future time.
558   //
559   // The entry has a PageID of -1 if newly created (corresponding to navigation
560   // to a new URL).
561   //
562   // If this method returns false, then the navigation is discarded (equivalent
563   // to calling DiscardPendingEntry on the NavigationController).
564   virtual bool NavigateToPendingEntry(
565       NavigationController::ReloadType reload_type) OVERRIDE;
566
567   // Sets the history for this WebContentsImpl to |history_length| entries, and
568   // moves the current page_id to the last entry in the list if it's valid.
569   // This is mainly used when a prerendered page is swapped into the current
570   // tab. The method is virtual for testing.
571   virtual void SetHistoryLengthAndPrune(
572       const SiteInstance* site_instance,
573       int merge_history_length,
574       int32 minimum_page_id) OVERRIDE;
575
576   // Called by InterstitialPageImpl when it creates a RenderFrameHost.
577   virtual void RenderFrameForInterstitialPageCreated(
578       RenderFrameHost* render_frame_host) OVERRIDE;
579
580   // Sets the passed interstitial as the currently showing interstitial.
581   // No interstitial page should already be attached.
582   virtual void AttachInterstitialPage(
583       InterstitialPageImpl* interstitial_page) OVERRIDE;
584
585   // Unsets the currently showing interstitial.
586   virtual void DetachInterstitialPage() OVERRIDE;
587
588   // Changes the IsLoading state and notifies the delegate as needed.
589   // |details| is used to provide details on the load that just finished
590   // (but can be null if not applicable).
591   virtual void SetIsLoading(RenderViewHost* render_view_host,
592                             bool is_loading,
593                             bool to_different_document,
594                             LoadNotificationDetails* details) OVERRIDE;
595
596   typedef base::Callback<void(WebContents*)> CreatedCallback;
597
598  private:
599   friend class NavigationControllerImpl;
600   friend class TestNavigationObserver;
601   friend class WebContentsObserver;
602   friend class WebContents;  // To implement factory methods.
603
604   FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, NoJSMessageOnInterstitials);
605   FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, UpdateTitle);
606   FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, FindOpenerRVHWhenPending);
607   FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest,
608                            CrossSiteCantPreemptAfterUnload);
609   FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, PendingContents);
610   FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, FrameTreeShape);
611   FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, GetLastActiveTime);
612   FRIEND_TEST_ALL_PREFIXES(FormStructureBrowserTest, HTMLFiles);
613   FRIEND_TEST_ALL_PREFIXES(NavigationControllerTest, HistoryNavigate);
614   FRIEND_TEST_ALL_PREFIXES(RenderFrameHostManagerTest, PageDoesBackAndReload);
615
616   // So InterstitialPageImpl can access SetIsLoading.
617   friend class InterstitialPageImpl;
618
619   // TODO(brettw) TestWebContents shouldn't exist!
620   friend class TestWebContents;
621
622   class DestructionObserver;
623
624   // See WebContents::Create for a description of these parameters.
625   WebContentsImpl(BrowserContext* browser_context,
626                   WebContentsImpl* opener);
627
628   // Add and remove observers for page navigation notifications. The order in
629   // which notifications are sent to observers is undefined. Clients must be
630   // sure to remove the observer before they go away.
631   void AddObserver(WebContentsObserver* observer);
632   void RemoveObserver(WebContentsObserver* observer);
633
634   // Clears this tab's opener if it has been closed.
635   void OnWebContentsDestroyed(WebContentsImpl* web_contents);
636
637   // Creates and adds to the map a destruction observer watching |web_contents|.
638   // No-op if such an observer already exists.
639   void AddDestructionObserver(WebContentsImpl* web_contents);
640
641   // Deletes and removes from the map a destruction observer
642   // watching |web_contents|. No-op if there is no such observer.
643   void RemoveDestructionObserver(WebContentsImpl* web_contents);
644
645   // Callback function when showing JS dialogs.
646   void OnDialogClosed(RenderViewHost* rvh,
647                       IPC::Message* reply_msg,
648                       bool success,
649                       const base::string16& user_input);
650
651   // Callback function when requesting permission to access the PPAPI broker.
652   // |result| is true if permission was granted.
653   void OnPpapiBrokerPermissionResult(int routing_id, bool result);
654
655   bool OnMessageReceived(RenderViewHost* render_view_host,
656                          RenderFrameHost* render_frame_host,
657                          const IPC::Message& message);
658
659   // IPC message handlers.
660   void OnDidLoadResourceFromMemoryCache(const GURL& url,
661                                         const std::string& security_info,
662                                         const std::string& http_request,
663                                         const std::string& mime_type,
664                                         ResourceType::Type resource_type);
665   void OnDidDisplayInsecureContent();
666   void OnDidRunInsecureContent(const std::string& security_origin,
667                                const GURL& target_url);
668   void OnDocumentLoadedInFrame();
669   void OnDidFinishLoad(const GURL& url);
670   void OnGoToEntryAtOffset(int offset);
671   void OnUpdateZoomLimits(int minimum_percent,
672                           int maximum_percent,
673                           bool remember);
674   void OnEnumerateDirectory(int request_id, const base::FilePath& path);
675
676   void OnRegisterProtocolHandler(const std::string& protocol,
677                                  const GURL& url,
678                                  const base::string16& title,
679                                  bool user_gesture);
680   void OnFindReply(int request_id,
681                    int number_of_matches,
682                    const gfx::Rect& selection_rect,
683                    int active_match_ordinal,
684                    bool final_update);
685 #if defined(OS_ANDROID)
686   void OnFindMatchRectsReply(int version,
687                              const std::vector<gfx::RectF>& rects,
688                              const gfx::RectF& active_rect);
689
690   void OnOpenDateTimeDialog(
691       const ViewHostMsg_DateTimeDialogValue_Params& value);
692   void OnJavaBridgeGetChannelHandle(IPC::Message* reply_msg);
693 #endif
694   void OnPepperPluginHung(int plugin_child_id,
695                           const base::FilePath& path,
696                           bool is_hung);
697   void OnPluginCrashed(const base::FilePath& plugin_path,
698                        base::ProcessId plugin_pid);
699   void OnDomOperationResponse(const std::string& json_string,
700                               int automation_id);
701   void OnAppCacheAccessed(const GURL& manifest_url, bool blocked_by_policy);
702   void OnOpenColorChooser(int color_chooser_id,
703                           SkColor color,
704                           const std::vector<ColorSuggestion>& suggestions);
705   void OnEndColorChooser(int color_chooser_id);
706   void OnSetSelectedColorInColorChooser(int color_chooser_id, SkColor color);
707   void OnWebUISend(const GURL& source_url,
708                    const std::string& name,
709                    const base::ListValue& args);
710   void OnRequestPpapiBrokerPermission(int routing_id,
711                                       const GURL& url,
712                                       const base::FilePath& plugin_path);
713   void OnBrowserPluginMessage(const IPC::Message& message);
714   void OnDidDownloadImage(int id,
715                           int http_status_code,
716                           const GURL& image_url,
717                           const std::vector<SkBitmap>& bitmaps,
718                           const std::vector<gfx::Size>& original_bitmap_sizes);
719   void OnUpdateFaviconURL(int32 page_id,
720                           const std::vector<FaviconURL>& candidates);
721   void OnFirstVisuallyNonEmptyPaint(int32 page_id);
722   void OnMediaPlayingNotification(int64 player_cookie,
723                                   bool has_video,
724                                   bool has_audio);
725   void OnMediaPausedNotification(int64 player_cookie);
726   void OnShowValidationMessage(const gfx::Rect& anchor_in_root_view,
727                                const base::string16& main_text,
728                                const base::string16& sub_text);
729   void OnHideValidationMessage();
730   void OnMoveValidationMessage(const gfx::Rect& anchor_in_root_view);
731
732
733   // Called by derived classes to indicate that we're no longer waiting for a
734   // response. This won't actually update the throbber, but it will get picked
735   // up at the next animation step if the throbber is going.
736   void SetNotWaitingForResponse() { waiting_for_response_ = false; }
737
738   // Navigation helpers --------------------------------------------------------
739   //
740   // These functions are helpers for Navigate() and DidNavigate().
741
742   // Handles post-navigation tasks in DidNavigate AFTER the entry has been
743   // committed to the navigation controller. Note that the navigation entry is
744   // not provided since it may be invalid/changed after being committed. The
745   // current navigation entry is in the NavigationController at this point.
746
747   // If our controller was restored, update the max page ID associated with the
748   // given RenderViewHost to be larger than the number of restored entries.
749   // This is called in CreateRenderView before any navigations in the RenderView
750   // have begun, to prevent any races in updating RenderView::next_page_id.
751   void UpdateMaxPageIDIfNecessary(RenderViewHost* rvh);
752
753   // Saves the given title to the navigation entry and does associated work. It
754   // will update history and the view for the new title, and also synthesize
755   // titles for file URLs that have none (so we require that the URL of the
756   // entry already be set).
757   //
758   // This is used as the backend for state updates, which include a new title,
759   // or the dedicated set title message. It returns true if the new title is
760   // different and was therefore updated.
761   bool UpdateTitleForEntry(NavigationEntryImpl* entry,
762                            const base::string16& title);
763
764   // Recursively creates swapped out RenderViews for this tab's opener chain
765   // (including this tab) in the given SiteInstance, allowing other tabs to send
766   // cross-process JavaScript calls to their opener(s).  Returns the route ID of
767   // this tab's RenderView for |instance|.
768   int CreateOpenerRenderViews(SiteInstance* instance);
769
770   // Helper for CreateNewWidget/CreateNewFullscreenWidget.
771   void CreateNewWidget(int render_process_id,
772                        int route_id,
773                        bool is_fullscreen,
774                        blink::WebPopupType popup_type);
775
776   // Helper for ShowCreatedWidget/ShowCreatedFullscreenWidget.
777   void ShowCreatedWidget(int route_id,
778                          bool is_fullscreen,
779                          const gfx::Rect& initial_pos);
780
781   // Finds the new RenderWidgetHost and returns it. Note that this can only be
782   // called once as this call also removes it from the internal map.
783   RenderWidgetHostView* GetCreatedWidget(int route_id);
784
785   // Finds the new WebContentsImpl by route_id, initializes it for
786   // renderer-initiated creation, and returns it. Note that this can only be
787   // called once as this call also removes it from the internal map.
788   WebContentsImpl* GetCreatedWindow(int route_id);
789
790   // Returns the RenderWidgetHostView that is associated with a native window
791   // and can be used in showing created widgets.
792   // If this WebContents belongs to a browser plugin guest, there is no native
793   // window 'view' associated with this WebContents. This method returns the
794   // 'view' of the embedder instead.
795   RenderWidgetHostViewPort* GetRenderWidgetHostViewPort() const;
796
797   // Misc non-view stuff -------------------------------------------------------
798
799   // Helper functions for sending notifications.
800   void NotifySwapped(RenderViewHost* old_host, RenderViewHost* new_host);
801   void NotifyDisconnected();
802
803   void SetEncoding(const std::string& encoding);
804
805   // TODO(creis): This should take in a FrameTreeNode to know which node's
806   // render manager to return.  For now, we just return the root's.
807   RenderFrameHostManager* GetRenderManager() const;
808
809   RenderViewHostImpl* GetRenderViewHostImpl();
810
811   // Removes browser plugin embedder if there is one.
812   void RemoveBrowserPluginEmbedder();
813
814   // Clear |render_view_host|'s PowerSaveBlockers.
815   void ClearPowerSaveBlockers(RenderViewHost* render_view_host);
816
817   // Clear all PowerSaveBlockers, leave power_save_blocker_ empty.
818   void ClearAllPowerSaveBlockers();
819
820   // Helper function to invoke WebContentsDelegate::GetSizeForNewRenderView().
821   gfx::Size GetSizeForNewRenderView() const;
822
823   void OnFrameRemoved(RenderViewHostImpl* render_view_host,
824                       int frame_routing_id);
825
826   // Helper method that's called whenever |preferred_size_| or
827   // |preferred_size_for_capture_| changes, to propagate the new value to the
828   // |delegate_|.
829   void OnPreferredSizeChanged(const gfx::Size& old_size);
830
831   // Adds/removes a callback called on creation of each new WebContents.
832   // Deprecated, about to remove.
833   static void AddCreatedCallback(const CreatedCallback& callback);
834   static void RemoveCreatedCallback(const CreatedCallback& callback);
835
836   // Data for core operation ---------------------------------------------------
837
838   // Delegate for notifying our owner about stuff. Not owned by us.
839   WebContentsDelegate* delegate_;
840
841   // Handles the back/forward list and loading.
842   NavigationControllerImpl controller_;
843
844   // The corresponding view.
845   scoped_ptr<WebContentsViewPort> view_;
846
847   // The view of the RVHD. Usually this is our WebContentsView implementation,
848   // but if an embedder uses a different WebContentsView, they'll need to
849   // provide this.
850   RenderViewHostDelegateView* render_view_host_delegate_view_;
851
852   // Tracks created WebContentsImpl objects that have not been shown yet. They
853   // are identified by the route ID passed to CreateNewWindow.
854   typedef std::map<int, WebContentsImpl*> PendingContents;
855   PendingContents pending_contents_;
856
857   // These maps hold on to the widgets that we created on behalf of the renderer
858   // that haven't shown yet.
859   typedef std::map<int, RenderWidgetHostView*> PendingWidgetViews;
860   PendingWidgetViews pending_widget_views_;
861
862   typedef std::map<WebContentsImpl*, DestructionObserver*> DestructionObservers;
863   DestructionObservers destruction_observers_;
864
865   // A list of observers notified when page state changes. Weak references.
866   // This MUST be listed above frame_tree_ since at destruction time the
867   // latter might cause RenderViewHost's destructor to call us and we might use
868   // the observer list then.
869   ObserverList<WebContentsObserver> observers_;
870
871   // The tab that opened this tab, if any.  Will be set to null if the opener
872   // is closed.
873   WebContentsImpl* opener_;
874
875 #if defined(OS_WIN)
876   gfx::NativeViewAccessible accessible_parent_;
877 #endif
878
879   // Helper classes ------------------------------------------------------------
880
881   // Maps the RenderViewHost to its media_player_cookie and PowerSaveBlocker
882   // pairs. Key is the RenderViewHost, value is the map which maps player_cookie
883   // on to PowerSaveBlocker.
884   typedef std::map<RenderViewHost*, std::map<int64, PowerSaveBlocker*> >
885       PowerSaveBlockerMap;
886   PowerSaveBlockerMap power_save_blockers_;
887
888   // Manages the frame tree of the page and process swaps in each node.
889   FrameTree frame_tree_;
890
891 #if defined(OS_ANDROID)
892   // Manages injecting Java objects into all RenderViewHosts associated with
893   // this WebContentsImpl.
894   scoped_ptr<JavaBridgeDispatcherHostManager>
895       java_bridge_dispatcher_host_manager_;
896 #endif
897
898   // SavePackage, lazily created.
899   scoped_refptr<SavePackage> save_package_;
900
901   // Data for loading state ----------------------------------------------------
902
903   // Indicates whether we're currently loading a resource.
904   bool is_loading_;
905
906   // Indicates if the tab is considered crashed.
907   base::TerminationStatus crashed_status_;
908   int crashed_error_code_;
909
910   // Whether this WebContents is waiting for a first-response for the
911   // main resource of the page. This controls whether the throbber state is
912   // "waiting" or "loading."
913   bool waiting_for_response_;
914
915   // Map of SiteInstance ID to max page ID for this tab. A page ID is specific
916   // to a given tab and SiteInstance, and must be valid for the lifetime of the
917   // WebContentsImpl.
918   std::map<int32, int32> max_page_ids_;
919
920   // The current load state and the URL associated with it.
921   net::LoadStateWithParam load_state_;
922   base::string16 load_state_host_;
923   // Upload progress, for displaying in the status bar.
924   // Set to zero when there is no significant upload happening.
925   uint64 upload_size_;
926   uint64 upload_position_;
927
928   // Data for current page -----------------------------------------------------
929
930   // When a title cannot be taken from any entry, this title will be used.
931   base::string16 page_title_when_no_navigation_entry_;
932
933   // When a navigation occurs, we record its contents MIME type. It can be
934   // used to check whether we can do something for some special contents.
935   std::string contents_mime_type_;
936
937   // Character encoding.
938   std::string encoding_;
939
940   // True if this is a secure page which displayed insecure content.
941   bool displayed_insecure_content_;
942
943   // Data for misc internal state ----------------------------------------------
944
945   // When > 0, the WebContents is currently being captured (e.g., for
946   // screenshots or mirroring); and the underlying RenderWidgetHost should not
947   // be told it is hidden.
948   int capturer_count_;
949
950   // Tracks whether RWHV should be visible once capturer_count_ becomes zero.
951   bool should_normally_be_visible_;
952
953   // See getter above.
954   bool is_being_destroyed_;
955
956   // Indicates whether we should notify about disconnection of this
957   // WebContentsImpl. This is used to ensure disconnection notifications only
958   // happen if a connection notification has happened and that they happen only
959   // once.
960   bool notify_disconnection_;
961
962   // Pointer to the JavaScript dialog manager, lazily assigned. Used because the
963   // delegate of this WebContentsImpl is nulled before its destructor is called.
964   JavaScriptDialogManager* dialog_manager_;
965
966   // Set to true when there is an active "before unload" dialog.  When true,
967   // we've forced the throbber to start in Navigate, and we need to remember to
968   // turn it off in OnJavaScriptMessageBoxClosed if the navigation is canceled.
969   bool is_showing_before_unload_dialog_;
970
971   // Settings that get passed to the renderer process.
972   RendererPreferences renderer_preferences_;
973
974   // The time that this WebContents was last made active. The initial value is
975   // the WebContents creation time.
976   base::TimeTicks last_active_time_;
977
978   // See description above setter.
979   bool closed_by_user_gesture_;
980
981   // Minimum/maximum zoom percent.
982   int minimum_zoom_percent_;
983   int maximum_zoom_percent_;
984   // If true, the default zoom limits have been overriden for this tab, in which
985   // case we don't want saved settings to apply to it and we don't want to
986   // remember it.
987   bool temporary_zoom_settings_;
988
989   // The intrinsic size of the page.
990   gfx::Size preferred_size_;
991
992   // The preferred size for content screen capture.  When |capturer_count_| > 0,
993   // this overrides |preferred_size_|.
994   gfx::Size preferred_size_for_capture_;
995
996 #if defined(OS_ANDROID)
997   // Date time chooser opened by this tab.
998   // Only used in Android since all other platforms use a multi field UI.
999   scoped_ptr<DateTimeChooserAndroid> date_time_chooser_;
1000 #endif
1001
1002   // Color chooser that was opened by this tab.
1003   scoped_ptr<ColorChooser> color_chooser_;
1004
1005   // A unique identifier for the current color chooser.  Identifiers are unique
1006   // across a renderer process.  This avoids race conditions in synchronizing
1007   // the browser and renderer processes.  For example, if a renderer closes one
1008   // chooser and opens another, and simultaneously the user picks a color in the
1009   // first chooser, the IDs can be used to drop the "chose a color" message
1010   // rather than erroneously tell the renderer that the user picked a color in
1011   // the second chooser.
1012   int color_chooser_identifier_;
1013
1014   // Manages the embedder state for browser plugins, if this WebContents is an
1015   // embedder; NULL otherwise.
1016   scoped_ptr<BrowserPluginEmbedder> browser_plugin_embedder_;
1017   // Manages the guest state for browser plugin, if this WebContents is a guest;
1018   // NULL otherwise.
1019   scoped_ptr<BrowserPluginGuest> browser_plugin_guest_;
1020
1021   // This must be at the end, or else we might get notifications and use other
1022   // member variables that are gone.
1023   NotificationRegistrar registrar_;
1024
1025   // Used during IPC message dispatching from the RenderView/RenderFrame so that
1026   // the handlers can get a pointer to the RVH through which the message was
1027   // received.
1028   RenderViewHost* render_view_message_source_;
1029   RenderFrameHost* render_frame_message_source_;
1030
1031   // All live RenderWidgetHostImpls that are created by this object and may
1032   // outlive it.
1033   std::set<RenderWidgetHostImpl*> created_widgets_;
1034
1035   // Routing id of the shown fullscreen widget or MSG_ROUTING_NONE otherwise.
1036   int fullscreen_widget_routing_id_;
1037
1038   // Maps the ids of pending image downloads to their callbacks
1039   typedef std::map<int, ImageDownloadCallback> ImageDownloadMap;
1040   ImageDownloadMap image_download_map_;
1041
1042   // Whether this WebContents is responsible for displaying a subframe in a
1043   // different process from its parent page.
1044   bool is_subframe_;
1045
1046   DISALLOW_COPY_AND_ASSIGN(WebContentsImpl);
1047 };
1048
1049 }  // namespace content
1050
1051 #endif  // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_