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

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

Issue 305443004: Introduce HistoryClient interface (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@371825
Patch Set: Reupload with --no-find-copies Created 6 years, 6 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
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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 #include "chrome/browser/history/web_history_service_factory.h" 50 #include "chrome/browser/history/web_history_service_factory.h"
51 #include "chrome/browser/profiles/profile.h" 51 #include "chrome/browser/profiles/profile.h"
52 #include "chrome/browser/ui/profile_error_dialog.h" 52 #include "chrome/browser/ui/profile_error_dialog.h"
53 #include "chrome/common/chrome_constants.h" 53 #include "chrome/common/chrome_constants.h"
54 #include "chrome/common/chrome_switches.h" 54 #include "chrome/common/chrome_switches.h"
55 #include "chrome/common/importer/imported_favicon_usage.h" 55 #include "chrome/common/importer/imported_favicon_usage.h"
56 #include "chrome/common/pref_names.h" 56 #include "chrome/common/pref_names.h"
57 #include "chrome/common/thumbnail_score.h" 57 #include "chrome/common/thumbnail_score.h"
58 #include "chrome/common/url_constants.h" 58 #include "chrome/common/url_constants.h"
59 #include "components/bookmarks/browser/bookmark_model.h" 59 #include "components/bookmarks/browser/bookmark_model.h"
60 #include "components/history/core/browser/history_client.h"
60 #include "components/visitedlink/browser/visitedlink_master.h" 61 #include "components/visitedlink/browser/visitedlink_master.h"
61 #include "content/public/browser/browser_thread.h" 62 #include "content/public/browser/browser_thread.h"
62 #include "content/public/browser/download_item.h" 63 #include "content/public/browser/download_item.h"
63 #include "content/public/browser/notification_service.h" 64 #include "content/public/browser/notification_service.h"
64 #include "grit/chromium_strings.h" 65 #include "grit/chromium_strings.h"
65 #include "grit/generated_resources.h" 66 #include "grit/generated_resources.h"
66 #include "sync/api/sync_error_factory.h" 67 #include "sync/api/sync_error_factory.h"
67 #include "third_party/skia/include/core/SkBitmap.h" 68 #include "third_party/skia/include/core/SkBitmap.h"
68 69
69 using base::Time; 70 using base::Time;
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 const scoped_refptr<base::SequencedTaskRunner> service_task_runner_; 186 const scoped_refptr<base::SequencedTaskRunner> service_task_runner_;
186 Profile* const profile_; 187 Profile* const profile_;
187 }; 188 };
188 189
189 // The history thread is intentionally not a BrowserThread because the 190 // The history thread is intentionally not a BrowserThread because the
190 // sync integration unit tests depend on being able to create more than one 191 // sync integration unit tests depend on being able to create more than one
191 // history thread. 192 // history thread.
192 HistoryService::HistoryService() 193 HistoryService::HistoryService()
193 : weak_ptr_factory_(this), 194 : weak_ptr_factory_(this),
194 thread_(new base::Thread(kHistoryThreadName)), 195 thread_(new base::Thread(kHistoryThreadName)),
196 history_client_(NULL),
195 profile_(NULL), 197 profile_(NULL),
196 backend_loaded_(false), 198 backend_loaded_(false),
197 bookmark_service_(NULL), 199 bookmark_service_(NULL),
198 no_db_(false) { 200 no_db_(false) {
199 } 201 }
200 202
201 HistoryService::HistoryService(Profile* profile) 203 HistoryService::HistoryService(history::HistoryClient* client, Profile* profile)
202 : weak_ptr_factory_(this), 204 : weak_ptr_factory_(this),
203 thread_(new base::Thread(kHistoryThreadName)), 205 thread_(new base::Thread(kHistoryThreadName)),
206 history_client_(client),
204 profile_(profile), 207 profile_(profile),
205 visitedlink_master_(new visitedlink::VisitedLinkMaster( 208 visitedlink_master_(new visitedlink::VisitedLinkMaster(
206 profile, this, true)), 209 profile, this, true)),
207 backend_loaded_(false), 210 backend_loaded_(false),
208 bookmark_service_(NULL), 211 bookmark_service_(NULL),
209 no_db_(false) { 212 no_db_(false) {
210 DCHECK(profile_); 213 DCHECK(profile_);
211 registrar_.Add(this, chrome::NOTIFICATION_HISTORY_URLS_DELETED, 214 registrar_.Add(this, chrome::NOTIFICATION_HISTORY_URLS_DELETED,
212 content::Source<Profile>(profile_)); 215 content::Source<Profile>(profile_));
213 registrar_.Add(this, chrome::NOTIFICATION_TEMPLATE_URL_REMOVED, 216 registrar_.Add(this, chrome::NOTIFICATION_TEMPLATE_URL_REMOVED,
(...skipping 972 matching lines...) Expand 10 before | Expand all | Expand 10 after
1186 DCHECK(thread_checker_.CalledOnValidThread()); 1189 DCHECK(thread_checker_.CalledOnValidThread());
1187 visit_database_observers_.RemoveObserver(observer); 1190 visit_database_observers_.RemoveObserver(observer);
1188 } 1191 }
1189 1192
1190 void HistoryService::NotifyVisitDBObserversOnAddVisit( 1193 void HistoryService::NotifyVisitDBObserversOnAddVisit(
1191 const history::BriefVisitInfo& info) { 1194 const history::BriefVisitInfo& info) {
1192 DCHECK(thread_checker_.CalledOnValidThread()); 1195 DCHECK(thread_checker_.CalledOnValidThread());
1193 FOR_EACH_OBSERVER(history::VisitDatabaseObserver, visit_database_observers_, 1196 FOR_EACH_OBSERVER(history::VisitDatabaseObserver, visit_database_observers_,
1194 OnAddVisit(info)); 1197 OnAddVisit(info));
1195 } 1198 }
OLDNEW
« no previous file with comments | « chrome/browser/history/history_service.h ('k') | chrome/browser/history/history_service_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698