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 // The history system runs on a background thread so that potentially slow | 5 // The history system runs on a background thread so that potentially slow |
6 // database operations don't delay the browser. This backend processing is | 6 // database operations don't delay the browser. This backend processing is |
7 // represented by HistoryBackend. The HistoryService's job is to dispatch to | 7 // represented by HistoryBackend. The HistoryService's job is to dispatch to |
8 // that thread. | 8 // that thread. |
9 // | 9 // |
10 // Main thread History thread | 10 // Main thread History thread |
(...skipping 21 matching lines...) Expand all Loading... |
32 #include "base/string_util.h" | 32 #include "base/string_util.h" |
33 #include "base/threading/thread.h" | 33 #include "base/threading/thread.h" |
34 #include "chrome/browser/autocomplete/history_url_provider.h" | 34 #include "chrome/browser/autocomplete/history_url_provider.h" |
35 #include "chrome/browser/browser_process.h" | 35 #include "chrome/browser/browser_process.h" |
36 #include "chrome/browser/history/history_backend.h" | 36 #include "chrome/browser/history/history_backend.h" |
37 #include "chrome/browser/history/history_notifications.h" | 37 #include "chrome/browser/history/history_notifications.h" |
38 #include "chrome/browser/history/history_types.h" | 38 #include "chrome/browser/history/history_types.h" |
39 #include "chrome/browser/history/in_memory_database.h" | 39 #include "chrome/browser/history/in_memory_database.h" |
40 #include "chrome/browser/history/in_memory_history_backend.h" | 40 #include "chrome/browser/history/in_memory_history_backend.h" |
41 #include "chrome/browser/history/in_memory_url_index.h" | 41 #include "chrome/browser/history/in_memory_url_index.h" |
| 42 #include "chrome/browser/history/time_filter.h" |
42 #include "chrome/browser/history/top_sites.h" | 43 #include "chrome/browser/history/top_sites.h" |
43 #include "chrome/browser/prefs/pref_service.h" | 44 #include "chrome/browser/prefs/pref_service.h" |
44 #include "chrome/browser/profiles/profile.h" | 45 #include "chrome/browser/profiles/profile.h" |
45 #include "chrome/browser/ui/profile_error_dialog.h" | 46 #include "chrome/browser/ui/profile_error_dialog.h" |
46 #include "chrome/browser/visitedlink/visitedlink_master.h" | 47 #include "chrome/browser/visitedlink/visitedlink_master.h" |
47 #include "chrome/common/chrome_constants.h" | 48 #include "chrome/common/chrome_constants.h" |
48 #include "chrome/common/chrome_notification_types.h" | 49 #include "chrome/common/chrome_notification_types.h" |
49 #include "chrome/common/chrome_switches.h" | 50 #include "chrome/common/chrome_switches.h" |
50 #include "chrome/common/pref_names.h" | 51 #include "chrome/common/pref_names.h" |
51 #include "chrome/common/thumbnail_score.h" | 52 #include "chrome/common/thumbnail_score.h" |
(...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
626 int result_count, | 627 int result_count, |
627 int days_back, | 628 int days_back, |
628 CancelableRequestConsumerBase* consumer, | 629 CancelableRequestConsumerBase* consumer, |
629 const QueryMostVisitedURLsCallback& callback) { | 630 const QueryMostVisitedURLsCallback& callback) { |
630 return Schedule(PRIORITY_NORMAL, &HistoryBackend::QueryMostVisitedURLs, | 631 return Schedule(PRIORITY_NORMAL, &HistoryBackend::QueryMostVisitedURLs, |
631 consumer, | 632 consumer, |
632 new history::QueryMostVisitedURLsRequest(callback), | 633 new history::QueryMostVisitedURLsRequest(callback), |
633 result_count, days_back); | 634 result_count, days_back); |
634 } | 635 } |
635 | 636 |
| 637 HistoryService::Handle HistoryService::QueryMostVisitedURLsDuringTime( |
| 638 int result_count, |
| 639 const history::TimeFilter& filter, |
| 640 CancelableRequestConsumerBase* consumer, |
| 641 const QueryMostVisitedURLsCallback& callback) { |
| 642 return Schedule(PRIORITY_NORMAL, |
| 643 &HistoryBackend::QueryMostVisitedURLsDuringTime, |
| 644 consumer, |
| 645 new history::QueryMostVisitedURLsRequest(callback), |
| 646 result_count, filter); |
| 647 } |
| 648 |
636 void HistoryService::Observe(int type, | 649 void HistoryService::Observe(int type, |
637 const content::NotificationSource& source, | 650 const content::NotificationSource& source, |
638 const content::NotificationDetails& details) { | 651 const content::NotificationDetails& details) { |
639 if (!thread_) | 652 if (!thread_) |
640 return; | 653 return; |
641 | 654 |
642 switch (type) { | 655 switch (type) { |
643 case chrome::NOTIFICATION_HISTORY_URLS_DELETED: { | 656 case chrome::NOTIFICATION_HISTORY_URLS_DELETED: { |
644 // Update the visited link system for deleted URLs. We will update the | 657 // Update the visited link system for deleted URLs. We will update the |
645 // visited link system for added URLs as soon as we get the add | 658 // visited link system for added URLs as soon as we get the add |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
857 history::TopSites* ts = profile_->GetTopSitesWithoutCreating(); | 870 history::TopSites* ts = profile_->GetTopSitesWithoutCreating(); |
858 if (ts) | 871 if (ts) |
859 ts->MigrateFromHistory(); | 872 ts->MigrateFromHistory(); |
860 } | 873 } |
861 } | 874 } |
862 | 875 |
863 void HistoryService::OnTopSitesReady() { | 876 void HistoryService::OnTopSitesReady() { |
864 ScheduleAndForget(PRIORITY_NORMAL, | 877 ScheduleAndForget(PRIORITY_NORMAL, |
865 &HistoryBackend::MigrateThumbnailsDatabase); | 878 &HistoryBackend::MigrateThumbnailsDatabase); |
866 } | 879 } |
OLD | NEW |