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

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

Issue 1459793002: Android: Allow compiling browser without Java UI (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/chrome_history_backend_client.h" 5 #include "chrome/browser/history/chrome_history_backend_client.h"
6 6
7 #include "chrome/common/channel_info.h" 7 #include "chrome/common/channel_info.h"
8 #include "chrome/common/features.h"
8 #include "components/bookmarks/browser/bookmark_model.h" 9 #include "components/bookmarks/browser/bookmark_model.h"
9 #include "components/version_info/version_info.h" 10 #include "components/version_info/version_info.h"
10 #include "url/gurl.h" 11 #include "url/gurl.h"
11 12
12 #if defined(OS_ANDROID) 13 #if BUILDFLAG(ANDROID_JAVA_UI)
13 #include "base/files/file_path.h" 14 #include "base/files/file_path.h"
14 #include "base/logging.h" 15 #include "base/logging.h"
15 #include "chrome/browser/history/android/android_provider_backend.h" 16 #include "chrome/browser/history/android/android_provider_backend.h"
16 #include "components/history/core/browser/history_backend.h" 17 #include "components/history/core/browser/history_backend.h"
17 #endif 18 #endif
18 19
19 #if defined(OS_ANDROID) 20 #if BUILDFLAG(ANDROID_JAVA_UI)
20 namespace { 21 namespace {
21 const base::FilePath::CharType kAndroidCacheFilename[] = 22 const base::FilePath::CharType kAndroidCacheFilename[] =
22 FILE_PATH_LITERAL("AndroidCache"); 23 FILE_PATH_LITERAL("AndroidCache");
23 } 24 }
24 #endif // defined(OS_IOS) 25 #endif // defined(OS_IOS)
25 26
26 ChromeHistoryBackendClient::ChromeHistoryBackendClient( 27 ChromeHistoryBackendClient::ChromeHistoryBackendClient(
27 bookmarks::BookmarkModel* bookmark_model) 28 bookmarks::BookmarkModel* bookmark_model)
28 : bookmark_model_(bookmark_model) { 29 : bookmark_model_(bookmark_model) {
29 } 30 }
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 64
64 bool ChromeHistoryBackendClient::ShouldReportDatabaseError() { 65 bool ChromeHistoryBackendClient::ShouldReportDatabaseError() {
65 // TODO(shess): For now, don't report on beta or stable so as not to 66 // TODO(shess): For now, don't report on beta or stable so as not to
66 // overwhelm the crash server. Once the big fish are fried, 67 // overwhelm the crash server. Once the big fish are fried,
67 // consider reporting at a reduced rate on the bigger channels. 68 // consider reporting at a reduced rate on the bigger channels.
68 version_info::Channel channel = chrome::GetChannel(); 69 version_info::Channel channel = chrome::GetChannel();
69 return channel != version_info::Channel::STABLE && 70 return channel != version_info::Channel::STABLE &&
70 channel != version_info::Channel::BETA; 71 channel != version_info::Channel::BETA;
71 } 72 }
72 73
73 #if defined(OS_ANDROID) 74 #if BUILDFLAG(ANDROID_JAVA_UI)
74 void ChromeHistoryBackendClient::OnHistoryBackendInitialized( 75 void ChromeHistoryBackendClient::OnHistoryBackendInitialized(
75 history::HistoryBackend* history_backend, 76 history::HistoryBackend* history_backend,
76 history::HistoryDatabase* history_database, 77 history::HistoryDatabase* history_database,
77 history::ThumbnailDatabase* thumbnail_database, 78 history::ThumbnailDatabase* thumbnail_database,
78 const base::FilePath& history_dir) { 79 const base::FilePath& history_dir) {
79 DCHECK(history_backend); 80 DCHECK(history_backend);
80 if (thumbnail_database) { 81 if (thumbnail_database) {
81 history_backend->SetUserData( 82 history_backend->SetUserData(
82 history::AndroidProviderBackend::GetUserDataKey(), 83 history::AndroidProviderBackend::GetUserDataKey(),
83 new history::AndroidProviderBackend( 84 new history::AndroidProviderBackend(
84 history_dir.Append(kAndroidCacheFilename), history_database, 85 history_dir.Append(kAndroidCacheFilename), history_database,
85 thumbnail_database, this, history_backend)); 86 thumbnail_database, this, history_backend));
86 } 87 }
87 } 88 }
88 89
89 void ChromeHistoryBackendClient::OnHistoryBackendDestroyed( 90 void ChromeHistoryBackendClient::OnHistoryBackendDestroyed(
90 history::HistoryBackend* history_backend, 91 history::HistoryBackend* history_backend,
91 const base::FilePath& history_dir) { 92 const base::FilePath& history_dir) {
92 sql::Connection::Delete(history_dir.Append(kAndroidCacheFilename)); 93 sql::Connection::Delete(history_dir.Append(kAndroidCacheFilename));
93 } 94 }
94 #endif // defined(OS_ANDROID) 95 #endif // BUILDFLAG(ANDROID_JAVA_UI)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698