Chromium Code Reviews| 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 #include "chrome/browser/browsing_data/browsing_data_remover.h" | 5 #include "chrome/browser/browsing_data/browsing_data_remover.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| 11 | 11 |
| 12 #include "base/bind.h" | 12 #include "base/bind.h" |
| 13 #include "base/bind_helpers.h" | 13 #include "base/bind_helpers.h" |
| 14 #include "base/callback.h" | 14 #include "base/callback.h" |
| 15 #include "base/logging.h" | 15 #include "base/logging.h" |
| 16 #include "base/metrics/histogram_macros.h" | 16 #include "base/metrics/histogram_macros.h" |
| 17 #include "build/build_config.h" | 17 #include "build/build_config.h" |
| 18 #include "chrome/browser/autofill/personal_data_manager_factory.h" | 18 #include "chrome/browser/autofill/personal_data_manager_factory.h" |
| 19 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | |
| 19 #include "chrome/browser/browser_process.h" | 20 #include "chrome/browser/browser_process.h" |
| 20 #include "chrome/browser/browsing_data/browsing_data_filter_builder.h" | 21 #include "chrome/browser/browsing_data/browsing_data_filter_builder.h" |
| 21 #include "chrome/browser/browsing_data/browsing_data_helper.h" | 22 #include "chrome/browser/browsing_data/browsing_data_helper.h" |
| 22 #include "chrome/browser/browsing_data/browsing_data_remover_factory.h" | 23 #include "chrome/browser/browsing_data/browsing_data_remover_factory.h" |
| 23 #include "chrome/browser/browsing_data/registrable_domain_filter_builder.h" | 24 #include "chrome/browser/browsing_data/registrable_domain_filter_builder.h" |
| 24 #include "chrome/browser/chrome_notification_types.h" | 25 #include "chrome/browser/chrome_notification_types.h" |
| 25 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" | 26 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" |
| 26 #include "chrome/browser/domain_reliability/service_factory.h" | 27 #include "chrome/browser/domain_reliability/service_factory.h" |
| 27 #include "chrome/browser/download/download_prefs.h" | 28 #include "chrome/browser/download/download_prefs.h" |
| 28 #include "chrome/browser/history/history_service_factory.h" | 29 #include "chrome/browser/history/history_service_factory.h" |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 44 #include "chrome/browser/profiles/profile.h" | 45 #include "chrome/browser/profiles/profile.h" |
| 45 #include "chrome/browser/safe_browsing/safe_browsing_service.h" | 46 #include "chrome/browser/safe_browsing/safe_browsing_service.h" |
| 46 #include "chrome/browser/search_engines/template_url_service_factory.h" | 47 #include "chrome/browser/search_engines/template_url_service_factory.h" |
| 47 #include "chrome/browser/sessions/tab_restore_service_factory.h" | 48 #include "chrome/browser/sessions/tab_restore_service_factory.h" |
| 48 #include "chrome/browser/web_data_service_factory.h" | 49 #include "chrome/browser/web_data_service_factory.h" |
| 49 #include "chrome/common/features.h" | 50 #include "chrome/common/features.h" |
| 50 #include "chrome/common/pref_names.h" | 51 #include "chrome/common/pref_names.h" |
| 51 #include "chrome/common/url_constants.h" | 52 #include "chrome/common/url_constants.h" |
| 52 #include "components/autofill/core/browser/personal_data_manager.h" | 53 #include "components/autofill/core/browser/personal_data_manager.h" |
| 53 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" | 54 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" |
| 55 #include "components/bookmarks/browser/bookmark_model.h" | |
| 54 #include "components/browsing_data/content/storage_partition_http_cache_data_rem over.h" | 56 #include "components/browsing_data/content/storage_partition_http_cache_data_rem over.h" |
| 55 #include "components/content_settings/core/browser/host_content_settings_map.h" | 57 #include "components/content_settings/core/browser/host_content_settings_map.h" |
| 56 #include "components/content_settings/core/common/content_settings.h" | 58 #include "components/content_settings/core/common/content_settings.h" |
| 57 #include "components/content_settings/core/common/content_settings_pattern.h" | 59 #include "components/content_settings/core/common/content_settings_pattern.h" |
| 58 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_comp ression_stats.h" | 60 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_comp ression_stats.h" |
| 59 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_serv ice.h" | 61 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_serv ice.h" |
| 60 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_sett ings.h" | 62 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_sett ings.h" |
| 61 #include "components/domain_reliability/service.h" | 63 #include "components/domain_reliability/service.h" |
| 62 #include "components/history/core/browser/history_service.h" | 64 #include "components/history/core/browser/history_service.h" |
| 63 #include "components/nacl/browser/nacl_browser.h" | 65 #include "components/nacl/browser/nacl_browser.h" |
| 64 #include "components/nacl/browser/pnacl_host.h" | 66 #include "components/nacl/browser/pnacl_host.h" |
| 67 #include "components/ntp_snippets/bookmarks/bookmark_last_visit_utils.h" | |
| 65 #include "components/ntp_snippets/content_suggestions_service.h" | 68 #include "components/ntp_snippets/content_suggestions_service.h" |
| 66 #include "components/omnibox/browser/omnibox_pref_names.h" | 69 #include "components/omnibox/browser/omnibox_pref_names.h" |
| 67 #include "components/password_manager/core/browser/password_store.h" | 70 #include "components/password_manager/core/browser/password_store.h" |
| 68 #include "components/prefs/pref_service.h" | 71 #include "components/prefs/pref_service.h" |
| 69 #include "components/previews/core/previews_ui_service.h" | 72 #include "components/previews/core/previews_ui_service.h" |
| 70 #include "components/search_engines/template_url_service.h" | 73 #include "components/search_engines/template_url_service.h" |
| 71 #include "components/sessions/core/tab_restore_service.h" | 74 #include "components/sessions/core/tab_restore_service.h" |
| 72 #include "components/web_cache/browser/web_cache_manager.h" | 75 #include "components/web_cache/browser/web_cache_manager.h" |
| 73 #include "content/public/browser/browser_thread.h" | 76 #include "content/public/browser/browser_thread.h" |
| 74 #include "content/public/browser/download_manager.h" | 77 #include "content/public/browser/download_manager.h" |
| (...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 521 content::RecordAction(UserMetricsAction("ClearBrowsingData_History")); | 524 content::RecordAction(UserMetricsAction("ClearBrowsingData_History")); |
| 522 waiting_for_clear_history_ = true; | 525 waiting_for_clear_history_ = true; |
| 523 history_service->ExpireLocalAndRemoteHistoryBetween( | 526 history_service->ExpireLocalAndRemoteHistoryBetween( |
| 524 WebHistoryServiceFactory::GetForProfile(profile_), std::set<GURL>(), | 527 WebHistoryServiceFactory::GetForProfile(profile_), std::set<GURL>(), |
| 525 delete_begin_, delete_end_, | 528 delete_begin_, delete_end_, |
| 526 base::Bind(&BrowsingDataRemover::OnHistoryDeletionDone, | 529 base::Bind(&BrowsingDataRemover::OnHistoryDeletionDone, |
| 527 weak_ptr_factory_.GetWeakPtr()), | 530 weak_ptr_factory_.GetWeakPtr()), |
| 528 &history_task_tracker_); | 531 &history_task_tracker_); |
| 529 } | 532 } |
| 530 | 533 |
| 534 // Currently, ContentSuggestionService instance exists only on Android. | |
| 531 ntp_snippets::ContentSuggestionsService* content_suggestions_service = | 535 ntp_snippets::ContentSuggestionsService* content_suggestions_service = |
| 532 ContentSuggestionsServiceFactory::GetForProfileIfExists(profile_); | 536 ContentSuggestionsServiceFactory::GetForProfileIfExists(profile_); |
| 533 if (content_suggestions_service) { | 537 if (content_suggestions_service) { |
| 534 content_suggestions_service->ClearHistory(delete_begin_, delete_end_, | 538 content_suggestions_service->ClearHistory(delete_begin_, delete_end_, |
| 535 filter); | 539 filter); |
| 536 } | 540 } |
| 537 | 541 |
| 542 // Remove the last visit dates meta-data from the bookmark model. | |
| 543 // TODO(vitaliii): Do not remove all dates, but only the ones matched by the | |
| 544 // time range and the filter. | |
| 545 bookmarks::BookmarkModel* bookmark_model; | |
|
tschumann
2016/12/12 20:03:34
this seems quite heavy-handed. I wonder why someth
jkrcal
2016/12/13 08:58:35
Oh, cool, I could not find this! Thanks!
| |
| 546 if (bookmark_model_for_testing_) | |
| 547 bookmark_model = bookmark_model_for_testing_; | |
| 548 else | |
| 549 bookmark_model = BookmarkModelFactory::GetForBrowserContext(profile_); | |
| 550 | |
| 551 if (bookmark_model) | |
| 552 ntp_snippets::RemoveAllLastVisitDates(bookmark_model); | |
| 553 | |
| 538 #if BUILDFLAG(ENABLE_EXTENSIONS) | 554 #if BUILDFLAG(ENABLE_EXTENSIONS) |
| 539 // The extension activity log contains details of which websites extensions | 555 // The extension activity log contains details of which websites extensions |
| 540 // were active on. It therefore indirectly stores details of websites a | 556 // were active on. It therefore indirectly stores details of websites a |
| 541 // user has visited so best clean from here as well. | 557 // user has visited so best clean from here as well. |
| 542 // TODO(msramek): Support all backends with filter (crbug.com/589586). | 558 // TODO(msramek): Support all backends with filter (crbug.com/589586). |
| 543 extensions::ActivityLog::GetInstance(profile_)->RemoveURLs( | 559 extensions::ActivityLog::GetInstance(profile_)->RemoveURLs( |
| 544 std::set<GURL>()); | 560 std::set<GURL>()); |
| 545 | 561 |
| 546 // Clear launch times as they are a form of history. | 562 // Clear launch times as they are a form of history. |
| 547 // BrowsingDataFilterBuilder currently doesn't support extension origins. | 563 // BrowsingDataFilterBuilder currently doesn't support extension origins. |
| (...skipping 991 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1539 waiting_for_clear_offline_page_data_ = false; | 1555 waiting_for_clear_offline_page_data_ = false; |
| 1540 NotifyIfDone(); | 1556 NotifyIfDone(); |
| 1541 } | 1557 } |
| 1542 #endif | 1558 #endif |
| 1543 | 1559 |
| 1544 void BrowsingDataRemover::OnClearedDomainReliabilityMonitor() { | 1560 void BrowsingDataRemover::OnClearedDomainReliabilityMonitor() { |
| 1545 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 1561 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 1546 waiting_for_clear_domain_reliability_monitor_ = false; | 1562 waiting_for_clear_domain_reliability_monitor_ = false; |
| 1547 NotifyIfDone(); | 1563 NotifyIfDone(); |
| 1548 } | 1564 } |
| OLD | NEW |