OLD | NEW |
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 "components/bookmarks/browser/bookmark_model.h" | 8 #include "components/bookmarks/browser/bookmark_model.h" |
9 #include "components/version_info/version_info.h" | 9 #include "components/version_info/version_info.h" |
10 #include "url/gurl.h" | 10 #include "url/gurl.h" |
11 | 11 |
12 #if defined(OS_ANDROID) | 12 #if defined(ANDROID_JAVA_UI) |
13 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
14 #include "base/logging.h" | 14 #include "base/logging.h" |
15 #include "chrome/browser/history/android/android_provider_backend.h" | 15 #include "chrome/browser/history/android/android_provider_backend.h" |
16 #include "components/history/core/browser/history_backend.h" | 16 #include "components/history/core/browser/history_backend.h" |
17 #endif | 17 #endif |
18 | 18 |
19 #if defined(OS_ANDROID) | 19 #if defined(ANDROID_JAVA_UI) |
20 namespace { | 20 namespace { |
21 const base::FilePath::CharType kAndroidCacheFilename[] = | 21 const base::FilePath::CharType kAndroidCacheFilename[] = |
22 FILE_PATH_LITERAL("AndroidCache"); | 22 FILE_PATH_LITERAL("AndroidCache"); |
23 } | 23 } |
24 #endif // defined(OS_IOS) | 24 #endif // defined(OS_IOS) |
25 | 25 |
26 ChromeHistoryBackendClient::ChromeHistoryBackendClient( | 26 ChromeHistoryBackendClient::ChromeHistoryBackendClient( |
27 bookmarks::BookmarkModel* bookmark_model) | 27 bookmarks::BookmarkModel* bookmark_model) |
28 : bookmark_model_(bookmark_model) { | 28 : bookmark_model_(bookmark_model) { |
29 } | 29 } |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 | 63 |
64 bool ChromeHistoryBackendClient::ShouldReportDatabaseError() { | 64 bool ChromeHistoryBackendClient::ShouldReportDatabaseError() { |
65 // TODO(shess): For now, don't report on beta or stable so as not to | 65 // 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, | 66 // overwhelm the crash server. Once the big fish are fried, |
67 // consider reporting at a reduced rate on the bigger channels. | 67 // consider reporting at a reduced rate on the bigger channels. |
68 version_info::Channel channel = chrome::GetChannel(); | 68 version_info::Channel channel = chrome::GetChannel(); |
69 return channel != version_info::Channel::STABLE && | 69 return channel != version_info::Channel::STABLE && |
70 channel != version_info::Channel::BETA; | 70 channel != version_info::Channel::BETA; |
71 } | 71 } |
72 | 72 |
73 #if defined(OS_ANDROID) | 73 #if defined(ANDROID_JAVA_UI) |
74 void ChromeHistoryBackendClient::OnHistoryBackendInitialized( | 74 void ChromeHistoryBackendClient::OnHistoryBackendInitialized( |
75 history::HistoryBackend* history_backend, | 75 history::HistoryBackend* history_backend, |
76 history::HistoryDatabase* history_database, | 76 history::HistoryDatabase* history_database, |
77 history::ThumbnailDatabase* thumbnail_database, | 77 history::ThumbnailDatabase* thumbnail_database, |
78 const base::FilePath& history_dir) { | 78 const base::FilePath& history_dir) { |
79 DCHECK(history_backend); | 79 DCHECK(history_backend); |
80 if (thumbnail_database) { | 80 if (thumbnail_database) { |
81 history_backend->SetUserData( | 81 history_backend->SetUserData( |
82 history::AndroidProviderBackend::GetUserDataKey(), | 82 history::AndroidProviderBackend::GetUserDataKey(), |
83 new history::AndroidProviderBackend( | 83 new history::AndroidProviderBackend( |
84 history_dir.Append(kAndroidCacheFilename), history_database, | 84 history_dir.Append(kAndroidCacheFilename), history_database, |
85 thumbnail_database, this, history_backend)); | 85 thumbnail_database, this, history_backend)); |
86 } | 86 } |
87 } | 87 } |
88 | 88 |
89 void ChromeHistoryBackendClient::OnHistoryBackendDestroyed( | 89 void ChromeHistoryBackendClient::OnHistoryBackendDestroyed( |
90 history::HistoryBackend* history_backend, | 90 history::HistoryBackend* history_backend, |
91 const base::FilePath& history_dir) { | 91 const base::FilePath& history_dir) { |
92 sql::Connection::Delete(history_dir.Append(kAndroidCacheFilename)); | 92 sql::Connection::Delete(history_dir.Append(kAndroidCacheFilename)); |
93 } | 93 } |
94 #endif // defined(OS_ANDROID) | 94 #endif // defined(ANDROID_JAVA_UI) |
OLD | NEW |