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 #include "chrome/browser/history/history_backend.h" | 5 #include "chrome/browser/history/history_backend.h" |
6 | 6 |
7 #include <list> | 7 #include <list> |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
14 #include "base/file_util.h" | 14 #include "base/file_util.h" |
15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
16 #include "base/memory/scoped_vector.h" | 16 #include "base/memory/scoped_vector.h" |
17 #include "base/message_loop.h" | 17 #include "base/message_loop.h" |
18 #include "base/metrics/histogram.h" | 18 #include "base/metrics/histogram.h" |
19 #include "base/string_util.h" | 19 #include "base/string_util.h" |
20 #include "base/time.h" | 20 #include "base/time.h" |
21 #include "chrome/browser/autocomplete/history_url_provider.h" | 21 #include "chrome/browser/autocomplete/history_url_provider.h" |
22 #include "chrome/browser/bookmarks/bookmark_service.h" | 22 #include "chrome/browser/bookmarks/bookmark_service.h" |
23 #include "chrome/browser/history/download_create_info.h" | 23 #include "chrome/browser/history/download_history_info.h" |
24 #include "chrome/browser/history/history_notifications.h" | 24 #include "chrome/browser/history/history_notifications.h" |
25 #include "chrome/browser/history/history_publisher.h" | 25 #include "chrome/browser/history/history_publisher.h" |
26 #include "chrome/browser/history/in_memory_history_backend.h" | 26 #include "chrome/browser/history/in_memory_history_backend.h" |
27 #include "chrome/browser/history/page_usage_data.h" | 27 #include "chrome/browser/history/page_usage_data.h" |
28 #include "chrome/browser/history/top_sites.h" | 28 #include "chrome/browser/history/top_sites.h" |
29 #include "chrome/common/chrome_constants.h" | 29 #include "chrome/common/chrome_constants.h" |
30 #include "chrome/common/url_constants.h" | 30 #include "chrome/common/url_constants.h" |
31 #include "content/common/notification_type.h" | 31 #include "content/common/notification_type.h" |
32 #include "googleurl/src/gurl.h" | 32 #include "googleurl/src/gurl.h" |
33 #include "grit/chromium_strings.h" | 33 #include "grit/chromium_strings.h" |
(...skipping 1091 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1125 // Update the path of a particular download entry. | 1125 // Update the path of a particular download entry. |
1126 void HistoryBackend::UpdateDownloadPath(const FilePath& path, | 1126 void HistoryBackend::UpdateDownloadPath(const FilePath& path, |
1127 int64 db_handle) { | 1127 int64 db_handle) { |
1128 if (db_.get()) | 1128 if (db_.get()) |
1129 db_->UpdateDownloadPath(path, db_handle); | 1129 db_->UpdateDownloadPath(path, db_handle); |
1130 } | 1130 } |
1131 | 1131 |
1132 // Create a new download entry and pass back the db_handle to it. | 1132 // Create a new download entry and pass back the db_handle to it. |
1133 void HistoryBackend::CreateDownload( | 1133 void HistoryBackend::CreateDownload( |
1134 scoped_refptr<DownloadCreateRequest> request, | 1134 scoped_refptr<DownloadCreateRequest> request, |
1135 const DownloadCreateInfo& create_info) { | 1135 int32 id, |
| 1136 const DownloadHistoryInfo& history_info) { |
1136 int64 db_handle = 0; | 1137 int64 db_handle = 0; |
1137 if (!request->canceled()) { | 1138 if (!request->canceled()) { |
1138 if (db_.get()) | 1139 if (db_.get()) |
1139 db_handle = db_->CreateDownload(create_info); | 1140 db_handle = db_->CreateDownload(history_info); |
1140 request->ForwardResult(DownloadCreateRequest::TupleType(create_info, | 1141 request->ForwardResult(DownloadCreateRequest::TupleType(id, db_handle)); |
1141 db_handle)); | |
1142 } | 1142 } |
1143 } | 1143 } |
1144 | 1144 |
1145 void HistoryBackend::RemoveDownload(int64 db_handle) { | 1145 void HistoryBackend::RemoveDownload(int64 db_handle) { |
1146 if (db_.get()) | 1146 if (db_.get()) |
1147 db_->RemoveDownload(db_handle); | 1147 db_->RemoveDownload(db_handle); |
1148 } | 1148 } |
1149 | 1149 |
1150 void HistoryBackend::RemoveDownloadsBetween(const Time remove_begin, | 1150 void HistoryBackend::RemoveDownloadsBetween(const Time remove_begin, |
1151 const Time remove_end) { | 1151 const Time remove_end) { |
(...skipping 1094 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2246 return true; | 2246 return true; |
2247 } | 2247 } |
2248 | 2248 |
2249 BookmarkService* HistoryBackend::GetBookmarkService() { | 2249 BookmarkService* HistoryBackend::GetBookmarkService() { |
2250 if (bookmark_service_) | 2250 if (bookmark_service_) |
2251 bookmark_service_->BlockTillLoaded(); | 2251 bookmark_service_->BlockTillLoaded(); |
2252 return bookmark_service_; | 2252 return bookmark_service_; |
2253 } | 2253 } |
2254 | 2254 |
2255 } // namespace history | 2255 } // namespace history |
OLD | NEW |