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

Side by Side Diff: chrome/browser/browsing_data/browsing_data_remover.cc

Issue 2566123002: Last visit dates of bookmarks - fix browsing data removal on desktop (Closed)
Patch Set: Created 4 years 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
« no previous file with comments | « no previous file | components/ntp_snippets/bookmarks/bookmark_suggestions_provider.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #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
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 453 matching lines...) Expand 10 before | Expand all | Expand 10 after
528 &history_task_tracker_); 531 &history_task_tracker_);
529 } 532 }
530 533
531 ntp_snippets::ContentSuggestionsService* content_suggestions_service = 534 ntp_snippets::ContentSuggestionsService* content_suggestions_service =
532 ContentSuggestionsServiceFactory::GetForProfileIfExists(profile_); 535 ContentSuggestionsServiceFactory::GetForProfileIfExists(profile_);
533 if (content_suggestions_service) { 536 if (content_suggestions_service) {
534 content_suggestions_service->ClearHistory(delete_begin_, delete_end_, 537 content_suggestions_service->ClearHistory(delete_begin_, delete_end_,
535 filter); 538 filter);
536 } 539 }
537 540
541 // Remove the last visit dates meta-data from the bookmark model.
542 // TODO(vitaliii): Do not remove all dates, but only the ones matched by the
543 // time range and the filter.
544 bookmarks::BookmarkModel* bookmark_model =
545 BookmarkModelFactory::GetForBrowserContext(profile_);
546 ntp_snippets::RemoveAllLastVisitDates(bookmark_model);
tschumann 2016/12/12 13:26:18 should we handle nullptr? seems safer...
msramek 2016/12/12 13:33:40 +1 Also, please add a unittest; that should not h
jkrcal 2016/12/12 19:22:04 True. Definitely safer.
jkrcal 2016/12/12 19:22:04 Hmm, I tried hard, the cost for the unit-test is q
547
538 #if BUILDFLAG(ENABLE_EXTENSIONS) 548 #if BUILDFLAG(ENABLE_EXTENSIONS)
539 // The extension activity log contains details of which websites extensions 549 // The extension activity log contains details of which websites extensions
540 // were active on. It therefore indirectly stores details of websites a 550 // were active on. It therefore indirectly stores details of websites a
541 // user has visited so best clean from here as well. 551 // user has visited so best clean from here as well.
542 // TODO(msramek): Support all backends with filter (crbug.com/589586). 552 // TODO(msramek): Support all backends with filter (crbug.com/589586).
543 extensions::ActivityLog::GetInstance(profile_)->RemoveURLs( 553 extensions::ActivityLog::GetInstance(profile_)->RemoveURLs(
544 std::set<GURL>()); 554 std::set<GURL>());
545 555
546 // Clear launch times as they are a form of history. 556 // Clear launch times as they are a form of history.
547 // BrowsingDataFilterBuilder currently doesn't support extension origins. 557 // BrowsingDataFilterBuilder currently doesn't support extension origins.
(...skipping 991 matching lines...) Expand 10 before | Expand all | Expand 10 after
1539 waiting_for_clear_offline_page_data_ = false; 1549 waiting_for_clear_offline_page_data_ = false;
1540 NotifyIfDone(); 1550 NotifyIfDone();
1541 } 1551 }
1542 #endif 1552 #endif
1543 1553
1544 void BrowsingDataRemover::OnClearedDomainReliabilityMonitor() { 1554 void BrowsingDataRemover::OnClearedDomainReliabilityMonitor() {
1545 DCHECK_CURRENTLY_ON(BrowserThread::UI); 1555 DCHECK_CURRENTLY_ON(BrowserThread::UI);
1546 waiting_for_clear_domain_reliability_monitor_ = false; 1556 waiting_for_clear_domain_reliability_monitor_ = false;
1547 NotifyIfDone(); 1557 NotifyIfDone();
1548 } 1558 }
OLDNEW
« no previous file with comments | « no previous file | components/ntp_snippets/bookmarks/bookmark_suggestions_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698