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