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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 #include "chrome/browser/history/history_types.h" | 49 #include "chrome/browser/history/history_types.h" |
50 #include "chrome/browser/history/in_memory_database.h" | 50 #include "chrome/browser/history/in_memory_database.h" |
51 #include "chrome/browser/history/in_memory_history_backend.h" | 51 #include "chrome/browser/history/in_memory_history_backend.h" |
52 #include "chrome/browser/history/in_memory_url_index.h" | 52 #include "chrome/browser/history/in_memory_url_index.h" |
53 #include "chrome/browser/history/top_sites.h" | 53 #include "chrome/browser/history/top_sites.h" |
54 #include "chrome/browser/history/visit_database.h" | 54 #include "chrome/browser/history/visit_database.h" |
55 #include "chrome/browser/history/visit_filter.h" | 55 #include "chrome/browser/history/visit_filter.h" |
56 #include "chrome/browser/prefs/pref_service.h" | 56 #include "chrome/browser/prefs/pref_service.h" |
57 #include "chrome/browser/profiles/profile.h" | 57 #include "chrome/browser/profiles/profile.h" |
58 #include "chrome/browser/ui/profile_error_dialog.h" | 58 #include "chrome/browser/ui/profile_error_dialog.h" |
59 #include "chrome/browser/visitedlink/visitedlink_master.h" | |
60 #include "chrome/common/chrome_constants.h" | 59 #include "chrome/common/chrome_constants.h" |
61 #include "chrome/common/chrome_notification_types.h" | 60 #include "chrome/common/chrome_notification_types.h" |
62 #include "chrome/common/chrome_switches.h" | 61 #include "chrome/common/chrome_switches.h" |
63 #include "chrome/common/pref_names.h" | 62 #include "chrome/common/pref_names.h" |
64 #include "chrome/common/thumbnail_score.h" | 63 #include "chrome/common/thumbnail_score.h" |
65 #include "chrome/common/url_constants.h" | 64 #include "chrome/common/url_constants.h" |
| 65 #include "components/visitedlink/browser/visitedlink_master.h" |
66 #include "content/public/browser/browser_thread.h" | 66 #include "content/public/browser/browser_thread.h" |
67 #include "content/public/browser/notification_service.h" | 67 #include "content/public/browser/notification_service.h" |
68 #include "grit/chromium_strings.h" | 68 #include "grit/chromium_strings.h" |
69 #include "grit/generated_resources.h" | 69 #include "grit/generated_resources.h" |
70 #include "sync/api/sync_change.h" | 70 #include "sync/api/sync_change.h" |
71 #include "sync/api/sync_change_processor.h" | 71 #include "sync/api/sync_change_processor.h" |
72 #include "sync/api/sync_data.h" | 72 #include "sync/api/sync_data.h" |
73 #include "sync/api/sync_error.h" | 73 #include "sync/api/sync_error.h" |
74 #include "sync/api/sync_error_factory.h" | 74 #include "sync/api/sync_error_factory.h" |
75 #include "sync/protocol/history_delete_directive_specifics.pb.h" | 75 #include "sync/protocol/history_delete_directive_specifics.pb.h" |
(...skipping 29 matching lines...) Expand all Loading... |
105 callback.Run(*id); | 105 callback.Run(*id); |
106 } | 106 } |
107 | 107 |
108 void RunWithFaviconResults( | 108 void RunWithFaviconResults( |
109 const FaviconService::FaviconResultsCallback& callback, | 109 const FaviconService::FaviconResultsCallback& callback, |
110 const HistoryBackend::FaviconResults* results) { | 110 const HistoryBackend::FaviconResults* results) { |
111 callback.Run(results->bitmap_results, results->size_map); | 111 callback.Run(results->bitmap_results, results->size_map); |
112 } | 112 } |
113 | 113 |
114 // Extract history::URLRows into GURLs for VisitedLinkMaster. | 114 // Extract history::URLRows into GURLs for VisitedLinkMaster. |
115 class URLIteratorFromURLRows : public VisitedLinkMaster::URLIterator { | 115 class URLIteratorFromURLRows |
| 116 : public components::VisitedLinkMaster::URLIterator { |
116 public: | 117 public: |
117 explicit URLIteratorFromURLRows(const history::URLRows& url_rows) | 118 explicit URLIteratorFromURLRows(const history::URLRows& url_rows) |
118 : itr_(url_rows.begin()), | 119 : itr_(url_rows.begin()), |
119 end_(url_rows.end()) { | 120 end_(url_rows.end()) { |
120 } | 121 } |
121 | 122 |
122 virtual const GURL& NextURL() OVERRIDE { | 123 virtual const GURL& NextURL() OVERRIDE { |
123 return (itr_++)->url(); | 124 return (itr_++)->url(); |
124 } | 125 } |
125 | 126 |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 current_backend_id_(-1), | 225 current_backend_id_(-1), |
225 bookmark_service_(NULL), | 226 bookmark_service_(NULL), |
226 no_db_(false), | 227 no_db_(false), |
227 needs_top_sites_migration_(false) { | 228 needs_top_sites_migration_(false) { |
228 } | 229 } |
229 | 230 |
230 HistoryService::HistoryService(Profile* profile) | 231 HistoryService::HistoryService(Profile* profile) |
231 : weak_ptr_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)), | 232 : weak_ptr_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)), |
232 thread_(new base::Thread(kHistoryThreadName)), | 233 thread_(new base::Thread(kHistoryThreadName)), |
233 profile_(profile), | 234 profile_(profile), |
234 visitedlink_master_(new VisitedLinkMaster( | 235 visitedlink_master_(new components::VisitedLinkMaster( |
235 profile, ALLOW_THIS_IN_INITIALIZER_LIST(this))), | 236 profile, ALLOW_THIS_IN_INITIALIZER_LIST(this))), |
236 backend_loaded_(false), | 237 backend_loaded_(false), |
237 current_backend_id_(-1), | 238 current_backend_id_(-1), |
238 bookmark_service_(NULL), | 239 bookmark_service_(NULL), |
239 no_db_(false), | 240 no_db_(false), |
240 needs_top_sites_migration_(false) { | 241 needs_top_sites_migration_(false) { |
241 DCHECK(profile_); | 242 DCHECK(profile_); |
242 registrar_.Add(this, chrome::NOTIFICATION_HISTORY_URLS_DELETED, | 243 registrar_.Add(this, chrome::NOTIFICATION_HISTORY_URLS_DELETED, |
243 content::Source<Profile>(profile_)); | 244 content::Source<Profile>(profile_)); |
244 registrar_.Add(this, chrome::NOTIFICATION_TEMPLATE_URL_REMOVED, | 245 registrar_.Add(this, chrome::NOTIFICATION_TEMPLATE_URL_REMOVED, |
(...skipping 1121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1366 } | 1367 } |
1367 } | 1368 } |
1368 | 1369 |
1369 void HistoryService::OnDeleteDirectiveProcessed( | 1370 void HistoryService::OnDeleteDirectiveProcessed( |
1370 const sync_pb::HistoryDeleteDirectiveSpecifics& delete_directive) { | 1371 const sync_pb::HistoryDeleteDirectiveSpecifics& delete_directive) { |
1371 DVLOG(1) << "Processed delete directive: " | 1372 DVLOG(1) << "Processed delete directive: " |
1372 << DeleteDirectiveToString(delete_directive); | 1373 << DeleteDirectiveToString(delete_directive); |
1373 // TODO(akalin): Keep track of which delete directives we've already | 1374 // TODO(akalin): Keep track of which delete directives we've already |
1374 // processed. | 1375 // processed. |
1375 } | 1376 } |
OLD | NEW |