| 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 extern const char kDeleteProhibitedError[]; | 50 extern const char kDeleteProhibitedError[]; |
| 51 extern const char kOneAtATimeError[]; | 51 extern const char kOneAtATimeError[]; |
| 52 | 52 |
| 53 } // namespace extension_browsing_data_api_constants | 53 } // namespace extension_browsing_data_api_constants |
| 54 | 54 |
| 55 class BrowsingDataSettingsFunction : public ChromeSyncExtensionFunction { | 55 class BrowsingDataSettingsFunction : public ChromeSyncExtensionFunction { |
| 56 public: | 56 public: |
| 57 DECLARE_EXTENSION_FUNCTION("browsingData.settings", BROWSINGDATA_SETTINGS) | 57 DECLARE_EXTENSION_FUNCTION("browsingData.settings", BROWSINGDATA_SETTINGS) |
| 58 | 58 |
| 59 // ExtensionFunction: | 59 // ExtensionFunction: |
| 60 virtual bool RunSync() OVERRIDE; | 60 virtual bool RunSync() override; |
| 61 | 61 |
| 62 protected: | 62 protected: |
| 63 virtual ~BrowsingDataSettingsFunction() {} | 63 virtual ~BrowsingDataSettingsFunction() {} |
| 64 | 64 |
| 65 private: | 65 private: |
| 66 // Sets a boolean value in the |selected_dict| with the |data_type| as a key, | 66 // Sets a boolean value in the |selected_dict| with the |data_type| as a key, |
| 67 // indicating whether the data type is both selected and permitted to be | 67 // indicating whether the data type is both selected and permitted to be |
| 68 // removed; and a value in the |permitted_dict| with the |data_type| as a | 68 // removed; and a value in the |permitted_dict| with the |data_type| as a |
| 69 // key, indicating only whether the data type is permitted to be removed. | 69 // key, indicating only whether the data type is permitted to be removed. |
| 70 void SetDetails(base::DictionaryValue* selected_dict, | 70 void SetDetails(base::DictionaryValue* selected_dict, |
| 71 base::DictionaryValue* permitted_dict, | 71 base::DictionaryValue* permitted_dict, |
| 72 const char* data_type, | 72 const char* data_type, |
| 73 bool is_selected); | 73 bool is_selected); |
| 74 }; | 74 }; |
| 75 | 75 |
| 76 // This serves as a base class from which the browsing data API removal | 76 // This serves as a base class from which the browsing data API removal |
| 77 // functions will inherit. Each needs to be an observer of BrowsingDataRemover | 77 // functions will inherit. Each needs to be an observer of BrowsingDataRemover |
| 78 // events, and each will handle those events in the same way (by calling the | 78 // events, and each will handle those events in the same way (by calling the |
| 79 // passed-in callback function). | 79 // passed-in callback function). |
| 80 // | 80 // |
| 81 // Each child class must implement GetRemovalMask(), which returns the bitmask | 81 // Each child class must implement GetRemovalMask(), which returns the bitmask |
| 82 // of data types to remove. | 82 // of data types to remove. |
| 83 class BrowsingDataRemoverFunction : public ChromeAsyncExtensionFunction, | 83 class BrowsingDataRemoverFunction : public ChromeAsyncExtensionFunction, |
| 84 public BrowsingDataRemover::Observer { | 84 public BrowsingDataRemover::Observer { |
| 85 public: | 85 public: |
| 86 // BrowsingDataRemover::Observer interface method. | 86 // BrowsingDataRemover::Observer interface method. |
| 87 virtual void OnBrowsingDataRemoverDone() OVERRIDE; | 87 virtual void OnBrowsingDataRemoverDone() override; |
| 88 | 88 |
| 89 // ExtensionFunction: | 89 // ExtensionFunction: |
| 90 virtual bool RunAsync() OVERRIDE; | 90 virtual bool RunAsync() override; |
| 91 | 91 |
| 92 protected: | 92 protected: |
| 93 virtual ~BrowsingDataRemoverFunction() {} | 93 virtual ~BrowsingDataRemoverFunction() {} |
| 94 | 94 |
| 95 // Children should override this method to provide the proper removal mask | 95 // Children should override this method to provide the proper removal mask |
| 96 // based on the API call they represent. | 96 // based on the API call they represent. |
| 97 virtual int GetRemovalMask() = 0; | 97 virtual int GetRemovalMask() = 0; |
| 98 | 98 |
| 99 private: | 99 private: |
| 100 // Updates the removal bitmask according to whether removing plugin data is | 100 // Updates the removal bitmask according to whether removing plugin data is |
| (...skipping 15 matching lines...) Expand all Loading... |
| 116 | 116 |
| 117 class BrowsingDataRemoveAppcacheFunction : public BrowsingDataRemoverFunction { | 117 class BrowsingDataRemoveAppcacheFunction : public BrowsingDataRemoverFunction { |
| 118 public: | 118 public: |
| 119 DECLARE_EXTENSION_FUNCTION("browsingData.removeAppcache", | 119 DECLARE_EXTENSION_FUNCTION("browsingData.removeAppcache", |
| 120 BROWSINGDATA_REMOVEAPPCACHE) | 120 BROWSINGDATA_REMOVEAPPCACHE) |
| 121 | 121 |
| 122 protected: | 122 protected: |
| 123 virtual ~BrowsingDataRemoveAppcacheFunction() {} | 123 virtual ~BrowsingDataRemoveAppcacheFunction() {} |
| 124 | 124 |
| 125 // BrowsingDataRemoverFunction: | 125 // BrowsingDataRemoverFunction: |
| 126 virtual int GetRemovalMask() OVERRIDE; | 126 virtual int GetRemovalMask() override; |
| 127 }; | 127 }; |
| 128 | 128 |
| 129 class BrowsingDataRemoveFunction : public BrowsingDataRemoverFunction { | 129 class BrowsingDataRemoveFunction : public BrowsingDataRemoverFunction { |
| 130 public: | 130 public: |
| 131 DECLARE_EXTENSION_FUNCTION("browsingData.remove", BROWSINGDATA_REMOVE) | 131 DECLARE_EXTENSION_FUNCTION("browsingData.remove", BROWSINGDATA_REMOVE) |
| 132 | 132 |
| 133 protected: | 133 protected: |
| 134 virtual ~BrowsingDataRemoveFunction() {} | 134 virtual ~BrowsingDataRemoveFunction() {} |
| 135 | 135 |
| 136 // BrowsingDataRemoverFunction: | 136 // BrowsingDataRemoverFunction: |
| 137 virtual int GetRemovalMask() OVERRIDE; | 137 virtual int GetRemovalMask() override; |
| 138 }; | 138 }; |
| 139 | 139 |
| 140 class BrowsingDataRemoveCacheFunction : public BrowsingDataRemoverFunction { | 140 class BrowsingDataRemoveCacheFunction : public BrowsingDataRemoverFunction { |
| 141 public: | 141 public: |
| 142 DECLARE_EXTENSION_FUNCTION("browsingData.removeCache", | 142 DECLARE_EXTENSION_FUNCTION("browsingData.removeCache", |
| 143 BROWSINGDATA_REMOVECACHE) | 143 BROWSINGDATA_REMOVECACHE) |
| 144 | 144 |
| 145 protected: | 145 protected: |
| 146 virtual ~BrowsingDataRemoveCacheFunction() {} | 146 virtual ~BrowsingDataRemoveCacheFunction() {} |
| 147 | 147 |
| 148 // BrowsingDataRemoverFunction: | 148 // BrowsingDataRemoverFunction: |
| 149 virtual int GetRemovalMask() OVERRIDE; | 149 virtual int GetRemovalMask() override; |
| 150 }; | 150 }; |
| 151 | 151 |
| 152 class BrowsingDataRemoveCookiesFunction : public BrowsingDataRemoverFunction { | 152 class BrowsingDataRemoveCookiesFunction : public BrowsingDataRemoverFunction { |
| 153 public: | 153 public: |
| 154 DECLARE_EXTENSION_FUNCTION("browsingData.removeCookies", | 154 DECLARE_EXTENSION_FUNCTION("browsingData.removeCookies", |
| 155 BROWSINGDATA_REMOVECOOKIES) | 155 BROWSINGDATA_REMOVECOOKIES) |
| 156 | 156 |
| 157 protected: | 157 protected: |
| 158 virtual ~BrowsingDataRemoveCookiesFunction() {} | 158 virtual ~BrowsingDataRemoveCookiesFunction() {} |
| 159 | 159 |
| 160 // BrowsingDataRemoverFunction: | 160 // BrowsingDataRemoverFunction: |
| 161 virtual int GetRemovalMask() OVERRIDE; | 161 virtual int GetRemovalMask() override; |
| 162 }; | 162 }; |
| 163 | 163 |
| 164 class BrowsingDataRemoveDownloadsFunction : public BrowsingDataRemoverFunction { | 164 class BrowsingDataRemoveDownloadsFunction : public BrowsingDataRemoverFunction { |
| 165 public: | 165 public: |
| 166 DECLARE_EXTENSION_FUNCTION("browsingData.removeDownloads", | 166 DECLARE_EXTENSION_FUNCTION("browsingData.removeDownloads", |
| 167 BROWSINGDATA_REMOVEDOWNLOADS) | 167 BROWSINGDATA_REMOVEDOWNLOADS) |
| 168 | 168 |
| 169 protected: | 169 protected: |
| 170 virtual ~BrowsingDataRemoveDownloadsFunction() {} | 170 virtual ~BrowsingDataRemoveDownloadsFunction() {} |
| 171 | 171 |
| 172 // BrowsingDataRemoverFunction: | 172 // BrowsingDataRemoverFunction: |
| 173 virtual int GetRemovalMask() OVERRIDE; | 173 virtual int GetRemovalMask() override; |
| 174 }; | 174 }; |
| 175 | 175 |
| 176 class BrowsingDataRemoveFileSystemsFunction | 176 class BrowsingDataRemoveFileSystemsFunction |
| 177 : public BrowsingDataRemoverFunction { | 177 : public BrowsingDataRemoverFunction { |
| 178 public: | 178 public: |
| 179 DECLARE_EXTENSION_FUNCTION("browsingData.removeFileSystems", | 179 DECLARE_EXTENSION_FUNCTION("browsingData.removeFileSystems", |
| 180 BROWSINGDATA_REMOVEFILESYSTEMS) | 180 BROWSINGDATA_REMOVEFILESYSTEMS) |
| 181 | 181 |
| 182 protected: | 182 protected: |
| 183 virtual ~BrowsingDataRemoveFileSystemsFunction() {} | 183 virtual ~BrowsingDataRemoveFileSystemsFunction() {} |
| 184 | 184 |
| 185 // BrowsingDataRemoverFunction: | 185 // BrowsingDataRemoverFunction: |
| 186 virtual int GetRemovalMask() OVERRIDE; | 186 virtual int GetRemovalMask() override; |
| 187 }; | 187 }; |
| 188 | 188 |
| 189 class BrowsingDataRemoveFormDataFunction : public BrowsingDataRemoverFunction { | 189 class BrowsingDataRemoveFormDataFunction : public BrowsingDataRemoverFunction { |
| 190 public: | 190 public: |
| 191 DECLARE_EXTENSION_FUNCTION("browsingData.removeFormData", | 191 DECLARE_EXTENSION_FUNCTION("browsingData.removeFormData", |
| 192 BROWSINGDATA_REMOVEFORMDATA) | 192 BROWSINGDATA_REMOVEFORMDATA) |
| 193 | 193 |
| 194 protected: | 194 protected: |
| 195 virtual ~BrowsingDataRemoveFormDataFunction() {} | 195 virtual ~BrowsingDataRemoveFormDataFunction() {} |
| 196 | 196 |
| 197 // BrowsingDataRemoverFunction: | 197 // BrowsingDataRemoverFunction: |
| 198 virtual int GetRemovalMask() OVERRIDE; | 198 virtual int GetRemovalMask() override; |
| 199 }; | 199 }; |
| 200 | 200 |
| 201 class BrowsingDataRemoveHistoryFunction : public BrowsingDataRemoverFunction { | 201 class BrowsingDataRemoveHistoryFunction : public BrowsingDataRemoverFunction { |
| 202 public: | 202 public: |
| 203 DECLARE_EXTENSION_FUNCTION("browsingData.removeHistory", | 203 DECLARE_EXTENSION_FUNCTION("browsingData.removeHistory", |
| 204 BROWSINGDATA_REMOVEHISTORY) | 204 BROWSINGDATA_REMOVEHISTORY) |
| 205 | 205 |
| 206 protected: | 206 protected: |
| 207 virtual ~BrowsingDataRemoveHistoryFunction() {} | 207 virtual ~BrowsingDataRemoveHistoryFunction() {} |
| 208 | 208 |
| 209 // BrowsingDataRemoverFunction: | 209 // BrowsingDataRemoverFunction: |
| 210 virtual int GetRemovalMask() OVERRIDE; | 210 virtual int GetRemovalMask() override; |
| 211 }; | 211 }; |
| 212 | 212 |
| 213 class BrowsingDataRemoveIndexedDBFunction : public BrowsingDataRemoverFunction { | 213 class BrowsingDataRemoveIndexedDBFunction : public BrowsingDataRemoverFunction { |
| 214 public: | 214 public: |
| 215 DECLARE_EXTENSION_FUNCTION("browsingData.removeIndexedDB", | 215 DECLARE_EXTENSION_FUNCTION("browsingData.removeIndexedDB", |
| 216 BROWSINGDATA_REMOVEINDEXEDDB) | 216 BROWSINGDATA_REMOVEINDEXEDDB) |
| 217 | 217 |
| 218 protected: | 218 protected: |
| 219 virtual ~BrowsingDataRemoveIndexedDBFunction() {} | 219 virtual ~BrowsingDataRemoveIndexedDBFunction() {} |
| 220 | 220 |
| 221 // BrowsingDataRemoverFunction: | 221 // BrowsingDataRemoverFunction: |
| 222 virtual int GetRemovalMask() OVERRIDE; | 222 virtual int GetRemovalMask() override; |
| 223 }; | 223 }; |
| 224 | 224 |
| 225 class BrowsingDataRemoveLocalStorageFunction | 225 class BrowsingDataRemoveLocalStorageFunction |
| 226 : public BrowsingDataRemoverFunction { | 226 : public BrowsingDataRemoverFunction { |
| 227 public: | 227 public: |
| 228 DECLARE_EXTENSION_FUNCTION("browsingData.removeLocalStorage", | 228 DECLARE_EXTENSION_FUNCTION("browsingData.removeLocalStorage", |
| 229 BROWSINGDATA_REMOVELOCALSTORAGE) | 229 BROWSINGDATA_REMOVELOCALSTORAGE) |
| 230 | 230 |
| 231 protected: | 231 protected: |
| 232 virtual ~BrowsingDataRemoveLocalStorageFunction() {} | 232 virtual ~BrowsingDataRemoveLocalStorageFunction() {} |
| 233 | 233 |
| 234 // BrowsingDataRemoverFunction: | 234 // BrowsingDataRemoverFunction: |
| 235 virtual int GetRemovalMask() OVERRIDE; | 235 virtual int GetRemovalMask() override; |
| 236 }; | 236 }; |
| 237 | 237 |
| 238 class BrowsingDataRemovePluginDataFunction | 238 class BrowsingDataRemovePluginDataFunction |
| 239 : public BrowsingDataRemoverFunction { | 239 : public BrowsingDataRemoverFunction { |
| 240 public: | 240 public: |
| 241 DECLARE_EXTENSION_FUNCTION("browsingData.removePluginData", | 241 DECLARE_EXTENSION_FUNCTION("browsingData.removePluginData", |
| 242 BROWSINGDATA_REMOVEPLUGINDATA) | 242 BROWSINGDATA_REMOVEPLUGINDATA) |
| 243 | 243 |
| 244 protected: | 244 protected: |
| 245 virtual ~BrowsingDataRemovePluginDataFunction() {} | 245 virtual ~BrowsingDataRemovePluginDataFunction() {} |
| 246 | 246 |
| 247 // BrowsingDataRemoverFunction: | 247 // BrowsingDataRemoverFunction: |
| 248 virtual int GetRemovalMask() OVERRIDE; | 248 virtual int GetRemovalMask() override; |
| 249 }; | 249 }; |
| 250 | 250 |
| 251 class BrowsingDataRemovePasswordsFunction : public BrowsingDataRemoverFunction { | 251 class BrowsingDataRemovePasswordsFunction : public BrowsingDataRemoverFunction { |
| 252 public: | 252 public: |
| 253 DECLARE_EXTENSION_FUNCTION("browsingData.removePasswords", | 253 DECLARE_EXTENSION_FUNCTION("browsingData.removePasswords", |
| 254 BROWSINGDATA_REMOVEPASSWORDS) | 254 BROWSINGDATA_REMOVEPASSWORDS) |
| 255 | 255 |
| 256 protected: | 256 protected: |
| 257 virtual ~BrowsingDataRemovePasswordsFunction() {} | 257 virtual ~BrowsingDataRemovePasswordsFunction() {} |
| 258 | 258 |
| 259 // BrowsingDataRemoverFunction: | 259 // BrowsingDataRemoverFunction: |
| 260 virtual int GetRemovalMask() OVERRIDE; | 260 virtual int GetRemovalMask() override; |
| 261 }; | 261 }; |
| 262 | 262 |
| 263 class BrowsingDataRemoveServiceWorkersFunction | 263 class BrowsingDataRemoveServiceWorkersFunction |
| 264 : public BrowsingDataRemoverFunction { | 264 : public BrowsingDataRemoverFunction { |
| 265 public: | 265 public: |
| 266 DECLARE_EXTENSION_FUNCTION("browsingData.removeServiceWorkers", | 266 DECLARE_EXTENSION_FUNCTION("browsingData.removeServiceWorkers", |
| 267 BROWSINGDATA_REMOVESERVICEWORKERS) | 267 BROWSINGDATA_REMOVESERVICEWORKERS) |
| 268 | 268 |
| 269 protected: | 269 protected: |
| 270 virtual ~BrowsingDataRemoveServiceWorkersFunction() {} | 270 virtual ~BrowsingDataRemoveServiceWorkersFunction() {} |
| 271 | 271 |
| 272 // BrowsingDataRemoverFunction: | 272 // BrowsingDataRemoverFunction: |
| 273 virtual int GetRemovalMask() OVERRIDE; | 273 virtual int GetRemovalMask() override; |
| 274 }; | 274 }; |
| 275 | 275 |
| 276 class BrowsingDataRemoveWebSQLFunction : public BrowsingDataRemoverFunction { | 276 class BrowsingDataRemoveWebSQLFunction : public BrowsingDataRemoverFunction { |
| 277 public: | 277 public: |
| 278 DECLARE_EXTENSION_FUNCTION("browsingData.removeWebSQL", | 278 DECLARE_EXTENSION_FUNCTION("browsingData.removeWebSQL", |
| 279 BROWSINGDATA_REMOVEWEBSQL) | 279 BROWSINGDATA_REMOVEWEBSQL) |
| 280 | 280 |
| 281 protected: | 281 protected: |
| 282 virtual ~BrowsingDataRemoveWebSQLFunction() {} | 282 virtual ~BrowsingDataRemoveWebSQLFunction() {} |
| 283 | 283 |
| 284 // BrowsingDataRemoverFunction: | 284 // BrowsingDataRemoverFunction: |
| 285 virtual int GetRemovalMask() OVERRIDE; | 285 virtual int GetRemovalMask() override; |
| 286 }; | 286 }; |
| 287 | 287 |
| 288 #endif // CHROME_BROWSER_EXTENSIONS_API_BROWSING_DATA_BROWSING_DATA_API_H_ | 288 #endif // CHROME_BROWSER_EXTENSIONS_API_BROWSING_DATA_BROWSING_DATA_API_H_ |
| OLD | NEW |