| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "content/browser/appcache/appcache_service_impl.h" | 5 #include "content/browser/appcache/appcache_service_impl.h" |
| 6 | 6 |
| 7 #include <functional> | 7 #include <functional> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| 11 #include "base/bind_helpers.h" | 11 #include "base/bind_helpers.h" |
| 12 #include "base/location.h" | 12 #include "base/location.h" |
| 13 #include "base/logging.h" | 13 #include "base/logging.h" |
| 14 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 #include "base/memory/ptr_util.h" | 15 #include "base/memory/ptr_util.h" |
| 16 #include "base/single_thread_task_runner.h" | 16 #include "base/single_thread_task_runner.h" |
| 17 #include "base/threading/thread_task_runner_handle.h" | 17 #include "base/threading/thread_task_runner_handle.h" |
| 18 #include "content/browser/appcache/appcache.h" | 18 #include "content/browser/appcache/appcache.h" |
| 19 #include "content/browser/appcache/appcache_backend_impl.h" | 19 #include "content/browser/appcache/appcache_backend_impl.h" |
| 20 #include "content/browser/appcache/appcache_entry.h" | 20 #include "content/browser/appcache/appcache_entry.h" |
| 21 #include "content/browser/appcache/appcache_executable_handler.h" | 21 #include "content/browser/appcache/appcache_executable_handler.h" |
| 22 #include "content/browser/appcache/appcache_histograms.h" | 22 #include "content/browser/appcache/appcache_histograms.h" |
| 23 #include "content/browser/appcache/appcache_interceptor.h" |
| 23 #include "content/browser/appcache/appcache_policy.h" | 24 #include "content/browser/appcache/appcache_policy.h" |
| 24 #include "content/browser/appcache/appcache_quota_client.h" | 25 #include "content/browser/appcache/appcache_quota_client.h" |
| 26 #include "content/browser/appcache/appcache_request_handler.h" |
| 25 #include "content/browser/appcache/appcache_response.h" | 27 #include "content/browser/appcache/appcache_response.h" |
| 26 #include "content/browser/appcache/appcache_service_impl.h" | 28 #include "content/browser/appcache/appcache_service_impl.h" |
| 27 #include "content/browser/appcache/appcache_storage_impl.h" | 29 #include "content/browser/appcache/appcache_storage_impl.h" |
| 28 #include "net/base/completion_callback.h" | 30 #include "net/base/completion_callback.h" |
| 29 #include "net/base/io_buffer.h" | 31 #include "net/base/io_buffer.h" |
| 30 #include "storage/browser/quota/special_storage_policy.h" | 32 #include "storage/browser/quota/special_storage_policy.h" |
| 31 | 33 |
| 32 namespace content { | 34 namespace content { |
| 33 | 35 |
| 34 namespace { | 36 namespace { |
| (...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 520 DCHECK(backends_.find(backend_impl->process_id()) == backends_.end()); | 522 DCHECK(backends_.find(backend_impl->process_id()) == backends_.end()); |
| 521 backends_.insert( | 523 backends_.insert( |
| 522 BackendMap::value_type(backend_impl->process_id(), backend_impl)); | 524 BackendMap::value_type(backend_impl->process_id(), backend_impl)); |
| 523 } | 525 } |
| 524 | 526 |
| 525 void AppCacheServiceImpl::UnregisterBackend( | 527 void AppCacheServiceImpl::UnregisterBackend( |
| 526 AppCacheBackendImpl* backend_impl) { | 528 AppCacheBackendImpl* backend_impl) { |
| 527 backends_.erase(backend_impl->process_id()); | 529 backends_.erase(backend_impl->process_id()); |
| 528 } | 530 } |
| 529 | 531 |
| 532 // Static AppCacheService methods ------- |
| 533 |
| 534 // static |
| 535 bool AppCacheService::URLRequestHasActiveAppCache( |
| 536 const net::URLRequest* request) { |
| 537 AppCacheRequestHandler* appcache_handle = |
| 538 AppCacheInterceptor::GetHandler(request); |
| 539 if (appcache_handle) { |
| 540 int64_t appcache_id; |
| 541 GURL unused_manifest_url; |
| 542 appcache_handle->GetExtraResponseInfo(&appcache_id, &unused_manifest_url); |
| 543 if (appcache_id != kAppCacheNoCacheId) |
| 544 return true; |
| 545 } |
| 546 return false; |
| 547 } |
| 548 |
| 530 } // namespace content | 549 } // namespace content |
| OLD | NEW |