| 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 "extensions/browser/api/storage/storage_api.h" | 5 #include "extensions/browser/api/storage/storage_api.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/bind.h" | 13 #include "base/bind.h" |
| 14 #include "base/memory/ptr_util.h" |
| 14 #include "base/strings/stringprintf.h" | 15 #include "base/strings/stringprintf.h" |
| 15 #include "base/values.h" | 16 #include "base/values.h" |
| 16 #include "content/public/browser/browser_thread.h" | 17 #include "content/public/browser/browser_thread.h" |
| 17 #include "extensions/browser/api/storage/storage_frontend.h" | 18 #include "extensions/browser/api/storage/storage_frontend.h" |
| 18 #include "extensions/browser/quota_service.h" | 19 #include "extensions/browser/quota_service.h" |
| 19 #include "extensions/common/api/storage.h" | 20 #include "extensions/common/api/storage.h" |
| 20 | 21 |
| 21 namespace extensions { | 22 namespace extensions { |
| 22 | 23 |
| 23 using content::BrowserThread; | 24 using content::BrowserThread; |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 base::DictionaryValue* as_dict = | 169 base::DictionaryValue* as_dict = |
| 169 static_cast<base::DictionaryValue*>(input); | 170 static_cast<base::DictionaryValue*>(input); |
| 170 ValueStore::ReadResult result = storage->Get(GetKeys(*as_dict)); | 171 ValueStore::ReadResult result = storage->Get(GetKeys(*as_dict)); |
| 171 if (!result->status().ok()) { | 172 if (!result->status().ok()) { |
| 172 return UseReadResult(std::move(result)); | 173 return UseReadResult(std::move(result)); |
| 173 } | 174 } |
| 174 | 175 |
| 175 base::DictionaryValue* with_default_values = as_dict->DeepCopy(); | 176 base::DictionaryValue* with_default_values = as_dict->DeepCopy(); |
| 176 with_default_values->MergeDictionary(&result->settings()); | 177 with_default_values->MergeDictionary(&result->settings()); |
| 177 return UseReadResult(ValueStore::MakeReadResult( | 178 return UseReadResult(ValueStore::MakeReadResult( |
| 178 make_scoped_ptr(with_default_values), result->status())); | 179 base::WrapUnique(with_default_values), result->status())); |
| 179 } | 180 } |
| 180 | 181 |
| 181 default: | 182 default: |
| 182 return BadMessage(); | 183 return BadMessage(); |
| 183 } | 184 } |
| 184 } | 185 } |
| 185 | 186 |
| 186 ExtensionFunction::ResponseValue | 187 ExtensionFunction::ResponseValue |
| 187 StorageStorageAreaGetBytesInUseFunction::RunWithStorage(ValueStore* storage) { | 188 StorageStorageAreaGetBytesInUseFunction::RunWithStorage(ValueStore* storage) { |
| 188 base::Value* input = NULL; | 189 base::Value* input = NULL; |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 StorageStorageAreaClearFunction::RunWithStorage(ValueStore* storage) { | 267 StorageStorageAreaClearFunction::RunWithStorage(ValueStore* storage) { |
| 267 return UseWriteResult(storage->Clear()); | 268 return UseWriteResult(storage->Clear()); |
| 268 } | 269 } |
| 269 | 270 |
| 270 void StorageStorageAreaClearFunction::GetQuotaLimitHeuristics( | 271 void StorageStorageAreaClearFunction::GetQuotaLimitHeuristics( |
| 271 QuotaLimitHeuristics* heuristics) const { | 272 QuotaLimitHeuristics* heuristics) const { |
| 272 GetModificationQuotaLimitHeuristics(heuristics); | 273 GetModificationQuotaLimitHeuristics(heuristics); |
| 273 } | 274 } |
| 274 | 275 |
| 275 } // namespace extensions | 276 } // namespace extensions |
| OLD | NEW |