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/service_worker/service_worker_cache.h" | 5 #include "content/browser/service_worker/service_worker_cache.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/guid.h" | 10 #include "base/guid.h" |
11 #include "base/message_loop/message_loop_proxy.h" | 11 #include "base/message_loop/message_loop_proxy.h" |
12 #include "base/profiler/scoped_tracker.h" | 12 #include "base/profiler/scoped_tracker.h" |
13 #include "base/strings/string_util.h" | 13 #include "base/strings/string_util.h" |
14 #include "content/browser/service_worker/service_worker_cache.pb.h" | 14 #include "content/browser/service_worker/service_worker_cache.pb.h" |
15 #include "content/public/browser/browser_thread.h" | 15 #include "content/public/browser/browser_thread.h" |
| 16 #include "content/public/common/referrer.h" |
16 #include "net/base/io_buffer.h" | 17 #include "net/base/io_buffer.h" |
17 #include "net/base/net_errors.h" | 18 #include "net/base/net_errors.h" |
18 #include "net/disk_cache/disk_cache.h" | 19 #include "net/disk_cache/disk_cache.h" |
19 #include "net/url_request/url_request_context.h" | 20 #include "net/url_request/url_request_context.h" |
20 #include "storage/browser/blob/blob_data_handle.h" | 21 #include "storage/browser/blob/blob_data_handle.h" |
21 #include "storage/browser/blob/blob_storage_context.h" | 22 #include "storage/browser/blob/blob_storage_context.h" |
22 #include "storage/browser/blob/blob_url_request_job_factory.h" | 23 #include "storage/browser/blob/blob_url_request_job_factory.h" |
23 #include "storage/browser/quota/quota_manager_proxy.h" | 24 #include "storage/browser/quota/quota_manager_proxy.h" |
24 #include "third_party/WebKit/public/platform/WebServiceWorkerResponseType.h" | 25 #include "third_party/WebKit/public/platform/WebServiceWorkerResponseType.h" |
25 | 26 |
(...skipping 1063 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1089 scoped_ptr<KeysContext> keys_context, | 1090 scoped_ptr<KeysContext> keys_context, |
1090 const Entries::iterator& iter, | 1091 const Entries::iterator& iter, |
1091 scoped_ptr<ServiceWorkerCacheMetadata> metadata) { | 1092 scoped_ptr<ServiceWorkerCacheMetadata> metadata) { |
1092 disk_cache::Entry* entry = *iter; | 1093 disk_cache::Entry* entry = *iter; |
1093 | 1094 |
1094 if (metadata) { | 1095 if (metadata) { |
1095 keys_context->out_keys->push_back( | 1096 keys_context->out_keys->push_back( |
1096 ServiceWorkerFetchRequest(GURL(entry->GetKey()), | 1097 ServiceWorkerFetchRequest(GURL(entry->GetKey()), |
1097 metadata->request().method(), | 1098 metadata->request().method(), |
1098 ServiceWorkerHeaderMap(), | 1099 ServiceWorkerHeaderMap(), |
1099 GURL(), | 1100 Referrer(), |
1100 false)); | 1101 false)); |
1101 | 1102 |
1102 ServiceWorkerHeaderMap& req_headers = | 1103 ServiceWorkerHeaderMap& req_headers = |
1103 keys_context->out_keys->back().headers; | 1104 keys_context->out_keys->back().headers; |
1104 | 1105 |
1105 for (int i = 0; i < metadata->request().headers_size(); ++i) { | 1106 for (int i = 0; i < metadata->request().headers_size(); ++i) { |
1106 const ServiceWorkerCacheHeaderMap header = metadata->request().headers(i); | 1107 const ServiceWorkerCacheHeaderMap header = metadata->request().headers(i); |
1107 req_headers.insert(std::make_pair(header.name(), header.value())); | 1108 req_headers.insert(std::make_pair(header.name(), header.value())); |
1108 } | 1109 } |
1109 } else { | 1110 } else { |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1215 | 1216 |
1216 void ServiceWorkerCache::PendingRequestsCallback( | 1217 void ServiceWorkerCache::PendingRequestsCallback( |
1217 const RequestsCallback& callback, | 1218 const RequestsCallback& callback, |
1218 ErrorType error, | 1219 ErrorType error, |
1219 scoped_ptr<Requests> requests) { | 1220 scoped_ptr<Requests> requests) { |
1220 callback.Run(error, requests.Pass()); | 1221 callback.Run(error, requests.Pass()); |
1221 DecPendingOps(); | 1222 DecPendingOps(); |
1222 } | 1223 } |
1223 | 1224 |
1224 } // namespace content | 1225 } // namespace content |
OLD | NEW |