Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(54)

Side by Side Diff: chrome/browser/history/history_service.cc

Issue 898473003: Revert of Remove dependency of HistoryService on WebHistoryServiceFactory (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@schedule-and-forget
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/history/history_service.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 15 matching lines...) Expand all
26 #include "base/memory/ref_counted.h" 26 #include "base/memory/ref_counted.h"
27 #include "base/message_loop/message_loop.h" 27 #include "base/message_loop/message_loop.h"
28 #include "base/prefs/pref_service.h" 28 #include "base/prefs/pref_service.h"
29 #include "base/thread_task_runner_handle.h" 29 #include "base/thread_task_runner_handle.h"
30 #include "base/threading/thread.h" 30 #include "base/threading/thread.h"
31 #include "base/time/time.h" 31 #include "base/time/time.h"
32 #include "chrome/browser/browser_process.h" 32 #include "chrome/browser/browser_process.h"
33 #include "chrome/browser/history/history_backend.h" 33 #include "chrome/browser/history/history_backend.h"
34 #include "chrome/browser/history/in_memory_history_backend.h" 34 #include "chrome/browser/history/in_memory_history_backend.h"
35 #include "chrome/browser/history/in_memory_url_index.h" 35 #include "chrome/browser/history/in_memory_url_index.h"
36 #include "chrome/browser/history/web_history_service_factory.h"
36 #include "chrome/browser/profiles/profile.h" 37 #include "chrome/browser/profiles/profile.h"
37 #include "chrome/common/chrome_constants.h" 38 #include "chrome/common/chrome_constants.h"
38 #include "chrome/common/chrome_switches.h" 39 #include "chrome/common/chrome_switches.h"
39 #include "chrome/common/importer/imported_favicon_usage.h" 40 #include "chrome/common/importer/imported_favicon_usage.h"
40 #include "chrome/common/pref_names.h" 41 #include "chrome/common/pref_names.h"
41 #include "chrome/common/url_constants.h" 42 #include "chrome/common/url_constants.h"
42 #include "components/dom_distiller/core/url_constants.h" 43 #include "components/dom_distiller/core/url_constants.h"
43 #include "components/history/core/browser/download_row.h" 44 #include "components/history/core/browser/download_row.h"
44 #include "components/history/core/browser/history_client.h" 45 #include "components/history/core/browser/history_client.h"
45 #include "components/history/core/browser/history_database_params.h" 46 #include "components/history/core/browser/history_database_params.h"
(...skipping 1112 matching lines...) Expand 10 before | Expand all | Expand 10 after
1158 DCHECK(thread_) << "History service being called after cleanup"; 1159 DCHECK(thread_) << "History service being called after cleanup";
1159 DCHECK(thread_checker_.CalledOnValidThread()); 1160 DCHECK(thread_checker_.CalledOnValidThread());
1160 tracker->PostTaskAndReply( 1161 tracker->PostTaskAndReply(
1161 thread_->message_loop_proxy().get(), 1162 thread_->message_loop_proxy().get(),
1162 FROM_HERE, 1163 FROM_HERE,
1163 base::Bind(&HistoryBackend::ExpireHistory, history_backend_, expire_list), 1164 base::Bind(&HistoryBackend::ExpireHistory, history_backend_, expire_list),
1164 callback); 1165 callback);
1165 } 1166 }
1166 1167
1167 void HistoryService::ExpireLocalAndRemoteHistoryBetween( 1168 void HistoryService::ExpireLocalAndRemoteHistoryBetween(
1168 history::WebHistoryService* web_history,
1169 const std::set<GURL>& restrict_urls, 1169 const std::set<GURL>& restrict_urls,
1170 Time begin_time, 1170 Time begin_time,
1171 Time end_time, 1171 Time end_time,
1172 const base::Closure& callback, 1172 const base::Closure& callback,
1173 base::CancelableTaskTracker* tracker) { 1173 base::CancelableTaskTracker* tracker) {
1174 // TODO(dubroy): This should be factored out into a separate class that 1174 // TODO(dubroy): This should be factored out into a separate class that
1175 // dispatches deletions to the proper places. 1175 // dispatches deletions to the proper places.
1176 1176
1177 history::WebHistoryService* web_history =
1178 WebHistoryServiceFactory::GetForProfile(profile_);
1177 if (web_history) { 1179 if (web_history) {
1178 // TODO(dubroy): This API does not yet support deletion of specific URLs. 1180 // TODO(dubroy): This API does not yet support deletion of specific URLs.
1179 DCHECK(restrict_urls.empty()); 1181 DCHECK(restrict_urls.empty());
1180 1182
1181 delete_directive_handler_.CreateDeleteDirectives( 1183 delete_directive_handler_.CreateDeleteDirectives(
1182 std::set<int64>(), begin_time, end_time); 1184 std::set<int64>(), begin_time, end_time);
1183 1185
1184 // Attempt online deletion from the history server, but ignore the result. 1186 // Attempt online deletion from the history server, but ignore the result.
1185 // Deletion directives ensure that the results will eventually be deleted. 1187 // Deletion directives ensure that the results will eventually be deleted.
1186 // 1188 //
1187 // TODO(davidben): |callback| should not run until this operation completes 1189 // TODO(davidben): |callback| should not run until this operation completes
1188 // too. 1190 // too.
1189 web_history->ExpireHistoryBetween(restrict_urls, begin_time, end_time, 1191 web_history->ExpireHistoryBetween(
1190 base::Bind(&ExpireWebHistoryComplete)); 1192 restrict_urls, begin_time, end_time,
1193 base::Bind(&ExpireWebHistoryComplete));
1191 } 1194 }
1192 ExpireHistoryBetween(restrict_urls, begin_time, end_time, callback, tracker); 1195 ExpireHistoryBetween(restrict_urls, begin_time, end_time, callback, tracker);
1193 } 1196 }
1194 1197
1195 void HistoryService::OnDBLoaded() { 1198 void HistoryService::OnDBLoaded() {
1196 DCHECK(thread_checker_.CalledOnValidThread()); 1199 DCHECK(thread_checker_.CalledOnValidThread());
1197 backend_loaded_ = true; 1200 backend_loaded_ = true;
1198 NotifyHistoryServiceLoaded(); 1201 NotifyHistoryServiceLoaded();
1199 } 1202 }
1200 1203
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
1290 const HistoryService::OnFaviconChangedCallback& callback) { 1293 const HistoryService::OnFaviconChangedCallback& callback) {
1291 DCHECK(thread_checker_.CalledOnValidThread()); 1294 DCHECK(thread_checker_.CalledOnValidThread());
1292 return favicon_changed_callback_list_.Add(callback); 1295 return favicon_changed_callback_list_.Add(callback);
1293 } 1296 }
1294 1297
1295 void HistoryService::NotifyFaviconChanged( 1298 void HistoryService::NotifyFaviconChanged(
1296 const std::set<GURL>& changed_favicons) { 1299 const std::set<GURL>& changed_favicons) {
1297 DCHECK(thread_checker_.CalledOnValidThread()); 1300 DCHECK(thread_checker_.CalledOnValidThread());
1298 favicon_changed_callback_list_.Notify(changed_favicons); 1301 favicon_changed_callback_list_.Notify(changed_favicons);
1299 } 1302 }
OLDNEW
« no previous file with comments | « chrome/browser/history/history_service.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698