OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_FRAME_HOST_RENDER_FRAME_HOST_MANAGER_H_ | 5 #ifndef CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_MANAGER_H_ |
6 #define CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_MANAGER_H_ | 6 #define CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_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/global_request_id.h" | 15 #include "content/public/browser/global_request_id.h" |
16 #include "content/public/browser/notification_observer.h" | 16 #include "content/public/browser/notification_observer.h" |
17 #include "content/public/browser/notification_registrar.h" | 17 #include "content/public/browser/notification_registrar.h" |
18 #include "content/public/common/referrer.h" | 18 #include "content/public/common/referrer.h" |
19 | 19 |
20 | 20 |
21 namespace content { | 21 namespace content { |
22 class BrowserContext; | 22 class BrowserContext; |
23 class CrossProcessFrameConnector; | 23 class CrossProcessFrameConnector; |
24 class CrossSiteRequestTransfer; | |
24 class InterstitialPageImpl; | 25 class InterstitialPageImpl; |
25 class FrameTreeNode; | 26 class FrameTreeNode; |
26 class NavigationControllerImpl; | 27 class NavigationControllerImpl; |
27 class NavigationEntry; | 28 class NavigationEntry; |
28 class NavigationEntryImpl; | 29 class NavigationEntryImpl; |
29 class RenderFrameHostDelegate; | 30 class RenderFrameHostDelegate; |
30 class RenderFrameHostImpl; | 31 class RenderFrameHostImpl; |
31 class RenderFrameHostManagerTest; | 32 class RenderFrameHostManagerTest; |
32 class RenderViewHost; | 33 class RenderViewHost; |
33 class RenderViewHostImpl; | 34 class RenderViewHostImpl; |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
232 InterstitialPageImpl* interstitial_page() const { return interstitial_page_; } | 233 InterstitialPageImpl* interstitial_page() const { return interstitial_page_; } |
233 | 234 |
234 // RenderViewHostDelegate::RendererManagement implementation. | 235 // RenderViewHostDelegate::RendererManagement implementation. |
235 virtual void ShouldClosePage( | 236 virtual void ShouldClosePage( |
236 bool for_cross_site_transition, | 237 bool for_cross_site_transition, |
237 bool proceed, | 238 bool proceed, |
238 const base::TimeTicks& proceed_time) OVERRIDE; | 239 const base::TimeTicks& proceed_time) OVERRIDE; |
239 virtual void OnCrossSiteResponse( | 240 virtual void OnCrossSiteResponse( |
240 RenderViewHost* pending_render_view_host, | 241 RenderViewHost* pending_render_view_host, |
241 const GlobalRequestID& global_request_id, | 242 const GlobalRequestID& global_request_id, |
242 bool is_transfer, | 243 scoped_ptr<CrossSiteRequestTransfer> cross_site_request_transfer, |
243 const std::vector<GURL>& transfer_url_chain, | 244 const std::vector<GURL>& transfer_url_chain, |
244 const Referrer& referrer, | 245 const Referrer& referrer, |
245 PageTransition page_transition, | 246 PageTransition page_transition, |
246 int64 frame_id, | 247 int64 frame_id, |
247 bool should_replace_current_entry) OVERRIDE; | 248 bool should_replace_current_entry) OVERRIDE; |
248 | 249 |
249 // NotificationObserver implementation. | 250 // NotificationObserver implementation. |
250 virtual void Observe(int type, | 251 virtual void Observe(int type, |
251 const NotificationSource& source, | 252 const NotificationSource& source, |
252 const NotificationDetails& details) OVERRIDE; | 253 const NotificationDetails& details) OVERRIDE; |
(...skipping 20 matching lines...) Expand all Loading... | |
273 // Deletes a RenderFrameHost that was pending shutdown. | 274 // Deletes a RenderFrameHost that was pending shutdown. |
274 void ClearPendingShutdownRFHForSiteInstance(int32 site_instance_id, | 275 void ClearPendingShutdownRFHForSiteInstance(int32 site_instance_id, |
275 RenderFrameHostImpl* rfh); | 276 RenderFrameHostImpl* rfh); |
276 | 277 |
277 private: | 278 private: |
278 friend class RenderFrameHostManagerTest; | 279 friend class RenderFrameHostManagerTest; |
279 friend class TestWebContents; | 280 friend class TestWebContents; |
280 | 281 |
281 // Tracks information about a navigation while a cross-process transition is | 282 // Tracks information about a navigation while a cross-process transition is |
282 // in progress, in case we need to transfer it to a new RenderFrameHost. | 283 // in progress, in case we need to transfer it to a new RenderFrameHost. |
284 // When a request is being transferred, deleting the PendingNavigationParams, | |
285 // and thus |request_transfer|, will cancel the request being transferred, | |
Charlie Reis
2014/02/13 22:12:19
nit: request_transfer doesn't match the name of th
mmenke
2014/02/14 16:30:02
Done. I've noticed my number of typos varies dire
| |
286 // unless |request_transfer|'s ReleaseRequest method has been called. | |
283 struct PendingNavigationParams { | 287 struct PendingNavigationParams { |
284 PendingNavigationParams(); | 288 PendingNavigationParams( |
285 PendingNavigationParams(const GlobalRequestID& global_request_id, | 289 const GlobalRequestID& global_request_id, |
286 bool is_transfer, | 290 scoped_ptr<CrossSiteRequestTransfer> cross_site_request_transfer, |
287 const std::vector<GURL>& transfer_url, | 291 const std::vector<GURL>& transfer_url, |
288 Referrer referrer, | 292 Referrer referrer, |
289 PageTransition page_transition, | 293 PageTransition page_transition, |
290 int64 frame_id, | 294 int64 frame_id, |
291 bool should_replace_current_entry); | 295 bool should_replace_current_entry); |
292 ~PendingNavigationParams(); | 296 ~PendingNavigationParams(); |
293 | 297 |
294 // The child ID and request ID for the pending navigation. Present whether | 298 // The child ID and request ID for the pending navigation. Present whether |
295 // |is_transfer| is true or false. | 299 // |request_transfer| is NULL or not. |
296 GlobalRequestID global_request_id; | 300 GlobalRequestID global_request_id; |
297 | 301 |
298 // Whether this pending navigation needs to be transferred to another | 302 // If a pending request needs to be transfferred to another process, this |
Charlie Reis
2014/02/13 22:12:19
nit: transferred
mmenke
2014/02/14 16:30:02
Done.
| |
299 // process than the one it was going to commit in. If so, the | 303 // owns the request until it's transferred to the new process, so it will be |
300 // |transfer_url|, |referrer|, and |frame_id| parameters will be set. | 304 // cleaned up if teh navigation is cancelled. Otherwise, this is NULL. |
Charlie Reis
2014/02/13 22:12:19
nit: the
mmenke
2014/02/14 16:30:02
Done.
| |
301 bool is_transfer; | 305 scoped_ptr<CrossSiteRequestTransfer> cross_site_request_transfer; |
302 | 306 |
303 // If |is_transfer|, this is the URL chain of the request. The first entry | 307 // If |request_transfer| is non-NULL, the values below are all set. |
304 // is the original request URL, and the last entry is the destination URL to | 308 |
305 // request in the new process. | 309 // The first entry is the original request URL, and the last entry is the |
310 // destination URL to request in the new process. | |
306 std::vector<GURL> transfer_url_chain; | 311 std::vector<GURL> transfer_url_chain; |
307 | 312 |
308 // If |is_transfer|, this is the referrer to use for the request in the new | 313 // This is the referrer to use for the request in the new process. |
309 // process. | |
310 Referrer referrer; | 314 Referrer referrer; |
311 | 315 |
312 // If |is_transfer|, this is the transition type for the original | 316 // This is the transition type for the original navigation. |
313 // navigation. | |
314 PageTransition page_transition; | 317 PageTransition page_transition; |
315 | 318 |
316 // If |is_transfer|, this is the frame ID to use in RequestTransferURL. | 319 // This is the frame ID to use in RequestTransferURL. |
317 int64 frame_id; | 320 int64 frame_id; |
318 | 321 |
319 // If |is_transfer|, this is whether the navigation should replace the | 322 // This is whether the navigation should replace the current history entry. |
320 // current history entry. | |
321 bool should_replace_current_entry; | 323 bool should_replace_current_entry; |
322 }; | 324 }; |
323 | 325 |
324 // Used with FrameTree::ForEach to erase inactive RenderFrameHosts from a | 326 // Used with FrameTree::ForEach to erase inactive RenderFrameHosts from a |
325 // FrameTreeNode's RenderFrameHostManager. | 327 // FrameTreeNode's RenderFrameHostManager. |
326 static bool ClearSwappedOutRFHsInSiteInstance(int32 site_instance_id, | 328 static bool ClearSwappedOutRFHsInSiteInstance(int32 site_instance_id, |
327 FrameTreeNode* node); | 329 FrameTreeNode* node); |
328 | 330 |
329 // Returns whether this tab should transition to a new renderer for | 331 // Returns whether this tab should transition to a new renderer for |
330 // cross-site URLs. Enabled unless we see the --process-per-tab command line | 332 // cross-site URLs. Enabled unless we see the --process-per-tab command line |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
461 CrossProcessFrameConnector* cross_process_frame_connector_; | 463 CrossProcessFrameConnector* cross_process_frame_connector_; |
462 | 464 |
463 base::WeakPtrFactory<RenderFrameHostManager> weak_factory_; | 465 base::WeakPtrFactory<RenderFrameHostManager> weak_factory_; |
464 | 466 |
465 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostManager); | 467 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostManager); |
466 }; | 468 }; |
467 | 469 |
468 } // namespace content | 470 } // namespace content |
469 | 471 |
470 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_MANAGER_H_ | 472 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_MANAGER_H_ |
OLD | NEW |