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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 | 140 |
141 bool OnGoToEntryOffset(int offset) override { | 141 bool OnGoToEntryOffset(int offset) override { |
142 // This isn't allowed because the history merge operation | 142 // This isn't allowed because the history merge operation |
143 // does not work if there are renderer issued challenges. | 143 // does not work if there are renderer issued challenges. |
144 // TODO(cbentzel): Cancel in this case? May not need to do | 144 // TODO(cbentzel): Cancel in this case? May not need to do |
145 // since render-issued offset navigations are not guaranteed, | 145 // since render-issued offset navigations are not guaranteed, |
146 // but indicates that the page cares about the history. | 146 // but indicates that the page cares about the history. |
147 return false; | 147 return false; |
148 } | 148 } |
149 | 149 |
150 bool ShouldSuppressDialogs(WebContents* source) override { | 150 bool ShouldSuppressDialogs(WebContents* source, bool before_unload) override { |
151 // We still want to show the user the message when they navigate to this | 151 // We still want to show the user the message when they navigate to this |
152 // page, so cancel this prerender. | 152 // page, so cancel this prerender. |
153 prerender_contents_->Destroy(FINAL_STATUS_JAVASCRIPT_ALERT); | 153 prerender_contents_->Destroy(FINAL_STATUS_JAVASCRIPT_ALERT); |
154 // Always suppress JavaScript messages if they're triggered by a page being | 154 // Always suppress JavaScript messages if they're triggered by a page being |
155 // prerendered. | 155 // prerendered. |
156 return true; | 156 return true; |
157 } | 157 } |
158 | 158 |
159 void RegisterProtocolHandler(WebContents* web_contents, | 159 void RegisterProtocolHandler(WebContents* web_contents, |
160 const std::string& protocol, | 160 const std::string& protocol, |
(...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
719 void PrerenderContents::AddResourceThrottle( | 719 void PrerenderContents::AddResourceThrottle( |
720 const base::WeakPtr<PrerenderResourceThrottle>& throttle) { | 720 const base::WeakPtr<PrerenderResourceThrottle>& throttle) { |
721 resource_throttles_.push_back(throttle); | 721 resource_throttles_.push_back(throttle); |
722 } | 722 } |
723 | 723 |
724 void PrerenderContents::AddNetworkBytes(int64_t bytes) { | 724 void PrerenderContents::AddNetworkBytes(int64_t bytes) { |
725 network_bytes_ += bytes; | 725 network_bytes_ += bytes; |
726 } | 726 } |
727 | 727 |
728 } // namespace prerender | 728 } // namespace prerender |
OLD | NEW |