Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(236)

Side by Side Diff: chrome/browser/extensions/api/storage/storage_api.h

Issue 11747025: Run the JSON Schema Compiler's bundle compilation on JSON files. Previously it (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix ms release build Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_API_STORAGE_STORAGE_API_H_
6 #define CHROME_BROWSER_EXTENSIONS_SETTINGS_SETTINGS_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"
11 #include "chrome/browser/extensions/api/storage/settings_observer.h"
10 #include "chrome/browser/extensions/extension_function.h" 12 #include "chrome/browser/extensions/extension_function.h"
11 #include "chrome/browser/extensions/settings/settings_namespace.h"
12 #include "chrome/browser/extensions/settings/settings_observer.h"
13 #include "chrome/browser/value_store/value_store.h" 13 #include "chrome/browser/value_store/value_store.h"
14 14
15 namespace extensions { 15 namespace extensions {
16 16
17 // Superclass of all settings functions. 17 // Superclass of all settings functions.
18 //
19 // NOTE: these all have "*SettingsFunction" names left over from when the API
20 // was called the "Settings API" (now "Storage API").
21 // TODO(kalman): Rename these functions, and all files under
22 // chrome/browser/extensions/settings.
23 class SettingsFunction : public AsyncExtensionFunction { 18 class SettingsFunction : public AsyncExtensionFunction {
24 protected: 19 protected:
25 SettingsFunction(); 20 SettingsFunction();
26 virtual ~SettingsFunction(); 21 virtual ~SettingsFunction();
27 22
28 // ExtensionFunction: 23 // ExtensionFunction:
29 virtual bool ShouldSkipQuotaLimiting() const OVERRIDE; 24 virtual bool ShouldSkipQuotaLimiting() const OVERRIDE;
30 virtual bool RunImpl() OVERRIDE; 25 virtual bool RunImpl() OVERRIDE;
31 26
32 // Extension settings function implementations should do their work here. 27 // Extension settings function implementations should do their work here.
(...skipping 17 matching lines...) Expand all
50 void AsyncRunWithStorage(ValueStore* storage); 45 void AsyncRunWithStorage(ValueStore* storage);
51 46
52 // 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
53 // call was chrome.settings.experimental.sync..., LOCAL if .local, etc. 48 // call was chrome.settings.experimental.sync..., LOCAL if .local, etc.
54 settings_namespace::Namespace settings_namespace_; 49 settings_namespace::Namespace settings_namespace_;
55 50
56 // 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.
57 scoped_refptr<SettingsObserverList> observers_; 52 scoped_refptr<SettingsObserverList> observers_;
58 }; 53 };
59 54
60 class GetSettingsFunction : public SettingsFunction { 55 class StorageGetFunction : public SettingsFunction {
61 public: 56 public:
62 DECLARE_EXTENSION_FUNCTION_NAME("storage.get"); 57 DECLARE_EXTENSION_FUNCTION_NAME("storage.get");
63 58
64 protected: 59 protected:
65 virtual ~GetSettingsFunction() {} 60 virtual ~StorageGetFunction() {}
66 61
67 // SettingsFunction: 62 // SettingsFunction:
68 virtual bool RunWithStorage(ValueStore* storage) OVERRIDE; 63 virtual bool RunWithStorage(ValueStore* storage) OVERRIDE;
69 }; 64 };
70 65
71 class SetSettingsFunction : public SettingsFunction { 66 class StorageSetFunction : public SettingsFunction {
72 public: 67 public:
73 DECLARE_EXTENSION_FUNCTION_NAME("storage.set"); 68 DECLARE_EXTENSION_FUNCTION_NAME("storage.set");
74 69
75 protected: 70 protected:
76 virtual ~SetSettingsFunction() {} 71 virtual ~StorageSetFunction() {}
77 72
78 // SettingsFunction: 73 // SettingsFunction:
79 virtual bool RunWithStorage(ValueStore* storage) OVERRIDE; 74 virtual bool RunWithStorage(ValueStore* storage) OVERRIDE;
80 75
81 // ExtensionFunction: 76 // ExtensionFunction:
82 virtual void GetQuotaLimitHeuristics( 77 virtual void GetQuotaLimitHeuristics(
83 QuotaLimitHeuristics* heuristics) const OVERRIDE; 78 QuotaLimitHeuristics* heuristics) const OVERRIDE;
84 }; 79 };
85 80
86 class RemoveSettingsFunction : public SettingsFunction { 81 class StorageRemoveFunction : public SettingsFunction {
87 public: 82 public:
88 DECLARE_EXTENSION_FUNCTION_NAME("storage.remove"); 83 DECLARE_EXTENSION_FUNCTION_NAME("storage.remove");
89 84
90 protected: 85 protected:
91 virtual ~RemoveSettingsFunction() {} 86 virtual ~StorageRemoveFunction() {}
92 87
93 // SettingsFunction: 88 // SettingsFunction:
94 virtual bool RunWithStorage(ValueStore* storage) OVERRIDE; 89 virtual bool RunWithStorage(ValueStore* storage) OVERRIDE;
95 90
96 // ExtensionFunction: 91 // ExtensionFunction:
97 virtual void GetQuotaLimitHeuristics( 92 virtual void GetQuotaLimitHeuristics(
98 QuotaLimitHeuristics* heuristics) const OVERRIDE; 93 QuotaLimitHeuristics* heuristics) const OVERRIDE;
99 }; 94 };
100 95
101 class ClearSettingsFunction : public SettingsFunction { 96 class StorageClearFunction : public SettingsFunction {
102 public: 97 public:
103 DECLARE_EXTENSION_FUNCTION_NAME("storage.clear"); 98 DECLARE_EXTENSION_FUNCTION_NAME("storage.clear");
104 99
105 protected: 100 protected:
106 virtual ~ClearSettingsFunction() {} 101 virtual ~StorageClearFunction() {}
107 102
108 // SettingsFunction: 103 // SettingsFunction:
109 virtual bool RunWithStorage(ValueStore* storage) OVERRIDE; 104 virtual bool RunWithStorage(ValueStore* storage) OVERRIDE;
110 105
111 // ExtensionFunction: 106 // ExtensionFunction:
112 virtual void GetQuotaLimitHeuristics( 107 virtual void GetQuotaLimitHeuristics(
113 QuotaLimitHeuristics* heuristics) const OVERRIDE; 108 QuotaLimitHeuristics* heuristics) const OVERRIDE;
114 }; 109 };
115 110
116 class GetBytesInUseSettingsFunction : public SettingsFunction { 111 class StorageGetBytesInUseFunction : public SettingsFunction {
117 public: 112 public:
118 DECLARE_EXTENSION_FUNCTION_NAME("storage.getBytesInUse"); 113 DECLARE_EXTENSION_FUNCTION_NAME("storage.getBytesInUse");
119 114
120 protected: 115 protected:
121 virtual ~GetBytesInUseSettingsFunction() {} 116 virtual ~StorageGetBytesInUseFunction() {}
122 117
123 // SettingsFunction: 118 // SettingsFunction:
124 virtual bool RunWithStorage(ValueStore* storage) OVERRIDE; 119 virtual bool RunWithStorage(ValueStore* storage) OVERRIDE;
125 }; 120 };
126 121
127 } // namespace extensions 122 } // namespace extensions
128 123
129 #endif // CHROME_BROWSER_EXTENSIONS_SETTINGS_SETTINGS_API_H_ 124 #endif // CHROME_BROWSER_EXTENSIONS_API_STORAGE_STORAGE_API_H_
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/storage/settings_test_util.cc ('k') | chrome/browser/extensions/api/storage/storage_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698