| 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/history/history_backend.h" | 5 #include "chrome/browser/history/history_backend.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <functional> | 8 #include <functional> |
| 9 #include <list> | 9 #include <list> |
| 10 #include <map> | 10 #include <map> |
| 11 #include <set> | 11 #include <set> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "base/basictypes.h" | 14 #include "base/basictypes.h" |
| 15 #include "base/bind.h" | 15 #include "base/bind.h" |
| 16 #include "base/compiler_specific.h" | 16 #include "base/compiler_specific.h" |
| 17 #include "base/files/file_enumerator.h" | 17 #include "base/files/file_enumerator.h" |
| 18 #include "base/memory/scoped_ptr.h" | 18 #include "base/memory/scoped_ptr.h" |
| 19 #include "base/memory/scoped_vector.h" | 19 #include "base/memory/scoped_vector.h" |
| 20 #include "base/message_loop/message_loop.h" | 20 #include "base/message_loop/message_loop.h" |
| 21 #include "base/metrics/histogram.h" | 21 #include "base/metrics/histogram.h" |
| 22 #include "base/rand_util.h" | 22 #include "base/rand_util.h" |
| 23 #include "base/strings/string_util.h" | 23 #include "base/strings/string_util.h" |
| 24 #include "base/strings/utf_string_conversions.h" | 24 #include "base/strings/utf_string_conversions.h" |
| 25 #include "base/time/time.h" | 25 #include "base/time/time.h" |
| 26 #include "chrome/browser/chrome_notification_types.h" | 26 #include "chrome/browser/chrome_notification_types.h" |
| 27 #include "chrome/browser/history/download_row.h" | |
| 28 #include "chrome/browser/history/history_notifications.h" | 27 #include "chrome/browser/history/history_notifications.h" |
| 29 #include "chrome/browser/history/in_memory_history_backend.h" | 28 #include "chrome/browser/history/in_memory_history_backend.h" |
| 30 #include "chrome/browser/history/in_memory_history_backend.h" | 29 #include "chrome/browser/history/in_memory_history_backend.h" |
| 31 #include "chrome/browser/history/top_sites.h" | 30 #include "chrome/browser/history/top_sites.h" |
| 32 #include "chrome/browser/history/typed_url_syncable_service.h" | 31 #include "chrome/browser/history/typed_url_syncable_service.h" |
| 33 #include "chrome/browser/history/typed_url_syncable_service.h" | 32 #include "chrome/browser/history/typed_url_syncable_service.h" |
| 34 #include "chrome/common/chrome_constants.h" | 33 #include "chrome/common/chrome_constants.h" |
| 35 #include "chrome/common/importer/imported_favicon_usage.h" | 34 #include "chrome/common/importer/imported_favicon_usage.h" |
| 36 #include "chrome/common/url_constants.h" | 35 #include "chrome/common/url_constants.h" |
| 37 #include "components/favicon_base/select_favicon_frames.h" | 36 #include "components/favicon_base/select_favicon_frames.h" |
| 37 #include "components/history/core/browser/download_constants.h" |
| 38 #include "components/history/core/browser/download_row.h" |
| 38 #include "components/history/core/browser/history_backend_observer.h" | 39 #include "components/history/core/browser/history_backend_observer.h" |
| 39 #include "components/history/core/browser/history_client.h" | 40 #include "components/history/core/browser/history_client.h" |
| 40 #include "components/history/core/browser/history_constants.h" | 41 #include "components/history/core/browser/history_constants.h" |
| 41 #include "components/history/core/browser/history_db_task.h" | 42 #include "components/history/core/browser/history_db_task.h" |
| 42 #include "components/history/core/browser/keyword_search_term.h" | 43 #include "components/history/core/browser/keyword_search_term.h" |
| 43 #include "components/history/core/browser/page_usage_data.h" | 44 #include "components/history/core/browser/page_usage_data.h" |
| 44 #include "components/history/core/browser/visit_filter.h" | 45 #include "components/history/core/browser/visit_filter.h" |
| 45 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" | 46 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" |
| 46 #include "sql/error_delegate_util.h" | 47 #include "sql/error_delegate_util.h" |
| 47 #include "third_party/skia/include/core/SkBitmap.h" | 48 #include "third_party/skia/include/core/SkBitmap.h" |
| (...skipping 1057 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1105 observers_.AddObserver(observer); | 1106 observers_.AddObserver(observer); |
| 1106 } | 1107 } |
| 1107 | 1108 |
| 1108 void HistoryBackend::RemoveObserver(HistoryBackendObserver* observer) { | 1109 void HistoryBackend::RemoveObserver(HistoryBackendObserver* observer) { |
| 1109 observers_.RemoveObserver(observer); | 1110 observers_.RemoveObserver(observer); |
| 1110 } | 1111 } |
| 1111 | 1112 |
| 1112 // Downloads ------------------------------------------------------------------- | 1113 // Downloads ------------------------------------------------------------------- |
| 1113 | 1114 |
| 1114 uint32 HistoryBackend::GetNextDownloadId() { | 1115 uint32 HistoryBackend::GetNextDownloadId() { |
| 1115 return db_ ? db_->GetNextDownloadId() : content::DownloadItem::kInvalidId; | 1116 return db_ ? db_->GetNextDownloadId() : kInvalidDownloadId; |
| 1116 } | 1117 } |
| 1117 | 1118 |
| 1118 // Get all the download entries from the database. | 1119 // Get all the download entries from the database. |
| 1119 void HistoryBackend::QueryDownloads(std::vector<DownloadRow>* rows) { | 1120 void HistoryBackend::QueryDownloads(std::vector<DownloadRow>* rows) { |
| 1120 if (db_) | 1121 if (db_) |
| 1121 db_->QueryDownloads(rows); | 1122 db_->QueryDownloads(rows); |
| 1122 } | 1123 } |
| 1123 | 1124 |
| 1124 // Update a particular download entry. | 1125 // Update a particular download entry. |
| 1125 void HistoryBackend::UpdateDownload(const history::DownloadRow& data) { | 1126 void HistoryBackend::UpdateDownload(const history::DownloadRow& data) { |
| (...skipping 1564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2690 info.url_id = visit.url_id; | 2691 info.url_id = visit.url_id; |
| 2691 info.time = visit.visit_time; | 2692 info.time = visit.visit_time; |
| 2692 info.transition = visit.transition; | 2693 info.transition = visit.transition; |
| 2693 // If we don't have a delegate yet during setup or shutdown, we will drop | 2694 // If we don't have a delegate yet during setup or shutdown, we will drop |
| 2694 // these notifications. | 2695 // these notifications. |
| 2695 if (delegate_) | 2696 if (delegate_) |
| 2696 delegate_->NotifyAddVisit(info); | 2697 delegate_->NotifyAddVisit(info); |
| 2697 } | 2698 } |
| 2698 | 2699 |
| 2699 } // namespace history | 2700 } // namespace history |
| OLD | NEW |