Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(25)

Side by Side Diff: content/browser/service_worker/service_worker_cache_listener.cc

Issue 526193002: use c++03 style enum scope (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_listener.h" 5 #include "content/browser/service_worker/service_worker_cache_listener.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "content/browser/service_worker/service_worker_cache_storage_manager.h" 9 #include "content/browser/service_worker/service_worker_cache_storage_manager.h"
10 #include "content/browser/service_worker/service_worker_context_core.h" 10 #include "content/browser/service_worker/service_worker_context_core.h"
11 #include "content/browser/service_worker/service_worker_version.h" 11 #include "content/browser/service_worker/service_worker_version.h"
12 #include "content/common/service_worker/service_worker_messages.h" 12 #include "content/common/service_worker/service_worker_messages.h"
13 #include "third_party/WebKit/public/platform/WebServiceWorkerCacheError.h" 13 #include "third_party/WebKit/public/platform/WebServiceWorkerCacheError.h"
14 14
15 namespace content { 15 namespace content {
16 16
17 using blink::WebServiceWorkerCacheError; 17 using blink::WebServiceWorkerCacheError;
18 18
19 namespace { 19 namespace {
20 20
21 WebServiceWorkerCacheError ToWebServiceWorkerCacheError( 21 WebServiceWorkerCacheError ToWebServiceWorkerCacheError(
22 ServiceWorkerCacheStorage::CacheStorageError err) { 22 ServiceWorkerCacheStorage::CacheStorageError err) {
23 switch (err) { 23 switch (err) {
24 case ServiceWorkerCacheStorage::CACHE_STORAGE_ERROR_NO_ERROR: 24 case ServiceWorkerCacheStorage::CACHE_STORAGE_ERROR_NO_ERROR:
25 NOTREACHED(); 25 NOTREACHED();
26 return WebServiceWorkerCacheError:: 26 return blink::WebServiceWorkerCacheErrorNotImplemented;
27 WebServiceWorkerCacheErrorNotImplemented;
28 case ServiceWorkerCacheStorage::CACHE_STORAGE_ERROR_NOT_IMPLEMENTED: 27 case ServiceWorkerCacheStorage::CACHE_STORAGE_ERROR_NOT_IMPLEMENTED:
29 return WebServiceWorkerCacheError:: 28 return blink::WebServiceWorkerCacheErrorNotImplemented;
30 WebServiceWorkerCacheErrorNotImplemented;
31 case ServiceWorkerCacheStorage::CACHE_STORAGE_ERROR_NOT_FOUND: 29 case ServiceWorkerCacheStorage::CACHE_STORAGE_ERROR_NOT_FOUND:
32 return WebServiceWorkerCacheError::WebServiceWorkerCacheErrorNotFound; 30 return blink::WebServiceWorkerCacheErrorNotFound;
33 case ServiceWorkerCacheStorage::CACHE_STORAGE_ERROR_EXISTS: 31 case ServiceWorkerCacheStorage::CACHE_STORAGE_ERROR_EXISTS:
34 return WebServiceWorkerCacheError::WebServiceWorkerCacheErrorExists; 32 return blink::WebServiceWorkerCacheErrorExists;
35 case ServiceWorkerCacheStorage::CACHE_STORAGE_ERROR_STORAGE: 33 case ServiceWorkerCacheStorage::CACHE_STORAGE_ERROR_STORAGE:
36 // TODO(jkarlin): Changethis to CACHE_STORAGE_ERROR_STORAGE once that's 34 // TODO(jkarlin): Changethis to CACHE_STORAGE_ERROR_STORAGE once that's
37 // added. 35 // added.
38 return WebServiceWorkerCacheError::WebServiceWorkerCacheErrorNotFound; 36 return blink::WebServiceWorkerCacheErrorNotFound;
39 case ServiceWorkerCacheStorage::CACHE_STORAGE_ERROR_EMPTY_KEY: 37 case ServiceWorkerCacheStorage::CACHE_STORAGE_ERROR_EMPTY_KEY:
40 // TODO(jkarlin): Update this to CACHE_STORAGE_ERROR_EMPTY_KEY once that's 38 // TODO(jkarlin): Update this to CACHE_STORAGE_ERROR_EMPTY_KEY once that's
41 // added. 39 // added.
42 return WebServiceWorkerCacheError::WebServiceWorkerCacheErrorNotFound; 40 return blink::WebServiceWorkerCacheErrorNotFound;
43 case ServiceWorkerCacheStorage::CACHE_STORAGE_ERROR_CLOSING: 41 case ServiceWorkerCacheStorage::CACHE_STORAGE_ERROR_CLOSING:
44 // TODO(jkarlin): Update this to CACHE_STORAGE_ERROR_CLOSING once that's 42 // TODO(jkarlin): Update this to CACHE_STORAGE_ERROR_CLOSING once that's
45 // added. 43 // added.
46 return WebServiceWorkerCacheError::WebServiceWorkerCacheErrorNotFound; 44 return blink::WebServiceWorkerCacheErrorNotFound;
47 } 45 }
48 NOTREACHED(); 46 NOTREACHED();
49 return WebServiceWorkerCacheError::WebServiceWorkerCacheErrorNotImplemented; 47 return blink::WebServiceWorkerCacheErrorNotImplemented;
50 } 48 }
51 49
52 } // namespace 50 } // namespace
53 51
54 ServiceWorkerCacheListener::ServiceWorkerCacheListener( 52 ServiceWorkerCacheListener::ServiceWorkerCacheListener(
55 ServiceWorkerVersion* version, 53 ServiceWorkerVersion* version,
56 base::WeakPtr<ServiceWorkerContextCore> context) 54 base::WeakPtr<ServiceWorkerContextCore> context)
57 : version_(version), context_(context), weak_factory_(this) { 55 : version_(version), context_(context), weak_factory_(this) {
58 } 56 }
59 57
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 bool has_cache, 151 bool has_cache,
154 ServiceWorkerCacheStorage::CacheStorageError error) { 152 ServiceWorkerCacheStorage::CacheStorageError error) {
155 if (error != ServiceWorkerCacheStorage::CACHE_STORAGE_ERROR_NO_ERROR) { 153 if (error != ServiceWorkerCacheStorage::CACHE_STORAGE_ERROR_NO_ERROR) {
156 Send(ServiceWorkerMsg_CacheStorageHasError( 154 Send(ServiceWorkerMsg_CacheStorageHasError(
157 request_id, ToWebServiceWorkerCacheError(error))); 155 request_id, ToWebServiceWorkerCacheError(error)));
158 return; 156 return;
159 } 157 }
160 if (!has_cache) { 158 if (!has_cache) {
161 Send(ServiceWorkerMsg_CacheStorageHasError( 159 Send(ServiceWorkerMsg_CacheStorageHasError(
162 request_id, 160 request_id,
163 WebServiceWorkerCacheError::WebServiceWorkerCacheErrorNotFound)); 161 blink::WebServiceWorkerCacheErrorNotFound));
164 return; 162 return;
165 } 163 }
166 Send(ServiceWorkerMsg_CacheStorageHasSuccess(request_id)); 164 Send(ServiceWorkerMsg_CacheStorageHasSuccess(request_id));
167 } 165 }
168 166
169 void ServiceWorkerCacheListener::OnCacheStorageCreateCallback( 167 void ServiceWorkerCacheListener::OnCacheStorageCreateCallback(
170 int request_id, 168 int request_id,
171 int cache_id, 169 int cache_id,
172 ServiceWorkerCacheStorage::CacheStorageError error) { 170 ServiceWorkerCacheStorage::CacheStorageError error) {
173 if (error != ServiceWorkerCacheStorage::CACHE_STORAGE_ERROR_NO_ERROR) { 171 if (error != ServiceWorkerCacheStorage::CACHE_STORAGE_ERROR_NO_ERROR) {
(...skipping 28 matching lines...) Expand all
202 } 200 }
203 201
204 std::vector<base::string16> string16s; 202 std::vector<base::string16> string16s;
205 for (size_t i = 0, max = strings.size(); i < max; ++i) { 203 for (size_t i = 0, max = strings.size(); i < max; ++i) {
206 string16s.push_back(base::UTF8ToUTF16(strings[i])); 204 string16s.push_back(base::UTF8ToUTF16(strings[i]));
207 } 205 }
208 Send(ServiceWorkerMsg_CacheStorageKeysSuccess(request_id, string16s)); 206 Send(ServiceWorkerMsg_CacheStorageKeysSuccess(request_id, string16s));
209 } 207 }
210 208
211 } // namespace content 209 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698