OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #include "chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.h" | 5 #include "chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 #endif | 327 #endif |
328 clear_auto_sign_in_(sub_task_forward_callback_), | 328 clear_auto_sign_in_(sub_task_forward_callback_), |
329 #if BUILDFLAG(ENABLE_PLUGINS) | 329 #if BUILDFLAG(ENABLE_PLUGINS) |
330 flash_lso_helper_(BrowsingDataFlashLSOHelper::Create(browser_context)), | 330 flash_lso_helper_(BrowsingDataFlashLSOHelper::Create(browser_context)), |
331 #endif | 331 #endif |
332 #if defined(OS_ANDROID) | 332 #if defined(OS_ANDROID) |
333 webapp_registry_(new WebappRegistry()), | 333 webapp_registry_(new WebappRegistry()), |
334 #endif | 334 #endif |
335 weak_ptr_factory_(this) {} | 335 weak_ptr_factory_(this) {} |
336 | 336 |
337 ChromeBrowsingDataRemoverDelegate::~ChromeBrowsingDataRemoverDelegate() { | 337 ChromeBrowsingDataRemoverDelegate::~ChromeBrowsingDataRemoverDelegate() {} |
| 338 |
| 339 void ChromeBrowsingDataRemoverDelegate::Shutdown() { |
338 history_task_tracker_.TryCancelAll(); | 340 history_task_tracker_.TryCancelAll(); |
339 template_url_sub_.reset(); | 341 template_url_sub_.reset(); |
340 } | 342 } |
341 | 343 |
342 BrowsingDataRemoverDelegate::EmbedderOriginTypeMatcher | 344 content::BrowsingDataRemoverDelegate::EmbedderOriginTypeMatcher |
343 ChromeBrowsingDataRemoverDelegate::GetOriginTypeMatcher() const { | 345 ChromeBrowsingDataRemoverDelegate::GetOriginTypeMatcher() const { |
344 return base::Bind(DoesOriginMatchEmbedderMask); | 346 return base::Bind(&DoesOriginMatchEmbedderMask); |
345 } | 347 } |
346 | 348 |
347 void ChromeBrowsingDataRemoverDelegate::RemoveEmbedderData( | 349 void ChromeBrowsingDataRemoverDelegate::RemoveEmbedderData( |
348 const base::Time& delete_begin, | 350 const base::Time& delete_begin, |
349 const base::Time& delete_end, | 351 const base::Time& delete_end, |
350 int remove_mask, | 352 int remove_mask, |
351 const BrowsingDataFilterBuilder& filter_builder, | 353 const BrowsingDataFilterBuilder& filter_builder, |
352 int origin_type_mask, | 354 int origin_type_mask, |
353 const base::Closure& callback) { | 355 const base::Closure& callback) { |
354 DCHECK(((remove_mask & ~FILTERABLE_DATA_TYPES) == 0) || | 356 DCHECK(((remove_mask & ~FILTERABLE_DATA_TYPES) == 0) || |
355 filter_builder.IsEmptyBlacklist()); | 357 filter_builder.IsEmptyBlacklist()); |
356 | 358 |
357 // Embedder-defined DOM-accessible storage currently contains only | 359 // Embedder-defined DOM-accessible storage currently contains only |
358 // one datatype, which is the durable storage permission. | 360 // one datatype, which is the durable storage permission. |
359 if (remove_mask & BrowsingDataRemover::DATA_TYPE_EMBEDDER_DOM_STORAGE) { | 361 if (remove_mask & |
| 362 content::BrowsingDataRemover::DATA_TYPE_EMBEDDER_DOM_STORAGE) { |
360 remove_mask |= DATA_TYPE_DURABLE_PERMISSION; | 363 remove_mask |= DATA_TYPE_DURABLE_PERMISSION; |
361 } | 364 } |
362 | 365 |
363 if (origin_type_mask & BrowsingDataRemover::ORIGIN_TYPE_UNPROTECTED_WEB) { | 366 if (origin_type_mask & |
| 367 content::BrowsingDataRemover::ORIGIN_TYPE_UNPROTECTED_WEB) { |
364 base::RecordAction( | 368 base::RecordAction( |
365 UserMetricsAction("ClearBrowsingData_MaskContainsUnprotectedWeb")); | 369 UserMetricsAction("ClearBrowsingData_MaskContainsUnprotectedWeb")); |
366 } | 370 } |
367 if (origin_type_mask & BrowsingDataRemover::ORIGIN_TYPE_PROTECTED_WEB) { | 371 if (origin_type_mask & |
| 372 content::BrowsingDataRemover::ORIGIN_TYPE_PROTECTED_WEB) { |
368 base::RecordAction( | 373 base::RecordAction( |
369 UserMetricsAction("ClearBrowsingData_MaskContainsProtectedWeb")); | 374 UserMetricsAction("ClearBrowsingData_MaskContainsProtectedWeb")); |
370 } | 375 } |
371 #if BUILDFLAG(ENABLE_EXTENSIONS) | 376 #if BUILDFLAG(ENABLE_EXTENSIONS) |
372 if (origin_type_mask & ORIGIN_TYPE_EXTENSION) { | 377 if (origin_type_mask & ORIGIN_TYPE_EXTENSION) { |
373 base::RecordAction( | 378 base::RecordAction( |
374 UserMetricsAction("ClearBrowsingData_MaskContainsExtension")); | 379 UserMetricsAction("ClearBrowsingData_MaskContainsExtension")); |
375 } | 380 } |
376 #endif | 381 #endif |
377 // If this fires, we added a new BrowsingDataHelper::OriginTypeMask without | 382 // If this fires, we added a new BrowsingDataHelper::OriginTypeMask without |
378 // updating the user metrics above. | 383 // updating the user metrics above. |
379 static_assert( | 384 static_assert( |
380 ALL_ORIGIN_TYPES == (BrowsingDataRemover::ORIGIN_TYPE_UNPROTECTED_WEB | | 385 ALL_ORIGIN_TYPES == |
| 386 (content::BrowsingDataRemover::ORIGIN_TYPE_UNPROTECTED_WEB | |
381 #if BUILDFLAG(ENABLE_EXTENSIONS) | 387 #if BUILDFLAG(ENABLE_EXTENSIONS) |
382 ORIGIN_TYPE_EXTENSION | | 388 ORIGIN_TYPE_EXTENSION | |
383 #endif | 389 #endif |
384 BrowsingDataRemover::ORIGIN_TYPE_PROTECTED_WEB), | 390 content::BrowsingDataRemover::ORIGIN_TYPE_PROTECTED_WEB), |
385 "OriginTypeMask has been updated without updating user metrics"); | 391 "OriginTypeMask has been updated without updating user metrics"); |
386 | 392 |
387 ////////////////////////////////////////////////////////////////////////////// | 393 ////////////////////////////////////////////////////////////////////////////// |
388 // INITIALIZATION | 394 // INITIALIZATION |
389 synchronous_clear_operations_.Start(); | 395 synchronous_clear_operations_.Start(); |
390 callback_ = callback; | 396 callback_ = callback; |
391 | 397 |
392 delete_begin_ = delete_begin; | 398 delete_begin_ = delete_begin; |
393 delete_end_ = delete_end; | 399 delete_end_ = delete_end; |
394 | 400 |
395 base::Callback<bool(const GURL& url)> filter = | 401 base::Callback<bool(const GURL& url)> filter = |
396 filter_builder.BuildGeneralFilter(); | 402 filter_builder.BuildGeneralFilter(); |
397 | 403 |
398 // Some backends support a filter that |is_null()| to make complete deletion | 404 // Some backends support a filter that |is_null()| to make complete deletion |
399 // more efficient. | 405 // more efficient. |
400 base::Callback<bool(const GURL&)> nullable_filter = | 406 base::Callback<bool(const GURL&)> nullable_filter = |
401 filter_builder.IsEmptyBlacklist() ? base::Callback<bool(const GURL&)>() | 407 filter_builder.IsEmptyBlacklist() ? base::Callback<bool(const GURL&)>() |
402 : filter; | 408 : filter; |
403 | 409 |
404 // Managed devices and supervised users can have restrictions on history | 410 // Managed devices and supervised users can have restrictions on history |
405 // deletion. | 411 // deletion. |
406 PrefService* prefs = profile_->GetPrefs(); | 412 PrefService* prefs = profile_->GetPrefs(); |
407 bool may_delete_history = prefs->GetBoolean( | 413 bool may_delete_history = prefs->GetBoolean( |
408 prefs::kAllowDeletingBrowserHistory); | 414 prefs::kAllowDeletingBrowserHistory); |
409 | 415 |
410 // All the UI entry points into the BrowsingDataRemoverImpl should be | 416 // All the UI entry points into the BrowsingDataRemoverImpl should be |
411 // disabled, but this will fire if something was missed or added. | 417 // disabled, but this will fire if something was missed or added. |
412 DCHECK(may_delete_history || | 418 DCHECK(may_delete_history || |
413 (remove_mask & BrowsingDataRemover::DATA_TYPE_NO_CHECKS) || | 419 (remove_mask & content::BrowsingDataRemover::DATA_TYPE_NO_CHECKS) || |
414 (!(remove_mask & DATA_TYPE_HISTORY) && | 420 (!(remove_mask & DATA_TYPE_HISTORY) && |
415 !(remove_mask & BrowsingDataRemover::DATA_TYPE_DOWNLOADS))); | 421 !(remove_mask & content::BrowsingDataRemover::DATA_TYPE_DOWNLOADS))); |
416 | 422 |
417 ////////////////////////////////////////////////////////////////////////////// | 423 ////////////////////////////////////////////////////////////////////////////// |
418 // DATA_TYPE_HISTORY | 424 // DATA_TYPE_HISTORY |
419 if ((remove_mask & DATA_TYPE_HISTORY) && may_delete_history) { | 425 if ((remove_mask & DATA_TYPE_HISTORY) && may_delete_history) { |
420 history::HistoryService* history_service = | 426 history::HistoryService* history_service = |
421 HistoryServiceFactory::GetForProfile( | 427 HistoryServiceFactory::GetForProfile( |
422 profile_, ServiceAccessType::EXPLICIT_ACCESS); | 428 profile_, ServiceAccessType::EXPLICIT_ACCESS); |
423 if (history_service) { | 429 if (history_service) { |
424 // TODO(dmurph): Support all backends with filter (crbug.com/113621). | 430 // TODO(dmurph): Support all backends with filter (crbug.com/113621). |
425 base::RecordAction(UserMetricsAction("ClearBrowsingData_History")); | 431 base::RecordAction(UserMetricsAction("ClearBrowsingData_History")); |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
636 if (profile_->GetSSLHostStateDelegate()) { | 642 if (profile_->GetSSLHostStateDelegate()) { |
637 profile_->GetSSLHostStateDelegate()->Clear( | 643 profile_->GetSSLHostStateDelegate()->Clear( |
638 filter_builder.IsEmptyBlacklist() | 644 filter_builder.IsEmptyBlacklist() |
639 ? base::Callback<bool(const std::string&)>() | 645 ? base::Callback<bool(const std::string&)>() |
640 : filter_builder.BuildPluginFilter()); | 646 : filter_builder.BuildPluginFilter()); |
641 } | 647 } |
642 } | 648 } |
643 | 649 |
644 ////////////////////////////////////////////////////////////////////////////// | 650 ////////////////////////////////////////////////////////////////////////////// |
645 // DATA_TYPE_DOWNLOADS | 651 // DATA_TYPE_DOWNLOADS |
646 if ((remove_mask & BrowsingDataRemover::DATA_TYPE_DOWNLOADS) && | 652 if ((remove_mask & content::BrowsingDataRemover::DATA_TYPE_DOWNLOADS) && |
647 may_delete_history) { | 653 may_delete_history) { |
648 DownloadPrefs* download_prefs = DownloadPrefs::FromDownloadManager( | 654 DownloadPrefs* download_prefs = DownloadPrefs::FromDownloadManager( |
649 BrowserContext::GetDownloadManager(profile_)); | 655 BrowserContext::GetDownloadManager(profile_)); |
650 download_prefs->SetSaveFilePath(download_prefs->DownloadPath()); | 656 download_prefs->SetSaveFilePath(download_prefs->DownloadPath()); |
651 } | 657 } |
652 | 658 |
653 ////////////////////////////////////////////////////////////////////////////// | 659 ////////////////////////////////////////////////////////////////////////////// |
654 // DATA_TYPE_COOKIES | 660 // DATA_TYPE_COOKIES |
655 // We ignore the DATA_TYPE_COOKIES request if UNPROTECTED_WEB is not set, | 661 // We ignore the DATA_TYPE_COOKIES request if UNPROTECTED_WEB is not set, |
656 // so that callers who request DATA_TYPE_SITE_DATA with PROTECTED_WEB | 662 // so that callers who request DATA_TYPE_SITE_DATA with PROTECTED_WEB |
657 // don't accidentally remove the cookies that are associated with the | 663 // don't accidentally remove the cookies that are associated with the |
658 // UNPROTECTED_WEB origin. This is necessary because cookies are not separated | 664 // UNPROTECTED_WEB origin. This is necessary because cookies are not separated |
659 // between UNPROTECTED_WEB and PROTECTED_WEB. | 665 // between UNPROTECTED_WEB and PROTECTED_WEB. |
660 if (remove_mask & BrowsingDataRemover::DATA_TYPE_COOKIES && | 666 if ((remove_mask & content::BrowsingDataRemover::DATA_TYPE_COOKIES) && |
661 origin_type_mask & BrowsingDataRemover::ORIGIN_TYPE_UNPROTECTED_WEB) { | 667 (origin_type_mask & |
| 668 content::BrowsingDataRemover::ORIGIN_TYPE_UNPROTECTED_WEB)) { |
662 base::RecordAction(UserMetricsAction("ClearBrowsingData_Cookies")); | 669 base::RecordAction(UserMetricsAction("ClearBrowsingData_Cookies")); |
663 | 670 |
664 // Clear the safebrowsing cookies only if time period is for "all time". It | 671 // Clear the safebrowsing cookies only if time period is for "all time". It |
665 // doesn't make sense to apply the time period of deleting in the last X | 672 // doesn't make sense to apply the time period of deleting in the last X |
666 // hours/days to the safebrowsing cookies since they aren't the result of | 673 // hours/days to the safebrowsing cookies since they aren't the result of |
667 // any user action. | 674 // any user action. |
668 if (delete_begin_ == base::Time()) { | 675 if (delete_begin_ == base::Time()) { |
669 safe_browsing::SafeBrowsingService* sb_service = | 676 safe_browsing::SafeBrowsingService* sb_service = |
670 g_browser_process->safe_browsing_service(); | 677 g_browser_process->safe_browsing_service(); |
671 if (sb_service) { | 678 if (sb_service) { |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
748 BrowserContext::GetDefaultStoragePartition(profile_) | 755 BrowserContext::GetDefaultStoragePartition(profile_) |
749 ->GetURLRequestContext(); | 756 ->GetURLRequestContext(); |
750 clear_http_auth_cache_.Start(); | 757 clear_http_auth_cache_.Start(); |
751 BrowserThread::PostTaskAndReply( | 758 BrowserThread::PostTaskAndReply( |
752 BrowserThread::IO, FROM_HERE, | 759 BrowserThread::IO, FROM_HERE, |
753 base::Bind(&ClearHttpAuthCacheOnIOThread, std::move(request_context), | 760 base::Bind(&ClearHttpAuthCacheOnIOThread, std::move(request_context), |
754 delete_begin_), | 761 delete_begin_), |
755 clear_http_auth_cache_.GetCompletionCallback()); | 762 clear_http_auth_cache_.GetCompletionCallback()); |
756 } | 763 } |
757 | 764 |
758 if (remove_mask & BrowsingDataRemover::DATA_TYPE_COOKIES) { | 765 if (remove_mask & content::BrowsingDataRemover::DATA_TYPE_COOKIES) { |
759 password_manager::PasswordStore* password_store = | 766 password_manager::PasswordStore* password_store = |
760 PasswordStoreFactory::GetForProfile(profile_, | 767 PasswordStoreFactory::GetForProfile(profile_, |
761 ServiceAccessType::EXPLICIT_ACCESS) | 768 ServiceAccessType::EXPLICIT_ACCESS) |
762 .get(); | 769 .get(); |
763 | 770 |
764 if (password_store) { | 771 if (password_store) { |
765 clear_auto_sign_in_.Start(); | 772 clear_auto_sign_in_.Start(); |
766 password_store->DisableAutoSignInForOrigins( | 773 password_store->DisableAutoSignInForOrigins( |
767 filter, clear_auto_sign_in_.GetCompletionCallback()); | 774 filter, clear_auto_sign_in_.GetCompletionCallback()); |
768 } | 775 } |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
804 | 811 |
805 autofill::PersonalDataManager* data_manager = | 812 autofill::PersonalDataManager* data_manager = |
806 autofill::PersonalDataManagerFactory::GetForProfile(profile_); | 813 autofill::PersonalDataManagerFactory::GetForProfile(profile_); |
807 if (data_manager) | 814 if (data_manager) |
808 data_manager->Refresh(); | 815 data_manager->Refresh(); |
809 } | 816 } |
810 } | 817 } |
811 | 818 |
812 ////////////////////////////////////////////////////////////////////////////// | 819 ////////////////////////////////////////////////////////////////////////////// |
813 // DATA_TYPE_CACHE | 820 // DATA_TYPE_CACHE |
814 if (remove_mask & BrowsingDataRemover::DATA_TYPE_CACHE) { | 821 if (remove_mask & content::BrowsingDataRemover::DATA_TYPE_CACHE) { |
815 // Tell the renderers to clear their cache. | 822 // Tell the renderers to clear their cache. |
816 // TODO(crbug.com/668114): Renderer cache is a platform concept, and should | 823 // TODO(crbug.com/668114): Renderer cache is a platform concept, and should |
817 // live in BrowsingDataRemoverImpl. However, WebCacheManager itself is | 824 // live in BrowsingDataRemoverImpl. However, WebCacheManager itself is |
818 // a component with dependency on content/browser. Untangle these | 825 // a component with dependency on content/browser. Untangle these |
819 // dependencies or reimplement the relevant part of WebCacheManager | 826 // dependencies or reimplement the relevant part of WebCacheManager |
820 // in content/browser. | 827 // in content/browser. |
821 web_cache::WebCacheManager::GetInstance()->ClearCache(); | 828 web_cache::WebCacheManager::GetInstance()->ClearCache(); |
822 | 829 |
823 #if !defined(DISABLE_NACL) | 830 #if !defined(DISABLE_NACL) |
824 clear_nacl_cache_.Start(); | 831 clear_nacl_cache_.Start(); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
868 // Network Quality Estimator (NQE) stores the quality (RTT, bandwidth | 875 // Network Quality Estimator (NQE) stores the quality (RTT, bandwidth |
869 // etc.) of different networks in prefs. The stored quality is not | 876 // etc.) of different networks in prefs. The stored quality is not |
870 // broken down by URLs or timestamps, so clearing the cache should | 877 // broken down by URLs or timestamps, so clearing the cache should |
871 // completely clear the prefs. | 878 // completely clear the prefs. |
872 ui_nqe_service->ClearPrefs(); | 879 ui_nqe_service->ClearPrefs(); |
873 } | 880 } |
874 | 881 |
875 #if defined(OS_ANDROID) | 882 #if defined(OS_ANDROID) |
876 // For now we're considering offline pages as cache, so if we're removing | 883 // For now we're considering offline pages as cache, so if we're removing |
877 // cache we should remove offline pages as well. | 884 // cache we should remove offline pages as well. |
878 if ((remove_mask & BrowsingDataRemover::DATA_TYPE_CACHE)) { | 885 if ((remove_mask & content::BrowsingDataRemover::DATA_TYPE_CACHE)) { |
879 clear_offline_page_data_.Start(); | 886 clear_offline_page_data_.Start(); |
880 offline_pages::OfflinePageModelFactory::GetForBrowserContext(profile_) | 887 offline_pages::OfflinePageModelFactory::GetForBrowserContext(profile_) |
881 ->DeleteCachedPagesByURLPredicate( | 888 ->DeleteCachedPagesByURLPredicate( |
882 filter, | 889 filter, |
883 IgnoreArgument<offline_pages::OfflinePageModel::DeletePageResult>( | 890 IgnoreArgument<offline_pages::OfflinePageModel::DeletePageResult>( |
884 clear_offline_page_data_.GetCompletionCallback())); | 891 clear_offline_page_data_.GetCompletionCallback())); |
885 } | 892 } |
886 #endif | 893 #endif |
887 } | 894 } |
888 | 895 |
889 ////////////////////////////////////////////////////////////////////////////// | 896 ////////////////////////////////////////////////////////////////////////////// |
890 // DATA_TYPE_PLUGINS | 897 // DATA_TYPE_PLUGINS |
891 // Plugins are known to //content and their bulk deletion is implemented in | 898 // Plugins are known to //content and their bulk deletion is implemented in |
892 // PluginDataRemover. However, the filtered deletion uses | 899 // PluginDataRemover. However, the filtered deletion uses |
893 // BrowsingDataFlashLSOHelper which (currently) has strong dependencies | 900 // BrowsingDataFlashLSOHelper which (currently) has strong dependencies |
894 // on //chrome. | 901 // on //chrome. |
895 // TODO(msramek): Investigate these dependencies and move the plugin deletion | 902 // TODO(msramek): Investigate these dependencies and move the plugin deletion |
896 // to BrowsingDataRemoverImpl in //content. Note that code in //content | 903 // to BrowsingDataRemoverImpl in //content. Note that code in //content |
897 // can simply take advantage of PluginDataRemover directly to delete plugin | 904 // can simply take advantage of PluginDataRemover directly to delete plugin |
898 // data in bulk. | 905 // data in bulk. |
899 #if BUILDFLAG(ENABLE_PLUGINS) | 906 #if BUILDFLAG(ENABLE_PLUGINS) |
900 // Plugin is data not separated for protected and unprotected web origins. We | 907 // Plugin is data not separated for protected and unprotected web origins. We |
901 // check the origin_type_mask_ to prevent unintended deletion. | 908 // check the origin_type_mask_ to prevent unintended deletion. |
902 if (remove_mask & DATA_TYPE_PLUGIN_DATA && | 909 if ((remove_mask & DATA_TYPE_PLUGIN_DATA) && |
903 origin_type_mask & BrowsingDataRemover::ORIGIN_TYPE_UNPROTECTED_WEB) { | 910 (origin_type_mask & |
| 911 content::BrowsingDataRemover::ORIGIN_TYPE_UNPROTECTED_WEB)) { |
904 base::RecordAction(UserMetricsAction("ClearBrowsingData_LSOData")); | 912 base::RecordAction(UserMetricsAction("ClearBrowsingData_LSOData")); |
905 clear_plugin_data_count_ = 1; | 913 clear_plugin_data_count_ = 1; |
906 | 914 |
907 if (filter_builder.IsEmptyBlacklist()) { | 915 if (filter_builder.IsEmptyBlacklist()) { |
908 DCHECK(!plugin_data_remover_); | 916 DCHECK(!plugin_data_remover_); |
909 plugin_data_remover_.reset( | 917 plugin_data_remover_.reset( |
910 content::PluginDataRemover::Create(profile_)); | 918 content::PluginDataRemover::Create(profile_)); |
911 base::WaitableEvent* event = | 919 base::WaitableEvent* event = |
912 plugin_data_remover_->StartRemoving(delete_begin_); | 920 plugin_data_remover_->StartRemoving(delete_begin_); |
913 | 921 |
914 base::WaitableEventWatcher::EventCallback watcher_callback = base::Bind( | 922 base::WaitableEventWatcher::EventCallback watcher_callback = base::Bind( |
915 &ChromeBrowsingDataRemoverDelegate::OnWaitableEventSignaled, | 923 &ChromeBrowsingDataRemoverDelegate::OnWaitableEventSignaled, |
916 weak_ptr_factory_.GetWeakPtr()); | 924 weak_ptr_factory_.GetWeakPtr()); |
917 watcher_.StartWatching(event, std::move(watcher_callback)); | 925 watcher_.StartWatching(event, std::move(watcher_callback)); |
918 } else { | 926 } else { |
919 // TODO(msramek): Store filters from the currently executed task on the | 927 // TODO(msramek): Store filters from the currently executed task on the |
920 // object to avoid having to copy them to callback methods. | 928 // object to avoid having to copy them to callback methods. |
921 flash_lso_helper_->StartFetching(base::Bind( | 929 flash_lso_helper_->StartFetching(base::Bind( |
922 &ChromeBrowsingDataRemoverDelegate::OnSitesWithFlashDataFetched, | 930 &ChromeBrowsingDataRemoverDelegate::OnSitesWithFlashDataFetched, |
923 weak_ptr_factory_.GetWeakPtr(), | 931 weak_ptr_factory_.GetWeakPtr(), |
924 filter_builder.BuildPluginFilter())); | 932 filter_builder.BuildPluginFilter())); |
925 } | 933 } |
926 } | 934 } |
927 #endif | 935 #endif |
928 | 936 |
929 ////////////////////////////////////////////////////////////////////////////// | 937 ////////////////////////////////////////////////////////////////////////////// |
930 // DATA_TYPE_MEDIA_LICENSES | 938 // DATA_TYPE_MEDIA_LICENSES |
931 if (remove_mask & BrowsingDataRemover::DATA_TYPE_MEDIA_LICENSES) { | 939 if (remove_mask & content::BrowsingDataRemover::DATA_TYPE_MEDIA_LICENSES) { |
932 // TODO(jrummell): This UMA should be renamed to indicate it is for Media | 940 // TODO(jrummell): This UMA should be renamed to indicate it is for Media |
933 // Licenses. | 941 // Licenses. |
934 base::RecordAction(UserMetricsAction("ClearBrowsingData_ContentLicenses")); | 942 base::RecordAction(UserMetricsAction("ClearBrowsingData_ContentLicenses")); |
935 | 943 |
936 #if BUILDFLAG(ENABLE_PLUGINS) | 944 #if BUILDFLAG(ENABLE_PLUGINS) |
937 clear_flash_content_licenses_.Start(); | 945 clear_flash_content_licenses_.Start(); |
938 if (!pepper_flash_settings_manager_.get()) { | 946 if (!pepper_flash_settings_manager_.get()) { |
939 pepper_flash_settings_manager_.reset( | 947 pepper_flash_settings_manager_.reset( |
940 new PepperFlashSettingsManager(this, profile_)); | 948 new PepperFlashSettingsManager(this, profile_)); |
941 } | 949 } |
(...skipping 20 matching lines...) Expand all Loading... |
962 weak_ptr_factory_.GetWeakPtr())); | 970 weak_ptr_factory_.GetWeakPtr())); |
963 } | 971 } |
964 #endif // defined(OS_CHROMEOS) | 972 #endif // defined(OS_CHROMEOS) |
965 } | 973 } |
966 | 974 |
967 ////////////////////////////////////////////////////////////////////////////// | 975 ////////////////////////////////////////////////////////////////////////////// |
968 // Zero suggest. | 976 // Zero suggest. |
969 // Remove omnibox zero-suggest cache results. Filtering is not supported. | 977 // Remove omnibox zero-suggest cache results. Filtering is not supported. |
970 // This is not a problem, as deleting more data than necessary will just cause | 978 // This is not a problem, as deleting more data than necessary will just cause |
971 // another server round-trip; no data is actually lost. | 979 // another server round-trip; no data is actually lost. |
972 if ((remove_mask & (BrowsingDataRemover::DATA_TYPE_CACHE | | 980 if ((remove_mask & (content::BrowsingDataRemover::DATA_TYPE_CACHE | |
973 BrowsingDataRemover::DATA_TYPE_COOKIES))) { | 981 content::BrowsingDataRemover::DATA_TYPE_COOKIES))) { |
974 prefs->SetString(omnibox::kZeroSuggestCachedResults, std::string()); | 982 prefs->SetString(omnibox::kZeroSuggestCachedResults, std::string()); |
975 } | 983 } |
976 | 984 |
977 ////////////////////////////////////////////////////////////////////////////// | 985 ////////////////////////////////////////////////////////////////////////////// |
978 // Domain reliability service. | 986 // Domain reliability service. |
979 if (remove_mask & | 987 if (remove_mask & |
980 (BrowsingDataRemover::DATA_TYPE_COOKIES | DATA_TYPE_HISTORY)) { | 988 (content::BrowsingDataRemover::DATA_TYPE_COOKIES | DATA_TYPE_HISTORY)) { |
981 domain_reliability::DomainReliabilityService* service = | 989 domain_reliability::DomainReliabilityService* service = |
982 domain_reliability::DomainReliabilityServiceFactory:: | 990 domain_reliability::DomainReliabilityServiceFactory:: |
983 GetForBrowserContext(profile_); | 991 GetForBrowserContext(profile_); |
984 if (service) { | 992 if (service) { |
985 domain_reliability::DomainReliabilityClearMode mode; | 993 domain_reliability::DomainReliabilityClearMode mode; |
986 if (remove_mask & BrowsingDataRemover::DATA_TYPE_COOKIES) | 994 if (remove_mask & content::BrowsingDataRemover::DATA_TYPE_COOKIES) |
987 mode = domain_reliability::CLEAR_CONTEXTS; | 995 mode = domain_reliability::CLEAR_CONTEXTS; |
988 else | 996 else |
989 mode = domain_reliability::CLEAR_BEACONS; | 997 mode = domain_reliability::CLEAR_BEACONS; |
990 | 998 |
991 clear_domain_reliability_monitor_.Start(); | 999 clear_domain_reliability_monitor_.Start(); |
992 service->ClearBrowsingData( | 1000 service->ClearBrowsingData( |
993 mode, | 1001 mode, |
994 filter, | 1002 filter, |
995 clear_domain_reliability_monitor_.GetCompletionCallback()); | 1003 clear_domain_reliability_monitor_.GetCompletionCallback()); |
996 } | 1004 } |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1134 } | 1142 } |
1135 | 1143 |
1136 void ChromeBrowsingDataRemoverDelegate:: | 1144 void ChromeBrowsingDataRemoverDelegate:: |
1137 OnDeauthorizeFlashContentLicensesCompleted( | 1145 OnDeauthorizeFlashContentLicensesCompleted( |
1138 uint32_t request_id, | 1146 uint32_t request_id, |
1139 bool /* success */) { | 1147 bool /* success */) { |
1140 DCHECK_EQ(request_id, deauthorize_flash_content_licenses_request_id_); | 1148 DCHECK_EQ(request_id, deauthorize_flash_content_licenses_request_id_); |
1141 clear_flash_content_licenses_.GetCompletionCallback().Run(); | 1149 clear_flash_content_licenses_.GetCompletionCallback().Run(); |
1142 } | 1150 } |
1143 #endif | 1151 #endif |
OLD | NEW |