| 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 29 matching lines...) Expand all Loading... |
| 40 | 40 |
| 41 bool SettingsFunction::RunImpl() { | 41 bool SettingsFunction::RunImpl() { |
| 42 std::string settings_namespace_string; | 42 std::string settings_namespace_string; |
| 43 EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &settings_namespace_string)); | 43 EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &settings_namespace_string)); |
| 44 args_->Remove(0, NULL); | 44 args_->Remove(0, NULL); |
| 45 settings_namespace_ = | 45 settings_namespace_ = |
| 46 settings_namespace::FromString(settings_namespace_string); | 46 settings_namespace::FromString(settings_namespace_string); |
| 47 EXTENSION_FUNCTION_VALIDATE( | 47 EXTENSION_FUNCTION_VALIDATE( |
| 48 settings_namespace_ != settings_namespace::INVALID); | 48 settings_namespace_ != settings_namespace::INVALID); |
| 49 | 49 |
| 50 SettingsFrontend* frontend = SettingsFrontend::Get(context()); | 50 SettingsFrontend* frontend = SettingsFrontend::Get(browser_context()); |
| 51 if (!frontend->IsStorageEnabled(settings_namespace_)) { | 51 if (!frontend->IsStorageEnabled(settings_namespace_)) { |
| 52 error_ = base::StringPrintf( | 52 error_ = base::StringPrintf( |
| 53 "\"%s\" is not available in this instance of Chrome", | 53 "\"%s\" is not available in this instance of Chrome", |
| 54 settings_namespace_string.c_str()); | 54 settings_namespace_string.c_str()); |
| 55 return false; | 55 return false; |
| 56 } | 56 } |
| 57 | 57 |
| 58 observers_ = frontend->GetObservers(); | 58 observers_ = frontend->GetObservers(); |
| 59 frontend->RunWithStorage( | 59 frontend->RunWithStorage( |
| 60 extension_id(), | 60 extension_id(), |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 bool StorageStorageAreaClearFunction::RunWithStorage(ValueStore* storage) { | 295 bool StorageStorageAreaClearFunction::RunWithStorage(ValueStore* storage) { |
| 296 return UseWriteResult(storage->Clear(), storage); | 296 return UseWriteResult(storage->Clear(), storage); |
| 297 } | 297 } |
| 298 | 298 |
| 299 void StorageStorageAreaClearFunction::GetQuotaLimitHeuristics( | 299 void StorageStorageAreaClearFunction::GetQuotaLimitHeuristics( |
| 300 QuotaLimitHeuristics* heuristics) const { | 300 QuotaLimitHeuristics* heuristics) const { |
| 301 GetModificationQuotaLimitHeuristics(heuristics); | 301 GetModificationQuotaLimitHeuristics(heuristics); |
| 302 } | 302 } |
| 303 | 303 |
| 304 } // namespace extensions | 304 } // namespace extensions |
| OLD | NEW |