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

Side by Side Diff: content/browser/tab_contents/render_view_host_manager.h

Issue 9473001: Extract minimal RenderViewHost interface for embedders, leaving (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to LKGR. Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_BROWSER_TAB_CONTENTS_RENDER_VIEW_HOST_MANAGER_H_ 5 #ifndef CONTENT_BROWSER_TAB_CONTENTS_RENDER_VIEW_HOST_MANAGER_H_
6 #define CONTENT_BROWSER_TAB_CONTENTS_RENDER_VIEW_HOST_MANAGER_H_ 6 #define CONTENT_BROWSER_TAB_CONTENTS_RENDER_VIEW_HOST_MANAGER_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "content/browser/site_instance_impl.h" 12 #include "content/browser/site_instance_impl.h"
13 #include "content/common/content_export.h" 13 #include "content/common/content_export.h"
14 #include "content/public/browser/notification_observer.h" 14 #include "content/public/browser/notification_observer.h"
15 #include "content/public/browser/notification_registrar.h" 15 #include "content/public/browser/notification_registrar.h"
16 #include "content/public/browser/render_view_host_delegate.h" 16 #include "content/public/browser/render_view_host_delegate.h"
17 17
18 class InterstitialPageImpl; 18 class InterstitialPageImpl;
19 class NavigationControllerImpl; 19 class NavigationControllerImpl;
20 class RenderViewHost; 20 class RenderViewHost;
21 class RenderViewHostImpl;
21 class WebUIImpl; 22 class WebUIImpl;
22 23
23 namespace content { 24 namespace content {
24 class BrowserContext; 25 class BrowserContext;
25 class NavigationEntry; 26 class NavigationEntry;
26 class NavigationEntryImpl; 27 class NavigationEntryImpl;
27 class RenderWidgetHostView; 28 class RenderWidgetHostView;
28 } 29 }
29 30
30 // Manages RenderViewHosts for a TabContents. Normally there is only one and 31 // Manages RenderViewHosts for a TabContents. Normally there is only one and
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 // For arguments, see TabContents constructor. 103 // For arguments, see TabContents constructor.
103 void Init(content::BrowserContext* browser_context, 104 void Init(content::BrowserContext* browser_context,
104 content::SiteInstance* site_instance, 105 content::SiteInstance* site_instance,
105 int routing_id); 106 int routing_id);
106 107
107 // Returns the currently active RenderViewHost. 108 // Returns the currently active RenderViewHost.
108 // 109 //
109 // This will be non-NULL between Init() and Shutdown(). You may want to NULL 110 // This will be non-NULL between Init() and Shutdown(). You may want to NULL
110 // check it in many cases, however. Windows can send us messages during the 111 // check it in many cases, however. Windows can send us messages during the
111 // destruction process after it has been shut down. 112 // destruction process after it has been shut down.
112 RenderViewHost* current_host() const { 113 RenderViewHostImpl* current_host() const;
113 return render_view_host_;
114 }
115 114
116 // Returns the view associated with the current RenderViewHost, or NULL if 115 // Returns the view associated with the current RenderViewHost, or NULL if
117 // there is no current one. 116 // there is no current one.
118 content::RenderWidgetHostView* GetRenderWidgetHostView() const; 117 content::RenderWidgetHostView* GetRenderWidgetHostView() const;
119 118
120 // Returns the pending render view host, or NULL if there is no pending one. 119 // Returns the pending render view host, or NULL if there is no pending one.
121 RenderViewHost* pending_render_view_host() const { 120 RenderViewHostImpl* pending_render_view_host() const;
122 return pending_render_view_host_;
123 }
124 121
125 // Returns the current committed Web UI or NULL if none applies. 122 // Returns the current committed Web UI or NULL if none applies.
126 WebUIImpl* web_ui() const { return web_ui_.get(); } 123 WebUIImpl* web_ui() const { return web_ui_.get(); }
127 124
128 // Returns the Web UI for the pending navigation, or NULL of none applies. 125 // Returns the Web UI for the pending navigation, or NULL of none applies.
129 WebUIImpl* pending_web_ui() const { return pending_web_ui_.get(); } 126 WebUIImpl* pending_web_ui() const { return pending_web_ui_.get(); }
130 127
131 // Called when we want to instruct the renderer to navigate to the given 128 // Called when we want to instruct the renderer to navigate to the given
132 // navigation entry. It may create a new RenderViewHost or re-use an existing 129 // navigation entry. It may create a new RenderViewHost or re-use an existing
133 // one. The RenderViewHost to navigate will be returned. Returns NULL if one 130 // one. The RenderViewHost to navigate will be returned. Returns NULL if one
134 // could not be created. 131 // could not be created.
135 RenderViewHost* Navigate(const content::NavigationEntryImpl& entry); 132 RenderViewHostImpl* Navigate(const content::NavigationEntryImpl& entry);
136 133
137 // Instructs the various live views to stop. Called when the user directed the 134 // Instructs the various live views to stop. Called when the user directed the
138 // page to stop loading. 135 // page to stop loading.
139 void Stop(); 136 void Stop();
140 137
141 // Notifies the regular and pending RenderViewHosts that a load is or is not 138 // Notifies the regular and pending RenderViewHosts that a load is or is not
142 // happening. Even though the message is only for one of them, we don't know 139 // happening. Even though the message is only for one of them, we don't know
143 // which one so we tell both. 140 // which one so we tell both.
144 void SetIsLoading(bool is_loading); 141 void SetIsLoading(bool is_loading);
145 142
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 const content::NavigationEntryImpl& entry); 232 const content::NavigationEntryImpl& entry);
236 233
237 // Sets the pending RenderViewHost/WebUI to be the active one. Note that this 234 // Sets the pending RenderViewHost/WebUI to be the active one. Note that this
238 // doesn't require the pending render_view_host_ pointer to be non-NULL, since 235 // doesn't require the pending render_view_host_ pointer to be non-NULL, since
239 // there could be Web UI switching as well. Call this for every commit. 236 // there could be Web UI switching as well. Call this for every commit.
240 void CommitPending(); 237 void CommitPending();
241 238
242 // Helper method to terminate the pending RenderViewHost. 239 // Helper method to terminate the pending RenderViewHost.
243 void CancelPending(); 240 void CancelPending();
244 241
245 RenderViewHost* UpdateRendererStateForNavigate( 242 RenderViewHostImpl* UpdateRendererStateForNavigate(
246 const content::NavigationEntryImpl& entry); 243 const content::NavigationEntryImpl& entry);
247 244
248 // Called when a renderer process is starting to close. We should not 245 // Called when a renderer process is starting to close. We should not
249 // schedule new navigations in its swapped out RenderViewHosts after this. 246 // schedule new navigations in its swapped out RenderViewHosts after this.
250 void RendererProcessClosing(content::RenderProcessHost* render_process_host); 247 void RendererProcessClosing(content::RenderProcessHost* render_process_host);
251 248
252 // Our delegate, not owned by us. Guaranteed non-NULL. 249 // Our delegate, not owned by us. Guaranteed non-NULL.
253 Delegate* delegate_; 250 Delegate* delegate_;
254 251
255 // Whether a navigation requiring different RenderView's is pending. This is 252 // Whether a navigation requiring different RenderView's is pending. This is
256 // either cross-site request is (in the new process model), or when required 253 // either cross-site request is (in the new process model), or when required
257 // for the view type (like view source versus not). 254 // for the view type (like view source versus not).
258 bool cross_navigation_pending_; 255 bool cross_navigation_pending_;
259 256
260 // Implemented by the owner of this class, this delegate is installed into all 257 // Implemented by the owner of this class, this delegate is installed into all
261 // the RenderViewHosts that we create. 258 // the RenderViewHosts that we create.
262 content::RenderViewHostDelegate* render_view_delegate_; 259 content::RenderViewHostDelegate* render_view_delegate_;
263 260
264 // Our RenderView host and its associated Web UI (if any, will be NULL for 261 // Our RenderView host and its associated Web UI (if any, will be NULL for
265 // non-DOM-UI pages). This object is responsible for all communication with 262 // non-DOM-UI pages). This object is responsible for all communication with
266 // a child RenderView instance. 263 // a child RenderView instance.
267 RenderViewHost* render_view_host_; 264 RenderViewHostImpl* render_view_host_;
268 scoped_ptr<WebUIImpl> web_ui_; 265 scoped_ptr<WebUIImpl> web_ui_;
269 266
270 // A RenderViewHost used to load a cross-site page. This remains hidden 267 // A RenderViewHost used to load a cross-site page. This remains hidden
271 // while a cross-site request is pending until it calls DidNavigate. It may 268 // while a cross-site request is pending until it calls DidNavigate. It may
272 // have an associated Web UI, in which case the Web UI pointer will be non- 269 // have an associated Web UI, in which case the Web UI pointer will be non-
273 // NULL. 270 // NULL.
274 // 271 //
275 // The pending_web_ui may be non-NULL even when the pending_render_view_host_ 272 // The pending_web_ui may be non-NULL even when the pending_render_view_host_
276 // is. This will happen when we're transitioning between two Web UI pages: 273 // is. This will happen when we're transitioning between two Web UI pages:
277 // the RVH won't be swapped, so the pending pointer will be unused, but there 274 // the RVH won't be swapped, so the pending pointer will be unused, but there
278 // will be a pending Web UI associated with the navigation. 275 // will be a pending Web UI associated with the navigation.
279 RenderViewHost* pending_render_view_host_; 276 RenderViewHostImpl* pending_render_view_host_;
280 scoped_ptr<WebUIImpl> pending_web_ui_; 277 scoped_ptr<WebUIImpl> pending_web_ui_;
281 278
282 // A map of site instance ID to swapped out RenderViewHosts. 279 // A map of site instance ID to swapped out RenderViewHosts.
283 typedef base::hash_map<int32, RenderViewHost*> RenderViewHostMap; 280 typedef base::hash_map<int32, RenderViewHostImpl*> RenderViewHostMap;
284 RenderViewHostMap swapped_out_hosts_; 281 RenderViewHostMap swapped_out_hosts_;
285 282
286 // The intersitial page currently shown if any, not own by this class 283 // The intersitial page currently shown if any, not own by this class
287 // (the InterstitialPage is self-owned, it deletes itself when hidden). 284 // (the InterstitialPage is self-owned, it deletes itself when hidden).
288 InterstitialPageImpl* interstitial_page_; 285 InterstitialPageImpl* interstitial_page_;
289 286
290 content::NotificationRegistrar registrar_; 287 content::NotificationRegistrar registrar_;
291 288
292 DISALLOW_COPY_AND_ASSIGN(RenderViewHostManager); 289 DISALLOW_COPY_AND_ASSIGN(RenderViewHostManager);
293 }; 290 };
294 291
295 #endif // CONTENT_BROWSER_TAB_CONTENTS_RENDER_VIEW_HOST_MANAGER_H_ 292 #endif // CONTENT_BROWSER_TAB_CONTENTS_RENDER_VIEW_HOST_MANAGER_H_
OLDNEW
« no previous file with comments | « content/browser/tab_contents/popup_menu_helper_mac.mm ('k') | content/browser/tab_contents/render_view_host_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698