| 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/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 if ((successes_ + failures_) < num_caches_to_delete_) | 292 if ((successes_ + failures_) < num_caches_to_delete_) |
| 293 return; | 293 return; |
| 294 | 294 |
| 295 CallCallback(!failures_ ? net::OK : net::ERR_FAILED); | 295 CallCallback(!failures_ ? net::OK : net::ERR_FAILED); |
| 296 delete this; | 296 delete this; |
| 297 } | 297 } |
| 298 | 298 |
| 299 | 299 |
| 300 // GetInfoHelper ------- | 300 // GetInfoHelper ------- |
| 301 | 301 |
| 302 class AppCacheService::GetInfoHelper : AsyncHelper { | 302 class AppCacheService::GetInfoHelper : NewAsyncHelper { |
| 303 public: | 303 public: |
| 304 GetInfoHelper( | 304 GetInfoHelper( |
| 305 AppCacheService* service, AppCacheInfoCollection* collection, | 305 AppCacheService* service, AppCacheInfoCollection* collection, |
| 306 net::OldCompletionCallback* callback) | 306 const net::CompletionCallback& callback) |
| 307 : AsyncHelper(service, callback), collection_(collection) { | 307 : NewAsyncHelper(service, callback), collection_(collection) { |
| 308 } | 308 } |
| 309 | 309 |
| 310 virtual void Start() { | 310 virtual void Start() { |
| 311 service_->storage()->GetAllInfo(this); | 311 service_->storage()->GetAllInfo(this); |
| 312 } | 312 } |
| 313 | 313 |
| 314 private: | 314 private: |
| 315 // AppCacheStorage::Delegate override | 315 // AppCacheStorage::Delegate override |
| 316 virtual void OnAllInfo(AppCacheInfoCollection* collection); | 316 virtual void OnAllInfo(AppCacheInfoCollection* collection); |
| 317 | 317 |
| 318 scoped_refptr<AppCacheInfoCollection> collection_; | 318 scoped_refptr<AppCacheInfoCollection> collection_; |
| 319 |
| 319 DISALLOW_COPY_AND_ASSIGN(GetInfoHelper); | 320 DISALLOW_COPY_AND_ASSIGN(GetInfoHelper); |
| 320 }; | 321 }; |
| 321 | 322 |
| 322 void AppCacheService::GetInfoHelper::OnAllInfo( | 323 void AppCacheService::GetInfoHelper::OnAllInfo( |
| 323 AppCacheInfoCollection* collection) { | 324 AppCacheInfoCollection* collection) { |
| 324 if (collection) | 325 if (collection) |
| 325 collection->infos_by_origin.swap(collection_->infos_by_origin); | 326 collection->infos_by_origin.swap(collection_->infos_by_origin); |
| 326 CallCallback(collection ? net::OK : net::ERR_FAILED); | 327 CallCallback(collection ? net::OK : net::ERR_FAILED); |
| 327 delete this; | 328 delete this; |
| 328 } | 329 } |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 499 | 500 |
| 500 void AppCacheService::CanHandleMainResourceOffline( | 501 void AppCacheService::CanHandleMainResourceOffline( |
| 501 const GURL& url, | 502 const GURL& url, |
| 502 const GURL& first_party, | 503 const GURL& first_party, |
| 503 const net::CompletionCallback& callback) { | 504 const net::CompletionCallback& callback) { |
| 504 CanHandleOfflineHelper* helper = | 505 CanHandleOfflineHelper* helper = |
| 505 new CanHandleOfflineHelper(this, url, first_party, callback); | 506 new CanHandleOfflineHelper(this, url, first_party, callback); |
| 506 helper->Start(); | 507 helper->Start(); |
| 507 } | 508 } |
| 508 | 509 |
| 509 void AppCacheService::GetAllAppCacheInfo(AppCacheInfoCollection* collection, | 510 void AppCacheService::GetAllAppCacheInfo( |
| 510 net::OldCompletionCallback* callback) { | 511 AppCacheInfoCollection* collection, |
| 512 const net::CompletionCallback& callback) { |
| 511 DCHECK(collection); | 513 DCHECK(collection); |
| 512 GetInfoHelper* helper = new GetInfoHelper(this, collection, callback); | 514 GetInfoHelper* helper = new GetInfoHelper(this, collection, callback); |
| 513 helper->Start(); | 515 helper->Start(); |
| 514 } | 516 } |
| 515 | 517 |
| 516 void AppCacheService::DeleteAppCacheGroup(const GURL& manifest_url, | 518 void AppCacheService::DeleteAppCacheGroup(const GURL& manifest_url, |
| 517 net::OldCompletionCallback* callback)
{ | 519 net::OldCompletionCallback* callback)
{ |
| 518 DeleteHelper* helper = new DeleteHelper(this, manifest_url, callback); | 520 DeleteHelper* helper = new DeleteHelper(this, manifest_url, callback); |
| 519 helper->Start(); | 521 helper->Start(); |
| 520 } | 522 } |
| (...skipping 23 matching lines...) Expand all Loading... |
| 544 backends_.insert( | 546 backends_.insert( |
| 545 BackendMap::value_type(backend_impl->process_id(), backend_impl)); | 547 BackendMap::value_type(backend_impl->process_id(), backend_impl)); |
| 546 } | 548 } |
| 547 | 549 |
| 548 void AppCacheService::UnregisterBackend( | 550 void AppCacheService::UnregisterBackend( |
| 549 AppCacheBackendImpl* backend_impl) { | 551 AppCacheBackendImpl* backend_impl) { |
| 550 backends_.erase(backend_impl->process_id()); | 552 backends_.erase(backend_impl->process_id()); |
| 551 } | 553 } |
| 552 | 554 |
| 553 } // namespace appcache | 555 } // namespace appcache |
| OLD | NEW |