| 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 #include "chrome/browser/prerender/prerender_contents.h" | 5 #include "chrome/browser/prerender/prerender_contents.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <functional> | 10 #include <functional> |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 const OpenURLParams& params) override { | 95 const OpenURLParams& params) override { |
| 96 // |OpenURLFromTab| is typically called when a frame performs a navigation | 96 // |OpenURLFromTab| is typically called when a frame performs a navigation |
| 97 // that requires the browser to perform the transition instead of WebKit. | 97 // that requires the browser to perform the transition instead of WebKit. |
| 98 // Examples include client redirects to hosted app URLs. | 98 // Examples include client redirects to hosted app URLs. |
| 99 // TODO(cbentzel): Consider supporting this for CURRENT_TAB dispositions, if | 99 // TODO(cbentzel): Consider supporting this for CURRENT_TAB dispositions, if |
| 100 // it is a common case during prerenders. | 100 // it is a common case during prerenders. |
| 101 prerender_contents_->Destroy(FINAL_STATUS_OPEN_URL); | 101 prerender_contents_->Destroy(FINAL_STATUS_OPEN_URL); |
| 102 return NULL; | 102 return NULL; |
| 103 } | 103 } |
| 104 | 104 |
| 105 bool ShouldTransferNavigation() override { | 105 bool ShouldTransferNavigation(bool is_main_frame_navigation) override { |
| 106 // Cancel the prerender if the navigation attempts to transfer to a | 106 // Cancel the prerender if the navigation attempts to transfer to a |
| 107 // different process. Examples include server redirects to privileged pages | 107 // different process. Examples include server redirects to privileged pages |
| 108 // or cross-site subframe navigations in --site-per-process. | 108 // or cross-site subframe navigations in --site-per-process. |
| 109 prerender_contents_->Destroy(FINAL_STATUS_OPEN_URL); | 109 prerender_contents_->Destroy(FINAL_STATUS_OPEN_URL); |
| 110 return false; | 110 return false; |
| 111 } | 111 } |
| 112 | 112 |
| 113 void CloseContents(content::WebContents* contents) override { | 113 void CloseContents(content::WebContents* contents) override { |
| 114 prerender_contents_->Destroy(FINAL_STATUS_CLOSED); | 114 prerender_contents_->Destroy(FINAL_STATUS_CLOSED); |
| 115 } | 115 } |
| (...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 725 void PrerenderContents::AddResourceThrottle( | 725 void PrerenderContents::AddResourceThrottle( |
| 726 const base::WeakPtr<PrerenderResourceThrottle>& throttle) { | 726 const base::WeakPtr<PrerenderResourceThrottle>& throttle) { |
| 727 resource_throttles_.push_back(throttle); | 727 resource_throttles_.push_back(throttle); |
| 728 } | 728 } |
| 729 | 729 |
| 730 void PrerenderContents::AddNetworkBytes(int64_t bytes) { | 730 void PrerenderContents::AddNetworkBytes(int64_t bytes) { |
| 731 network_bytes_ += bytes; | 731 network_bytes_ += bytes; |
| 732 } | 732 } |
| 733 | 733 |
| 734 } // namespace prerender | 734 } // namespace prerender |
| OLD | NEW |