| 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 // function). | 47 // function). |
| 48 // | 48 // |
| 49 // Each child class must implement GetRemovalMask(), which returns the bitmask | 49 // Each child class must implement GetRemovalMask(), which returns the bitmask |
| 50 // of data types to remove. | 50 // of data types to remove. |
| 51 class BrowsingDataExtensionFunction : public AsyncExtensionFunction, | 51 class BrowsingDataExtensionFunction : public AsyncExtensionFunction, |
| 52 public BrowsingDataRemover::Observer { | 52 public BrowsingDataRemover::Observer { |
| 53 public: | 53 public: |
| 54 // BrowsingDataRemover::Observer interface method. | 54 // BrowsingDataRemover::Observer interface method. |
| 55 virtual void OnBrowsingDataRemoverDone() OVERRIDE; | 55 virtual void OnBrowsingDataRemoverDone() OVERRIDE; |
| 56 | 56 |
| 57 // AsyncExtensionFunction interface method. | 57 // ExtensionFunction: |
| 58 virtual bool RunImpl() OVERRIDE; | 58 virtual bool RunImpl() OVERRIDE; |
| 59 | 59 |
| 60 protected: | 60 protected: |
| 61 virtual ~BrowsingDataExtensionFunction() {} |
| 62 |
| 61 // Children should override this method to provide the proper removal mask | 63 // Children should override this method to provide the proper removal mask |
| 62 // based on the API call they represent. | 64 // based on the API call they represent. |
| 63 virtual int GetRemovalMask() const = 0; | 65 virtual int GetRemovalMask() const = 0; |
| 64 | 66 |
| 65 private: | 67 private: |
| 66 // Updates the removal bitmask according to whether removing plugin data is | 68 // Updates the removal bitmask according to whether removing plugin data is |
| 67 // supported or not. | 69 // supported or not. |
| 68 void CheckRemovingPluginDataSupported( | 70 void CheckRemovingPluginDataSupported( |
| 69 scoped_refptr<PluginPrefs> plugin_prefs); | 71 scoped_refptr<PluginPrefs> plugin_prefs); |
| 70 | 72 |
| 71 // Called when we're ready to start removing data. | 73 // Called when we're ready to start removing data. |
| 72 void StartRemoving(); | 74 void StartRemoving(); |
| 73 | 75 |
| 74 base::Time remove_since_; | 76 base::Time remove_since_; |
| 75 int removal_mask_; | 77 int removal_mask_; |
| 76 }; | 78 }; |
| 77 | 79 |
| 78 class RemoveAppCacheFunction : public BrowsingDataExtensionFunction { | 80 class RemoveAppCacheFunction : public BrowsingDataExtensionFunction { |
| 79 public: | 81 public: |
| 80 RemoveAppCacheFunction() {} | 82 DECLARE_EXTENSION_FUNCTION_NAME("browsingData.removeAppcache") |
| 83 |
| 84 protected: |
| 81 virtual ~RemoveAppCacheFunction() {} | 85 virtual ~RemoveAppCacheFunction() {} |
| 82 | 86 |
| 83 protected: | 87 // BrowsingDataTypeExtensionFunction: |
| 84 // BrowsingDataTypeExtensionFunction interface method. | |
| 85 virtual int GetRemovalMask() const OVERRIDE; | 88 virtual int GetRemovalMask() const OVERRIDE; |
| 86 | |
| 87 DECLARE_EXTENSION_FUNCTION_NAME("browsingData.removeAppcache") | |
| 88 }; | 89 }; |
| 89 | 90 |
| 90 class RemoveBrowsingDataFunction : public BrowsingDataExtensionFunction { | 91 class RemoveBrowsingDataFunction : public BrowsingDataExtensionFunction { |
| 91 public: | 92 public: |
| 92 RemoveBrowsingDataFunction() {} | 93 DECLARE_EXTENSION_FUNCTION_NAME("browsingData.remove") |
| 94 |
| 95 protected: |
| 93 virtual ~RemoveBrowsingDataFunction() {} | 96 virtual ~RemoveBrowsingDataFunction() {} |
| 94 | 97 |
| 95 protected: | 98 // BrowsingDataExtensionFunction: |
| 96 // BrowsingDataExtensionFunction interface method. | |
| 97 virtual int GetRemovalMask() const OVERRIDE; | 99 virtual int GetRemovalMask() const OVERRIDE; |
| 98 | |
| 99 DECLARE_EXTENSION_FUNCTION_NAME("browsingData.remove") | |
| 100 }; | 100 }; |
| 101 | 101 |
| 102 class RemoveCacheFunction : public BrowsingDataExtensionFunction { | 102 class RemoveCacheFunction : public BrowsingDataExtensionFunction { |
| 103 public: | 103 public: |
| 104 RemoveCacheFunction() {} | 104 DECLARE_EXTENSION_FUNCTION_NAME("browsingData.removeCache") |
| 105 |
| 106 protected: |
| 105 virtual ~RemoveCacheFunction() {} | 107 virtual ~RemoveCacheFunction() {} |
| 106 | 108 |
| 107 protected: | 109 // BrowsingDataExtensionFunction: |
| 108 // BrowsingDataTypeExtensionFunction interface method. | |
| 109 virtual int GetRemovalMask() const OVERRIDE; | 110 virtual int GetRemovalMask() const OVERRIDE; |
| 110 | |
| 111 DECLARE_EXTENSION_FUNCTION_NAME("browsingData.removeCache") | |
| 112 }; | 111 }; |
| 113 | 112 |
| 114 class RemoveCookiesFunction : public BrowsingDataExtensionFunction { | 113 class RemoveCookiesFunction : public BrowsingDataExtensionFunction { |
| 115 public: | 114 public: |
| 116 RemoveCookiesFunction() {} | 115 DECLARE_EXTENSION_FUNCTION_NAME("browsingData.removeCookies") |
| 116 |
| 117 protected: |
| 117 virtual ~RemoveCookiesFunction() {} | 118 virtual ~RemoveCookiesFunction() {} |
| 118 | 119 |
| 119 protected: | 120 // BrowsingDataExtensionFunction: |
| 120 // BrowsingDataTypeExtensionFunction interface method. | |
| 121 virtual int GetRemovalMask() const OVERRIDE; | 121 virtual int GetRemovalMask() const OVERRIDE; |
| 122 | |
| 123 DECLARE_EXTENSION_FUNCTION_NAME("browsingData.removeCookies") | |
| 124 }; | 122 }; |
| 125 | 123 |
| 126 class RemoveDownloadsFunction : public BrowsingDataExtensionFunction { | 124 class RemoveDownloadsFunction : public BrowsingDataExtensionFunction { |
| 127 public: | 125 public: |
| 128 RemoveDownloadsFunction() {} | 126 DECLARE_EXTENSION_FUNCTION_NAME("browsingData.removeDownloads") |
| 127 |
| 128 protected: |
| 129 virtual ~RemoveDownloadsFunction() {} | 129 virtual ~RemoveDownloadsFunction() {} |
| 130 | 130 |
| 131 protected: | 131 // BrowsingDataExtensionFunction: |
| 132 // BrowsingDataTypeExtensionFunction interface method. | |
| 133 virtual int GetRemovalMask() const OVERRIDE; | 132 virtual int GetRemovalMask() const OVERRIDE; |
| 134 | |
| 135 DECLARE_EXTENSION_FUNCTION_NAME("browsingData.removeDownloads") | |
| 136 }; | 133 }; |
| 137 | 134 |
| 138 class RemoveFileSystemsFunction : public BrowsingDataExtensionFunction { | 135 class RemoveFileSystemsFunction : public BrowsingDataExtensionFunction { |
| 139 public: | 136 public: |
| 140 RemoveFileSystemsFunction() {} | 137 DECLARE_EXTENSION_FUNCTION_NAME("browsingData.removeFileSystems") |
| 138 |
| 139 protected: |
| 141 virtual ~RemoveFileSystemsFunction() {} | 140 virtual ~RemoveFileSystemsFunction() {} |
| 142 | 141 |
| 143 protected: | 142 // BrowsingDataExtensionFunction: |
| 144 // BrowsingDataTypeExtensionFunction interface method. | |
| 145 virtual int GetRemovalMask() const OVERRIDE; | 143 virtual int GetRemovalMask() const OVERRIDE; |
| 146 | |
| 147 DECLARE_EXTENSION_FUNCTION_NAME("browsingData.removeFileSystems") | |
| 148 }; | 144 }; |
| 149 | 145 |
| 150 class RemoveFormDataFunction : public BrowsingDataExtensionFunction { | 146 class RemoveFormDataFunction : public BrowsingDataExtensionFunction { |
| 151 public: | 147 public: |
| 152 RemoveFormDataFunction() {} | 148 DECLARE_EXTENSION_FUNCTION_NAME("browsingData.removeFormData") |
| 149 |
| 150 protected: |
| 153 virtual ~RemoveFormDataFunction() {} | 151 virtual ~RemoveFormDataFunction() {} |
| 154 | 152 |
| 155 protected: | 153 // BrowsingDataExtensionFunction: |
| 156 // BrowsingDataTypeExtensionFunction interface method. | |
| 157 virtual int GetRemovalMask() const OVERRIDE; | 154 virtual int GetRemovalMask() const OVERRIDE; |
| 158 | |
| 159 DECLARE_EXTENSION_FUNCTION_NAME("browsingData.removeFormData") | |
| 160 }; | 155 }; |
| 161 | 156 |
| 162 class RemoveHistoryFunction : public BrowsingDataExtensionFunction { | 157 class RemoveHistoryFunction : public BrowsingDataExtensionFunction { |
| 163 public: | 158 public: |
| 164 RemoveHistoryFunction() {} | 159 DECLARE_EXTENSION_FUNCTION_NAME("browsingData.removeHistory") |
| 160 |
| 161 protected: |
| 165 virtual ~RemoveHistoryFunction() {} | 162 virtual ~RemoveHistoryFunction() {} |
| 166 | 163 |
| 167 protected: | 164 // BrowsingDataExtensionFunction: |
| 168 // BrowsingDataTypeExtensionFunction interface method. | |
| 169 virtual int GetRemovalMask() const OVERRIDE; | 165 virtual int GetRemovalMask() const OVERRIDE; |
| 170 | |
| 171 DECLARE_EXTENSION_FUNCTION_NAME("browsingData.removeHistory") | |
| 172 }; | 166 }; |
| 173 | 167 |
| 174 class RemoveIndexedDBFunction : public BrowsingDataExtensionFunction { | 168 class RemoveIndexedDBFunction : public BrowsingDataExtensionFunction { |
| 175 public: | 169 public: |
| 176 RemoveIndexedDBFunction() {} | 170 DECLARE_EXTENSION_FUNCTION_NAME("browsingData.removeIndexedDB") |
| 171 |
| 172 protected: |
| 177 virtual ~RemoveIndexedDBFunction() {} | 173 virtual ~RemoveIndexedDBFunction() {} |
| 178 | 174 |
| 179 protected: | 175 // BrowsingDataExtensionFunction: |
| 180 // BrowsingDataTypeExtensionFunction interface method. | |
| 181 virtual int GetRemovalMask() const OVERRIDE; | 176 virtual int GetRemovalMask() const OVERRIDE; |
| 182 | |
| 183 DECLARE_EXTENSION_FUNCTION_NAME("browsingData.removeIndexedDB") | |
| 184 }; | 177 }; |
| 185 | 178 |
| 186 class RemoveLocalStorageFunction : public BrowsingDataExtensionFunction { | 179 class RemoveLocalStorageFunction : public BrowsingDataExtensionFunction { |
| 187 public: | 180 public: |
| 188 RemoveLocalStorageFunction() {} | 181 DECLARE_EXTENSION_FUNCTION_NAME("browsingData.removeLocalStorage") |
| 182 |
| 183 protected: |
| 189 virtual ~RemoveLocalStorageFunction() {} | 184 virtual ~RemoveLocalStorageFunction() {} |
| 190 | 185 |
| 191 protected: | 186 // BrowsingDataExtensionFunction: |
| 192 // BrowsingDataTypeExtensionFunction interface method. | |
| 193 virtual int GetRemovalMask() const OVERRIDE; | 187 virtual int GetRemovalMask() const OVERRIDE; |
| 194 | |
| 195 DECLARE_EXTENSION_FUNCTION_NAME("browsingData.removeLocalStorage") | |
| 196 }; | 188 }; |
| 197 | 189 |
| 198 class RemoveServerBoundCertsFunction : public BrowsingDataExtensionFunction { | 190 class RemoveServerBoundCertsFunction : public BrowsingDataExtensionFunction { |
| 199 public: | 191 public: |
| 200 RemoveServerBoundCertsFunction() {} | 192 DECLARE_EXTENSION_FUNCTION_NAME("browsingData.removeServerBoundCertificates") |
| 193 |
| 194 protected: |
| 201 virtual ~RemoveServerBoundCertsFunction() {} | 195 virtual ~RemoveServerBoundCertsFunction() {} |
| 202 | 196 |
| 203 protected: | 197 // BrowsingDataExtensionFunction: |
| 204 // BrowsingDataTypeExtensionFunction interface method. | |
| 205 virtual int GetRemovalMask() const OVERRIDE; | 198 virtual int GetRemovalMask() const OVERRIDE; |
| 206 | |
| 207 DECLARE_EXTENSION_FUNCTION_NAME("browsingData.removeServerBoundCertificates") | |
| 208 }; | 199 }; |
| 209 | 200 |
| 210 class RemovePluginDataFunction : public BrowsingDataExtensionFunction { | 201 class RemovePluginDataFunction : public BrowsingDataExtensionFunction { |
| 211 public: | 202 public: |
| 212 RemovePluginDataFunction() {} | 203 DECLARE_EXTENSION_FUNCTION_NAME("browsingData.removePluginData") |
| 204 |
| 205 protected: |
| 213 virtual ~RemovePluginDataFunction() {} | 206 virtual ~RemovePluginDataFunction() {} |
| 214 | 207 |
| 215 protected: | 208 // BrowsingDataExtensionFunction: |
| 216 // BrowsingDataTypeExtensionFunction interface method. | |
| 217 virtual int GetRemovalMask() const OVERRIDE; | 209 virtual int GetRemovalMask() const OVERRIDE; |
| 218 | |
| 219 DECLARE_EXTENSION_FUNCTION_NAME("browsingData.removePluginData") | |
| 220 }; | 210 }; |
| 221 | 211 |
| 222 class RemovePasswordsFunction : public BrowsingDataExtensionFunction { | 212 class RemovePasswordsFunction : public BrowsingDataExtensionFunction { |
| 223 public: | 213 public: |
| 224 RemovePasswordsFunction() {} | 214 DECLARE_EXTENSION_FUNCTION_NAME("browsingData.removePasswords") |
| 215 |
| 216 protected: |
| 225 virtual ~RemovePasswordsFunction() {} | 217 virtual ~RemovePasswordsFunction() {} |
| 226 | 218 |
| 227 protected: | 219 // BrowsingDataExtensionFunction: |
| 228 // BrowsingDataTypeExtensionFunction interface method. | |
| 229 virtual int GetRemovalMask() const OVERRIDE; | 220 virtual int GetRemovalMask() const OVERRIDE; |
| 230 | |
| 231 DECLARE_EXTENSION_FUNCTION_NAME("browsingData.removePasswords") | |
| 232 }; | 221 }; |
| 233 | 222 |
| 234 class RemoveWebSQLFunction : public BrowsingDataExtensionFunction { | 223 class RemoveWebSQLFunction : public BrowsingDataExtensionFunction { |
| 235 public: | 224 public: |
| 236 RemoveWebSQLFunction() {} | 225 DECLARE_EXTENSION_FUNCTION_NAME("browsingData.removeWebSQL") |
| 226 |
| 227 protected: |
| 237 virtual ~RemoveWebSQLFunction() {} | 228 virtual ~RemoveWebSQLFunction() {} |
| 238 | 229 |
| 239 protected: | 230 // BrowsingDataExtensionFunction: |
| 240 // BrowsingDataTypeExtensionFunction interface method. | |
| 241 virtual int GetRemovalMask() const OVERRIDE; | 231 virtual int GetRemovalMask() const OVERRIDE; |
| 232 }; |
| 242 | 233 |
| 243 DECLARE_EXTENSION_FUNCTION_NAME("browsingData.removeWebSQL") | |
| 244 }; | |
| 245 #endif // CHROME_BROWSER_EXTENSIONS_API_BROWSING_DATA_BROWSING_DATA_API_H_ | 234 #endif // CHROME_BROWSER_EXTENSIONS_API_BROWSING_DATA_BROWSING_DATA_API_H_ |
| OLD | NEW |