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

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

Issue 322113002: Move HistoryService::NotifyProfileError to HistoryClient (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comments 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
« no previous file with comments | « chrome/browser/history/chrome_history_client.cc ('k') | components/history/DEPS » ('j') | 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 28 matching lines...) Expand all
39 #include "chrome/browser/history/history_types.h" 39 #include "chrome/browser/history/history_types.h"
40 #include "chrome/browser/history/in_memory_database.h" 40 #include "chrome/browser/history/in_memory_database.h"
41 #include "chrome/browser/history/in_memory_history_backend.h" 41 #include "chrome/browser/history/in_memory_history_backend.h"
42 #include "chrome/browser/history/in_memory_url_index.h" 42 #include "chrome/browser/history/in_memory_url_index.h"
43 #include "chrome/browser/history/top_sites.h" 43 #include "chrome/browser/history/top_sites.h"
44 #include "chrome/browser/history/visit_database.h" 44 #include "chrome/browser/history/visit_database.h"
45 #include "chrome/browser/history/visit_filter.h" 45 #include "chrome/browser/history/visit_filter.h"
46 #include "chrome/browser/history/web_history_service.h" 46 #include "chrome/browser/history/web_history_service.h"
47 #include "chrome/browser/history/web_history_service_factory.h" 47 #include "chrome/browser/history/web_history_service_factory.h"
48 #include "chrome/browser/profiles/profile.h" 48 #include "chrome/browser/profiles/profile.h"
49 #include "chrome/browser/ui/profile_error_dialog.h"
50 #include "chrome/common/chrome_constants.h" 49 #include "chrome/common/chrome_constants.h"
51 #include "chrome/common/chrome_switches.h" 50 #include "chrome/common/chrome_switches.h"
52 #include "chrome/common/importer/imported_favicon_usage.h" 51 #include "chrome/common/importer/imported_favicon_usage.h"
53 #include "chrome/common/pref_names.h" 52 #include "chrome/common/pref_names.h"
54 #include "chrome/common/thumbnail_score.h" 53 #include "chrome/common/thumbnail_score.h"
55 #include "chrome/common/url_constants.h" 54 #include "chrome/common/url_constants.h"
56 #include "components/history/core/browser/history_client.h" 55 #include "components/history/core/browser/history_client.h"
57 #include "components/visitedlink/browser/visitedlink_master.h" 56 #include "components/visitedlink/browser/visitedlink_master.h"
58 #include "content/public/browser/browser_thread.h" 57 #include "content/public/browser/browser_thread.h"
59 #include "content/public/browser/download_item.h" 58 #include "content/public/browser/download_item.h"
(...skipping 967 matching lines...) Expand 10 before | Expand all | Expand 10 after
1027 DCHECK(thread_checker_.CalledOnValidThread()); 1026 DCHECK(thread_checker_.CalledOnValidThread());
1028 DCHECK(!in_memory_backend_) << "Setting mem DB twice"; 1027 DCHECK(!in_memory_backend_) << "Setting mem DB twice";
1029 in_memory_backend_.reset(mem_backend.release()); 1028 in_memory_backend_.reset(mem_backend.release());
1030 1029
1031 // The database requires additional initialization once we own it. 1030 // The database requires additional initialization once we own it.
1032 in_memory_backend_->AttachToHistoryService(profile_); 1031 in_memory_backend_->AttachToHistoryService(profile_);
1033 } 1032 }
1034 1033
1035 void HistoryService::NotifyProfileError(sql::InitStatus init_status) { 1034 void HistoryService::NotifyProfileError(sql::InitStatus init_status) {
1036 DCHECK(thread_checker_.CalledOnValidThread()); 1035 DCHECK(thread_checker_.CalledOnValidThread());
1037 ShowProfileErrorDialog( 1036 if (history_client_)
1038 PROFILE_ERROR_HISTORY, 1037 history_client_->NotifyProfileError(init_status);
1039 (init_status == sql::INIT_FAILURE) ?
1040 IDS_COULDNT_OPEN_PROFILE_ERROR : IDS_PROFILE_TOO_NEW_ERROR);
1041 } 1038 }
1042 1039
1043 void HistoryService::DeleteURL(const GURL& url) { 1040 void HistoryService::DeleteURL(const GURL& url) {
1044 DCHECK(thread_checker_.CalledOnValidThread()); 1041 DCHECK(thread_checker_.CalledOnValidThread());
1045 // We will update the visited links when we observe the delete notifications. 1042 // We will update the visited links when we observe the delete notifications.
1046 ScheduleAndForget(PRIORITY_NORMAL, &HistoryBackend::DeleteURL, url); 1043 ScheduleAndForget(PRIORITY_NORMAL, &HistoryBackend::DeleteURL, url);
1047 } 1044 }
1048 1045
1049 void HistoryService::DeleteURLsForTest(const std::vector<GURL>& urls) { 1046 void HistoryService::DeleteURLsForTest(const std::vector<GURL>& urls) {
1050 DCHECK(thread_checker_.CalledOnValidThread()); 1047 DCHECK(thread_checker_.CalledOnValidThread());
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
1167 DCHECK(thread_checker_.CalledOnValidThread()); 1164 DCHECK(thread_checker_.CalledOnValidThread());
1168 visit_database_observers_.RemoveObserver(observer); 1165 visit_database_observers_.RemoveObserver(observer);
1169 } 1166 }
1170 1167
1171 void HistoryService::NotifyVisitDBObserversOnAddVisit( 1168 void HistoryService::NotifyVisitDBObserversOnAddVisit(
1172 const history::BriefVisitInfo& info) { 1169 const history::BriefVisitInfo& info) {
1173 DCHECK(thread_checker_.CalledOnValidThread()); 1170 DCHECK(thread_checker_.CalledOnValidThread());
1174 FOR_EACH_OBSERVER(history::VisitDatabaseObserver, visit_database_observers_, 1171 FOR_EACH_OBSERVER(history::VisitDatabaseObserver, visit_database_observers_,
1175 OnAddVisit(info)); 1172 OnAddVisit(info));
1176 } 1173 }
OLDNEW
« no previous file with comments | « chrome/browser/history/chrome_history_client.cc ('k') | components/history/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698