| 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 "webkit/appcache/appcache_service.h" | 5 #include "webkit/appcache/appcache_service.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
| 10 #include "net/base/io_buffer.h" | 10 #include "net/base/io_buffer.h" |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 return; | 90 return; |
| 91 } | 91 } |
| 92 service_->storage()->FindResponseForMainRequest(url_, GURL(), this); | 92 service_->storage()->FindResponseForMainRequest(url_, GURL(), this); |
| 93 } | 93 } |
| 94 | 94 |
| 95 private: | 95 private: |
| 96 // AppCacheStorage::Delegate override | 96 // AppCacheStorage::Delegate override |
| 97 virtual void OnMainResponseFound( | 97 virtual void OnMainResponseFound( |
| 98 const GURL& url, const AppCacheEntry& entry, | 98 const GURL& url, const AppCacheEntry& entry, |
| 99 const GURL& fallback_url, const AppCacheEntry& fallback_entry, | 99 const GURL& fallback_url, const AppCacheEntry& fallback_entry, |
| 100 int64 cache_id, const GURL& mainfest_url); | 100 int64 cache_id, int64 group_id, const GURL& mainfest_url) OVERRIDE; |
| 101 | 101 |
| 102 GURL url_; | 102 GURL url_; |
| 103 GURL first_party_; | 103 GURL first_party_; |
| 104 DISALLOW_COPY_AND_ASSIGN(CanHandleOfflineHelper); | 104 DISALLOW_COPY_AND_ASSIGN(CanHandleOfflineHelper); |
| 105 }; | 105 }; |
| 106 | 106 |
| 107 void AppCacheService::CanHandleOfflineHelper::OnMainResponseFound( | 107 void AppCacheService::CanHandleOfflineHelper::OnMainResponseFound( |
| 108 const GURL& url, const AppCacheEntry& entry, | 108 const GURL& url, const AppCacheEntry& entry, |
| 109 const GURL& fallback_url, const AppCacheEntry& fallback_entry, | 109 const GURL& fallback_url, const AppCacheEntry& fallback_entry, |
| 110 int64 cache_id, const GURL& manifest_url) { | 110 int64 cache_id, int64 group_id, const GURL& manifest_url) { |
| 111 bool can = (entry.has_response_id() || fallback_entry.has_response_id()); | 111 bool can = (entry.has_response_id() || fallback_entry.has_response_id()); |
| 112 CallCallback(can ? net::OK : net::ERR_FAILED); | 112 CallCallback(can ? net::OK : net::ERR_FAILED); |
| 113 delete this; | 113 delete this; |
| 114 } | 114 } |
| 115 | 115 |
| 116 // DeleteHelper ------- | 116 // DeleteHelper ------- |
| 117 | 117 |
| 118 class AppCacheService::DeleteHelper : public AsyncHelper { | 118 class AppCacheService::DeleteHelper : public AsyncHelper { |
| 119 public: | 119 public: |
| 120 DeleteHelper( | 120 DeleteHelper( |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 AppCacheHistograms::CountCheckResponseResult( | 354 AppCacheHistograms::CountCheckResponseResult( |
| 355 AppCacheHistograms::RESPONSE_OUT_OF_DATE); | 355 AppCacheHistograms::RESPONSE_OUT_OF_DATE); |
| 356 } | 356 } |
| 357 delete this; | 357 delete this; |
| 358 return; | 358 return; |
| 359 } | 359 } |
| 360 | 360 |
| 361 // Verify that we can read the response info and data. | 361 // Verify that we can read the response info and data. |
| 362 expected_total_size_ = entry->response_size(); | 362 expected_total_size_ = entry->response_size(); |
| 363 response_reader_.reset(service_->storage()->CreateResponseReader( | 363 response_reader_.reset(service_->storage()->CreateResponseReader( |
| 364 manifest_url_, response_id_)); | 364 manifest_url_, group->group_id(), response_id_)); |
| 365 info_buffer_ = new HttpResponseInfoIOBuffer(); | 365 info_buffer_ = new HttpResponseInfoIOBuffer(); |
| 366 response_reader_->ReadInfo(info_buffer_, &read_info_callback_); | 366 response_reader_->ReadInfo(info_buffer_, &read_info_callback_); |
| 367 } | 367 } |
| 368 | 368 |
| 369 void AppCacheService::CheckResponseHelper::OnReadInfoComplete(int result) { | 369 void AppCacheService::CheckResponseHelper::OnReadInfoComplete(int result) { |
| 370 if (result < 0) { | 370 if (result < 0) { |
| 371 AppCacheHistograms::CountCheckResponseResult( | 371 AppCacheHistograms::CountCheckResponseResult( |
| 372 AppCacheHistograms::READ_HEADERS_ERROR); | 372 AppCacheHistograms::READ_HEADERS_ERROR); |
| 373 service_->DeleteAppCacheGroup(manifest_url_, NULL); | 373 service_->DeleteAppCacheGroup(manifest_url_, NULL); |
| 374 delete this; | 374 delete this; |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 489 backends_.insert( | 489 backends_.insert( |
| 490 BackendMap::value_type(backend_impl->process_id(), backend_impl)); | 490 BackendMap::value_type(backend_impl->process_id(), backend_impl)); |
| 491 } | 491 } |
| 492 | 492 |
| 493 void AppCacheService::UnregisterBackend( | 493 void AppCacheService::UnregisterBackend( |
| 494 AppCacheBackendImpl* backend_impl) { | 494 AppCacheBackendImpl* backend_impl) { |
| 495 backends_.erase(backend_impl->process_id()); | 495 backends_.erase(backend_impl->process_id()); |
| 496 } | 496 } |
| 497 | 497 |
| 498 } // namespace appcache | 498 } // namespace appcache |
| OLD | NEW |