OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/renderer_host/offline_resource_handler.h" | 5 #include "chrome/browser/renderer_host/offline_resource_handler.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 } | 117 } |
118 | 118 |
119 void OfflineResourceHandler::ClearRequestInfo() { | 119 void OfflineResourceHandler::ClearRequestInfo() { |
120 deferred_url_ = GURL(); | 120 deferred_url_ = GURL(); |
121 deferred_request_id_ = -1; | 121 deferred_request_id_ = -1; |
122 } | 122 } |
123 | 123 |
124 bool OfflineResourceHandler::IsRemote(const GURL& url) const { | 124 bool OfflineResourceHandler::IsRemote(const GURL& url) const { |
125 return url.SchemeIs(chrome::kFtpScheme) || | 125 return url.SchemeIs(chrome::kFtpScheme) || |
126 url.SchemeIs(chrome::kHttpScheme) || | 126 url.SchemeIs(chrome::kHttpScheme) || |
127 url.SchemeIs(chrome::kHttpsScheme); | 127 url.SchemeIs(chrome::kHttpsScheme) || |
| 128 url.SchemeIs(chrome::kHttpsvScheme); |
128 } | 129 } |
129 | 130 |
130 bool OfflineResourceHandler::ShouldShowOfflinePage(const GURL& url) const { | 131 bool OfflineResourceHandler::ShouldShowOfflinePage(const GURL& url) const { |
131 // Only check main frame. If the network is disconnected while | 132 // Only check main frame. If the network is disconnected while |
132 // loading other resources, we'll simply show broken link/images. | 133 // loading other resources, we'll simply show broken link/images. |
133 return IsRemote(url) && | 134 return IsRemote(url) && |
134 !chromeos::NetworkStateNotifier::is_connected() && | 135 !chromeos::NetworkStateNotifier::is_connected() && |
135 ResourceDispatcherHost::InfoForRequest(request_)->resource_type() | 136 ResourceDispatcherHost::InfoForRequest(request_)->resource_type() |
136 == ResourceType::MAIN_FRAME && | 137 == ResourceType::MAIN_FRAME && |
137 !chromeos::OfflineLoadService::Get()->ShouldProceed( | 138 !chromeos::OfflineLoadService::Get()->ShouldProceed( |
(...skipping 13 matching lines...) Expand all Loading... |
151 DVLOG(1) << "Resume load: this=" << this << ", request id=" << request_id; | 152 DVLOG(1) << "Resume load: this=" << this << ", request id=" << request_id; |
152 next_handler_->OnWillStart(request_id, url, &defer); | 153 next_handler_->OnWillStart(request_id, url, &defer); |
153 if (!defer) | 154 if (!defer) |
154 rdh_->StartDeferredRequest(process_host_id_, request_id); | 155 rdh_->StartDeferredRequest(process_host_id_, request_id); |
155 } | 156 } |
156 | 157 |
157 void OfflineResourceHandler::ShowOfflinePage() { | 158 void OfflineResourceHandler::ShowOfflinePage() { |
158 chromeos::OfflineLoadPage::Show( | 159 chromeos::OfflineLoadPage::Show( |
159 process_host_id_, render_view_id_, deferred_url_, this); | 160 process_host_id_, render_view_id_, deferred_url_, this); |
160 } | 161 } |
OLD | NEW |