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/memory/singleton.h" | 10 #include "base/memory/singleton.h" |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 deferred_request_id_ = request_id; | 105 deferred_request_id_ = request_id; |
106 deferred_url_ = url; | 106 deferred_url_ = url; |
107 DVLOG(1) << "OnWillStart: this=" << this << ", request id=" << request_id | 107 DVLOG(1) << "OnWillStart: this=" << this << ", request id=" << request_id |
108 << ", url=" << url; | 108 << ", url=" << url; |
109 AddRef(); // Balanced with OnCanHandleOfflineComplete | 109 AddRef(); // Balanced with OnCanHandleOfflineComplete |
110 DCHECK(!appcache_completion_callback_); | 110 DCHECK(!appcache_completion_callback_); |
111 appcache_completion_callback_ = | 111 appcache_completion_callback_ = |
112 new net::CancelableCompletionCallback<OfflineResourceHandler>( | 112 new net::CancelableCompletionCallback<OfflineResourceHandler>( |
113 this, &OfflineResourceHandler::OnCanHandleOfflineComplete); | 113 this, &OfflineResourceHandler::OnCanHandleOfflineComplete); |
114 appcache_service_->CanHandleMainResourceOffline( | 114 appcache_service_->CanHandleMainResourceOffline( |
115 url, appcache_completion_callback_); | 115 url, request_->first_party_for_cookies(), |
| 116 appcache_completion_callback_); |
116 | 117 |
117 *defer = true; | 118 *defer = true; |
118 return true; | 119 return true; |
119 } | 120 } |
120 return next_handler_->OnWillStart(request_id, url, defer); | 121 return next_handler_->OnWillStart(request_id, url, defer); |
121 } | 122 } |
122 | 123 |
123 // We'll let the original event handler provide a buffer, and reuse it for | 124 // We'll let the original event handler provide a buffer, and reuse it for |
124 // subsequent reads until we're done buffering. | 125 // subsequent reads until we're done buffering. |
125 bool OfflineResourceHandler::OnWillRead(int request_id, net::IOBuffer** buf, | 126 bool OfflineResourceHandler::OnWillRead(int request_id, net::IOBuffer** buf, |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 DVLOG(1) << "Resume load: this=" << this << ", request id=" << request_id; | 186 DVLOG(1) << "Resume load: this=" << this << ", request id=" << request_id; |
186 next_handler_->OnWillStart(request_id, url, &defer); | 187 next_handler_->OnWillStart(request_id, url, &defer); |
187 if (!defer) | 188 if (!defer) |
188 rdh_->StartDeferredRequest(process_host_id_, request_id); | 189 rdh_->StartDeferredRequest(process_host_id_, request_id); |
189 } | 190 } |
190 | 191 |
191 void OfflineResourceHandler::ShowOfflinePage() { | 192 void OfflineResourceHandler::ShowOfflinePage() { |
192 chromeos::OfflineLoadPage::Show( | 193 chromeos::OfflineLoadPage::Show( |
193 process_host_id_, render_view_id_, deferred_url_, this); | 194 process_host_id_, render_view_id_, deferred_url_, this); |
194 } | 195 } |
OLD | NEW |