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

Side by Side Diff: extensions/browser/api/storage/storage_api.cc

Issue 291453002: Make ExtensionFunction::ArgumentList (PKA MultipleArguments) take a scoped_ptr (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: reabse Created 6 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « extensions/browser/api/runtime/runtime_api.cc ('k') | extensions/browser/extension_function.h » ('j') | 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 "extensions/browser/api/storage/storage_api.h" 5 #include "extensions/browser/api/storage/storage_api.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 } 71 }
72 72
73 ExtensionFunction::ResponseValue SettingsFunction::UseReadResult( 73 ExtensionFunction::ResponseValue SettingsFunction::UseReadResult(
74 ValueStore::ReadResult result, 74 ValueStore::ReadResult result,
75 ValueStore* storage) { 75 ValueStore* storage) {
76 if (result->HasError()) 76 if (result->HasError())
77 return HandleError(result->error(), storage); 77 return HandleError(result->error(), storage);
78 78
79 base::DictionaryValue* dict = new base::DictionaryValue(); 79 base::DictionaryValue* dict = new base::DictionaryValue();
80 dict->Swap(&result->settings()); 80 dict->Swap(&result->settings());
81 return SingleArgument(dict); 81 return OneArgument(dict);
82 } 82 }
83 83
84 ExtensionFunction::ResponseValue SettingsFunction::UseWriteResult( 84 ExtensionFunction::ResponseValue SettingsFunction::UseWriteResult(
85 ValueStore::WriteResult result, 85 ValueStore::WriteResult result,
86 ValueStore* storage) { 86 ValueStore* storage) {
87 if (result->HasError()) 87 if (result->HasError())
88 return HandleError(result->error(), storage); 88 return HandleError(result->error(), storage);
89 89
90 if (!result->changes().empty()) { 90 if (!result->changes().empty()) {
91 observers_->Notify( 91 observers_->Notify(
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 AddAllStringValues(*static_cast<base::ListValue*>(input), 242 AddAllStringValues(*static_cast<base::ListValue*>(input),
243 &as_string_list); 243 &as_string_list);
244 bytes_in_use = storage->GetBytesInUse(as_string_list); 244 bytes_in_use = storage->GetBytesInUse(as_string_list);
245 break; 245 break;
246 } 246 }
247 247
248 default: 248 default:
249 return BadMessage(); 249 return BadMessage();
250 } 250 }
251 251
252 return SingleArgument( 252 return OneArgument(
253 new base::FundamentalValue(static_cast<int>(bytes_in_use))); 253 new base::FundamentalValue(static_cast<int>(bytes_in_use)));
254 } 254 }
255 255
256 ExtensionFunction::ResponseValue StorageStorageAreaSetFunction::RunWithStorage( 256 ExtensionFunction::ResponseValue StorageStorageAreaSetFunction::RunWithStorage(
257 ValueStore* storage) { 257 ValueStore* storage) {
258 base::DictionaryValue* input = NULL; 258 base::DictionaryValue* input = NULL;
259 if (!args_->GetDictionary(0, &input)) 259 if (!args_->GetDictionary(0, &input))
260 return BadMessage(); 260 return BadMessage();
261 return UseWriteResult(storage->Set(ValueStore::DEFAULTS, *input), storage); 261 return UseWriteResult(storage->Set(ValueStore::DEFAULTS, *input), storage);
262 } 262 }
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 StorageStorageAreaClearFunction::RunWithStorage(ValueStore* storage) { 300 StorageStorageAreaClearFunction::RunWithStorage(ValueStore* storage) {
301 return UseWriteResult(storage->Clear(), storage); 301 return UseWriteResult(storage->Clear(), storage);
302 } 302 }
303 303
304 void StorageStorageAreaClearFunction::GetQuotaLimitHeuristics( 304 void StorageStorageAreaClearFunction::GetQuotaLimitHeuristics(
305 QuotaLimitHeuristics* heuristics) const { 305 QuotaLimitHeuristics* heuristics) const {
306 GetModificationQuotaLimitHeuristics(heuristics); 306 GetModificationQuotaLimitHeuristics(heuristics);
307 } 307 }
308 308
309 } // namespace extensions 309 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/browser/api/runtime/runtime_api.cc ('k') | extensions/browser/extension_function.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698