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

Side by Side Diff: chrome/browser/extensions/api/browsing_data/browsing_data_api.cc

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

Powered by Google App Engine
This is Rietveld 408576698