| Index: chrome/browser/extensions/settings/settings_api.cc
|
| diff --git a/chrome/browser/extensions/settings/settings_api.cc b/chrome/browser/extensions/settings/settings_api.cc
|
| index bcb05dcb8e7ed4df2638bf9e47371bb1c818e3ac..56ccfbd89e7cd523231f67e73192b1c516614e92 100644
|
| --- a/chrome/browser/extensions/settings/settings_api.cc
|
| +++ b/chrome/browser/extensions/settings/settings_api.cc
|
| @@ -4,11 +4,13 @@
|
|
|
| #include "chrome/browser/extensions/settings/settings_api.h"
|
|
|
| +#include <string>
|
| +#include <vector>
|
| +
|
| #include "base/bind.h"
|
| #include "base/values.h"
|
| #include "chrome/browser/extensions/extension_service.h"
|
| #include "chrome/browser/extensions/extensions_quota_service.h"
|
| -#include "chrome/browser/extensions/settings/settings_api.h"
|
| #include "chrome/browser/extensions/settings/settings_frontend.h"
|
| #include "chrome/browser/profiles/profile.h"
|
| #include "chrome/common/extensions/api/storage.h"
|
| @@ -19,7 +21,7 @@ namespace extensions {
|
| using content::BrowserThread;
|
|
|
| namespace {
|
| -const char* kUnsupportedArgumentType = "Unsupported argument type";
|
| +const char kUnsupportedArgumentType[] = "Unsupported argument type";
|
| } // namespace
|
|
|
| // SettingsFunction
|
| @@ -58,12 +60,11 @@ bool SettingsFunction::RunImpl() {
|
| frontend->RunWithStorage(
|
| extension_id(),
|
| settings_namespace_,
|
| - base::Bind(&SettingsFunction::RunWithStorageOnFileThread, this));
|
| + base::Bind(&SettingsFunction::AsyncRunWithStorage, this));
|
| return true;
|
| }
|
|
|
| -void SettingsFunction::RunWithStorageOnFileThread(ValueStore* storage) {
|
| - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
|
| +void SettingsFunction::AsyncRunWithStorage(ValueStore* storage) {
|
| bool success = RunWithStorage(storage);
|
| BrowserThread::PostTask(
|
| BrowserThread::UI,
|
| @@ -72,7 +73,6 @@ void SettingsFunction::RunWithStorageOnFileThread(ValueStore* storage) {
|
| }
|
|
|
| bool SettingsFunction::UseReadResult(ValueStore::ReadResult result) {
|
| - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
|
| if (result->HasError()) {
|
| error_ = result->error();
|
| return false;
|
| @@ -83,7 +83,6 @@ bool SettingsFunction::UseReadResult(ValueStore::ReadResult result) {
|
| }
|
|
|
| bool SettingsFunction::UseWriteResult(ValueStore::WriteResult result) {
|
| - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
|
| if (result->HasError()) {
|
| error_ = result->error();
|
| return false;
|
| @@ -126,8 +125,7 @@ std::vector<std::string> GetKeys(const DictionaryValue& dict) {
|
| }
|
|
|
| // Creates quota heuristics for settings modification.
|
| -static void GetModificationQuotaLimitHeuristics(
|
| - QuotaLimitHeuristics* heuristics) {
|
| +void GetModificationQuotaLimitHeuristics(QuotaLimitHeuristics* heuristics) {
|
| QuotaLimitHeuristic::Config longLimitConfig = {
|
| // See storage.json for current value.
|
| api::storage::sync::MAX_WRITE_OPERATIONS_PER_HOUR,
|
| @@ -153,7 +151,6 @@ static void GetModificationQuotaLimitHeuristics(
|
| } // namespace
|
|
|
| bool GetSettingsFunction::RunWithStorage(ValueStore* storage) {
|
| - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
|
| Value* input = NULL;
|
| EXTENSION_FUNCTION_VALIDATE(args_->Get(0, &input));
|
|
|
| @@ -193,7 +190,6 @@ bool GetSettingsFunction::RunWithStorage(ValueStore* storage) {
|
| }
|
|
|
| bool GetBytesInUseSettingsFunction::RunWithStorage(ValueStore* storage) {
|
| - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
|
| Value* input = NULL;
|
| EXTENSION_FUNCTION_VALIDATE(args_->Get(0, &input));
|
|
|
| @@ -228,7 +224,6 @@ bool GetBytesInUseSettingsFunction::RunWithStorage(ValueStore* storage) {
|
| }
|
|
|
| bool SetSettingsFunction::RunWithStorage(ValueStore* storage) {
|
| - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
|
| DictionaryValue* input = NULL;
|
| EXTENSION_FUNCTION_VALIDATE(args_->GetDictionary(0, &input));
|
| return UseWriteResult(storage->Set(ValueStore::DEFAULTS, *input));
|
| @@ -240,7 +235,6 @@ void SetSettingsFunction::GetQuotaLimitHeuristics(
|
| }
|
|
|
| bool RemoveSettingsFunction::RunWithStorage(ValueStore* storage) {
|
| - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
|
| Value* input = NULL;
|
| EXTENSION_FUNCTION_VALIDATE(args_->Get(0, &input));
|
|
|
| @@ -269,7 +263,6 @@ void RemoveSettingsFunction::GetQuotaLimitHeuristics(
|
| }
|
|
|
| bool ClearSettingsFunction::RunWithStorage(ValueStore* storage) {
|
| - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
|
| return UseWriteResult(storage->Clear());
|
| }
|
|
|
|
|