| 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/renderer_host/offline_resource_throttle.h" | 5 #include "chrome/browser/renderer_host/offline_resource_throttle.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 107 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 108 | 108 |
| 109 if (proceed) { | 109 if (proceed) { |
| 110 controller()->Resume(); | 110 controller()->Resume(); |
| 111 } else { | 111 } else { |
| 112 controller()->Cancel(); | 112 controller()->Cancel(); |
| 113 } | 113 } |
| 114 } | 114 } |
| 115 | 115 |
| 116 bool OfflineResourceThrottle::IsRemote(const GURL& url) const { | 116 bool OfflineResourceThrottle::IsRemote(const GURL& url) const { |
| 117 return !net::IsLocalhost(url.host()) && (url.SchemeIs(chrome::kFtpScheme) || | 117 return !net::IsLocalhost(url.host()) && (url.SchemeIs(content::kFtpScheme) || |
| 118 url.SchemeIs(content::kHttpScheme) || | 118 url.SchemeIs(content::kHttpScheme) || |
| 119 url.SchemeIs(content::kHttpsScheme)); | 119 url.SchemeIs(content::kHttpsScheme)); |
| 120 } | 120 } |
| 121 | 121 |
| 122 bool OfflineResourceThrottle::ShouldShowOfflinePage(const GURL& url) const { | 122 bool OfflineResourceThrottle::ShouldShowOfflinePage(const GURL& url) const { |
| 123 // If the network is disconnected while loading other resources, we'll simply | 123 // If the network is disconnected while loading other resources, we'll simply |
| 124 // show broken link/images. | 124 // show broken link/images. |
| 125 return IsRemote(url) && net::NetworkChangeNotifier::IsOffline(); | 125 return IsRemote(url) && net::NetworkChangeNotifier::IsOffline(); |
| 126 } | 126 } |
| 127 | 127 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 139 base::Bind( | 139 base::Bind( |
| 140 &ShowOfflinePage, | 140 &ShowOfflinePage, |
| 141 info->GetChildID(), | 141 info->GetChildID(), |
| 142 info->GetRouteID(), | 142 info->GetRouteID(), |
| 143 request_->url(), | 143 request_->url(), |
| 144 base::Bind( | 144 base::Bind( |
| 145 &OfflineResourceThrottle::OnBlockingPageComplete, | 145 &OfflineResourceThrottle::OnBlockingPageComplete, |
| 146 AsWeakPtr()))); | 146 AsWeakPtr()))); |
| 147 } | 147 } |
| 148 } | 148 } |
| OLD | NEW |