Chromium Code Reviews| 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" |
| 11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
| 12 #include "content/browser/renderer_host/render_view_host_delegate.h" | 12 #include "content/browser/renderer_host/render_view_host_delegate.h" |
| 13 #include "content/browser/site_instance_impl.h" | 13 #include "content/browser/site_instance_impl.h" |
| 14 #include "content/common/content_export.h" | 14 #include "content/common/content_export.h" |
| 15 #include "content/public/browser/notification_observer.h" | 15 #include "content/public/browser/notification_observer.h" |
| 16 #include "content/public/browser/notification_registrar.h" | 16 #include "content/public/browser/notification_registrar.h" |
| 17 #include "content/public/common/referrer.h" | |
| 17 | 18 |
| 18 | 19 |
| 19 namespace content { | 20 namespace content { |
| 20 class BrowserContext; | 21 class BrowserContext; |
| 21 class InterstitialPageImpl; | 22 class InterstitialPageImpl; |
| 22 class NavigationControllerImpl; | 23 class NavigationControllerImpl; |
| 23 class NavigationEntry; | 24 class NavigationEntry; |
| 24 class NavigationEntryImpl; | 25 class NavigationEntryImpl; |
| 25 class RenderViewHost; | 26 class RenderViewHost; |
| 26 class RenderViewHostImpl; | 27 class RenderViewHostImpl; |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 205 // showing. | 206 // showing. |
| 206 InterstitialPageImpl* interstitial_page() const { return interstitial_page_; } | 207 InterstitialPageImpl* interstitial_page() const { return interstitial_page_; } |
| 207 | 208 |
| 208 // RenderViewHostDelegate::RendererManagement implementation. | 209 // RenderViewHostDelegate::RendererManagement implementation. |
| 209 virtual void ShouldClosePage( | 210 virtual void ShouldClosePage( |
| 210 bool for_cross_site_transition, | 211 bool for_cross_site_transition, |
| 211 bool proceed, | 212 bool proceed, |
| 212 const base::TimeTicks& proceed_time) OVERRIDE; | 213 const base::TimeTicks& proceed_time) OVERRIDE; |
| 213 virtual void OnCrossSiteResponse( | 214 virtual void OnCrossSiteResponse( |
| 214 RenderViewHost* pending_render_view_host, | 215 RenderViewHost* pending_render_view_host, |
| 216 const GURL& pending_url, | |
| 217 const Referrer& referrer, | |
| 218 int64 frame_id, | |
| 215 const GlobalRequestID& global_request_id) OVERRIDE; | 219 const GlobalRequestID& global_request_id) OVERRIDE; |
| 216 | 220 |
| 217 // NotificationObserver implementation. | 221 // NotificationObserver implementation. |
| 218 virtual void Observe(int type, | 222 virtual void Observe(int type, |
| 219 const NotificationSource& source, | 223 const NotificationSource& source, |
| 220 const NotificationDetails& details) OVERRIDE; | 224 const NotificationDetails& details) OVERRIDE; |
| 221 | 225 |
| 222 // Called when a RenderViewHost is about to be deleted. | 226 // Called when a RenderViewHost is about to be deleted. |
| 223 void RenderViewDeleted(RenderViewHost* rvh); | 227 void RenderViewDeleted(RenderViewHost* rvh); |
| 224 | 228 |
| 225 // Returns whether the given RenderViewHost is on the list of swapped out | 229 // Returns whether the given RenderViewHost is on the list of swapped out |
| 226 // RenderViewHosts. | 230 // RenderViewHosts. |
| 227 bool IsOnSwappedOutList(RenderViewHost* rvh) const; | 231 bool IsOnSwappedOutList(RenderViewHost* rvh) const; |
| 228 | 232 |
| 229 // Returns the swapped out RenderViewHost for the given SiteInstance, if any. | 233 // Returns the swapped out RenderViewHost for the given SiteInstance, if any. |
| 230 RenderViewHostImpl* GetSwappedOutRenderViewHost(SiteInstance* instance); | 234 RenderViewHostImpl* GetSwappedOutRenderViewHost(SiteInstance* instance); |
| 231 | 235 |
| 232 // Runs the unload handler in the current page, when we know that a pending | 236 // Runs the unload handler in the current page, when we know that a pending |
| 233 // cross-process navigation is going to commit. | 237 // cross-process navigation is going to commit. We may initiate a transfer |
| 238 // to a new process after this completes or times out. | |
| 234 void SwapOutOldPage(); | 239 void SwapOutOldPage(); |
| 235 | 240 |
| 236 private: | 241 private: |
| 237 friend class RenderViewHostManagerTest; | 242 friend class RenderViewHostManagerTest; |
| 238 friend class TestWebContents; | 243 friend class TestWebContents; |
| 239 | 244 |
| 240 // Tracks information about a navigation while a cross-process transition is | 245 // Tracks information about a navigation while a cross-process transition is |
| 241 // in progress. | 246 // in progress, in case we need to transfer it to a new RenderViewHost. |
| 242 // TODO(creis): Add transfer navigation params for http://crbug.com/238331. | |
| 243 struct PendingNavigationParams { | 247 struct PendingNavigationParams { |
| 244 PendingNavigationParams(); | 248 PendingNavigationParams(); |
| 245 explicit PendingNavigationParams(const GlobalRequestID& global_request_id); | 249 PendingNavigationParams(const GURL& new_url, |
| 250 Referrer referrer, | |
| 251 int64 frame_id, | |
| 252 const GlobalRequestID& global_request_id); | |
| 246 | 253 |
| 254 GURL new_url; | |
|
Matt Perry
2013/06/18 22:58:51
Could you document these fields? Also, it looks li
Charlie Reis
2013/06/19 00:17:01
Good call. I went with transfer_url (since we'll
| |
| 255 Referrer referrer; | |
| 256 int64 frame_id; | |
| 247 GlobalRequestID global_request_id; | 257 GlobalRequestID global_request_id; |
| 248 }; | 258 }; |
| 249 | 259 |
| 250 // Returns whether this tab should transition to a new renderer for | 260 // Returns whether this tab should transition to a new renderer for |
| 251 // cross-site URLs. Enabled unless we see the --process-per-tab command line | 261 // cross-site URLs. Enabled unless we see the --process-per-tab command line |
| 252 // switch. Can be overridden in unit tests. | 262 // switch. Can be overridden in unit tests. |
| 253 bool ShouldTransitionCrossSite(); | 263 bool ShouldTransitionCrossSite(); |
| 254 | 264 |
| 255 // Returns true if the two navigation entries are incompatible in some way | 265 // Returns true if the two navigation entries are incompatible in some way |
| 256 // other than site instances. Cases where this can happen include Web UI | 266 // other than site instances. Cases where this can happen include Web UI |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 342 InterstitialPageImpl* interstitial_page_; | 352 InterstitialPageImpl* interstitial_page_; |
| 343 | 353 |
| 344 NotificationRegistrar registrar_; | 354 NotificationRegistrar registrar_; |
| 345 | 355 |
| 346 DISALLOW_COPY_AND_ASSIGN(RenderViewHostManager); | 356 DISALLOW_COPY_AND_ASSIGN(RenderViewHostManager); |
| 347 }; | 357 }; |
| 348 | 358 |
| 349 } // namespace content | 359 } // namespace content |
| 350 | 360 |
| 351 #endif // CONTENT_BROWSER_WEB_CONTENTS_RENDER_VIEW_HOST_MANAGER_H_ | 361 #endif // CONTENT_BROWSER_WEB_CONTENTS_RENDER_VIEW_HOST_MANAGER_H_ |
| OLD | NEW |