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

Side by Side Diff: chrome/browser/extensions/extension_browsing_data_api.h

Issue 9424036: Move `browsingData` extension API out of experimental. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebuilt docs. Created 8 years, 10 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
(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_EXTENSION_BROWSING_DATA_API_H_
10 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_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("experimental.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("experimental.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("experimental.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("experimental.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("experimental.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("experimental.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("experimental.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("experimental.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("experimental.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(
196 "experimental.browsingData.removeLocalStorage")
197 };
198
199 class RemoveOriginBoundCertsFunction : public BrowsingDataExtensionFunction {
200 public:
201 RemoveOriginBoundCertsFunction() {}
202 virtual ~RemoveOriginBoundCertsFunction() {}
203
204 protected:
205 // BrowsingDataTypeExtensionFunction interface method.
206 virtual int GetRemovalMask() const OVERRIDE;
207
208 DECLARE_EXTENSION_FUNCTION_NAME(
209 "experimental.browsingData.removeOriginBoundCertificates")
210 };
211
212 class RemovePluginDataFunction : public BrowsingDataExtensionFunction {
213 public:
214 RemovePluginDataFunction() {}
215 virtual ~RemovePluginDataFunction() {}
216
217 protected:
218 // BrowsingDataTypeExtensionFunction interface method.
219 virtual int GetRemovalMask() const OVERRIDE;
220
221 DECLARE_EXTENSION_FUNCTION_NAME("experimental.browsingData.removePluginData")
222 };
223
224 class RemovePasswordsFunction : public BrowsingDataExtensionFunction {
225 public:
226 RemovePasswordsFunction() {}
227 virtual ~RemovePasswordsFunction() {}
228
229 protected:
230 // BrowsingDataTypeExtensionFunction interface method.
231 virtual int GetRemovalMask() const OVERRIDE;
232
233 DECLARE_EXTENSION_FUNCTION_NAME("experimental.browsingData.removePasswords")
234 };
235
236 class RemoveWebSQLFunction : public BrowsingDataExtensionFunction {
237 public:
238 RemoveWebSQLFunction() {}
239 virtual ~RemoveWebSQLFunction() {}
240
241 protected:
242 // BrowsingDataTypeExtensionFunction interface method.
243 virtual int GetRemovalMask() const OVERRIDE;
244
245 DECLARE_EXTENSION_FUNCTION_NAME("experimental.browsingData.removeWebSQL")
246 };
247 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_BROWSING_DATA_API_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698