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

Side by Side Diff: chrome/browser/history/android/android_provider_backend.cc

Issue 1198373002: Split HistoryClient in two objects (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@1192403002
Patch Set: Add comments in ChromeHistoryBackendClient Created 5 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 #include "chrome/browser/history/android/android_provider_backend.h" 5 #include "chrome/browser/history/android/android_provider_backend.h"
6 6
7 #include "base/i18n/case_conversion.h" 7 #include "base/i18n/case_conversion.h"
8 #include "chrome/browser/history/android/bookmark_model_sql_handler.h" 8 #include "chrome/browser/history/android/bookmark_model_sql_handler.h"
9 #include "components/history/core/browser/android/android_time.h" 9 #include "components/history/core/browser/android/android_time.h"
10 #include "components/history/core/browser/android/android_urls_sql_handler.h" 10 #include "components/history/core/browser/android/android_urls_sql_handler.h"
11 #include "components/history/core/browser/android/favicon_sql_handler.h" 11 #include "components/history/core/browser/android/favicon_sql_handler.h"
12 #include "components/history/core/browser/android/urls_sql_handler.h" 12 #include "components/history/core/browser/android/urls_sql_handler.h"
13 #include "components/history/core/browser/android/visit_sql_handler.h" 13 #include "components/history/core/browser/android/visit_sql_handler.h"
14 #include "components/history/core/browser/history_backend.h" 14 #include "components/history/core/browser/history_backend.h"
15 #include "components/history/core/browser/history_backend_client.h"
15 #include "components/history/core/browser/history_backend_notifier.h" 16 #include "components/history/core/browser/history_backend_notifier.h"
16 #include "components/history/core/browser/history_client.h"
17 #include "components/history/core/browser/history_database.h" 17 #include "components/history/core/browser/history_database.h"
18 #include "components/history/core/browser/keyword_search_term.h" 18 #include "components/history/core/browser/keyword_search_term.h"
19 #include "components/history/core/browser/thumbnail_database.h" 19 #include "components/history/core/browser/thumbnail_database.h"
20 20
21 21
22 namespace history { 22 namespace history {
23 23
24 24
25 // Helpers -------------------------------------------------------------------- 25 // Helpers --------------------------------------------------------------------
26 26
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 committed_ = true; 193 committed_ = true;
194 } 194 }
195 195
196 196
197 // AndroidProviderBackend ----------------------------------------------------- 197 // AndroidProviderBackend -----------------------------------------------------
198 198
199 AndroidProviderBackend::AndroidProviderBackend( 199 AndroidProviderBackend::AndroidProviderBackend(
200 const base::FilePath& db_name, 200 const base::FilePath& db_name,
201 HistoryDatabase* history_db, 201 HistoryDatabase* history_db,
202 ThumbnailDatabase* thumbnail_db, 202 ThumbnailDatabase* thumbnail_db,
203 HistoryClient* history_client, 203 HistoryBackendClient* backend_client,
204 HistoryBackendNotifier* notifier) 204 HistoryBackendNotifier* notifier)
205 : android_cache_db_filename_(db_name), 205 : android_cache_db_filename_(db_name),
206 db_(&history_db->GetDB()), 206 db_(&history_db->GetDB()),
207 history_db_(history_db), 207 history_db_(history_db),
208 thumbnail_db_(thumbnail_db), 208 thumbnail_db_(thumbnail_db),
209 history_client_(history_client), 209 backend_client_(backend_client),
210 initialized_(false), 210 initialized_(false),
211 notifier_(notifier) { 211 notifier_(notifier) {
212 DCHECK(notifier_); 212 DCHECK(notifier_);
213 } 213 }
214 214
215 AndroidProviderBackend::~AndroidProviderBackend() { 215 AndroidProviderBackend::~AndroidProviderBackend() {
216 } 216 }
217 217
218 // static 218 // static
219 const void* AndroidProviderBackend::GetUserDataKey() { 219 const void* AndroidProviderBackend::GetUserDataKey() {
(...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after
796 return false; 796 return false;
797 } 797 }
798 return true; 798 return true;
799 } 799 }
800 800
801 bool AndroidProviderBackend::UpdateRemovedURLs() { 801 bool AndroidProviderBackend::UpdateRemovedURLs() {
802 return history_db_->DeleteUnusedAndroidURLs(); 802 return history_db_->DeleteUnusedAndroidURLs();
803 } 803 }
804 804
805 bool AndroidProviderBackend::UpdateBookmarks() { 805 bool AndroidProviderBackend::UpdateBookmarks() {
806 if (history_client_ == NULL) { 806 if (backend_client_ == NULL) {
807 LOG(ERROR) << "HistoryClient is not available"; 807 LOG(ERROR) << "HistoryClient is not available";
808 return false; 808 return false;
809 } 809 }
810 810
811 std::vector<URLAndTitle> bookmarks; 811 std::vector<URLAndTitle> bookmarks;
812 history_client_->GetBookmarks(&bookmarks); 812 backend_client_->GetBookmarks(&bookmarks);
813 813
814 if (bookmarks.empty()) 814 if (bookmarks.empty())
815 return true; 815 return true;
816 816
817 std::vector<URLID> url_ids; 817 std::vector<URLID> url_ids;
818 for (std::vector<URLAndTitle>::const_iterator i = 818 for (std::vector<URLAndTitle>::const_iterator i =
819 bookmarks.begin(); i != bookmarks.end(); ++i) { 819 bookmarks.begin(); i != bookmarks.end(); ++i) {
820 URLID url_id = history_db_->GetRowForURL(i->url, NULL); 820 URLID url_id = history_db_->GetRowForURL(i->url, NULL);
821 if (url_id == 0) { 821 if (url_id == 0) {
822 URLRow url_row(i->url); 822 URLRow url_row(i->url);
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
1251 return false; 1251 return false;
1252 1252
1253 if (!history_db_->SetKeywordSearchTermsForURL(bookmark_row.url_id(), 1253 if (!history_db_->SetKeywordSearchTermsForURL(bookmark_row.url_id(),
1254 values.keyword_id(), values.search_term())) 1254 values.keyword_id(), values.search_term()))
1255 return false; 1255 return false;
1256 } 1256 }
1257 return true; 1257 return true;
1258 } 1258 }
1259 1259
1260 } // namespace history 1260 } // namespace history
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698