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 public: | 25 public: |
26 SettingsFunction(); | 26 SettingsFunction(); |
27 virtual ~SettingsFunction(); | 27 virtual ~SettingsFunction(); |
28 | 28 |
29 protected: | 29 protected: |
| 30 virtual bool ShouldSkipQuotaLimiting() const OVERRIDE; |
| 31 |
30 virtual bool RunImpl() OVERRIDE; | 32 virtual bool RunImpl() OVERRIDE; |
31 | 33 |
32 // Extension settings function implementations should do their work here. | 34 // Extension settings function implementations should do their work here. |
33 // This runs on the FILE thread. | 35 // This runs on the FILE thread. |
34 // | 36 // |
35 // Implementations should fill in args themselves, though (like RunImpl) | 37 // Implementations should fill in args themselves, though (like RunImpl) |
36 // may return false to imply failure. | 38 // may return false to imply failure. |
37 virtual bool RunWithStorage(SettingsStorage* storage) = 0; | 39 virtual bool RunWithStorage(SettingsStorage* storage) = 0; |
38 | 40 |
39 // Sets error_ or result_ depending on the value of a storage ReadResult, and | 41 // Sets error_ or result_ depending on the value of a storage ReadResult, and |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 public: | 105 public: |
104 DECLARE_EXTENSION_FUNCTION_NAME("storage.getBytesInUse"); | 106 DECLARE_EXTENSION_FUNCTION_NAME("storage.getBytesInUse"); |
105 | 107 |
106 protected: | 108 protected: |
107 virtual bool RunWithStorage(SettingsStorage* storage) OVERRIDE; | 109 virtual bool RunWithStorage(SettingsStorage* storage) OVERRIDE; |
108 }; | 110 }; |
109 | 111 |
110 } // namespace extensions | 112 } // namespace extensions |
111 | 113 |
112 #endif // CHROME_BROWSER_EXTENSIONS_SETTINGS_SETTINGS_API_H_ | 114 #endif // CHROME_BROWSER_EXTENSIONS_SETTINGS_SETTINGS_API_H_ |
OLD | NEW |