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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 const OpenURLParams& params) override { | 105 const OpenURLParams& params) override { |
106 // |OpenURLFromTab| is typically called when a frame performs a navigation | 106 // |OpenURLFromTab| is typically called when a frame performs a navigation |
107 // that requires the browser to perform the transition instead of WebKit. | 107 // that requires the browser to perform the transition instead of WebKit. |
108 // Examples include client redirects to hosted app URLs. | 108 // Examples include client redirects to hosted app URLs. |
109 // TODO(cbentzel): Consider supporting this for CURRENT_TAB dispositions, if | 109 // TODO(cbentzel): Consider supporting this for CURRENT_TAB dispositions, if |
110 // it is a common case during prerenders. | 110 // it is a common case during prerenders. |
111 prerender_contents_->Destroy(FINAL_STATUS_OPEN_URL); | 111 prerender_contents_->Destroy(FINAL_STATUS_OPEN_URL); |
112 return NULL; | 112 return NULL; |
113 } | 113 } |
114 | 114 |
115 bool ShouldTransferNavigation() override { | 115 bool ShouldTransferNavigation(bool is_main_frame_navigation) override { |
116 // Cancel the prerender if the navigation attempts to transfer to a | 116 // Cancel the prerender if the navigation attempts to transfer to a |
117 // different process. Examples include server redirects to privileged pages | 117 // different process. Examples include server redirects to privileged pages |
118 // or cross-site subframe navigations in --site-per-process. | 118 // or cross-site subframe navigations in --site-per-process. |
119 prerender_contents_->Destroy(FINAL_STATUS_OPEN_URL); | 119 prerender_contents_->Destroy(FINAL_STATUS_OPEN_URL); |
120 return false; | 120 return false; |
121 } | 121 } |
122 | 122 |
123 void CloseContents(content::WebContents* contents) override { | 123 void CloseContents(content::WebContents* contents) override { |
124 prerender_contents_->Destroy(FINAL_STATUS_CLOSED); | 124 prerender_contents_->Destroy(FINAL_STATUS_CLOSED); |
125 } | 125 } |
(...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
756 void PrerenderContents::AddResourceThrottle( | 756 void PrerenderContents::AddResourceThrottle( |
757 const base::WeakPtr<PrerenderResourceThrottle>& throttle) { | 757 const base::WeakPtr<PrerenderResourceThrottle>& throttle) { |
758 resource_throttles_.push_back(throttle); | 758 resource_throttles_.push_back(throttle); |
759 } | 759 } |
760 | 760 |
761 void PrerenderContents::AddNetworkBytes(int64_t bytes) { | 761 void PrerenderContents::AddNetworkBytes(int64_t bytes) { |
762 network_bytes_ += bytes; | 762 network_bytes_ += bytes; |
763 } | 763 } |
764 | 764 |
765 } // namespace prerender | 765 } // namespace prerender |
OLD | NEW |