| 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 #ifndef CHROME_BROWSER_EXTENSIONS_SETTINGS_SETTINGS_API_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_SETTINGS_SETTINGS_API_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_SETTINGS_SETTINGS_API_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_SETTINGS_SETTINGS_API_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| 11 #include "chrome/browser/extensions/extension_function.h" | 11 #include "chrome/browser/extensions/extension_function.h" |
| 12 #include "chrome/browser/extensions/settings/settings_backend.h" | 12 #include "chrome/browser/extensions/settings/settings_backend.h" |
| 13 #include "chrome/browser/extensions/settings/settings_namespace.h" | 13 #include "chrome/browser/extensions/settings/settings_namespace.h" |
| 14 #include "chrome/browser/extensions/settings/settings_storage.h" | 14 #include "chrome/browser/extensions/settings/settings_storage.h" |
| 15 | 15 |
| 16 namespace extensions { | 16 namespace extensions { |
| 17 | 17 |
| 18 // Superclass of all settings functions. | 18 // Superclass of all settings functions. |
| 19 // | 19 // |
| 20 // NOTE: these all have "*SettingsFunction" names left over from when the API | 20 // NOTE: these all have "*SettingsFunction" names left over from when the API |
| 21 // was called the "Settings API" (now "Storage API"). | 21 // was called the "Settings API" (now "Storage API"). |
| 22 // TODO(kalman): Rename these functions, and all files under | 22 // TODO(kalman): Rename these functions, and all files under |
| 23 // chrome/browser/extensions/settings. | 23 // chrome/browser/extensions/settings. |
| 24 class SettingsFunction : public AsyncExtensionFunction { | 24 class SettingsFunction : public AsyncExtensionFunction { |
| 25 protected: | 25 protected: |
| 26 SettingsFunction(); | 26 SettingsFunction(); |
| 27 virtual ~SettingsFunction(); | 27 virtual ~SettingsFunction(); |
| 28 | 28 |
| 29 // ExtensionFunction: | 29 // ExtensionFunction: |
| 30 virtual bool ShouldSkipQuotaLimiting() const OVERRIDE; |
| 30 virtual bool RunImpl() OVERRIDE; | 31 virtual bool RunImpl() OVERRIDE; |
| 31 | 32 |
| 32 // Extension settings function implementations should do their work here. | 33 // Extension settings function implementations should do their work here. |
| 33 // This runs on the FILE thread. | 34 // This runs on the FILE thread. |
| 34 // | 35 // |
| 35 // Implementations should fill in args themselves, though (like RunImpl) | 36 // Implementations should fill in args themselves, though (like RunImpl) |
| 36 // may return false to imply failure. | 37 // may return false to imply failure. |
| 37 virtual bool RunWithStorage(SettingsStorage* storage) = 0; | 38 virtual bool RunWithStorage(SettingsStorage* storage) = 0; |
| 38 | 39 |
| 39 // Sets error_ or result_ depending on the value of a storage ReadResult, and | 40 // Sets error_ or result_ depending on the value of a storage ReadResult, and |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 protected: | 122 protected: |
| 122 virtual ~GetBytesInUseSettingsFunction() {} | 123 virtual ~GetBytesInUseSettingsFunction() {} |
| 123 | 124 |
| 124 // SettingsFunction: | 125 // SettingsFunction: |
| 125 virtual bool RunWithStorage(SettingsStorage* storage) OVERRIDE; | 126 virtual bool RunWithStorage(SettingsStorage* storage) OVERRIDE; |
| 126 }; | 127 }; |
| 127 | 128 |
| 128 } // namespace extensions | 129 } // namespace extensions |
| 129 | 130 |
| 130 #endif // CHROME_BROWSER_EXTENSIONS_SETTINGS_SETTINGS_API_H_ | 131 #endif // CHROME_BROWSER_EXTENSIONS_SETTINGS_SETTINGS_API_H_ |
| OLD | NEW |