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 "build/build_config.h" | 7 #include "build/build_config.h" |
8 #include "chrome/common/channel_info.h" | 8 #include "chrome/common/channel_info.h" |
9 #include "chrome/common/features.h" | |
10 #include "components/bookmarks/browser/bookmark_model.h" | 9 #include "components/bookmarks/browser/bookmark_model.h" |
11 #include "components/version_info/version_info.h" | 10 #include "components/version_info/version_info.h" |
12 #include "content/public/browser/child_process_security_policy.h" | 11 #include "content/public/browser/child_process_security_policy.h" |
13 #include "url/gurl.h" | 12 #include "url/gurl.h" |
14 | 13 |
15 #if BUILDFLAG(ANDROID_JAVA_UI) | 14 #if defined(OS_ANDROID) |
16 #include "base/files/file_path.h" | 15 #include "base/files/file_path.h" |
17 #include "base/logging.h" | 16 #include "base/logging.h" |
18 #include "chrome/browser/history/android/android_provider_backend.h" | 17 #include "chrome/browser/history/android/android_provider_backend.h" |
19 #include "components/history/core/browser/history_backend.h" | 18 #include "components/history/core/browser/history_backend.h" |
20 #endif | 19 #endif |
21 | 20 |
22 #if BUILDFLAG(ANDROID_JAVA_UI) | 21 #if defined(OS_ANDROID) |
23 namespace { | 22 namespace { |
24 const base::FilePath::CharType kAndroidCacheFilename[] = | 23 const base::FilePath::CharType kAndroidCacheFilename[] = |
25 FILE_PATH_LITERAL("AndroidCache"); | 24 FILE_PATH_LITERAL("AndroidCache"); |
26 } | 25 } |
27 #endif | 26 #endif |
28 | 27 |
29 ChromeHistoryBackendClient::ChromeHistoryBackendClient( | 28 ChromeHistoryBackendClient::ChromeHistoryBackendClient( |
30 bookmarks::BookmarkModel* bookmark_model) | 29 bookmarks::BookmarkModel* bookmark_model) |
31 : bookmark_model_(bookmark_model) { | 30 : bookmark_model_(bookmark_model) { |
32 } | 31 } |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 version_info::Channel channel = chrome::GetChannel(); | 70 version_info::Channel channel = chrome::GetChannel(); |
72 return channel != version_info::Channel::STABLE && | 71 return channel != version_info::Channel::STABLE && |
73 channel != version_info::Channel::BETA; | 72 channel != version_info::Channel::BETA; |
74 } | 73 } |
75 | 74 |
76 bool ChromeHistoryBackendClient::IsWebSafe(const GURL& url) { | 75 bool ChromeHistoryBackendClient::IsWebSafe(const GURL& url) { |
77 return content::ChildProcessSecurityPolicy::GetInstance()->IsWebSafeScheme( | 76 return content::ChildProcessSecurityPolicy::GetInstance()->IsWebSafeScheme( |
78 url.scheme()); | 77 url.scheme()); |
79 } | 78 } |
80 | 79 |
81 #if BUILDFLAG(ANDROID_JAVA_UI) | 80 #if defined(OS_ANDROID) |
82 void ChromeHistoryBackendClient::OnHistoryBackendInitialized( | 81 void ChromeHistoryBackendClient::OnHistoryBackendInitialized( |
83 history::HistoryBackend* history_backend, | 82 history::HistoryBackend* history_backend, |
84 history::HistoryDatabase* history_database, | 83 history::HistoryDatabase* history_database, |
85 history::ThumbnailDatabase* thumbnail_database, | 84 history::ThumbnailDatabase* thumbnail_database, |
86 const base::FilePath& history_dir) { | 85 const base::FilePath& history_dir) { |
87 DCHECK(history_backend); | 86 DCHECK(history_backend); |
88 if (thumbnail_database) { | 87 if (thumbnail_database) { |
89 history_backend->SetUserData( | 88 history_backend->SetUserData( |
90 history::AndroidProviderBackend::GetUserDataKey(), | 89 history::AndroidProviderBackend::GetUserDataKey(), |
91 new history::AndroidProviderBackend( | 90 new history::AndroidProviderBackend( |
92 history_dir.Append(kAndroidCacheFilename), history_database, | 91 history_dir.Append(kAndroidCacheFilename), history_database, |
93 thumbnail_database, this, history_backend)); | 92 thumbnail_database, this, history_backend)); |
94 } | 93 } |
95 } | 94 } |
96 | 95 |
97 void ChromeHistoryBackendClient::OnHistoryBackendDestroyed( | 96 void ChromeHistoryBackendClient::OnHistoryBackendDestroyed( |
98 history::HistoryBackend* history_backend, | 97 history::HistoryBackend* history_backend, |
99 const base::FilePath& history_dir) { | 98 const base::FilePath& history_dir) { |
100 sql::Connection::Delete(history_dir.Append(kAndroidCacheFilename)); | 99 sql::Connection::Delete(history_dir.Append(kAndroidCacheFilename)); |
101 } | 100 } |
102 #endif // BUILDFLAG(ANDROID_JAVA_UI) | 101 #endif // defined(OS_ANDROID) |
OLD | NEW |