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 #include "chrome/browser/extensions/api/browsing_data/browsing_data_api.h" | 9 #include "chrome/browser/extensions/api/browsing_data/browsing_data_api.h" |
10 | 10 |
| 11 #include <set> |
11 #include <string> | 12 #include <string> |
12 #include <utility> | 13 #include <utility> |
13 | 14 |
| 15 #include "base/stl_util.h" |
14 #include "base/values.h" | 16 #include "base/values.h" |
15 #include "chrome/browser/browsing_data/browsing_data_helper.h" | 17 #include "chrome/browser/browsing_data/browsing_data_helper.h" |
16 #include "chrome/browser/browsing_data/browsing_data_remover.h" | 18 #include "chrome/browser/browsing_data/browsing_data_remover.h" |
17 #include "chrome/browser/browsing_data/browsing_data_remover_factory.h" | 19 #include "chrome/browser/browsing_data/browsing_data_remover_factory.h" |
| 20 #include "chrome/browser/browsing_data/chrome_browsing_data_types.h" |
18 #include "chrome/browser/plugins/plugin_data_remover_helper.h" | 21 #include "chrome/browser/plugins/plugin_data_remover_helper.h" |
19 #include "chrome/browser/plugins/plugin_prefs.h" | 22 #include "chrome/browser/plugins/plugin_prefs.h" |
20 #include "chrome/browser/profiles/profile.h" | 23 #include "chrome/browser/profiles/profile.h" |
21 #include "chrome/browser/ui/browser.h" | 24 #include "chrome/browser/ui/browser.h" |
22 #include "chrome/common/pref_names.h" | 25 #include "chrome/common/pref_names.h" |
23 #include "components/browsing_data/core/browsing_data_utils.h" | 26 #include "components/browsing_data/core/browsing_data_utils.h" |
24 #include "components/browsing_data/core/pref_names.h" | 27 #include "components/browsing_data/core/pref_names.h" |
25 #include "content/public/browser/browser_thread.h" | 28 #include "content/public/browser/browser_thread.h" |
26 #include "extensions/common/error_utils.h" | 29 #include "extensions/common/error_utils.h" |
27 #include "extensions/common/extension.h" | 30 #include "extensions/common/extension.h" |
28 | 31 |
29 using content::BrowserThread; | 32 using content::BrowserThread; |
| 33 using content::BrowsingDataType; |
30 | 34 |
31 namespace extension_browsing_data_api_constants { | 35 namespace extension_browsing_data_api_constants { |
32 | 36 |
33 // Parameter name keys. | 37 // Parameter name keys. |
34 const char kDataRemovalPermittedKey[] = "dataRemovalPermitted"; | 38 const char kDataRemovalPermittedKey[] = "dataRemovalPermitted"; |
35 const char kDataToRemoveKey[] = "dataToRemove"; | 39 const char kDataToRemoveKey[] = "dataToRemove"; |
36 const char kOptionsKey[] = "options"; | 40 const char kOptionsKey[] = "options"; |
37 | 41 |
38 // Type keys. | 42 // Type keys. |
39 const char kAppCacheKey[] = "appcache"; | 43 const char kAppCacheKey[] = "appcache"; |
(...skipping 22 matching lines...) Expand all Loading... |
62 // Errors! | 66 // Errors! |
63 // The placeholder will be filled by the name of the affected data type (e.g., | 67 // The placeholder will be filled by the name of the affected data type (e.g., |
64 // "history"). | 68 // "history"). |
65 const char kBadDataTypeDetails[] = "Invalid value for data type '%s'."; | 69 const char kBadDataTypeDetails[] = "Invalid value for data type '%s'."; |
66 const char kDeleteProhibitedError[] = "Browsing history and downloads are not " | 70 const char kDeleteProhibitedError[] = "Browsing history and downloads are not " |
67 "permitted to be removed."; | 71 "permitted to be removed."; |
68 | 72 |
69 } // namespace extension_browsing_data_api_constants | 73 } // namespace extension_browsing_data_api_constants |
70 | 74 |
71 namespace { | 75 namespace { |
72 int MaskForKey(const char* key) { | 76 |
| 77 // TODO(msramek): This function could be simplified to three lines if we ensured |
| 78 // that extension API keys are the same as names specified in BrowsingDataType. |
| 79 const BrowsingDataType* TypeForKey(const char* key) { |
73 if (strcmp(key, extension_browsing_data_api_constants::kAppCacheKey) == 0) | 80 if (strcmp(key, extension_browsing_data_api_constants::kAppCacheKey) == 0) |
74 return BrowsingDataRemover::REMOVE_APPCACHE; | 81 return &kBrowsingDataTypeAppCache; |
75 if (strcmp(key, extension_browsing_data_api_constants::kCacheKey) == 0) | 82 if (strcmp(key, extension_browsing_data_api_constants::kCacheKey) == 0) |
76 return BrowsingDataRemover::REMOVE_CACHE; | 83 return &kBrowsingDataTypeCache; |
77 if (strcmp(key, extension_browsing_data_api_constants::kCookiesKey) == 0) { | 84 if (strcmp(key, extension_browsing_data_api_constants::kCookiesKey) == 0) { |
78 return BrowsingDataRemover::REMOVE_COOKIES; | 85 return &kBrowsingDataTypeCookies; |
79 } | 86 } |
80 if (strcmp(key, extension_browsing_data_api_constants::kDownloadsKey) == 0) | 87 if (strcmp(key, extension_browsing_data_api_constants::kDownloadsKey) == 0) |
81 return BrowsingDataRemover::REMOVE_DOWNLOADS; | 88 return &kBrowsingDataTypeDownloads; |
82 if (strcmp(key, extension_browsing_data_api_constants::kFileSystemsKey) == 0) | 89 if (strcmp(key, extension_browsing_data_api_constants::kFileSystemsKey) == 0) |
83 return BrowsingDataRemover::REMOVE_FILE_SYSTEMS; | 90 return &kBrowsingDataTypeFileSystems; |
84 if (strcmp(key, extension_browsing_data_api_constants::kFormDataKey) == 0) | 91 if (strcmp(key, extension_browsing_data_api_constants::kFormDataKey) == 0) |
85 return BrowsingDataRemover::REMOVE_FORM_DATA; | 92 return &kBrowsingDataTypeFormData; |
86 if (strcmp(key, extension_browsing_data_api_constants::kHistoryKey) == 0) | 93 if (strcmp(key, extension_browsing_data_api_constants::kHistoryKey) == 0) |
87 return BrowsingDataRemover::REMOVE_HISTORY; | 94 return &kBrowsingDataTypeHistory; |
88 if (strcmp(key, extension_browsing_data_api_constants::kIndexedDBKey) == 0) | 95 if (strcmp(key, extension_browsing_data_api_constants::kIndexedDBKey) == 0) |
89 return BrowsingDataRemover::REMOVE_INDEXEDDB; | 96 return &kBrowsingDataTypeIndexedDB; |
90 if (strcmp(key, extension_browsing_data_api_constants::kLocalStorageKey) == 0) | 97 if (strcmp(key, extension_browsing_data_api_constants::kLocalStorageKey) == 0) |
91 return BrowsingDataRemover::REMOVE_LOCAL_STORAGE; | 98 return &kBrowsingDataTypeLocalStorage; |
92 if (strcmp(key, | 99 if (strcmp(key, |
93 extension_browsing_data_api_constants::kChannelIDsKey) == 0) | 100 extension_browsing_data_api_constants::kChannelIDsKey) == 0) |
94 return BrowsingDataRemover::REMOVE_CHANNEL_IDS; | 101 return &kBrowsingDataTypeChannelIDs; |
95 if (strcmp(key, extension_browsing_data_api_constants::kPasswordsKey) == 0) | 102 if (strcmp(key, extension_browsing_data_api_constants::kPasswordsKey) == 0) |
96 return BrowsingDataRemover::REMOVE_PASSWORDS; | 103 return &kBrowsingDataTypePasswords; |
97 if (strcmp(key, extension_browsing_data_api_constants::kPluginDataKey) == 0) | 104 if (strcmp(key, extension_browsing_data_api_constants::kPluginDataKey) == 0) |
98 return BrowsingDataRemover::REMOVE_PLUGIN_DATA; | 105 return &kBrowsingDataTypePluginData; |
99 if (strcmp(key, extension_browsing_data_api_constants::kServiceWorkersKey) == | 106 if (strcmp(key, extension_browsing_data_api_constants::kServiceWorkersKey) == |
100 0) | 107 0) |
101 return BrowsingDataRemover::REMOVE_SERVICE_WORKERS; | 108 return &kBrowsingDataTypeServiceWorkers; |
102 if (strcmp(key, extension_browsing_data_api_constants::kCacheStorageKey) == 0) | 109 if (strcmp(key, extension_browsing_data_api_constants::kCacheStorageKey) == 0) |
103 return BrowsingDataRemover::REMOVE_CACHE_STORAGE; | 110 return &kBrowsingDataTypeCacheStorage; |
104 if (strcmp(key, extension_browsing_data_api_constants::kWebSQLKey) == 0) | 111 if (strcmp(key, extension_browsing_data_api_constants::kWebSQLKey) == 0) |
105 return BrowsingDataRemover::REMOVE_WEBSQL; | 112 return &kBrowsingDataTypeWebSQL; |
106 | 113 |
107 return 0; | 114 return nullptr; |
108 } | 115 } |
109 | 116 |
110 // Returns false if any of the selected data types are not allowed to be | 117 // Returns false if any of the selected data types are not allowed to be |
111 // deleted. | 118 // deleted. |
112 bool IsRemovalPermitted(int removal_mask, PrefService* prefs) { | 119 bool IsRemovalPermitted(const std::set<const BrowsingDataType*>& removal_mask, |
| 120 PrefService* prefs) { |
113 // Enterprise policy or user preference might prohibit deleting browser or | 121 // Enterprise policy or user preference might prohibit deleting browser or |
114 // download history. | 122 // download history. |
115 if ((removal_mask & BrowsingDataRemover::REMOVE_HISTORY) || | 123 if (base::ContainsValue(removal_mask, &kBrowsingDataTypeHistory) || |
116 (removal_mask & BrowsingDataRemover::REMOVE_DOWNLOADS)) { | 124 base::ContainsValue(removal_mask, &kBrowsingDataTypeDownloads)) { |
117 return prefs->GetBoolean(prefs::kAllowDeletingBrowserHistory); | 125 return prefs->GetBoolean(prefs::kAllowDeletingBrowserHistory); |
118 } | 126 } |
119 return true; | 127 return true; |
120 } | 128 } |
121 | 129 |
122 } // namespace | 130 } // namespace |
123 | 131 |
124 ExtensionFunction::ResponseAction BrowsingDataSettingsFunction::Run() { | 132 ExtensionFunction::ResponseAction BrowsingDataSettingsFunction::Run() { |
125 prefs_ = Profile::FromBrowserContext(browser_context())->GetPrefs(); | 133 prefs_ = Profile::FromBrowserContext(browser_context())->GetPrefs(); |
126 | 134 |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 result->Set(extension_browsing_data_api_constants::kDataRemovalPermittedKey, | 228 result->Set(extension_browsing_data_api_constants::kDataRemovalPermittedKey, |
221 permitted.release()); | 229 permitted.release()); |
222 return RespondNow(OneArgument(std::move(result))); | 230 return RespondNow(OneArgument(std::move(result))); |
223 } | 231 } |
224 | 232 |
225 void BrowsingDataSettingsFunction::SetDetails( | 233 void BrowsingDataSettingsFunction::SetDetails( |
226 base::DictionaryValue* selected_dict, | 234 base::DictionaryValue* selected_dict, |
227 base::DictionaryValue* permitted_dict, | 235 base::DictionaryValue* permitted_dict, |
228 const char* data_type, | 236 const char* data_type, |
229 bool is_selected) { | 237 bool is_selected) { |
230 bool is_permitted = IsRemovalPermitted(MaskForKey(data_type), prefs_); | 238 const std::set<const BrowsingDataType*> removal_mask = { |
| 239 TypeForKey(data_type)}; |
| 240 bool is_permitted = IsRemovalPermitted(removal_mask, prefs_); |
231 selected_dict->SetBoolean(data_type, is_selected && is_permitted); | 241 selected_dict->SetBoolean(data_type, is_selected && is_permitted); |
232 permitted_dict->SetBoolean(data_type, is_permitted); | 242 permitted_dict->SetBoolean(data_type, is_permitted); |
233 } | 243 } |
234 | 244 |
235 BrowsingDataRemoverFunction::BrowsingDataRemoverFunction() : observer_(this) {} | 245 BrowsingDataRemoverFunction::BrowsingDataRemoverFunction() : observer_(this) {} |
236 | 246 |
237 void BrowsingDataRemoverFunction::OnBrowsingDataRemoverDone() { | 247 void BrowsingDataRemoverFunction::OnBrowsingDataRemoverDone() { |
238 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 248 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
239 | 249 |
240 observer_.RemoveAll(); | 250 observer_.RemoveAll(); |
(...skipping 22 matching lines...) Expand all Loading... |
263 ms_since_epoch = 0; | 273 ms_since_epoch = 0; |
264 | 274 |
265 // base::Time takes a double that represents seconds since epoch. JavaScript | 275 // base::Time takes a double that represents seconds since epoch. JavaScript |
266 // gives developers milliseconds, so do a quick conversion before populating | 276 // gives developers milliseconds, so do a quick conversion before populating |
267 // the object. Also, Time::FromDoubleT converts double time 0 to empty Time | 277 // the object. Also, Time::FromDoubleT converts double time 0 to empty Time |
268 // object. So we need to do special handling here. | 278 // object. So we need to do special handling here. |
269 remove_since_ = (ms_since_epoch == 0) ? | 279 remove_since_ = (ms_since_epoch == 0) ? |
270 base::Time::UnixEpoch() : | 280 base::Time::UnixEpoch() : |
271 base::Time::FromDoubleT(ms_since_epoch / 1000.0); | 281 base::Time::FromDoubleT(ms_since_epoch / 1000.0); |
272 | 282 |
| 283 removal_mask_.clear(); |
273 EXTENSION_FUNCTION_VALIDATE(GetRemovalMask(&removal_mask_)); | 284 EXTENSION_FUNCTION_VALIDATE(GetRemovalMask(&removal_mask_)); |
274 | 285 |
275 // Check for prohibited data types. | 286 // Check for prohibited data types. |
276 if (!IsRemovalPermitted(removal_mask_, GetProfile()->GetPrefs())) { | 287 if (!IsRemovalPermitted(removal_mask_, GetProfile()->GetPrefs())) { |
277 error_ = extension_browsing_data_api_constants::kDeleteProhibitedError; | 288 error_ = extension_browsing_data_api_constants::kDeleteProhibitedError; |
278 return false; | 289 return false; |
279 } | 290 } |
280 | 291 |
281 if (removal_mask_ & BrowsingDataRemover::REMOVE_PLUGIN_DATA) { | 292 if (base::ContainsValue(removal_mask_, &kBrowsingDataTypePluginData)) { |
282 // If we're being asked to remove plugin data, check whether it's actually | 293 // If we're being asked to remove plugin data, check whether it's actually |
283 // supported. | 294 // supported. |
284 BrowserThread::PostTask( | 295 BrowserThread::PostTask( |
285 BrowserThread::FILE, | 296 BrowserThread::FILE, |
286 FROM_HERE, | 297 FROM_HERE, |
287 base::Bind( | 298 base::Bind( |
288 &BrowsingDataRemoverFunction::CheckRemovingPluginDataSupported, | 299 &BrowsingDataRemoverFunction::CheckRemovingPluginDataSupported, |
289 this, | 300 this, |
290 PluginPrefs::GetForProfile(GetProfile()))); | 301 PluginPrefs::GetForProfile(GetProfile()))); |
291 } else { | 302 } else { |
292 StartRemoving(); | 303 StartRemoving(); |
293 } | 304 } |
294 | 305 |
295 // Will finish asynchronously. | 306 // Will finish asynchronously. |
296 return true; | 307 return true; |
297 } | 308 } |
298 | 309 |
299 BrowsingDataRemoverFunction::~BrowsingDataRemoverFunction() {} | 310 BrowsingDataRemoverFunction::~BrowsingDataRemoverFunction() {} |
300 | 311 |
301 void BrowsingDataRemoverFunction::CheckRemovingPluginDataSupported( | 312 void BrowsingDataRemoverFunction::CheckRemovingPluginDataSupported( |
302 scoped_refptr<PluginPrefs> plugin_prefs) { | 313 scoped_refptr<PluginPrefs> plugin_prefs) { |
303 if (!PluginDataRemoverHelper::IsSupported(plugin_prefs.get())) | 314 if (!PluginDataRemoverHelper::IsSupported(plugin_prefs.get())) |
304 removal_mask_ &= ~BrowsingDataRemover::REMOVE_PLUGIN_DATA; | 315 removal_mask_.erase(&kBrowsingDataTypePluginData); |
305 | 316 |
306 BrowserThread::PostTask( | 317 BrowserThread::PostTask( |
307 BrowserThread::UI, FROM_HERE, | 318 BrowserThread::UI, FROM_HERE, |
308 base::Bind(&BrowsingDataRemoverFunction::StartRemoving, this)); | 319 base::Bind(&BrowsingDataRemoverFunction::StartRemoving, this)); |
309 } | 320 } |
310 | 321 |
311 void BrowsingDataRemoverFunction::StartRemoving() { | 322 void BrowsingDataRemoverFunction::StartRemoving() { |
312 BrowsingDataRemover* remover = | 323 BrowsingDataRemover* remover = |
313 BrowsingDataRemoverFactory::GetForBrowserContext(GetProfile()); | 324 BrowsingDataRemoverFactory::GetForBrowserContext(GetProfile()); |
314 // Add a ref (Balanced in OnBrowsingDataRemoverDone) | 325 // Add a ref (Balanced in OnBrowsingDataRemoverDone) |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 *origin_type_mask |= value ? BrowsingDataHelper::EXTENSION : 0; | 382 *origin_type_mask |= value ? BrowsingDataHelper::EXTENSION : 0; |
372 } | 383 } |
373 } | 384 } |
374 | 385 |
375 return true; | 386 return true; |
376 } | 387 } |
377 | 388 |
378 // Parses the |dataToRemove| argument to generate the removal mask. | 389 // Parses the |dataToRemove| argument to generate the removal mask. |
379 // Returns false if parse was not successful, i.e. if 'dataToRemove' is not | 390 // Returns false if parse was not successful, i.e. if 'dataToRemove' is not |
380 // present or any data-type keys don't have supported (boolean) values. | 391 // present or any data-type keys don't have supported (boolean) values. |
381 bool BrowsingDataRemoveFunction::GetRemovalMask(int* removal_mask) { | 392 bool BrowsingDataRemoveFunction::GetRemovalMask( |
| 393 std::set<const BrowsingDataType*>* removal_mask) { |
382 base::DictionaryValue* data_to_remove; | 394 base::DictionaryValue* data_to_remove; |
383 if (!args_->GetDictionary(1, &data_to_remove)) | 395 if (!args_->GetDictionary(1, &data_to_remove)) |
384 return false; | 396 return false; |
385 | 397 |
386 *removal_mask = 0; | 398 removal_mask->clear(); |
387 for (base::DictionaryValue::Iterator i(*data_to_remove); | 399 for (base::DictionaryValue::Iterator i(*data_to_remove); |
388 !i.IsAtEnd(); | 400 !i.IsAtEnd(); |
389 i.Advance()) { | 401 i.Advance()) { |
390 bool selected = false; | 402 bool selected = false; |
391 if (!i.value().GetAsBoolean(&selected)) | 403 if (!i.value().GetAsBoolean(&selected)) |
392 return false; | 404 return false; |
393 if (selected) | 405 const BrowsingDataType* data_type = TypeForKey(i.key().c_str()); |
394 *removal_mask |= MaskForKey(i.key().c_str()); | 406 if (data_type && selected) |
| 407 removal_mask->insert(data_type); |
395 } | 408 } |
396 | 409 |
397 return true; | 410 return true; |
398 } | 411 } |
399 | 412 |
400 bool BrowsingDataRemoveAppcacheFunction::GetRemovalMask(int* removal_mask) { | 413 bool BrowsingDataRemoveAppcacheFunction::GetRemovalMask( |
401 *removal_mask = BrowsingDataRemover::REMOVE_APPCACHE; | 414 std::set<const BrowsingDataType*>* removal_mask) { |
| 415 removal_mask->insert(&kBrowsingDataTypeAppCache); |
402 return true; | 416 return true; |
403 } | 417 } |
404 | 418 |
405 bool BrowsingDataRemoveCacheFunction::GetRemovalMask(int* removal_mask) { | 419 bool BrowsingDataRemoveCacheFunction::GetRemovalMask( |
406 *removal_mask = BrowsingDataRemover::REMOVE_CACHE; | 420 std::set<const BrowsingDataType*>* removal_mask) { |
| 421 removal_mask->insert(&kBrowsingDataTypeCache); |
407 return true; | 422 return true; |
408 } | 423 } |
409 | 424 |
410 bool BrowsingDataRemoveCookiesFunction::GetRemovalMask(int* removal_mask) { | 425 bool BrowsingDataRemoveCookiesFunction::GetRemovalMask( |
411 *removal_mask = BrowsingDataRemover::REMOVE_COOKIES | | 426 std::set<const BrowsingDataType*>* removal_mask) { |
412 BrowsingDataRemover::REMOVE_CHANNEL_IDS; | 427 removal_mask->insert(&kBrowsingDataTypeCookies); |
| 428 removal_mask->insert(&kBrowsingDataTypeChannelIDs); |
413 return true; | 429 return true; |
414 } | 430 } |
415 | 431 |
416 bool BrowsingDataRemoveDownloadsFunction::GetRemovalMask(int* removal_mask) { | 432 bool BrowsingDataRemoveDownloadsFunction::GetRemovalMask( |
417 *removal_mask = BrowsingDataRemover::REMOVE_DOWNLOADS; | 433 std::set<const BrowsingDataType*>* removal_mask) { |
| 434 removal_mask->insert(&kBrowsingDataTypeDownloads); |
418 return true; | 435 return true; |
419 } | 436 } |
420 | 437 |
421 bool BrowsingDataRemoveFileSystemsFunction::GetRemovalMask(int* removal_mask) { | 438 bool BrowsingDataRemoveFileSystemsFunction::GetRemovalMask( |
422 *removal_mask = BrowsingDataRemover::REMOVE_FILE_SYSTEMS; | 439 std::set<const BrowsingDataType*>* removal_mask) { |
| 440 removal_mask->insert(&kBrowsingDataTypeFileSystems); |
423 return true; | 441 return true; |
424 } | 442 } |
425 | 443 |
426 bool BrowsingDataRemoveFormDataFunction::GetRemovalMask(int* removal_mask) { | 444 bool BrowsingDataRemoveFormDataFunction::GetRemovalMask( |
427 *removal_mask = BrowsingDataRemover::REMOVE_FORM_DATA; | 445 std::set<const BrowsingDataType*>* removal_mask) { |
| 446 removal_mask->insert(&kBrowsingDataTypeFormData); |
428 return true; | 447 return true; |
429 } | 448 } |
430 | 449 |
431 bool BrowsingDataRemoveHistoryFunction::GetRemovalMask(int* removal_mask) { | 450 bool BrowsingDataRemoveHistoryFunction::GetRemovalMask( |
432 *removal_mask = BrowsingDataRemover::REMOVE_HISTORY; | 451 std::set<const BrowsingDataType*>* removal_mask) { |
| 452 removal_mask->insert(&kBrowsingDataTypeHistory); |
433 return true; | 453 return true; |
434 } | 454 } |
435 | 455 |
436 bool BrowsingDataRemoveIndexedDBFunction::GetRemovalMask(int* removal_mask) { | 456 bool BrowsingDataRemoveIndexedDBFunction::GetRemovalMask( |
437 *removal_mask = BrowsingDataRemover::REMOVE_INDEXEDDB; | 457 std::set<const BrowsingDataType*>* removal_mask) { |
| 458 removal_mask->insert(&kBrowsingDataTypeIndexedDB); |
438 return true; | 459 return true; |
439 } | 460 } |
440 | 461 |
441 bool BrowsingDataRemoveLocalStorageFunction::GetRemovalMask(int* removal_mask) { | 462 bool BrowsingDataRemoveLocalStorageFunction::GetRemovalMask( |
442 *removal_mask = BrowsingDataRemover::REMOVE_LOCAL_STORAGE; | 463 std::set<const BrowsingDataType*>* removal_mask) { |
| 464 removal_mask->insert(&kBrowsingDataTypeLocalStorage); |
443 return true; | 465 return true; |
444 } | 466 } |
445 | 467 |
446 bool BrowsingDataRemovePluginDataFunction::GetRemovalMask(int* removal_mask) { | 468 bool BrowsingDataRemovePluginDataFunction::GetRemovalMask( |
447 *removal_mask = BrowsingDataRemover::REMOVE_PLUGIN_DATA; | 469 std::set<const BrowsingDataType*>* removal_mask) { |
| 470 removal_mask->insert(&kBrowsingDataTypePluginData); |
448 return true; | 471 return true; |
449 } | 472 } |
450 | 473 |
451 bool BrowsingDataRemovePasswordsFunction::GetRemovalMask(int* removal_mask) { | 474 bool BrowsingDataRemovePasswordsFunction::GetRemovalMask( |
452 *removal_mask = BrowsingDataRemover::REMOVE_PASSWORDS; | 475 std::set<const BrowsingDataType*>* removal_mask) { |
| 476 removal_mask->insert(&kBrowsingDataTypePasswords); |
453 return true; | 477 return true; |
454 } | 478 } |
455 | 479 |
456 bool BrowsingDataRemoveServiceWorkersFunction::GetRemovalMask( | 480 bool BrowsingDataRemoveServiceWorkersFunction::GetRemovalMask( |
457 int* removal_mask) { | 481 std::set<const BrowsingDataType*>* removal_mask) { |
458 *removal_mask = BrowsingDataRemover::REMOVE_SERVICE_WORKERS; | 482 removal_mask->insert(&kBrowsingDataTypeServiceWorkers); |
459 return true; | 483 return true; |
460 } | 484 } |
461 | 485 |
462 bool BrowsingDataRemoveCacheStorageFunction::GetRemovalMask(int* removal_mask) { | 486 bool BrowsingDataRemoveCacheStorageFunction::GetRemovalMask( |
463 *removal_mask = BrowsingDataRemover::REMOVE_CACHE_STORAGE; | 487 std::set<const BrowsingDataType*>* removal_mask) { |
| 488 removal_mask->insert(&kBrowsingDataTypeCacheStorage); |
464 return true; | 489 return true; |
465 } | 490 } |
466 | 491 |
467 bool BrowsingDataRemoveWebSQLFunction::GetRemovalMask(int* removal_mask) { | 492 bool BrowsingDataRemoveWebSQLFunction::GetRemovalMask( |
468 *removal_mask = BrowsingDataRemover::REMOVE_WEBSQL; | 493 std::set<const BrowsingDataType*>* removal_mask) { |
| 494 removal_mask->insert(&kBrowsingDataTypeWebSQL); |
469 return true; | 495 return true; |
470 } | 496 } |
OLD | NEW |