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_API_STORAGE_STORAGE_API_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_STORAGE_STORAGE_API_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_API_STORAGE_STORAGE_API_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_STORAGE_STORAGE_API_H_ |
7 | 7 |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "chrome/browser/extensions/api/storage/settings_namespace.h" | 10 #include "chrome/browser/extensions/api/storage/settings_namespace.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 void AsyncRunWithStorage(ValueStore* storage); | 45 void AsyncRunWithStorage(ValueStore* storage); |
46 | 46 |
47 // The settings namespace the call was for. For example, SYNC if the API | 47 // The settings namespace the call was for. For example, SYNC if the API |
48 // call was chrome.settings.experimental.sync..., LOCAL if .local, etc. | 48 // call was chrome.settings.experimental.sync..., LOCAL if .local, etc. |
49 settings_namespace::Namespace settings_namespace_; | 49 settings_namespace::Namespace settings_namespace_; |
50 | 50 |
51 // Observers, cached so that it's only grabbed from the UI thread. | 51 // Observers, cached so that it's only grabbed from the UI thread. |
52 scoped_refptr<SettingsObserverList> observers_; | 52 scoped_refptr<SettingsObserverList> observers_; |
53 }; | 53 }; |
54 | 54 |
55 class StorageGetFunction : public SettingsFunction { | 55 class StorageStorageAreaGetFunction : public SettingsFunction { |
56 public: | 56 public: |
57 DECLARE_EXTENSION_FUNCTION("storage.get", STORAGE_GET) | 57 DECLARE_EXTENSION_FUNCTION("storage.get", STORAGE_GET) |
58 | 58 |
59 protected: | 59 protected: |
60 virtual ~StorageGetFunction() {} | 60 virtual ~StorageStorageAreaGetFunction() {} |
61 | 61 |
62 // SettingsFunction: | 62 // SettingsFunction: |
63 virtual bool RunWithStorage(ValueStore* storage) OVERRIDE; | 63 virtual bool RunWithStorage(ValueStore* storage) OVERRIDE; |
64 }; | 64 }; |
65 | 65 |
66 class StorageSetFunction : public SettingsFunction { | 66 class StorageStorageAreaSetFunction : public SettingsFunction { |
67 public: | 67 public: |
68 DECLARE_EXTENSION_FUNCTION("storage.set", STORAGE_SET) | 68 DECLARE_EXTENSION_FUNCTION("storage.set", STORAGE_SET) |
69 | 69 |
70 protected: | 70 protected: |
71 virtual ~StorageSetFunction() {} | 71 virtual ~StorageStorageAreaSetFunction() {} |
72 | 72 |
73 // SettingsFunction: | 73 // SettingsFunction: |
74 virtual bool RunWithStorage(ValueStore* storage) OVERRIDE; | 74 virtual bool RunWithStorage(ValueStore* storage) OVERRIDE; |
75 | 75 |
76 // ExtensionFunction: | 76 // ExtensionFunction: |
77 virtual void GetQuotaLimitHeuristics( | 77 virtual void GetQuotaLimitHeuristics( |
78 QuotaLimitHeuristics* heuristics) const OVERRIDE; | 78 QuotaLimitHeuristics* heuristics) const OVERRIDE; |
79 }; | 79 }; |
80 | 80 |
81 class StorageRemoveFunction : public SettingsFunction { | 81 class StorageStorageAreaRemoveFunction : public SettingsFunction { |
82 public: | 82 public: |
83 DECLARE_EXTENSION_FUNCTION("storage.remove", STORAGE_REMOVE) | 83 DECLARE_EXTENSION_FUNCTION("storage.remove", STORAGE_REMOVE) |
84 | 84 |
85 protected: | 85 protected: |
86 virtual ~StorageRemoveFunction() {} | 86 virtual ~StorageStorageAreaRemoveFunction() {} |
87 | 87 |
88 // SettingsFunction: | 88 // SettingsFunction: |
89 virtual bool RunWithStorage(ValueStore* storage) OVERRIDE; | 89 virtual bool RunWithStorage(ValueStore* storage) OVERRIDE; |
90 | 90 |
91 // ExtensionFunction: | 91 // ExtensionFunction: |
92 virtual void GetQuotaLimitHeuristics( | 92 virtual void GetQuotaLimitHeuristics( |
93 QuotaLimitHeuristics* heuristics) const OVERRIDE; | 93 QuotaLimitHeuristics* heuristics) const OVERRIDE; |
94 }; | 94 }; |
95 | 95 |
96 class StorageClearFunction : public SettingsFunction { | 96 class StorageStorageAreaClearFunction : public SettingsFunction { |
97 public: | 97 public: |
98 DECLARE_EXTENSION_FUNCTION("storage.clear", STORAGE_CLEAR) | 98 DECLARE_EXTENSION_FUNCTION("storage.clear", STORAGE_CLEAR) |
99 | 99 |
100 protected: | 100 protected: |
101 virtual ~StorageClearFunction() {} | 101 virtual ~StorageStorageAreaClearFunction() {} |
102 | 102 |
103 // SettingsFunction: | 103 // SettingsFunction: |
104 virtual bool RunWithStorage(ValueStore* storage) OVERRIDE; | 104 virtual bool RunWithStorage(ValueStore* storage) OVERRIDE; |
105 | 105 |
106 // ExtensionFunction: | 106 // ExtensionFunction: |
107 virtual void GetQuotaLimitHeuristics( | 107 virtual void GetQuotaLimitHeuristics( |
108 QuotaLimitHeuristics* heuristics) const OVERRIDE; | 108 QuotaLimitHeuristics* heuristics) const OVERRIDE; |
109 }; | 109 }; |
110 | 110 |
111 class StorageGetBytesInUseFunction : public SettingsFunction { | 111 class StorageStorageAreaGetBytesInUseFunction : public SettingsFunction { |
112 public: | 112 public: |
113 DECLARE_EXTENSION_FUNCTION("storage.getBytesInUse", STORAGE_GETBYTESINUSE) | 113 DECLARE_EXTENSION_FUNCTION("storage.getBytesInUse", STORAGE_GETBYTESINUSE) |
114 | 114 |
115 protected: | 115 protected: |
116 virtual ~StorageGetBytesInUseFunction() {} | 116 virtual ~StorageStorageAreaGetBytesInUseFunction() {} |
117 | 117 |
118 // SettingsFunction: | 118 // SettingsFunction: |
119 virtual bool RunWithStorage(ValueStore* storage) OVERRIDE; | 119 virtual bool RunWithStorage(ValueStore* storage) OVERRIDE; |
120 }; | 120 }; |
121 | 121 |
122 } // namespace extensions | 122 } // namespace extensions |
123 | 123 |
124 #endif // CHROME_BROWSER_EXTENSIONS_API_STORAGE_STORAGE_API_H_ | 124 #endif // CHROME_BROWSER_EXTENSIONS_API_STORAGE_STORAGE_API_H_ |
OLD | NEW |