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 "url/gurl.h" | 13 #include "url/gurl.h" |
13 | 14 |
14 #if BUILDFLAG(ANDROID_JAVA_UI) | 15 #if BUILDFLAG(ANDROID_JAVA_UI) |
15 #include "base/files/file_path.h" | 16 #include "base/files/file_path.h" |
16 #include "base/logging.h" | 17 #include "base/logging.h" |
17 #include "chrome/browser/history/android/android_provider_backend.h" | 18 #include "chrome/browser/history/android/android_provider_backend.h" |
18 #include "components/history/core/browser/history_backend.h" | 19 #include "components/history/core/browser/history_backend.h" |
19 #endif | 20 #endif |
20 | 21 |
21 #if BUILDFLAG(ANDROID_JAVA_UI) | 22 #if BUILDFLAG(ANDROID_JAVA_UI) |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 | 66 |
66 bool ChromeHistoryBackendClient::ShouldReportDatabaseError() { | 67 bool ChromeHistoryBackendClient::ShouldReportDatabaseError() { |
67 // TODO(shess): For now, don't report on beta or stable so as not to | 68 // TODO(shess): For now, don't report on beta or stable so as not to |
68 // overwhelm the crash server. Once the big fish are fried, | 69 // overwhelm the crash server. Once the big fish are fried, |
69 // consider reporting at a reduced rate on the bigger channels. | 70 // consider reporting at a reduced rate on the bigger channels. |
70 version_info::Channel channel = chrome::GetChannel(); | 71 version_info::Channel channel = chrome::GetChannel(); |
71 return channel != version_info::Channel::STABLE && | 72 return channel != version_info::Channel::STABLE && |
72 channel != version_info::Channel::BETA; | 73 channel != version_info::Channel::BETA; |
73 } | 74 } |
74 | 75 |
| 76 bool ChromeHistoryBackendClient::IsWebSafe(const GURL& url) { |
| 77 return content::ChildProcessSecurityPolicy::GetInstance()->IsWebSafeScheme( |
| 78 url.scheme()); |
| 79 } |
| 80 |
75 #if BUILDFLAG(ANDROID_JAVA_UI) | 81 #if BUILDFLAG(ANDROID_JAVA_UI) |
76 void ChromeHistoryBackendClient::OnHistoryBackendInitialized( | 82 void ChromeHistoryBackendClient::OnHistoryBackendInitialized( |
77 history::HistoryBackend* history_backend, | 83 history::HistoryBackend* history_backend, |
78 history::HistoryDatabase* history_database, | 84 history::HistoryDatabase* history_database, |
79 history::ThumbnailDatabase* thumbnail_database, | 85 history::ThumbnailDatabase* thumbnail_database, |
80 const base::FilePath& history_dir) { | 86 const base::FilePath& history_dir) { |
81 DCHECK(history_backend); | 87 DCHECK(history_backend); |
82 if (thumbnail_database) { | 88 if (thumbnail_database) { |
83 history_backend->SetUserData( | 89 history_backend->SetUserData( |
84 history::AndroidProviderBackend::GetUserDataKey(), | 90 history::AndroidProviderBackend::GetUserDataKey(), |
85 new history::AndroidProviderBackend( | 91 new history::AndroidProviderBackend( |
86 history_dir.Append(kAndroidCacheFilename), history_database, | 92 history_dir.Append(kAndroidCacheFilename), history_database, |
87 thumbnail_database, this, history_backend)); | 93 thumbnail_database, this, history_backend)); |
88 } | 94 } |
89 } | 95 } |
90 | 96 |
91 void ChromeHistoryBackendClient::OnHistoryBackendDestroyed( | 97 void ChromeHistoryBackendClient::OnHistoryBackendDestroyed( |
92 history::HistoryBackend* history_backend, | 98 history::HistoryBackend* history_backend, |
93 const base::FilePath& history_dir) { | 99 const base::FilePath& history_dir) { |
94 sql::Connection::Delete(history_dir.Append(kAndroidCacheFilename)); | 100 sql::Connection::Delete(history_dir.Append(kAndroidCacheFilename)); |
95 } | 101 } |
96 #endif // BUILDFLAG(ANDROID_JAVA_UI) | 102 #endif // BUILDFLAG(ANDROID_JAVA_UI) |
OLD | NEW |