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/ui/webui/history_ui.h" | 5 #include "chrome/browser/ui/webui/history_ui.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
12 #include "base/i18n/rtl.h" | 12 #include "base/i18n/rtl.h" |
13 #include "base/i18n/time_formatting.h" | 13 #include "base/i18n/time_formatting.h" |
14 #include "base/memory/singleton.h" | 14 #include "base/memory/singleton.h" |
15 #include "base/message_loop/message_loop.h" | 15 #include "base/message_loop/message_loop.h" |
16 #include "base/metrics/histogram.h" | 16 #include "base/metrics/histogram.h" |
17 #include "base/prefs/pref_service.h" | 17 #include "base/prefs/pref_service.h" |
18 #include "base/strings/string16.h" | 18 #include "base/strings/string16.h" |
19 #include "base/strings/string_number_conversions.h" | 19 #include "base/strings/string_number_conversions.h" |
20 #include "base/strings/utf_string_conversions.h" | 20 #include "base/strings/utf_string_conversions.h" |
21 #include "base/time/time.h" | 21 #include "base/time/time.h" |
22 #include "base/values.h" | 22 #include "base/values.h" |
23 #include "chrome/browser/bookmarks/bookmark_model.h" | 23 #include "chrome/browser/bookmarks/bookmark_model.h" |
24 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 24 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
25 #include "chrome/browser/bookmarks/bookmark_utils.h" | 25 #include "chrome/browser/bookmarks/bookmark_utils.h" |
26 #include "chrome/browser/chrome_notification_types.h" | 26 #include "chrome/browser/chrome_notification_types.h" |
27 #include "chrome/browser/extensions/activity_log/activity_log.h" | |
27 #include "chrome/browser/history/history_notifications.h" | 28 #include "chrome/browser/history/history_notifications.h" |
28 #include "chrome/browser/history/history_service_factory.h" | 29 #include "chrome/browser/history/history_service_factory.h" |
29 #include "chrome/browser/history/history_types.h" | 30 #include "chrome/browser/history/history_types.h" |
30 #include "chrome/browser/history/web_history_service.h" | 31 #include "chrome/browser/history/web_history_service.h" |
31 #include "chrome/browser/history/web_history_service_factory.h" | 32 #include "chrome/browser/history/web_history_service_factory.h" |
32 #include "chrome/browser/profiles/profile.h" | 33 #include "chrome/browser/profiles/profile.h" |
33 #include "chrome/browser/search/search.h" | 34 #include "chrome/browser/search/search.h" |
34 #include "chrome/browser/sync/glue/device_info.h" | 35 #include "chrome/browser/sync/glue/device_info.h" |
35 #include "chrome/browser/sync/profile_sync_service.h" | 36 #include "chrome/browser/sync/profile_sync_service.h" |
36 #include "chrome/browser/sync/profile_sync_service_factory.h" | 37 #include "chrome/browser/sync/profile_sync_service_factory.h" |
(...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
610 base::Bind(&BrowsingHistoryHandler::RemoveComplete, | 611 base::Bind(&BrowsingHistoryHandler::RemoveComplete, |
611 base::Unretained(this)), | 612 base::Unretained(this)), |
612 &delete_task_tracker_); | 613 &delete_task_tracker_); |
613 | 614 |
614 if (web_history) { | 615 if (web_history) { |
615 web_history_delete_request_ = web_history->ExpireHistory( | 616 web_history_delete_request_ = web_history->ExpireHistory( |
616 expire_list, | 617 expire_list, |
617 base::Bind(&BrowsingHistoryHandler::RemoveWebHistoryComplete, | 618 base::Bind(&BrowsingHistoryHandler::RemoveWebHistoryComplete, |
618 base::Unretained(this))); | 619 base::Unretained(this))); |
619 } | 620 } |
621 | |
622 // If the profile has activity logging enabled also clean up any URLs from | |
623 // the extension activity log. The extension activity log contains URLS | |
624 // which websites an extension has activity on so it will indirectly | |
625 // contain websites that a user has visited. | |
626 extensions::ActivityLog* activity_log = extensions::ActivityLog::GetInstance( | |
Bernhard Bauer
2013/09/03 21:55:42
Nit: This might look a bit nicer if you break afte
karenlees
2013/09/04 21:35:05
Done.
| |
627 profile); | |
628 if (activity_log) { | |
629 for (std::vector<history::ExpireHistoryArgs>::const_iterator it = | |
630 expire_list.begin(); it != expire_list.end(); ++it) { | |
631 activity_log->RemoveURLs(it->urls); | |
632 } | |
633 } | |
620 } | 634 } |
621 | 635 |
622 void BrowsingHistoryHandler::HandleClearBrowsingData(const ListValue* args) { | 636 void BrowsingHistoryHandler::HandleClearBrowsingData(const ListValue* args) { |
623 #if defined(OS_ANDROID) | 637 #if defined(OS_ANDROID) |
624 Profile* profile = Profile::FromWebUI(web_ui()); | 638 Profile* profile = Profile::FromWebUI(web_ui()); |
625 const TabModel* tab_model = | 639 const TabModel* tab_model = |
626 TabModelList::GetTabModelWithProfile(profile); | 640 TabModelList::GetTabModelWithProfile(profile); |
627 if (tab_model) | 641 if (tab_model) |
628 tab_model->OpenClearBrowsingData(); | 642 tab_model->OpenClearBrowsingData(); |
629 #else | 643 #else |
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
983 return GURL(std::string(chrome::kChromeUIHistoryURL) + "#q=" + | 997 return GURL(std::string(chrome::kChromeUIHistoryURL) + "#q=" + |
984 net::EscapeQueryParamValue(UTF16ToUTF8(text), true)); | 998 net::EscapeQueryParamValue(UTF16ToUTF8(text), true)); |
985 } | 999 } |
986 | 1000 |
987 // static | 1001 // static |
988 base::RefCountedMemory* HistoryUI::GetFaviconResourceBytes( | 1002 base::RefCountedMemory* HistoryUI::GetFaviconResourceBytes( |
989 ui::ScaleFactor scale_factor) { | 1003 ui::ScaleFactor scale_factor) { |
990 return ResourceBundle::GetSharedInstance(). | 1004 return ResourceBundle::GetSharedInstance(). |
991 LoadDataResourceBytesForScale(IDR_HISTORY_FAVICON, scale_factor); | 1005 LoadDataResourceBytesForScale(IDR_HISTORY_FAVICON, scale_factor); |
992 } | 1006 } |
OLD | NEW |