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

Side by Side Diff: Source/modules/quota/StorageQuota.cpp

Issue 469773002: Cleanup blink:: prefix usage in Source/core/modules/[mediasource/*.cpp to websockets/*.cpp] (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 4 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2014 Google Inc. All rights reserved. 2 * Copyright (C) 2014 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 #include "platform/weborigin/SecurityOrigin.h" 42 #include "platform/weborigin/SecurityOrigin.h"
43 #include "public/platform/Platform.h" 43 #include "public/platform/Platform.h"
44 #include "public/platform/WebStorageQuotaCallbacks.h" 44 #include "public/platform/WebStorageQuotaCallbacks.h"
45 #include "public/platform/WebStorageQuotaType.h" 45 #include "public/platform/WebStorageQuotaType.h"
46 46
47 namespace blink { 47 namespace blink {
48 48
49 namespace { 49 namespace {
50 50
51 struct StorageTypeMapping { 51 struct StorageTypeMapping {
52 blink::WebStorageQuotaType type; 52 WebStorageQuotaType type;
53 const char* const name; 53 const char* const name;
54 }; 54 };
55 55
56 const StorageTypeMapping storageTypeMappings[] = { 56 const StorageTypeMapping storageTypeMappings[] = {
57 { blink::WebStorageQuotaTypeTemporary, "temporary" }, 57 { WebStorageQuotaTypeTemporary, "temporary" },
58 { blink::WebStorageQuotaTypePersistent, "persistent" }, 58 { WebStorageQuotaTypePersistent, "persistent" },
59 }; 59 };
60 60
61 blink::WebStorageQuotaType stringToStorageQuotaType(const String& type) 61 WebStorageQuotaType stringToStorageQuotaType(const String& type)
62 { 62 {
63 for (size_t i = 0; i < WTF_ARRAY_LENGTH(storageTypeMappings); ++i) { 63 for (size_t i = 0; i < WTF_ARRAY_LENGTH(storageTypeMappings); ++i) {
64 if (storageTypeMappings[i].name == type) 64 if (storageTypeMappings[i].name == type)
65 return storageTypeMappings[i].type; 65 return storageTypeMappings[i].type;
66 } 66 }
67 ASSERT_NOT_REACHED(); 67 ASSERT_NOT_REACHED();
68 return blink::WebStorageQuotaTypeTemporary; 68 return WebStorageQuotaTypeTemporary;
69 } 69 }
70 70
71 } // namespace 71 } // namespace
72 72
73 StorageQuota::StorageQuota() 73 StorageQuota::StorageQuota()
74 { 74 {
75 ScriptWrappable::init(this); 75 ScriptWrappable::init(this);
76 } 76 }
77 77
78 Vector<String> StorageQuota::supportedTypes() const 78 Vector<String> StorageQuota::supportedTypes() const
(...skipping 10 matching lines...) Expand all
89 ScriptPromise promise = resolver->promise(); 89 ScriptPromise promise = resolver->promise();
90 90
91 SecurityOrigin* securityOrigin = scriptState->executionContext()->securityOr igin(); 91 SecurityOrigin* securityOrigin = scriptState->executionContext()->securityOr igin();
92 if (securityOrigin->isUnique()) { 92 if (securityOrigin->isUnique()) {
93 resolver->reject(DOMError::create(NotSupportedError)); 93 resolver->reject(DOMError::create(NotSupportedError));
94 return promise; 94 return promise;
95 } 95 }
96 96
97 KURL storagePartition = KURL(KURL(), securityOrigin->toString()); 97 KURL storagePartition = KURL(KURL(), securityOrigin->toString());
98 OwnPtr<StorageQuotaCallbacks> callbacks = StorageQuotaCallbacksImpl::create( resolver); 98 OwnPtr<StorageQuotaCallbacks> callbacks = StorageQuotaCallbacksImpl::create( resolver);
99 blink::Platform::current()->queryStorageUsageAndQuota(storagePartition, stri ngToStorageQuotaType(type), callbacks.release()); 99 Platform::current()->queryStorageUsageAndQuota(storagePartition, stringToSto rageQuotaType(type), callbacks.release());
100 return promise; 100 return promise;
101 } 101 }
102 102
103 ScriptPromise StorageQuota::requestPersistentQuota(ScriptState* scriptState, uns igned long long newQuota) 103 ScriptPromise StorageQuota::requestPersistentQuota(ScriptState* scriptState, uns igned long long newQuota)
104 { 104 {
105 StorageQuotaClient* client = StorageQuotaClient::from(scriptState->execution Context()); 105 StorageQuotaClient* client = StorageQuotaClient::from(scriptState->execution Context());
106 if (!client) { 106 if (!client) {
107 RefPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver::create(s criptState); 107 RefPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver::create(s criptState);
108 ScriptPromise promise = resolver->promise(); 108 ScriptPromise promise = resolver->promise();
109 resolver->reject(DOMError::create(NotSupportedError)); 109 resolver->reject(DOMError::create(NotSupportedError));
110 return promise; 110 return promise;
111 } 111 }
112 112
113 return client->requestPersistentQuota(scriptState, newQuota); 113 return client->requestPersistentQuota(scriptState, newQuota);
114 } 114 }
115 115
116 } // namespace blink 116 } // namespace blink
OLDNEW
« no previous file with comments | « Source/modules/quota/DeprecatedStorageQuotaCallbacksImpl.cpp ('k') | Source/modules/quota/StorageQuotaCallbacksImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698