| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/settings/settings_api.h" | 5 #include "chrome/browser/extensions/settings/settings_api.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/values.h" | 8 #include "base/values.h" |
| 9 #include "chrome/browser/extensions/extension_service.h" | 9 #include "chrome/browser/extensions/extension_service.h" |
| 10 #include "chrome/browser/extensions/settings/settings_frontend.h" | 10 #include "chrome/browser/extensions/settings/settings_frontend.h" |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 SettingsStorage::ReadResult(kUnsupportedArgumentType)); | 141 SettingsStorage::ReadResult(kUnsupportedArgumentType)); |
| 142 } | 142 } |
| 143 } | 143 } |
| 144 | 144 |
| 145 bool SetSettingsFunction::RunWithStorage( | 145 bool SetSettingsFunction::RunWithStorage( |
| 146 scoped_refptr<SettingsObserverList> observers, | 146 scoped_refptr<SettingsObserverList> observers, |
| 147 SettingsStorage* storage) { | 147 SettingsStorage* storage) { |
| 148 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 148 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
| 149 DictionaryValue *input; | 149 DictionaryValue *input; |
| 150 EXTENSION_FUNCTION_VALIDATE(args_->GetDictionary(0, &input)); | 150 EXTENSION_FUNCTION_VALIDATE(args_->GetDictionary(0, &input)); |
| 151 return UseWriteResult(observers, storage->Set(*input)); | 151 return UseWriteResult( |
| 152 observers, storage->Set(SettingsStorage::DEFAULTS, *input)); |
| 152 } | 153 } |
| 153 | 154 |
| 154 bool RemoveSettingsFunction::RunWithStorage( | 155 bool RemoveSettingsFunction::RunWithStorage( |
| 155 scoped_refptr<SettingsObserverList> observers, | 156 scoped_refptr<SettingsObserverList> observers, |
| 156 SettingsStorage* storage) { | 157 SettingsStorage* storage) { |
| 157 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 158 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
| 158 Value *input; | 159 Value *input; |
| 159 EXTENSION_FUNCTION_VALIDATE(args_->Get(0, &input)); | 160 EXTENSION_FUNCTION_VALIDATE(args_->Get(0, &input)); |
| 160 | 161 |
| 161 switch (input->GetType()) { | 162 switch (input->GetType()) { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 179 } | 180 } |
| 180 | 181 |
| 181 bool ClearSettingsFunction::RunWithStorage( | 182 bool ClearSettingsFunction::RunWithStorage( |
| 182 scoped_refptr<SettingsObserverList> observers, | 183 scoped_refptr<SettingsObserverList> observers, |
| 183 SettingsStorage* storage) { | 184 SettingsStorage* storage) { |
| 184 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 185 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
| 185 return UseWriteResult(observers, storage->Clear()); | 186 return UseWriteResult(observers, storage->Clear()); |
| 186 } | 187 } |
| 187 | 188 |
| 188 } // namespace extensions | 189 } // namespace extensions |
| OLD | NEW |