OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/extensions/api/storage/storage_api.h" | 5 #include "chrome/browser/extensions/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 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 &as_string_list); | 228 &as_string_list); |
229 bytes_in_use = storage->GetBytesInUse(as_string_list); | 229 bytes_in_use = storage->GetBytesInUse(as_string_list); |
230 break; | 230 break; |
231 } | 231 } |
232 | 232 |
233 default: | 233 default: |
234 error_ = kUnsupportedArgumentType; | 234 error_ = kUnsupportedArgumentType; |
235 return false; | 235 return false; |
236 } | 236 } |
237 | 237 |
238 SetResult(base::Value::CreateIntegerValue(bytes_in_use)); | 238 SetResult(new base::FundamentalValue(static_cast<int>(bytes_in_use))); |
239 return true; | 239 return true; |
240 } | 240 } |
241 | 241 |
242 bool StorageStorageAreaSetFunction::RunWithStorage(ValueStore* storage) { | 242 bool StorageStorageAreaSetFunction::RunWithStorage(ValueStore* storage) { |
243 base::DictionaryValue* input = NULL; | 243 base::DictionaryValue* input = NULL; |
244 EXTENSION_FUNCTION_VALIDATE(args_->GetDictionary(0, &input)); | 244 EXTENSION_FUNCTION_VALIDATE(args_->GetDictionary(0, &input)); |
245 return UseWriteResult(storage->Set(ValueStore::DEFAULTS, *input)); | 245 return UseWriteResult(storage->Set(ValueStore::DEFAULTS, *input)); |
246 } | 246 } |
247 | 247 |
248 void StorageStorageAreaSetFunction::GetQuotaLimitHeuristics( | 248 void StorageStorageAreaSetFunction::GetQuotaLimitHeuristics( |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 bool StorageStorageAreaClearFunction::RunWithStorage(ValueStore* storage) { | 282 bool StorageStorageAreaClearFunction::RunWithStorage(ValueStore* storage) { |
283 return UseWriteResult(storage->Clear()); | 283 return UseWriteResult(storage->Clear()); |
284 } | 284 } |
285 | 285 |
286 void StorageStorageAreaClearFunction::GetQuotaLimitHeuristics( | 286 void StorageStorageAreaClearFunction::GetQuotaLimitHeuristics( |
287 QuotaLimitHeuristics* heuristics) const { | 287 QuotaLimitHeuristics* heuristics) const { |
288 GetModificationQuotaLimitHeuristics(heuristics); | 288 GetModificationQuotaLimitHeuristics(heuristics); |
289 } | 289 } |
290 | 290 |
291 } // namespace extensions | 291 } // namespace extensions |
OLD | NEW |