OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_BROWSER_WEB_CONTENTS_RENDER_VIEW_HOST_MANAGER_H_ | 5 #ifndef CONTENT_BROWSER_WEB_CONTENTS_RENDER_VIEW_HOST_MANAGER_H_ |
6 #define CONTENT_BROWSER_WEB_CONTENTS_RENDER_VIEW_HOST_MANAGER_H_ | 6 #define CONTENT_BROWSER_WEB_CONTENTS_RENDER_VIEW_HOST_MANAGER_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 | 225 |
226 private: | 226 private: |
227 friend class RenderViewHostManagerTest; | 227 friend class RenderViewHostManagerTest; |
228 friend class TestWebContents; | 228 friend class TestWebContents; |
229 | 229 |
230 // Returns whether this tab should transition to a new renderer for | 230 // Returns whether this tab should transition to a new renderer for |
231 // cross-site URLs. Enabled unless we see the --process-per-tab command line | 231 // cross-site URLs. Enabled unless we see the --process-per-tab command line |
232 // switch. Can be overridden in unit tests. | 232 // switch. Can be overridden in unit tests. |
233 bool ShouldTransitionCrossSite(); | 233 bool ShouldTransitionCrossSite(); |
234 | 234 |
235 // Returns true if the two navigation entries are incompatible in some way | 235 // Returns true if for the navigation from |current_entry| to |new_entry|, |
236 // other than site instances. Cases where this can happen include Web UI | 236 // a new SiteInstance and BrowsingInstance should be created (even if we are |
237 // to regular web pages. It will cause us to swap RenderViewHosts (and hence | 237 // in a process model that doesn't usually swap). This forces a process swap |
238 // RenderProcessHosts) even if the site instance would otherwise be the same. | 238 // and severs script connections with existing tabs. Cases where this can |
239 // As part of this, we'll also force new SiteInstances and BrowsingInstances. | 239 // happen include transitions between WebUI and regular web pages. |
240 // Either of the entries may be NULL. | 240 // Either of the entries may be NULL. |
241 bool ShouldSwapProcessesForNavigation( | 241 bool ShouldSwapBrowsingInstanceForNavigation( |
242 const NavigationEntry* curr_entry, | 242 const NavigationEntry* current_entry, |
243 const NavigationEntryImpl* new_entry) const; | 243 const NavigationEntryImpl* new_entry) const; |
244 | 244 |
| 245 // Returns true if it is safe to reuse the current WebUI when navigating from |
| 246 // |curr_entry| to |new_entry|. |
245 bool ShouldReuseWebUI( | 247 bool ShouldReuseWebUI( |
246 const NavigationEntry* curr_entry, | 248 const NavigationEntry* curr_entry, |
247 const NavigationEntryImpl* new_entry) const; | 249 const NavigationEntryImpl* new_entry) const; |
248 | 250 |
249 // Returns an appropriate SiteInstance object for the given NavigationEntry, | 251 // Returns an appropriate SiteInstance object for the given NavigationEntry, |
250 // possibly reusing the current SiteInstance. | 252 // possibly reusing the current SiteInstance. If --process-per-tab is used, |
251 // Never called if --process-per-tab is used. | 253 // this is only called when ShouldSwapBrowsingInstancesForNavigation returns |
| 254 // true. |
252 SiteInstance* GetSiteInstanceForEntry( | 255 SiteInstance* GetSiteInstanceForEntry( |
253 const NavigationEntryImpl& entry, | 256 const NavigationEntryImpl& entry, |
254 SiteInstance* curr_instance); | 257 SiteInstance* curr_instance, |
| 258 bool force_swap); |
255 | 259 |
256 // Sets up the necessary state for a new RenderViewHost with the given opener. | 260 // Sets up the necessary state for a new RenderViewHost with the given opener. |
257 bool InitRenderView(RenderViewHost* render_view_host, int opener_route_id); | 261 bool InitRenderView(RenderViewHost* render_view_host, int opener_route_id); |
258 | 262 |
259 // Sets the pending RenderViewHost/WebUI to be the active one. Note that this | 263 // Sets the pending RenderViewHost/WebUI to be the active one. Note that this |
260 // doesn't require the pending render_view_host_ pointer to be non-NULL, since | 264 // doesn't require the pending render_view_host_ pointer to be non-NULL, since |
261 // there could be Web UI switching as well. Call this for every commit. | 265 // there could be Web UI switching as well. Call this for every commit. |
262 void CommitPending(); | 266 void CommitPending(); |
263 | 267 |
264 // Helper method to terminate the pending RenderViewHost. | 268 // Helper method to terminate the pending RenderViewHost. |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 | 319 |
316 // The intersitial page currently shown if any, not own by this class | 320 // The intersitial page currently shown if any, not own by this class |
317 // (the InterstitialPage is self-owned, it deletes itself when hidden). | 321 // (the InterstitialPage is self-owned, it deletes itself when hidden). |
318 InterstitialPageImpl* interstitial_page_; | 322 InterstitialPageImpl* interstitial_page_; |
319 | 323 |
320 NotificationRegistrar registrar_; | 324 NotificationRegistrar registrar_; |
321 | 325 |
322 DISALLOW_COPY_AND_ASSIGN(RenderViewHostManager); | 326 DISALLOW_COPY_AND_ASSIGN(RenderViewHostManager); |
323 }; | 327 }; |
324 | 328 |
325 } // namespace content | 329 } // namespace content |
326 | 330 |
327 #endif // CONTENT_BROWSER_WEB_CONTENTS_RENDER_VIEW_HOST_MANAGER_H_ | 331 #endif // CONTENT_BROWSER_WEB_CONTENTS_RENDER_VIEW_HOST_MANAGER_H_ |
OLD | NEW |