OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 14 matching lines...) Expand all Loading... |
25 #include "chrome/browser/history/history.h" | 25 #include "chrome/browser/history/history.h" |
26 | 26 |
27 #include "base/callback.h" | 27 #include "base/callback.h" |
28 #include "base/memory/ref_counted.h" | 28 #include "base/memory/ref_counted.h" |
29 #include "base/message_loop.h" | 29 #include "base/message_loop.h" |
30 #include "base/path_service.h" | 30 #include "base/path_service.h" |
31 #include "base/string_util.h" | 31 #include "base/string_util.h" |
32 #include "base/task.h" | 32 #include "base/task.h" |
33 #include "chrome/browser/autocomplete/history_url_provider.h" | 33 #include "chrome/browser/autocomplete/history_url_provider.h" |
34 #include "chrome/browser/browser_process.h" | 34 #include "chrome/browser/browser_process.h" |
35 #include "chrome/browser/history/download_create_info.h" | 35 #include "chrome/browser/history/download_history_info.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/top_sites.h" | 41 #include "chrome/browser/history/top_sites.h" |
42 #include "chrome/browser/prefs/pref_service.h" | 42 #include "chrome/browser/prefs/pref_service.h" |
43 #include "chrome/browser/profiles/profile.h" | 43 #include "chrome/browser/profiles/profile.h" |
44 #include "chrome/browser/ui/profile_error_dialog.h" | 44 #include "chrome/browser/ui/profile_error_dialog.h" |
45 #include "chrome/browser/visitedlink/visitedlink_master.h" | 45 #include "chrome/browser/visitedlink/visitedlink_master.h" |
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
507 QueryURLCallback* callback) { | 507 QueryURLCallback* callback) { |
508 return Schedule(PRIORITY_UI, &HistoryBackend::QueryURL, consumer, | 508 return Schedule(PRIORITY_UI, &HistoryBackend::QueryURL, consumer, |
509 new history::QueryURLRequest(callback), url, want_visits); | 509 new history::QueryURLRequest(callback), url, want_visits); |
510 } | 510 } |
511 | 511 |
512 // Downloads ------------------------------------------------------------------- | 512 // Downloads ------------------------------------------------------------------- |
513 | 513 |
514 // Handle creation of a download by creating an entry in the history service's | 514 // Handle creation of a download by creating an entry in the history service's |
515 // 'downloads' table. | 515 // 'downloads' table. |
516 HistoryService::Handle HistoryService::CreateDownload( | 516 HistoryService::Handle HistoryService::CreateDownload( |
517 const DownloadCreateInfo& create_info, | 517 int32 id, |
| 518 const DownloadHistoryInfo& create_info, |
518 CancelableRequestConsumerBase* consumer, | 519 CancelableRequestConsumerBase* consumer, |
519 HistoryService::DownloadCreateCallback* callback) { | 520 HistoryService::DownloadCreateCallback* callback) { |
520 return Schedule(PRIORITY_NORMAL, &HistoryBackend::CreateDownload, consumer, | 521 return Schedule(PRIORITY_NORMAL, &HistoryBackend::CreateDownload, consumer, |
521 new history::DownloadCreateRequest(callback), create_info); | 522 new history::DownloadCreateRequest(callback), id, |
| 523 create_info); |
522 } | 524 } |
523 | 525 |
524 // Handle queries for a list of all downloads in the history database's | 526 // Handle queries for a list of all downloads in the history database's |
525 // 'downloads' table. | 527 // 'downloads' table. |
526 HistoryService::Handle HistoryService::QueryDownloads( | 528 HistoryService::Handle HistoryService::QueryDownloads( |
527 CancelableRequestConsumerBase* consumer, | 529 CancelableRequestConsumerBase* consumer, |
528 DownloadQueryCallback* callback) { | 530 DownloadQueryCallback* callback) { |
529 return Schedule(PRIORITY_NORMAL, &HistoryBackend::QueryDownloads, consumer, | 531 return Schedule(PRIORITY_NORMAL, &HistoryBackend::QueryDownloads, consumer, |
530 new history::DownloadQueryRequest(callback)); | 532 new history::DownloadQueryRequest(callback)); |
531 } | 533 } |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
811 history::TopSites* ts = profile_->GetTopSitesWithoutCreating(); | 813 history::TopSites* ts = profile_->GetTopSitesWithoutCreating(); |
812 if (ts) | 814 if (ts) |
813 ts->MigrateFromHistory(); | 815 ts->MigrateFromHistory(); |
814 } | 816 } |
815 } | 817 } |
816 | 818 |
817 void HistoryService::OnTopSitesReady() { | 819 void HistoryService::OnTopSitesReady() { |
818 ScheduleAndForget(PRIORITY_NORMAL, | 820 ScheduleAndForget(PRIORITY_NORMAL, |
819 &HistoryBackend::MigrateThumbnailsDatabase); | 821 &HistoryBackend::MigrateThumbnailsDatabase); |
820 } | 822 } |
OLD | NEW |