web_contents_impl.h revision a1401311d1ab56c4ed0a474bd38c108f75cb0cd9
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
40struct BrowserPluginHostMsg_ResizeGuest_Params;
41struct ViewHostMsg_DateTimeDialogValue_Params;
42struct ViewMsg_PostMessage_Params;
43
44namespace content {
45class BrowserPluginEmbedder;
46class BrowserPluginGuest;
47class BrowserPluginGuestManager;
48class ColorChooser;
49class DateTimeChooserAndroid;
50class DownloadItem;
51class InterstitialPageImpl;
52class JavaBridgeDispatcherHostManager;
53class JavaScriptDialogManager;
54class PowerSaveBlocker;
55class RenderViewHost;
56class RenderViewHostDelegateView;
57class RenderViewHostImpl;
58class RenderWidgetHostImpl;
59class RenderWidgetHostViewPort;
60class SavePackage;
61class SessionStorageNamespaceImpl;
62class SiteInstance;
63class TestWebContents;
64class WebContentsDelegate;
65class WebContentsImpl;
66class WebContentsObserver;
67class WebContentsViewPort;
68class WebContentsViewDelegate;
69struct AXEventNotificationDetails;
70struct ColorSuggestion;
71struct FaviconURL;
72struct LoadNotificationDetails;
73struct ResourceRedirectDetails;
74struct ResourceRequestDetails;
75
76// Factory function for the implementations that content knows about. Takes
77// ownership of |delegate|.
78WebContentsViewPort* CreateWebContentsView(
79    WebContentsImpl* web_contents,
80    WebContentsViewDelegate* delegate,
81    RenderViewHostDelegateView** render_view_host_delegate_view);
82
83class 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) OVERRIDE;
308  virtual void DidStopLoading(RenderFrameHost* render_frame_host) OVERRIDE;
309  virtual void WorkerCrashed(RenderFrameHost* render_frame_host) OVERRIDE;
310  virtual void ShowContextMenu(RenderFrameHost* render_frame_host,
311                               const ContextMenuParams& params) OVERRIDE;
312  virtual WebContents* GetAsWebContents() OVERRIDE;
313
314  // RenderViewHostDelegate ----------------------------------------------------
315  virtual RenderViewHostDelegateView* GetDelegateView() OVERRIDE;
316  virtual bool OnMessageReceived(RenderViewHost* render_view_host,
317                                 const IPC::Message& message) OVERRIDE;
318  virtual const GURL& GetURL() const OVERRIDE;
319  virtual const GURL& GetVisibleURL() const OVERRIDE;
320  virtual const GURL& GetLastCommittedURL() const OVERRIDE;
321  // RenderFrameHostDelegate has the same method, so list it there because this
322  // interface is going away.
323  // virtual WebContents* GetAsWebContents() OVERRIDE;
324  virtual gfx::Rect GetRootWindowResizerRect() const OVERRIDE;
325  virtual void RenderViewCreated(RenderViewHost* render_view_host) OVERRIDE;
326  virtual void RenderViewReady(RenderViewHost* render_view_host) OVERRIDE;
327  virtual void RenderViewTerminated(RenderViewHost* render_view_host,
328                                    base::TerminationStatus status,
329                                    int error_code) OVERRIDE;
330  virtual void RenderViewDeleted(RenderViewHost* render_view_host) OVERRIDE;
331  virtual void UpdateState(RenderViewHost* render_view_host,
332                           int32 page_id,
333                           const PageState& page_state) OVERRIDE;
334  virtual void UpdateTitle(RenderViewHost* render_view_host,
335                           int32 page_id,
336                           const base::string16& title,
337                           base::i18n::TextDirection title_direction) OVERRIDE;
338  virtual void UpdateEncoding(RenderViewHost* render_view_host,
339                              const std::string& encoding) OVERRIDE;
340  virtual void UpdateTargetURL(int32 page_id, const GURL& url) OVERRIDE;
341  virtual void Close(RenderViewHost* render_view_host) OVERRIDE;
342  virtual void RequestMove(const gfx::Rect& new_bounds) OVERRIDE;
343  virtual void SwappedOut(RenderViewHost* render_view_host) OVERRIDE;
344  virtual void DidCancelLoading() OVERRIDE;
345  virtual void DidChangeLoadProgress(double progress) OVERRIDE;
346  virtual void DidDisownOpener(RenderViewHost* rvh) OVERRIDE;
347  virtual void DidAccessInitialDocument() OVERRIDE;
348  virtual void DocumentAvailableInMainFrame(
349      RenderViewHost* render_view_host) OVERRIDE;
350  virtual void DocumentOnLoadCompletedInMainFrame(
351      RenderViewHost* render_view_host,
352      int32 page_id) OVERRIDE;
353  virtual void RouteCloseEvent(RenderViewHost* rvh) OVERRIDE;
354  virtual void RouteMessageEvent(
355      RenderViewHost* rvh,
356      const ViewMsg_PostMessage_Params& params) OVERRIDE;
357  virtual void RunJavaScriptMessage(RenderViewHost* rvh,
358                                    const base::string16& message,
359                                    const base::string16& default_prompt,
360                                    const GURL& frame_url,
361                                    JavaScriptMessageType type,
362                                    IPC::Message* reply_msg,
363                                    bool* did_suppress_message) OVERRIDE;
364  virtual void RunBeforeUnloadConfirm(RenderViewHost* rvh,
365                                      const base::string16& message,
366                                      bool is_reload,
367                                      IPC::Message* reply_msg) OVERRIDE;
368  virtual bool AddMessageToConsole(int32 level,
369                                   const base::string16& message,
370                                   int32 line_no,
371                                   const base::string16& source_id) OVERRIDE;
372  virtual RendererPreferences GetRendererPrefs(
373      BrowserContext* browser_context) const OVERRIDE;
374  virtual WebPreferences GetWebkitPrefs() OVERRIDE;
375  virtual void OnUserGesture() OVERRIDE;
376  virtual void OnIgnoredUIEvent() OVERRIDE;
377  virtual void RendererUnresponsive(RenderViewHost* render_view_host,
378                                    bool is_during_beforeunload,
379                                    bool is_during_unload) OVERRIDE;
380  virtual void RendererResponsive(RenderViewHost* render_view_host) OVERRIDE;
381  virtual void LoadStateChanged(const GURL& url,
382                                const net::LoadStateWithParam& load_state,
383                                uint64 upload_position,
384                                uint64 upload_size) OVERRIDE;
385  virtual void Activate() OVERRIDE;
386  virtual void Deactivate() OVERRIDE;
387  virtual void LostCapture() OVERRIDE;
388  virtual void HandleMouseDown() OVERRIDE;
389  virtual void HandleMouseUp() OVERRIDE;
390  virtual void HandlePointerActivate() OVERRIDE;
391  virtual void HandleGestureBegin() OVERRIDE;
392  virtual void HandleGestureEnd() OVERRIDE;
393  virtual void RunFileChooser(
394      RenderViewHost* render_view_host,
395      const FileChooserParams& params) OVERRIDE;
396  virtual void ToggleFullscreenMode(bool enter_fullscreen) OVERRIDE;
397  virtual bool IsFullscreenForCurrentTab() const OVERRIDE;
398  virtual void UpdatePreferredSize(const gfx::Size& pref_size) OVERRIDE;
399  virtual void ResizeDueToAutoResize(const gfx::Size& new_size) OVERRIDE;
400  virtual void RequestToLockMouse(bool user_gesture,
401                                  bool last_unlocked_by_target) OVERRIDE;
402  virtual void LostMouseLock() OVERRIDE;
403  virtual void CreateNewWindow(
404      int render_process_id,
405      int route_id,
406      int main_frame_route_id,
407      const ViewHostMsg_CreateWindow_Params& params,
408      SessionStorageNamespace* session_storage_namespace) OVERRIDE;
409  virtual void CreateNewWidget(int render_process_id,
410                               int route_id,
411                               blink::WebPopupType popup_type) OVERRIDE;
412  virtual void CreateNewFullscreenWidget(int render_process_id,
413                                         int route_id) OVERRIDE;
414  virtual void ShowCreatedWindow(int route_id,
415                                 WindowOpenDisposition disposition,
416                                 const gfx::Rect& initial_pos,
417                                 bool user_gesture) OVERRIDE;
418  virtual void ShowCreatedWidget(int route_id,
419                                 const gfx::Rect& initial_pos) OVERRIDE;
420  virtual void ShowCreatedFullscreenWidget(int route_id) OVERRIDE;
421  virtual void RequestMediaAccessPermission(
422      const MediaStreamRequest& request,
423      const MediaResponseCallback& callback) OVERRIDE;
424  virtual SessionStorageNamespace* GetSessionStorageNamespace(
425      SiteInstance* instance) OVERRIDE;
426  virtual FrameTree* GetFrameTree() OVERRIDE;
427  virtual void AccessibilityEventReceived(
428      const std::vector<AXEventNotificationDetails>& details) OVERRIDE;
429
430  // NavigatorDelegate ---------------------------------------------------------
431
432  virtual void DidStartProvisionalLoad(
433      RenderFrameHostImpl* render_frame_host,
434      int parent_routing_id,
435      bool is_main_frame,
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      bool is_main_frame,
447      int error_code,
448      const base::string16& error_description) OVERRIDE;
449  virtual void DidRedirectProvisionalLoad(
450      RenderFrameHostImpl* render_frame_host,
451      const GURL& validated_target_url) OVERRIDE;
452  virtual void DidCommitProvisionalLoad(
453      RenderFrameHostImpl* render_frame_host,
454      const base::string16& frame_unique_name,
455      bool is_main_frame,
456      const GURL& url,
457      PageTransition transition_type) OVERRIDE;
458  virtual void DidNavigateMainFramePostCommit(
459      const LoadCommittedDetails& details,
460      const FrameHostMsg_DidCommitProvisionalLoad_Params& params) OVERRIDE;
461  virtual void DidNavigateAnyFramePostCommit(
462      RenderFrameHostImpl* render_frame_host,
463      const LoadCommittedDetails& details,
464      const FrameHostMsg_DidCommitProvisionalLoad_Params& params) OVERRIDE;
465  virtual void SetMainFrameMimeType(const std::string& mime_type) OVERRIDE;
466  virtual bool CanOverscrollContent() OVERRIDE;
467  virtual void NotifyChangedNavigationState(
468      InvalidateTypes changed_flags) OVERRIDE;
469  virtual void AboutToNavigateRenderFrame(
470      RenderFrameHostImpl* render_frame_host) OVERRIDE;
471  virtual void DidStartNavigationToPendingEntry(
472      RenderFrameHostImpl* render_frame_host,
473      const GURL& url,
474      NavigationController::ReloadType reload_type) OVERRIDE;
475  virtual void RequestOpenURL(RenderFrameHostImpl* render_frame_host,
476                              const OpenURLParams& params) OVERRIDE;
477
478  // RenderWidgetHostDelegate --------------------------------------------------
479
480  virtual void RenderWidgetDeleted(
481      RenderWidgetHostImpl* render_widget_host) OVERRIDE;
482  virtual bool PreHandleKeyboardEvent(
483      const NativeWebKeyboardEvent& event,
484      bool* is_keyboard_shortcut) OVERRIDE;
485  virtual void HandleKeyboardEvent(
486      const NativeWebKeyboardEvent& event) OVERRIDE;
487  virtual bool HandleWheelEvent(
488      const blink::WebMouseWheelEvent& event) OVERRIDE;
489  virtual bool PreHandleGestureEvent(
490      const blink::WebGestureEvent& event) OVERRIDE;
491  virtual void DidSendScreenRects(RenderWidgetHostImpl* rwh) OVERRIDE;
492#if defined(OS_WIN)
493  virtual gfx::NativeViewAccessible GetParentNativeViewAccessible() OVERRIDE;
494#endif
495
496  // RenderFrameHostManager::Delegate ------------------------------------------
497
498  virtual bool CreateRenderViewForRenderManager(
499      RenderViewHost* render_view_host,
500      int opener_route_id,
501      CrossProcessFrameConnector* frame_connector) OVERRIDE;
502  virtual void BeforeUnloadFiredFromRenderManager(
503      bool proceed, const base::TimeTicks& proceed_time,
504      bool* proceed_to_fire_unload) OVERRIDE;
505  virtual void RenderProcessGoneFromRenderManager(
506      RenderViewHost* render_view_host) OVERRIDE;
507  virtual void UpdateRenderViewSizeForRenderManager() OVERRIDE;
508  virtual void CancelModalDialogsForRenderManager() OVERRIDE;
509  virtual void NotifySwappedFromRenderManager(
510      RenderViewHost* old_host, RenderViewHost* new_host) OVERRIDE;
511  virtual int CreateOpenerRenderViewsForRenderManager(
512      SiteInstance* instance) OVERRIDE;
513  virtual NavigationControllerImpl&
514      GetControllerForRenderManager() OVERRIDE;
515  virtual WebUIImpl* CreateWebUIForRenderManager(const GURL& url) OVERRIDE;
516  virtual NavigationEntry*
517      GetLastCommittedNavigationEntryForRenderManager() OVERRIDE;
518  virtual bool FocusLocationBarByDefault() OVERRIDE;
519  virtual void SetFocusToLocationBar(bool select_all) OVERRIDE;
520  virtual void CreateViewAndSetSizeForRVH(RenderViewHost* rvh) OVERRIDE;
521  virtual bool IsHidden() OVERRIDE;
522
523  // NotificationObserver ------------------------------------------------------
524
525  virtual void Observe(int type,
526                       const NotificationSource& source,
527                       const NotificationDetails& details) OVERRIDE;
528
529  // NavigationControllerDelegate ----------------------------------------------
530
531  virtual WebContents* GetWebContents() OVERRIDE;
532  virtual void NotifyNavigationEntryCommitted(
533      const LoadCommittedDetails& load_details) OVERRIDE;
534
535  // Invoked before a form repost warning is shown.
536  virtual void NotifyBeforeFormRepostWarningShow() OVERRIDE;
537
538  // Activate this WebContents and show a form repost warning.
539  virtual void ActivateAndShowRepostFormWarningDialog() OVERRIDE;
540
541  // Updates the max page ID for the current SiteInstance in this
542  // WebContentsImpl to be at least |page_id|.
543  virtual void UpdateMaxPageID(int32 page_id) OVERRIDE;
544
545  // Updates the max page ID for the given SiteInstance in this WebContentsImpl
546  // to be at least |page_id|.
547  virtual void UpdateMaxPageIDForSiteInstance(SiteInstance* site_instance,
548                                              int32 page_id) OVERRIDE;
549
550  // Copy the current map of SiteInstance ID to max page ID from another tab.
551  // This is necessary when this tab adopts the NavigationEntries from
552  // |web_contents|.
553  virtual void CopyMaxPageIDsFrom(WebContents* web_contents) OVERRIDE;
554
555  // Called by the NavigationController to cause the WebContentsImpl to navigate
556  // to the current pending entry. The NavigationController should be called
557  // back with RendererDidNavigate on success or DiscardPendingEntry on failure.
558  // The callbacks can be inside of this function, or at some future time.
559  //
560  // The entry has a PageID of -1 if newly created (corresponding to navigation
561  // to a new URL).
562  //
563  // If this method returns false, then the navigation is discarded (equivalent
564  // to calling DiscardPendingEntry on the NavigationController).
565  virtual bool NavigateToPendingEntry(
566      NavigationController::ReloadType reload_type) OVERRIDE;
567
568  // Sets the history for this WebContentsImpl to |history_length| entries, and
569  // moves the current page_id to the last entry in the list if it's valid.
570  // This is mainly used when a prerendered page is swapped into the current
571  // tab. The method is virtual for testing.
572  virtual void SetHistoryLengthAndPrune(
573      const SiteInstance* site_instance,
574      int merge_history_length,
575      int32 minimum_page_id) OVERRIDE;
576
577  // Called by InterstitialPageImpl when it creates a RenderFrameHost.
578  virtual void RenderFrameForInterstitialPageCreated(
579      RenderFrameHost* render_frame_host) OVERRIDE;
580
581  // Sets the passed interstitial as the currently showing interstitial.
582  // No interstitial page should already be attached.
583  virtual void AttachInterstitialPage(
584      InterstitialPageImpl* interstitial_page) OVERRIDE;
585
586  // Unsets the currently showing interstitial.
587  virtual void DetachInterstitialPage() OVERRIDE;
588
589  // Changes the IsLoading state and notifies the delegate as needed.
590  // |details| is used to provide details on the load that just finished
591  // (but can be null if not applicable).
592  virtual void SetIsLoading(RenderViewHost* render_view_host,
593                            bool is_loading,
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                       bool is_main_frame);
671  void OnGoToEntryAtOffset(int offset);
672  void OnUpdateZoomLimits(int minimum_percent,
673                          int maximum_percent,
674                          bool remember);
675  void OnEnumerateDirectory(int request_id, const base::FilePath& path);
676
677  void OnRegisterProtocolHandler(const std::string& protocol,
678                                 const GURL& url,
679                                 const base::string16& title,
680                                 bool user_gesture);
681  void OnFindReply(int request_id,
682                   int number_of_matches,
683                   const gfx::Rect& selection_rect,
684                   int active_match_ordinal,
685                   bool final_update);
686#if defined(OS_ANDROID)
687  void OnFindMatchRectsReply(int version,
688                             const std::vector<gfx::RectF>& rects,
689                             const gfx::RectF& active_rect);
690
691  void OnOpenDateTimeDialog(
692      const ViewHostMsg_DateTimeDialogValue_Params& value);
693  void OnJavaBridgeGetChannelHandle(IPC::Message* reply_msg);
694#endif
695  void OnPepperPluginHung(int plugin_child_id,
696                          const base::FilePath& path,
697                          bool is_hung);
698  void OnPluginCrashed(const base::FilePath& plugin_path,
699                       base::ProcessId plugin_pid);
700  void OnDomOperationResponse(const std::string& json_string,
701                              int automation_id);
702  void OnAppCacheAccessed(const GURL& manifest_url, bool blocked_by_policy);
703  void OnOpenColorChooser(int color_chooser_id,
704                          SkColor color,
705                          const std::vector<ColorSuggestion>& suggestions);
706  void OnEndColorChooser(int color_chooser_id);
707  void OnSetSelectedColorInColorChooser(int color_chooser_id, SkColor color);
708  void OnWebUISend(const GURL& source_url,
709                   const std::string& name,
710                   const base::ListValue& args);
711  void OnRequestPpapiBrokerPermission(int routing_id,
712                                      const GURL& url,
713                                      const base::FilePath& plugin_path);
714  void OnBrowserPluginMessage(const IPC::Message& message);
715  void OnDidDownloadImage(int id,
716                          int http_status_code,
717                          const GURL& image_url,
718                          const std::vector<SkBitmap>& bitmaps,
719                          const std::vector<gfx::Size>& original_bitmap_sizes);
720  void OnUpdateFaviconURL(int32 page_id,
721                          const std::vector<FaviconURL>& candidates);
722  void OnFirstVisuallyNonEmptyPaint(int32 page_id);
723  void OnMediaPlayingNotification(int64 player_cookie,
724                                  bool has_video,
725                                  bool has_audio);
726  void OnMediaPausedNotification(int64 player_cookie);
727  void OnShowValidationMessage(const gfx::Rect& anchor_in_root_view,
728                               const base::string16& main_text,
729                               const base::string16& sub_text);
730  void OnHideValidationMessage();
731  void OnMoveValidationMessage(const gfx::Rect& anchor_in_root_view);
732
733
734  // Called by derived classes to indicate that we're no longer waiting for a
735  // response. This won't actually update the throbber, but it will get picked
736  // up at the next animation step if the throbber is going.
737  void SetNotWaitingForResponse() { waiting_for_response_ = false; }
738
739  // Navigation helpers --------------------------------------------------------
740  //
741  // These functions are helpers for Navigate() and DidNavigate().
742
743  // Handles post-navigation tasks in DidNavigate AFTER the entry has been
744  // committed to the navigation controller. Note that the navigation entry is
745  // not provided since it may be invalid/changed after being committed. The
746  // current navigation entry is in the NavigationController at this point.
747
748  // If our controller was restored, update the max page ID associated with the
749  // given RenderViewHost to be larger than the number of restored entries.
750  // This is called in CreateRenderView before any navigations in the RenderView
751  // have begun, to prevent any races in updating RenderView::next_page_id.
752  void UpdateMaxPageIDIfNecessary(RenderViewHost* rvh);
753
754  // Saves the given title to the navigation entry and does associated work. It
755  // will update history and the view for the new title, and also synthesize
756  // titles for file URLs that have none (so we require that the URL of the
757  // entry already be set).
758  //
759  // This is used as the backend for state updates, which include a new title,
760  // or the dedicated set title message. It returns true if the new title is
761  // different and was therefore updated.
762  bool UpdateTitleForEntry(NavigationEntryImpl* entry,
763                           const base::string16& title);
764
765  // Recursively creates swapped out RenderViews for this tab's opener chain
766  // (including this tab) in the given SiteInstance, allowing other tabs to send
767  // cross-process JavaScript calls to their opener(s).  Returns the route ID of
768  // this tab's RenderView for |instance|.
769  int CreateOpenerRenderViews(SiteInstance* instance);
770
771  // Helper for CreateNewWidget/CreateNewFullscreenWidget.
772  void CreateNewWidget(int render_process_id,
773                       int route_id,
774                       bool is_fullscreen,
775                       blink::WebPopupType popup_type);
776
777  // Helper for ShowCreatedWidget/ShowCreatedFullscreenWidget.
778  void ShowCreatedWidget(int route_id,
779                         bool is_fullscreen,
780                         const gfx::Rect& initial_pos);
781
782  // Finds the new RenderWidgetHost and returns it. Note that this can only be
783  // called once as this call also removes it from the internal map.
784  RenderWidgetHostView* GetCreatedWidget(int route_id);
785
786  // Finds the new WebContentsImpl by route_id, initializes it for
787  // renderer-initiated creation, and returns it. Note that this can only be
788  // called once as this call also removes it from the internal map.
789  WebContentsImpl* GetCreatedWindow(int route_id);
790
791  // Returns the RenderWidgetHostView that is associated with a native window
792  // and can be used in showing created widgets.
793  // If this WebContents belongs to a browser plugin guest, there is no native
794  // window 'view' associated with this WebContents. This method returns the
795  // 'view' of the embedder instead.
796  RenderWidgetHostViewPort* GetRenderWidgetHostViewPort() const;
797
798  // Misc non-view stuff -------------------------------------------------------
799
800  // Helper functions for sending notifications.
801  void NotifySwapped(RenderViewHost* old_host, RenderViewHost* new_host);
802  void NotifyDisconnected();
803
804  void SetEncoding(const std::string& encoding);
805
806  // TODO(creis): This should take in a FrameTreeNode to know which node's
807  // render manager to return.  For now, we just return the root's.
808  RenderFrameHostManager* GetRenderManager() const;
809
810  RenderViewHostImpl* GetRenderViewHostImpl();
811
812  // Removes browser plugin embedder if there is one.
813  void RemoveBrowserPluginEmbedder();
814
815  // Clear |render_view_host|'s PowerSaveBlockers.
816  void ClearPowerSaveBlockers(RenderViewHost* render_view_host);
817
818  // Clear all PowerSaveBlockers, leave power_save_blocker_ empty.
819  void ClearAllPowerSaveBlockers();
820
821  // Helper function to invoke WebContentsDelegate::GetSizeForNewRenderView().
822  gfx::Size GetSizeForNewRenderView() const;
823
824  void OnFrameRemoved(RenderViewHostImpl* render_view_host,
825                      int frame_routing_id);
826
827  // Helper method that's called whenever |preferred_size_| or
828  // |preferred_size_for_capture_| changes, to propagate the new value to the
829  // |delegate_|.
830  void OnPreferredSizeChanged(const gfx::Size& old_size);
831
832  // Adds/removes a callback called on creation of each new WebContents.
833  // Deprecated, about to remove.
834  static void AddCreatedCallback(const CreatedCallback& callback);
835  static void RemoveCreatedCallback(const CreatedCallback& callback);
836
837  // Data for core operation ---------------------------------------------------
838
839  // Delegate for notifying our owner about stuff. Not owned by us.
840  WebContentsDelegate* delegate_;
841
842  // Handles the back/forward list and loading.
843  NavigationControllerImpl controller_;
844
845  // The corresponding view.
846  scoped_ptr<WebContentsViewPort> view_;
847
848  // The view of the RVHD. Usually this is our WebContentsView implementation,
849  // but if an embedder uses a different WebContentsView, they'll need to
850  // provide this.
851  RenderViewHostDelegateView* render_view_host_delegate_view_;
852
853  // Tracks created WebContentsImpl objects that have not been shown yet. They
854  // are identified by the route ID passed to CreateNewWindow.
855  typedef std::map<int, WebContentsImpl*> PendingContents;
856  PendingContents pending_contents_;
857
858  // These maps hold on to the widgets that we created on behalf of the renderer
859  // that haven't shown yet.
860  typedef std::map<int, RenderWidgetHostView*> PendingWidgetViews;
861  PendingWidgetViews pending_widget_views_;
862
863  typedef std::map<WebContentsImpl*, DestructionObserver*> DestructionObservers;
864  DestructionObservers destruction_observers_;
865
866  // A list of observers notified when page state changes. Weak references.
867  // This MUST be listed above frame_tree_ since at destruction time the
868  // latter might cause RenderViewHost's destructor to call us and we might use
869  // the observer list then.
870  ObserverList<WebContentsObserver> observers_;
871
872  // The tab that opened this tab, if any.  Will be set to null if the opener
873  // is closed.
874  WebContentsImpl* opener_;
875
876#if defined(OS_WIN)
877  gfx::NativeViewAccessible accessible_parent_;
878#endif
879
880  // Helper classes ------------------------------------------------------------
881
882  // Maps the RenderViewHost to its media_player_cookie and PowerSaveBlocker
883  // pairs. Key is the RenderViewHost, value is the map which maps player_cookie
884  // on to PowerSaveBlocker.
885  typedef std::map<RenderViewHost*, std::map<int64, PowerSaveBlocker*> >
886      PowerSaveBlockerMap;
887  PowerSaveBlockerMap power_save_blockers_;
888
889  // Manages the frame tree of the page and process swaps in each node.
890  FrameTree frame_tree_;
891
892#if defined(OS_ANDROID)
893  // Manages injecting Java objects into all RenderViewHosts associated with
894  // this WebContentsImpl.
895  scoped_ptr<JavaBridgeDispatcherHostManager>
896      java_bridge_dispatcher_host_manager_;
897#endif
898
899  // SavePackage, lazily created.
900  scoped_refptr<SavePackage> save_package_;
901
902  // Data for loading state ----------------------------------------------------
903
904  // Indicates whether we're currently loading a resource.
905  bool is_loading_;
906
907  // Indicates if the tab is considered crashed.
908  base::TerminationStatus crashed_status_;
909  int crashed_error_code_;
910
911  // Whether this WebContents is waiting for a first-response for the
912  // main resource of the page. This controls whether the throbber state is
913  // "waiting" or "loading."
914  bool waiting_for_response_;
915
916  // Map of SiteInstance ID to max page ID for this tab. A page ID is specific
917  // to a given tab and SiteInstance, and must be valid for the lifetime of the
918  // WebContentsImpl.
919  std::map<int32, int32> max_page_ids_;
920
921  // The current load state and the URL associated with it.
922  net::LoadStateWithParam load_state_;
923  base::string16 load_state_host_;
924  // Upload progress, for displaying in the status bar.
925  // Set to zero when there is no significant upload happening.
926  uint64 upload_size_;
927  uint64 upload_position_;
928
929  // Data for current page -----------------------------------------------------
930
931  // When a title cannot be taken from any entry, this title will be used.
932  base::string16 page_title_when_no_navigation_entry_;
933
934  // When a navigation occurs, we record its contents MIME type. It can be
935  // used to check whether we can do something for some special contents.
936  std::string contents_mime_type_;
937
938  // Character encoding.
939  std::string encoding_;
940
941  // True if this is a secure page which displayed insecure content.
942  bool displayed_insecure_content_;
943
944  // Data for misc internal state ----------------------------------------------
945
946  // When > 0, the WebContents is currently being captured (e.g., for
947  // screenshots or mirroring); and the underlying RenderWidgetHost should not
948  // be told it is hidden.
949  int capturer_count_;
950
951  // Tracks whether RWHV should be visible once capturer_count_ becomes zero.
952  bool should_normally_be_visible_;
953
954  // See getter above.
955  bool is_being_destroyed_;
956
957  // Indicates whether we should notify about disconnection of this
958  // WebContentsImpl. This is used to ensure disconnection notifications only
959  // happen if a connection notification has happened and that they happen only
960  // once.
961  bool notify_disconnection_;
962
963  // Pointer to the JavaScript dialog manager, lazily assigned. Used because the
964  // delegate of this WebContentsImpl is nulled before its destructor is called.
965  JavaScriptDialogManager* dialog_manager_;
966
967  // Set to true when there is an active "before unload" dialog.  When true,
968  // we've forced the throbber to start in Navigate, and we need to remember to
969  // turn it off in OnJavaScriptMessageBoxClosed if the navigation is canceled.
970  bool is_showing_before_unload_dialog_;
971
972  // Settings that get passed to the renderer process.
973  RendererPreferences renderer_preferences_;
974
975  // The time that this WebContents was last made active. The initial value is
976  // the WebContents creation time.
977  base::TimeTicks last_active_time_;
978
979  // See description above setter.
980  bool closed_by_user_gesture_;
981
982  // Minimum/maximum zoom percent.
983  int minimum_zoom_percent_;
984  int maximum_zoom_percent_;
985  // If true, the default zoom limits have been overriden for this tab, in which
986  // case we don't want saved settings to apply to it and we don't want to
987  // remember it.
988  bool temporary_zoom_settings_;
989
990  // The intrinsic size of the page.
991  gfx::Size preferred_size_;
992
993  // The preferred size for content screen capture.  When |capturer_count_| > 0,
994  // this overrides |preferred_size_|.
995  gfx::Size preferred_size_for_capture_;
996
997#if defined(OS_ANDROID)
998  // Date time chooser opened by this tab.
999  // Only used in Android since all other platforms use a multi field UI.
1000  scoped_ptr<DateTimeChooserAndroid> date_time_chooser_;
1001#endif
1002
1003  // Color chooser that was opened by this tab.
1004  scoped_ptr<ColorChooser> color_chooser_;
1005
1006  // A unique identifier for the current color chooser.  Identifiers are unique
1007  // across a renderer process.  This avoids race conditions in synchronizing
1008  // the browser and renderer processes.  For example, if a renderer closes one
1009  // chooser and opens another, and simultaneously the user picks a color in the
1010  // first chooser, the IDs can be used to drop the "chose a color" message
1011  // rather than erroneously tell the renderer that the user picked a color in
1012  // the second chooser.
1013  int color_chooser_identifier_;
1014
1015  // Manages the embedder state for browser plugins, if this WebContents is an
1016  // embedder; NULL otherwise.
1017  scoped_ptr<BrowserPluginEmbedder> browser_plugin_embedder_;
1018  // Manages the guest state for browser plugin, if this WebContents is a guest;
1019  // NULL otherwise.
1020  scoped_ptr<BrowserPluginGuest> browser_plugin_guest_;
1021
1022  // This must be at the end, or else we might get notifications and use other
1023  // member variables that are gone.
1024  NotificationRegistrar registrar_;
1025
1026  // Used during IPC message dispatching from the RenderView/RenderFrame so that
1027  // the handlers can get a pointer to the RVH through which the message was
1028  // received.
1029  RenderViewHost* render_view_message_source_;
1030  RenderFrameHost* render_frame_message_source_;
1031
1032  // All live RenderWidgetHostImpls that are created by this object and may
1033  // outlive it.
1034  std::set<RenderWidgetHostImpl*> created_widgets_;
1035
1036  // Routing id of the shown fullscreen widget or MSG_ROUTING_NONE otherwise.
1037  int fullscreen_widget_routing_id_;
1038
1039  // Maps the ids of pending image downloads to their callbacks
1040  typedef std::map<int, ImageDownloadCallback> ImageDownloadMap;
1041  ImageDownloadMap image_download_map_;
1042
1043  // Whether this WebContents is responsible for displaying a subframe in a
1044  // different process from its parent page.
1045  bool is_subframe_;
1046
1047  DISALLOW_COPY_AND_ASSIGN(WebContentsImpl);
1048};
1049
1050}  // namespace content
1051
1052#endif  // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_
1053