| 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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 NewRunnableMethod(this, &OfflineResourceHandler::ShowOfflinePage)); | 93 NewRunnableMethod(this, &OfflineResourceHandler::ShowOfflinePage)); |
| 94 } | 94 } |
| 95 } | 95 } |
| 96 | 96 |
| 97 bool OfflineResourceHandler::OnWillStart(int request_id, | 97 bool OfflineResourceHandler::OnWillStart(int request_id, |
| 98 const GURL& url, | 98 const GURL& url, |
| 99 bool* defer) { | 99 bool* defer) { |
| 100 if (ShouldShowOfflinePage(url)) { | 100 if (ShouldShowOfflinePage(url)) { |
| 101 deferred_request_id_ = request_id; | 101 deferred_request_id_ = request_id; |
| 102 deferred_url_ = url; | 102 deferred_url_ = url; |
| 103 DVLOG(1) << "WillStart: this=" << this << ", request id=" << request_id; | 103 DVLOG(1) << "OnWillStart: this=" << this << ", request id=" << request_id |
| 104 << ", url=" << url; |
| 104 AddRef(); // Balanced with OnCanHandleOfflineComplete | 105 AddRef(); // Balanced with OnCanHandleOfflineComplete |
| 105 DCHECK(!appcache_completion_callback_); | 106 DCHECK(!appcache_completion_callback_); |
| 106 appcache_completion_callback_ = | 107 appcache_completion_callback_ = |
| 107 new net::CancelableCompletionCallback<OfflineResourceHandler>( | 108 new net::CancelableCompletionCallback<OfflineResourceHandler>( |
| 108 this, &OfflineResourceHandler::OnCanHandleOfflineComplete); | 109 this, &OfflineResourceHandler::OnCanHandleOfflineComplete); |
| 109 ChromeURLRequestContext* url_request_context = | 110 ChromeURLRequestContext* url_request_context = |
| 110 static_cast<ChromeURLRequestContext*>(request_->context()); | 111 static_cast<ChromeURLRequestContext*>(request_->context()); |
| 111 url_request_context->appcache_service()->CanHandleMainResourceOffline( | 112 url_request_context->appcache_service()->CanHandleMainResourceOffline( |
| 112 url, appcache_completion_callback_); | 113 url, appcache_completion_callback_); |
| 113 | 114 |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 DVLOG(1) << "Resume load: this=" << this << ", request id=" << request_id; | 183 DVLOG(1) << "Resume load: this=" << this << ", request id=" << request_id; |
| 183 next_handler_->OnWillStart(request_id, url, &defer); | 184 next_handler_->OnWillStart(request_id, url, &defer); |
| 184 if (!defer) | 185 if (!defer) |
| 185 rdh_->StartDeferredRequest(process_host_id_, request_id); | 186 rdh_->StartDeferredRequest(process_host_id_, request_id); |
| 186 } | 187 } |
| 187 | 188 |
| 188 void OfflineResourceHandler::ShowOfflinePage() { | 189 void OfflineResourceHandler::ShowOfflinePage() { |
| 189 chromeos::OfflineLoadPage::Show( | 190 chromeos::OfflineLoadPage::Show( |
| 190 process_host_id_, render_view_id_, deferred_url_, this); | 191 process_host_id_, render_view_id_, deferred_url_, this); |
| 191 } | 192 } |
| OLD | NEW |