| 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 // Defines the Chrome Extensions BrowsingData API functions, which entail | 5 // Defines the Chrome Extensions BrowsingData 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_API_BROWSING_DATA_BROWSING_DATA_API_H_ | 9 #ifndef CHROME_BROWSER_EXTENSIONS_API_BROWSING_DATA_BROWSING_DATA_API_H_ |
| 10 #define CHROME_BROWSER_EXTENSIONS_API_BROWSING_DATA_BROWSING_DATA_API_H_ | 10 #define CHROME_BROWSER_EXTENSIONS_API_BROWSING_DATA_BROWSING_DATA_API_H_ |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 extern const char kFileSystemsKey[]; | 27 extern const char kFileSystemsKey[]; |
| 28 extern const char kFormDataKey[]; | 28 extern const char kFormDataKey[]; |
| 29 extern const char kHistoryKey[]; | 29 extern const char kHistoryKey[]; |
| 30 extern const char kIndexedDBKey[]; | 30 extern const char kIndexedDBKey[]; |
| 31 extern const char kPluginDataKey[]; | 31 extern const char kPluginDataKey[]; |
| 32 extern const char kLocalStorageKey[]; | 32 extern const char kLocalStorageKey[]; |
| 33 extern const char kPasswordsKey[]; | 33 extern const char kPasswordsKey[]; |
| 34 extern const char kWebSQLKey[]; | 34 extern const char kWebSQLKey[]; |
| 35 | 35 |
| 36 // Option keys. | 36 // Option keys. |
| 37 extern const char kExtensionsKey[]; |
| 38 extern const char kOriginTypesKey[]; |
| 39 extern const char kProtectedWebKey[]; |
| 37 extern const char kSinceKey[]; | 40 extern const char kSinceKey[]; |
| 41 extern const char kUnprotectedWebKey[]; |
| 38 | 42 |
| 39 // Errors! | 43 // Errors! |
| 40 extern const char kOneAtATimeError[]; | 44 extern const char kOneAtATimeError[]; |
| 41 | 45 |
| 42 } // namespace extension_browsing_data_api_constants | 46 } // namespace extension_browsing_data_api_constants |
| 43 | 47 |
| 44 // 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 |
| 45 // 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 |
| 46 // 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 |
| 47 // function). | 51 // function). |
| (...skipping 15 matching lines...) Expand all Loading... |
| 63 // Children should override this method to provide the proper removal mask | 67 // Children should override this method to provide the proper removal mask |
| 64 // based on the API call they represent. | 68 // based on the API call they represent. |
| 65 virtual int GetRemovalMask() const = 0; | 69 virtual int GetRemovalMask() const = 0; |
| 66 | 70 |
| 67 private: | 71 private: |
| 68 // Updates the removal bitmask according to whether removing plugin data is | 72 // Updates the removal bitmask according to whether removing plugin data is |
| 69 // supported or not. | 73 // supported or not. |
| 70 void CheckRemovingPluginDataSupported( | 74 void CheckRemovingPluginDataSupported( |
| 71 scoped_refptr<PluginPrefs> plugin_prefs); | 75 scoped_refptr<PluginPrefs> plugin_prefs); |
| 72 | 76 |
| 77 // Parse the developer-provided |origin_types| object into an origin_set_mask |
| 78 // that can be used with the BrowsingDataRemover. |
| 79 int ParseOriginSetMask(const base::DictionaryValue& options); |
| 80 |
| 73 // Called when we're ready to start removing data. | 81 // Called when we're ready to start removing data. |
| 74 void StartRemoving(); | 82 void StartRemoving(); |
| 75 | 83 |
| 76 base::Time remove_since_; | 84 base::Time remove_since_; |
| 77 int removal_mask_; | 85 int removal_mask_; |
| 86 int origin_set_mask_; |
| 78 }; | 87 }; |
| 79 | 88 |
| 80 class RemoveAppCacheFunction : public BrowsingDataExtensionFunction { | 89 class RemoveAppCacheFunction : public BrowsingDataExtensionFunction { |
| 81 public: | 90 public: |
| 82 DECLARE_EXTENSION_FUNCTION_NAME("browsingData.removeAppcache") | 91 DECLARE_EXTENSION_FUNCTION_NAME("browsingData.removeAppcache") |
| 83 | 92 |
| 84 protected: | 93 protected: |
| 85 virtual ~RemoveAppCacheFunction() {} | 94 virtual ~RemoveAppCacheFunction() {} |
| 86 | 95 |
| 87 // BrowsingDataTypeExtensionFunction: | 96 // BrowsingDataTypeExtensionFunction: |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 DECLARE_EXTENSION_FUNCTION_NAME("browsingData.removeWebSQL") | 234 DECLARE_EXTENSION_FUNCTION_NAME("browsingData.removeWebSQL") |
| 226 | 235 |
| 227 protected: | 236 protected: |
| 228 virtual ~RemoveWebSQLFunction() {} | 237 virtual ~RemoveWebSQLFunction() {} |
| 229 | 238 |
| 230 // BrowsingDataExtensionFunction: | 239 // BrowsingDataExtensionFunction: |
| 231 virtual int GetRemovalMask() const OVERRIDE; | 240 virtual int GetRemovalMask() const OVERRIDE; |
| 232 }; | 241 }; |
| 233 | 242 |
| 234 #endif // CHROME_BROWSER_EXTENSIONS_API_BROWSING_DATA_BROWSING_DATA_API_H_ | 243 #endif // CHROME_BROWSER_EXTENSIONS_API_BROWSING_DATA_BROWSING_DATA_API_H_ |
| OLD | NEW |