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

Unified Diff: chrome/browser/history/chrome_history_client.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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/history/chrome_history_client.cc
diff --git a/chrome/browser/history/chrome_history_client.cc b/chrome/browser/history/chrome_history_client.cc
index 2cb9f99bdb45ab170d2ce7a53aed34e042f23eca..e21bcbd0dca34bbfad71f89dcc3528af7f940c1b 100644
--- a/chrome/browser/history/chrome_history_client.cc
+++ b/chrome/browser/history/chrome_history_client.cc
@@ -4,7 +4,7 @@
#include "chrome/browser/history/chrome_history_client.h"
-#include "base/logging.h"
+#include "chrome/browser/history/chrome_history_backend_client.h"
#include "chrome/browser/history/history_utils.h"
#include "chrome/browser/ui/profile_error_dialog.h"
#include "chrome/common/chrome_version_info.h"
@@ -12,25 +12,6 @@
#include "chrome/grit/generated_resources.h"
#include "components/bookmarks/browser/bookmark_model.h"
-#if defined(OS_ANDROID)
-#include "base/files/file_path.h"
-#include "chrome/browser/history/android/android_provider_backend.h"
-#include "components/history/core/browser/history_backend.h"
-#endif
-
-#if defined(OS_ANDROID)
-namespace {
-
-const base::FilePath::CharType kAndroidCacheFilename[] =
- FILE_PATH_LITERAL("AndroidCache");
-
-base::FilePath GetAndroidCacheFileName(const base::FilePath& history_dir) {
- return history_dir.Append(kAndroidCacheFilename);
-}
-
-} // namespace
-#endif
-
ChromeHistoryClient::ChromeHistoryClient(
bookmarks::BookmarkModel* bookmark_model)
: bookmark_model_(bookmark_model) {
@@ -51,33 +32,6 @@ void ChromeHistoryClient::Shutdown() {
bookmark_model_->Shutdown();
}
-void ChromeHistoryClient::BlockUntilBookmarksLoaded() {
- if (bookmark_model_)
- bookmark_model_->BlockTillLoaded();
-}
-
-bool ChromeHistoryClient::IsBookmarked(const GURL& url) {
- return bookmark_model_ && bookmark_model_->IsBookmarked(url);
-}
-
-void ChromeHistoryClient::GetBookmarks(
- std::vector<history::URLAndTitle>* bookmarks) {
- if (!bookmark_model_)
- return;
-
- std::vector<bookmarks::BookmarkModel::URLAndTitle> bookmarks_url_and_title;
- bookmark_model_->GetBookmarks(&bookmarks_url_and_title);
-
- bookmarks->reserve(bookmarks->size() + bookmarks_url_and_title.size());
- for (size_t i = 0; i < bookmarks_url_and_title.size(); ++i) {
- history::URLAndTitle value = {
- bookmarks_url_and_title[i].url,
- bookmarks_url_and_title[i].title,
- };
- bookmarks->push_back(value);
- }
-}
-
bool ChromeHistoryClient::CanAddURL(const GURL& url) {
return CanAddURLToHistory(url);
}
@@ -89,34 +43,7 @@ void ChromeHistoryClient::NotifyProfileError(sql::InitStatus init_status) {
IDS_COULDNT_OPEN_PROFILE_ERROR : IDS_PROFILE_TOO_NEW_ERROR);
}
-bool ChromeHistoryClient::ShouldReportDatabaseError() {
- // TODO(shess): For now, don't report on beta or stable so as not to
- // overwhelm the crash server. Once the big fish are fried,
- // consider reporting at a reduced rate on the bigger channels.
- chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel();
- return channel != chrome::VersionInfo::CHANNEL_STABLE &&
- channel != chrome::VersionInfo::CHANNEL_BETA;
-}
-
-#if defined(OS_ANDROID)
-void ChromeHistoryClient::OnHistoryBackendInitialized(
- history::HistoryBackend* history_backend,
- history::HistoryDatabase* history_database,
- history::ThumbnailDatabase* thumbnail_database,
- const base::FilePath& history_dir) {
- if (thumbnail_database) {
- DCHECK(history_backend);
- history_backend->SetUserData(
- history::AndroidProviderBackend::GetUserDataKey(),
- new history::AndroidProviderBackend(
- GetAndroidCacheFileName(history_dir), history_database,
- thumbnail_database, this, history_backend));
- }
-}
-
-void ChromeHistoryClient::OnHistoryBackendDestroyed(
- history::HistoryBackend* history_backend,
- const base::FilePath& history_dir) {
- sql::Connection::Delete(GetAndroidCacheFileName(history_dir));
+scoped_ptr<history::HistoryBackendClient>
+ChromeHistoryClient::CreateBackendClient() {
+ return make_scoped_ptr(new ChromeHistoryBackendClient(bookmark_model_));
}
-#endif
« no previous file with comments | « chrome/browser/history/chrome_history_client.h ('k') | chrome/browser/sync/profile_sync_service_typed_url_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698