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