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

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

Issue 62044: Make the RenderViewHostFactory a global. This prevents us from having to pass... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 8 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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 CHROME_BROWSER_TAB_CONTENTS_RENDER_VIEW_HOST_MANAGER_H_ 5 #ifndef CHROME_BROWSER_TAB_CONTENTS_RENDER_VIEW_HOST_MANAGER_H_
6 #define CHROME_BROWSER_TAB_CONTENTS_RENDER_VIEW_HOST_MANAGER_H_ 6 #define CHROME_BROWSER_TAB_CONTENTS_RENDER_VIEW_HOST_MANAGER_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/scoped_ptr.h" 9 #include "base/scoped_ptr.h"
10 #include "chrome/browser/renderer_host/render_view_host.h" 10 #include "chrome/browser/renderer_host/render_view_host.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 // returned pointer will be passed to the caller. If no DOMUI applies, 54 // returned pointer will be passed to the caller. If no DOMUI applies,
55 // returns NULL. 55 // returns NULL.
56 virtual DOMUI* CreateDOMUIForRenderManager(const GURL& url) = 0; 56 virtual DOMUI* CreateDOMUIForRenderManager(const GURL& url) = 0;
57 57
58 // Returns the navigation entry of the current navigation, or NULL if there 58 // Returns the navigation entry of the current navigation, or NULL if there
59 // is none. 59 // is none.
60 virtual NavigationEntry* 60 virtual NavigationEntry*
61 GetLastCommittedNavigationEntryForRenderManager() = 0; 61 GetLastCommittedNavigationEntryForRenderManager() = 0;
62 }; 62 };
63 63
64 // The factory is optional. It is used by unit tests to supply custom render
65 // view hosts. When NULL, the regular RenderViewHost will be created.
66 //
67 // Both delegate pointers must be non-NULL and are not owned by this class. 64 // Both delegate pointers must be non-NULL and are not owned by this class.
68 // They must outlive this class. The RenderViewHostDelegate is what will be 65 // They must outlive this class. The RenderViewHostDelegate is what will be
69 // installed into all RenderViewHosts that are created. 66 // installed into all RenderViewHosts that are created.
70 // 67 //
71 // You must call Init() before using this class and Shutdown() before 68 // You must call Init() before using this class and Shutdown() before
72 // deleting it. 69 // deleting it.
73 RenderViewHostManager(RenderViewHostFactory* render_view_factory, 70 RenderViewHostManager(RenderViewHostDelegate* render_view_delegate,
74 RenderViewHostDelegate* render_view_delegate,
75 Delegate* delegate); 71 Delegate* delegate);
76 ~RenderViewHostManager(); 72 ~RenderViewHostManager();
77 73
78 // For arguments, see WebContents constructor. 74 // For arguments, see WebContents constructor.
79 void Init(Profile* profile, 75 void Init(Profile* profile,
80 SiteInstance* site_instance, 76 SiteInstance* site_instance,
81 int routing_id, 77 int routing_id,
82 base::WaitableEvent* modal_dialog_event); 78 base::WaitableEvent* modal_dialog_event);
83 79
84 // Schedules all RenderViewHosts for destruction. 80 // Schedules all RenderViewHosts for destruction.
85 void Shutdown(); 81 void Shutdown();
86 82
87 // Returns true if there is a RenderViewHostFactory that will generate
88 // non-standard RenderViewHosts.
89 bool has_render_view_host_factory() const {
90 return !!render_view_factory_;
91 }
92
93 // Returns the currently actuive RenderViewHost. 83 // Returns the currently actuive RenderViewHost.
94 // 84 //
95 // This will be non-NULL between Init() and Shutdown(). You may want to NULL 85 // This will be non-NULL between Init() and Shutdown(). You may want to NULL
96 // check it in many cases, however. Windows can send us messages during the 86 // check it in many cases, however. Windows can send us messages during the
97 // destruction process after it has been shut down. 87 // destruction process after it has been shut down.
98 RenderViewHost* current_host() const { 88 RenderViewHost* current_host() const {
99 return render_view_host_; 89 return render_view_host_;
100 } 90 }
101 91
102 // Returns the view associated with the current RenderViewHost, or NULL if 92 // Returns the view associated with the current RenderViewHost, or NULL if
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 // Returns an appropriate SiteInstance object for the given NavigationEntry, 196 // Returns an appropriate SiteInstance object for the given NavigationEntry,
207 // possibly reusing the current SiteInstance. 197 // possibly reusing the current SiteInstance.
208 // Never called if --process-per-tab is used. 198 // Never called if --process-per-tab is used.
209 SiteInstance* GetSiteInstanceForEntry(const NavigationEntry& entry, 199 SiteInstance* GetSiteInstanceForEntry(const NavigationEntry& entry,
210 SiteInstance* curr_instance); 200 SiteInstance* curr_instance);
211 201
212 // Helper method to create a pending RenderViewHost for a cross-site 202 // Helper method to create a pending RenderViewHost for a cross-site
213 // navigation. 203 // navigation.
214 bool CreatePendingRenderView(SiteInstance* instance); 204 bool CreatePendingRenderView(SiteInstance* instance);
215 205
216 // Creates a RenderViewHost using render_view_factory_ (or directly, if the
217 // factory is NULL).
218 RenderViewHost* CreateRenderViewHost(SiteInstance* instance,
219 int routing_id,
220 base::WaitableEvent* modal_dialog_event);
221
222 // Sets the pending RenderViewHost/DOMUI to be the active one. Note that this 206 // Sets the pending RenderViewHost/DOMUI to be the active one. Note that this
223 // doesn't require the pending render_view_host_ pointer to be non-NULL, since 207 // doesn't require the pending render_view_host_ pointer to be non-NULL, since
224 // there could be DOM UI switching as well. Call this for every commit. 208 // there could be DOM UI switching as well. Call this for every commit.
225 void CommitPending(); 209 void CommitPending();
226 210
227 // Helper method to terminate the pending RenderViewHost. 211 // Helper method to terminate the pending RenderViewHost.
228 void CancelPending(); 212 void CancelPending();
229 213
230 RenderViewHost* UpdateRendererStateForNavigate(const NavigationEntry& entry); 214 RenderViewHost* UpdateRendererStateForNavigate(const NavigationEntry& entry);
231 215
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 }; 256 };
273 257
274 // The "details" for a NOTIFY_RENDER_VIEW_HOST_CHANGED notification. The old 258 // The "details" for a NOTIFY_RENDER_VIEW_HOST_CHANGED notification. The old
275 // host can be NULL when the first RenderViewHost is set. 259 // host can be NULL when the first RenderViewHost is set.
276 struct RenderViewHostSwitchedDetails { 260 struct RenderViewHostSwitchedDetails {
277 RenderViewHost* old_host; 261 RenderViewHost* old_host;
278 RenderViewHost* new_host; 262 RenderViewHost* new_host;
279 }; 263 };
280 264
281 #endif // CHROME_BROWSER_TAB_CONTENTS_RENDER_VIEW_HOST_MANAGER_H_ 265 #endif // CHROME_BROWSER_TAB_CONTENTS_RENDER_VIEW_HOST_MANAGER_H_
OLDNEW
« no previous file with comments | « chrome/browser/tab_contents/navigation_controller.cc ('k') | chrome/browser/tab_contents/render_view_host_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698