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

Side by Side Diff: chrome/browser/extensions/api/browsingdata/browsing_data_api.h

Issue 9701039: Refactor folders in chrome/browser/extensions/api (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Small change to includes in extension_event_router.cc Created 8 years, 9 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 // Defines the Chrome Extensions BrowsingData API functions, which entail
6 // clearing browsing data, and clearing the browser's cache (which, let's be
7 // honest, are the same thing), as specified in the extension API JSON.
8
9 #ifndef CHROME_BROWSER_EXTENSIONS_API_BROWSINGDATA_BROWSING_DATA_API_H_
10 #define CHROME_BROWSER_EXTENSIONS_API_BROWSINGDATA_BROWSING_DATA_API_H_
11 #pragma once
12
13 #include <string>
14
15 #include "chrome/browser/browsing_data_remover.h"
16 #include "chrome/browser/extensions/extension_function.h"
17
18 class PluginPrefs;
19
20 namespace extension_browsing_data_api_constants {
21
22 // Type keys.
23 extern const char kAppCacheKey[];
24 extern const char kCacheKey[];
25 extern const char kCookiesKey[];
26 extern const char kDownloadsKey[];
27 extern const char kFileSystemsKey[];
28 extern const char kFormDataKey[];
29 extern const char kHistoryKey[];
30 extern const char kIndexedDBKey[];
31 extern const char kPluginDataKey[];
32 extern const char kLocalStorageKey[];
33 extern const char kPasswordsKey[];
34 extern const char kWebSQLKey[];
35
36 // Option keys.
37 extern const char kSinceKey[];
38
39 // Errors!
40 extern const char kOneAtATimeError[];
41
42 } // namespace extension_browsing_data_api_constants
43
44 // This serves as a base class from which the browsing data API functions will
45 // inherit. Each needs to be an observer of BrowsingDataRemover events, and each
46 // will handle those events in the same way (by calling the passed-in callback
47 // function).
48 //
49 // Each child class must implement GetRemovalMask(), which returns the bitmask
50 // of data types to remove.
51 class BrowsingDataExtensionFunction : public AsyncExtensionFunction,
52 public BrowsingDataRemover::Observer {
53 public:
54 // BrowsingDataRemover::Observer interface method.
55 virtual void OnBrowsingDataRemoverDone() OVERRIDE;
56
57 // AsyncExtensionFunction interface method.
58 virtual bool RunImpl() OVERRIDE;
59
60 protected:
61 // Children should override this method to provide the proper removal mask
62 // based on the API call they represent.
63 virtual int GetRemovalMask() const = 0;
64
65 private:
66 // Updates the removal bitmask according to whether removing plugin data is
67 // supported or not.
68 void CheckRemovingPluginDataSupported(
69 scoped_refptr<PluginPrefs> plugin_prefs);
70
71 // Called when we're ready to start removing data.
72 void StartRemoving();
73
74 base::Time remove_since_;
75 int removal_mask_;
76 };
77
78 class RemoveAppCacheFunction : public BrowsingDataExtensionFunction {
79 public:
80 RemoveAppCacheFunction() {}
81 virtual ~RemoveAppCacheFunction() {}
82
83 protected:
84 // BrowsingDataTypeExtensionFunction interface method.
85 virtual int GetRemovalMask() const OVERRIDE;
86
87 DECLARE_EXTENSION_FUNCTION_NAME("browsingData.removeAppcache")
88 };
89
90 class RemoveBrowsingDataFunction : public BrowsingDataExtensionFunction {
91 public:
92 RemoveBrowsingDataFunction() {}
93 virtual ~RemoveBrowsingDataFunction() {}
94
95 protected:
96 // BrowsingDataExtensionFunction interface method.
97 virtual int GetRemovalMask() const OVERRIDE;
98
99 DECLARE_EXTENSION_FUNCTION_NAME("browsingData.remove")
100 };
101
102 class RemoveCacheFunction : public BrowsingDataExtensionFunction {
103 public:
104 RemoveCacheFunction() {}
105 virtual ~RemoveCacheFunction() {}
106
107 protected:
108 // BrowsingDataTypeExtensionFunction interface method.
109 virtual int GetRemovalMask() const OVERRIDE;
110
111 DECLARE_EXTENSION_FUNCTION_NAME("browsingData.removeCache")
112 };
113
114 class RemoveCookiesFunction : public BrowsingDataExtensionFunction {
115 public:
116 RemoveCookiesFunction() {}
117 virtual ~RemoveCookiesFunction() {}
118
119 protected:
120 // BrowsingDataTypeExtensionFunction interface method.
121 virtual int GetRemovalMask() const OVERRIDE;
122
123 DECLARE_EXTENSION_FUNCTION_NAME("browsingData.removeCookies")
124 };
125
126 class RemoveDownloadsFunction : public BrowsingDataExtensionFunction {
127 public:
128 RemoveDownloadsFunction() {}
129 virtual ~RemoveDownloadsFunction() {}
130
131 protected:
132 // BrowsingDataTypeExtensionFunction interface method.
133 virtual int GetRemovalMask() const OVERRIDE;
134
135 DECLARE_EXTENSION_FUNCTION_NAME("browsingData.removeDownloads")
136 };
137
138 class RemoveFileSystemsFunction : public BrowsingDataExtensionFunction {
139 public:
140 RemoveFileSystemsFunction() {}
141 virtual ~RemoveFileSystemsFunction() {}
142
143 protected:
144 // BrowsingDataTypeExtensionFunction interface method.
145 virtual int GetRemovalMask() const OVERRIDE;
146
147 DECLARE_EXTENSION_FUNCTION_NAME("browsingData.removeFileSystems")
148 };
149
150 class RemoveFormDataFunction : public BrowsingDataExtensionFunction {
151 public:
152 RemoveFormDataFunction() {}
153 virtual ~RemoveFormDataFunction() {}
154
155 protected:
156 // BrowsingDataTypeExtensionFunction interface method.
157 virtual int GetRemovalMask() const OVERRIDE;
158
159 DECLARE_EXTENSION_FUNCTION_NAME("browsingData.removeFormData")
160 };
161
162 class RemoveHistoryFunction : public BrowsingDataExtensionFunction {
163 public:
164 RemoveHistoryFunction() {}
165 virtual ~RemoveHistoryFunction() {}
166
167 protected:
168 // BrowsingDataTypeExtensionFunction interface method.
169 virtual int GetRemovalMask() const OVERRIDE;
170
171 DECLARE_EXTENSION_FUNCTION_NAME("browsingData.removeHistory")
172 };
173
174 class RemoveIndexedDBFunction : public BrowsingDataExtensionFunction {
175 public:
176 RemoveIndexedDBFunction() {}
177 virtual ~RemoveIndexedDBFunction() {}
178
179 protected:
180 // BrowsingDataTypeExtensionFunction interface method.
181 virtual int GetRemovalMask() const OVERRIDE;
182
183 DECLARE_EXTENSION_FUNCTION_NAME("browsingData.removeIndexedDB")
184 };
185
186 class RemoveLocalStorageFunction : public BrowsingDataExtensionFunction {
187 public:
188 RemoveLocalStorageFunction() {}
189 virtual ~RemoveLocalStorageFunction() {}
190
191 protected:
192 // BrowsingDataTypeExtensionFunction interface method.
193 virtual int GetRemovalMask() const OVERRIDE;
194
195 DECLARE_EXTENSION_FUNCTION_NAME("browsingData.removeLocalStorage")
196 };
197
198 class RemoveOriginBoundCertsFunction : public BrowsingDataExtensionFunction {
199 public:
200 RemoveOriginBoundCertsFunction() {}
201 virtual ~RemoveOriginBoundCertsFunction() {}
202
203 protected:
204 // BrowsingDataTypeExtensionFunction interface method.
205 virtual int GetRemovalMask() const OVERRIDE;
206
207 DECLARE_EXTENSION_FUNCTION_NAME("browsingData.removeOriginBoundCertificates")
208 };
209
210 class RemovePluginDataFunction : public BrowsingDataExtensionFunction {
211 public:
212 RemovePluginDataFunction() {}
213 virtual ~RemovePluginDataFunction() {}
214
215 protected:
216 // BrowsingDataTypeExtensionFunction interface method.
217 virtual int GetRemovalMask() const OVERRIDE;
218
219 DECLARE_EXTENSION_FUNCTION_NAME("browsingData.removePluginData")
220 };
221
222 class RemovePasswordsFunction : public BrowsingDataExtensionFunction {
223 public:
224 RemovePasswordsFunction() {}
225 virtual ~RemovePasswordsFunction() {}
226
227 protected:
228 // BrowsingDataTypeExtensionFunction interface method.
229 virtual int GetRemovalMask() const OVERRIDE;
230
231 DECLARE_EXTENSION_FUNCTION_NAME("browsingData.removePasswords")
232 };
233
234 class RemoveWebSQLFunction : public BrowsingDataExtensionFunction {
235 public:
236 RemoveWebSQLFunction() {}
237 virtual ~RemoveWebSQLFunction() {}
238
239 protected:
240 // BrowsingDataTypeExtensionFunction interface method.
241 virtual int GetRemovalMask() const OVERRIDE;
242
243 DECLARE_EXTENSION_FUNCTION_NAME("browsingData.removeWebSQL")
244 };
245 #endif // CHROME_BROWSER_EXTENSIONS_API_BROWSINGDATA_BROWSING_DATA_API_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698