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 for the navigation from |current_entry| to |new_entry|, | 238 // Returns true if the two navigation entries are incompatible in some way |
239 // a new SiteInstance and BrowsingInstance should be created (even if we are | 239 // other than site instances. Cases where this can happen include Web UI |
240 // in a process model that doesn't usually swap). This forces a process swap | 240 // to regular web pages. It will cause us to swap RenderViewHosts (and hence |
241 // and severs script connections with existing tabs. Cases where this can | 241 // RenderProcessHosts) even if the site instance would otherwise be the same. |
242 // happen include transitions between WebUI and regular web pages. | 242 // As part of this, we'll also force new SiteInstances and BrowsingInstances. |
243 // Either of the entries may be NULL. | 243 // Either of the entries may be NULL. |
244 bool ShouldSwapBrowsingInstanceForNavigation( | 244 bool ShouldSwapProcessesForNavigation( |
245 const content::NavigationEntry* current_entry, | 245 const content::NavigationEntry* curr_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|. | |
250 bool ShouldReuseWebUI( | 248 bool ShouldReuseWebUI( |
251 const content::NavigationEntry* curr_entry, | 249 const content::NavigationEntry* curr_entry, |
252 const content::NavigationEntryImpl* new_entry) const; | 250 const content::NavigationEntryImpl* new_entry) const; |
253 | 251 |
254 // Returns an appropriate SiteInstance object for the given NavigationEntry, | 252 // Returns an appropriate SiteInstance object for the given NavigationEntry, |
255 // possibly reusing the current SiteInstance. If --process-per-tab is used, | 253 // possibly reusing the current SiteInstance. |
256 // this is only called when ShouldSwapBrowsingInstancesForNavigation returns | 254 // Never called if --process-per-tab is used. |
257 // true. | |
258 content::SiteInstance* GetSiteInstanceForEntry( | 255 content::SiteInstance* GetSiteInstanceForEntry( |
259 const content::NavigationEntryImpl& entry, | 256 const content::NavigationEntryImpl& entry, |
260 content::SiteInstance* curr_instance, | 257 content::SiteInstance* curr_instance); |
261 bool force_swap); | |
262 | 258 |
263 // Sets up the necessary state for a new RenderViewHost with the given opener. | 259 // Sets up the necessary state for a new RenderViewHost with the given opener. |
264 bool InitRenderView(content::RenderViewHost* render_view_host, | 260 bool InitRenderView(content::RenderViewHost* render_view_host, |
265 int opener_route_id); | 261 int opener_route_id); |
266 | 262 |
267 // 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 |
268 // 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 |
269 // 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. |
270 void CommitPending(); | 266 void CommitPending(); |
271 | 267 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 // 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 |
325 // (the InterstitialPage is self-owned, it deletes itself when hidden). | 321 // (the InterstitialPage is self-owned, it deletes itself when hidden). |
326 InterstitialPageImpl* interstitial_page_; | 322 InterstitialPageImpl* interstitial_page_; |
327 | 323 |
328 content::NotificationRegistrar registrar_; | 324 content::NotificationRegistrar registrar_; |
329 | 325 |
330 DISALLOW_COPY_AND_ASSIGN(RenderViewHostManager); | 326 DISALLOW_COPY_AND_ASSIGN(RenderViewHostManager); |
331 }; | 327 }; |
332 | 328 |
333 #endif // CONTENT_BROWSER_WEB_CONTENTS_RENDER_VIEW_HOST_MANAGER_H_ | 329 #endif // CONTENT_BROWSER_WEB_CONTENTS_RENDER_VIEW_HOST_MANAGER_H_ |
OLD | NEW |