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

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

Issue 8008012: chrome.clear: Increasing granularity of public API (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebasing after 2 months (ugh). Extension test. Fiddling. Created 9 years 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 // Defines the Chrome Extensions Clear API functions, which entail 5 // Defines the Chrome Extensions Clear API functions, which entail
6 // clearing browsing data, and clearing the browser's cache (which, let's be 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. 7 // honest, are the same thing), as specified in the extension API JSON.
8 8
9 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_CLEAR_API_H_ 9 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_CLEAR_API_H_
10 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_CLEAR_API_H_ 10 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_CLEAR_API_H_
11 #pragma once 11 #pragma once
12 12
13 #include <string> 13 #include <string>
14 14
15 #include "chrome/browser/browsing_data_remover.h" 15 #include "chrome/browser/browsing_data_remover.h"
16 #include "chrome/browser/extensions/extension_function.h" 16 #include "chrome/browser/extensions/extension_function.h"
17 17
18 class PluginPrefs; 18 class PluginPrefs;
19 19
20 namespace extension_clear_api_constants {
21
22 // 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 kLSODataKey[];
32 extern const char kLocalStorageKey[];
33 extern const char kPasswordsKey[];
34 extern const char kWebSQLKey[];
35
36 // Timeframe "enum" values.
37 extern const char kHourEnum[];
38 extern const char kDayEnum[];
39 extern const char kWeekEnum[];
40 extern const char kMonthEnum[];
41 extern const char kEverythingEnum[];
42
43 // Errors!
44 extern const char kOneAtATimeError[];
45
46 } // namespace extension_clear_api_constants
47
20 // This serves as a base class from which the browsing data API functions will 48 // This serves as a base class from which the browsing data API functions will
21 // inherit. Each needs to be an observer of BrowsingDataRemover events, and each 49 // inherit. Each needs to be an observer of BrowsingDataRemover events, and each
22 // will handle those events in the same way (by calling the passed-in callback 50 // will handle those events in the same way (by calling the passed-in callback
23 // function). 51 // function).
24 // 52 //
25 // Each child class must implement GetRemovalMask(), which returns the bitmask 53 // Each child class must implement GetRemovalMask(), which returns the bitmask
26 // of data types to remove. 54 // of data types to remove.
27 class BrowsingDataExtensionFunction : public AsyncExtensionFunction, 55 class BrowsingDataExtensionFunction : public AsyncExtensionFunction,
28 public BrowsingDataRemover::Observer { 56 public BrowsingDataRemover::Observer {
29 public: 57 public:
(...skipping 13 matching lines...) Expand all
43 // supported or not. 71 // supported or not.
44 void CheckRemovingLSODataSupported(scoped_refptr<PluginPrefs> plugin_prefs); 72 void CheckRemovingLSODataSupported(scoped_refptr<PluginPrefs> plugin_prefs);
45 73
46 // Called when we're ready to start removing data. 74 // Called when we're ready to start removing data.
47 void StartRemoving(); 75 void StartRemoving();
48 76
49 BrowsingDataRemover::TimePeriod period_; 77 BrowsingDataRemover::TimePeriod period_;
50 int removal_mask_; 78 int removal_mask_;
51 }; 79 };
52 80
81 class ClearAppCacheFunction : public BrowsingDataExtensionFunction {
82 public:
83 ClearAppCacheFunction() {}
84 virtual ~ClearAppCacheFunction() {}
85
86 protected:
87 // BrowsingDataTypeExtensionFunction interface method.
88 virtual int GetRemovalMask() const OVERRIDE;
89
90 DECLARE_EXTENSION_FUNCTION_NAME("experimental.clear.appcache")
91 };
92
53 class ClearBrowsingDataFunction : public BrowsingDataExtensionFunction { 93 class ClearBrowsingDataFunction : public BrowsingDataExtensionFunction {
54 public: 94 public:
55 ClearBrowsingDataFunction() {} 95 ClearBrowsingDataFunction() {}
56 virtual ~ClearBrowsingDataFunction() {} 96 virtual ~ClearBrowsingDataFunction() {}
57 97
58 protected: 98 protected:
59 // BrowsingDataExtensionFunction interface method. 99 // BrowsingDataExtensionFunction interface method.
60 virtual int GetRemovalMask() const OVERRIDE; 100 virtual int GetRemovalMask() const OVERRIDE;
61 101
62 DECLARE_EXTENSION_FUNCTION_NAME("experimental.clear.browsingData") 102 DECLARE_EXTENSION_FUNCTION_NAME("experimental.clear.browsingData")
(...skipping 28 matching lines...) Expand all
91 ClearDownloadsFunction() {} 131 ClearDownloadsFunction() {}
92 virtual ~ClearDownloadsFunction() {} 132 virtual ~ClearDownloadsFunction() {}
93 133
94 protected: 134 protected:
95 // BrowsingDataTypeExtensionFunction interface method. 135 // BrowsingDataTypeExtensionFunction interface method.
96 virtual int GetRemovalMask() const OVERRIDE; 136 virtual int GetRemovalMask() const OVERRIDE;
97 137
98 DECLARE_EXTENSION_FUNCTION_NAME("experimental.clear.downloads") 138 DECLARE_EXTENSION_FUNCTION_NAME("experimental.clear.downloads")
99 }; 139 };
100 140
141 class ClearFileSystemsFunction : public BrowsingDataExtensionFunction {
142 public:
143 ClearFileSystemsFunction() {}
144 virtual ~ClearFileSystemsFunction() {}
145
146 protected:
147 // BrowsingDataTypeExtensionFunction interface method.
148 virtual int GetRemovalMask() const OVERRIDE;
149
150 DECLARE_EXTENSION_FUNCTION_NAME("experimental.clear.fileSystems")
151 };
152
101 class ClearFormDataFunction : public BrowsingDataExtensionFunction { 153 class ClearFormDataFunction : public BrowsingDataExtensionFunction {
102 public: 154 public:
103 ClearFormDataFunction() {} 155 ClearFormDataFunction() {}
104 virtual ~ClearFormDataFunction() {} 156 virtual ~ClearFormDataFunction() {}
105 157
106 protected: 158 protected:
107 // BrowsingDataTypeExtensionFunction interface method. 159 // BrowsingDataTypeExtensionFunction interface method.
108 virtual int GetRemovalMask() const OVERRIDE; 160 virtual int GetRemovalMask() const OVERRIDE;
109 161
110 DECLARE_EXTENSION_FUNCTION_NAME("experimental.clear.formData") 162 DECLARE_EXTENSION_FUNCTION_NAME("experimental.clear.formData")
111 }; 163 };
112 164
113 class ClearHistoryFunction : public BrowsingDataExtensionFunction { 165 class ClearHistoryFunction : public BrowsingDataExtensionFunction {
114 public: 166 public:
115 ClearHistoryFunction() {} 167 ClearHistoryFunction() {}
116 virtual ~ClearHistoryFunction() {} 168 virtual ~ClearHistoryFunction() {}
117 169
118 protected: 170 protected:
119 // BrowsingDataTypeExtensionFunction interface method. 171 // BrowsingDataTypeExtensionFunction interface method.
120 virtual int GetRemovalMask() const OVERRIDE; 172 virtual int GetRemovalMask() const OVERRIDE;
121 173
122 DECLARE_EXTENSION_FUNCTION_NAME("experimental.clear.history") 174 DECLARE_EXTENSION_FUNCTION_NAME("experimental.clear.history")
123 }; 175 };
124 176
177 class ClearIndexedDBFunction : public BrowsingDataExtensionFunction {
178 public:
179 ClearIndexedDBFunction() {}
180 virtual ~ClearIndexedDBFunction() {}
181
182 protected:
183 // BrowsingDataTypeExtensionFunction interface method.
184 virtual int GetRemovalMask() const OVERRIDE;
185
186 DECLARE_EXTENSION_FUNCTION_NAME("experimental.clear.indexedDB")
187 };
188
189 class ClearLocalStorageFunction : public BrowsingDataExtensionFunction {
190 public:
191 ClearLocalStorageFunction() {}
192 virtual ~ClearLocalStorageFunction() {}
193
194 protected:
195 // BrowsingDataTypeExtensionFunction interface method.
196 virtual int GetRemovalMask() const OVERRIDE;
197
198 DECLARE_EXTENSION_FUNCTION_NAME("experimental.clear.localStorage")
199 };
200
201 class ClearLSODataFunction : public BrowsingDataExtensionFunction {
202 public:
203 ClearLSODataFunction() {}
204 virtual ~ClearLSODataFunction() {}
205
206 protected:
207 // BrowsingDataTypeExtensionFunction interface method.
208 virtual int GetRemovalMask() const OVERRIDE;
209
210 DECLARE_EXTENSION_FUNCTION_NAME("experimental.clear.lsoData")
211 };
212
125 class ClearPasswordsFunction : public BrowsingDataExtensionFunction { 213 class ClearPasswordsFunction : public BrowsingDataExtensionFunction {
126 public: 214 public:
127 ClearPasswordsFunction() {} 215 ClearPasswordsFunction() {}
128 virtual ~ClearPasswordsFunction() {} 216 virtual ~ClearPasswordsFunction() {}
129 217
130 protected: 218 protected:
131 // BrowsingDataTypeExtensionFunction interface method. 219 // BrowsingDataTypeExtensionFunction interface method.
132 virtual int GetRemovalMask() const OVERRIDE; 220 virtual int GetRemovalMask() const OVERRIDE;
133 221
134 DECLARE_EXTENSION_FUNCTION_NAME("experimental.clear.passwords") 222 DECLARE_EXTENSION_FUNCTION_NAME("experimental.clear.passwords")
135 }; 223 };
136 224
225 class ClearWebSQLFunction : public BrowsingDataExtensionFunction {
226 public:
227 ClearWebSQLFunction() {}
228 virtual ~ClearWebSQLFunction() {}
229
230 protected:
231 // BrowsingDataTypeExtensionFunction interface method.
232 virtual int GetRemovalMask() const OVERRIDE;
233
234 DECLARE_EXTENSION_FUNCTION_NAME("experimental.clear.webSQL")
235 };
137 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_CLEAR_API_H_ 236 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_CLEAR_API_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698