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