| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "android_webview/browser/aw_browser_context.h" | 5 #include "android_webview/browser/aw_browser_context.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "android_webview/browser/aw_browser_policy_connector.h" | 9 #include "android_webview/browser/aw_browser_policy_connector.h" |
| 10 #include "android_webview/browser/aw_form_database_service.h" | 10 #include "android_webview/browser/aw_form_database_service.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 #include "base/task_scheduler/post_task.h" | 22 #include "base/task_scheduler/post_task.h" |
| 23 #include "components/autofill/core/common/autofill_pref_names.h" | 23 #include "components/autofill/core/common/autofill_pref_names.h" |
| 24 #include "components/metrics/metrics_service.h" | 24 #include "components/metrics/metrics_service.h" |
| 25 #include "components/policy/core/browser/browser_policy_connector_base.h" | 25 #include "components/policy/core/browser/browser_policy_connector_base.h" |
| 26 #include "components/policy/core/browser/configuration_policy_pref_store.h" | 26 #include "components/policy/core/browser/configuration_policy_pref_store.h" |
| 27 #include "components/policy/core/browser/url_blacklist_manager.h" | 27 #include "components/policy/core/browser/url_blacklist_manager.h" |
| 28 #include "components/pref_registry/pref_registry_syncable.h" | 28 #include "components/pref_registry/pref_registry_syncable.h" |
| 29 #include "components/prefs/in_memory_pref_store.h" | 29 #include "components/prefs/in_memory_pref_store.h" |
| 30 #include "components/prefs/pref_service.h" | 30 #include "components/prefs/pref_service.h" |
| 31 #include "components/prefs/pref_service_factory.h" | 31 #include "components/prefs/pref_service_factory.h" |
| 32 #include "components/safe_browsing/triggers/trigger_manager.h" |
| 32 #include "components/url_formatter/url_fixer.h" | 33 #include "components/url_formatter/url_fixer.h" |
| 33 #include "components/user_prefs/user_prefs.h" | 34 #include "components/user_prefs/user_prefs.h" |
| 34 #include "components/visitedlink/browser/visitedlink_master.h" | 35 #include "components/visitedlink/browser/visitedlink_master.h" |
| 35 #include "content/public/browser/browser_thread.h" | 36 #include "content/public/browser/browser_thread.h" |
| 36 #include "content/public/browser/ssl_host_state_delegate.h" | 37 #include "content/public/browser/ssl_host_state_delegate.h" |
| 37 #include "content/public/browser/storage_partition.h" | 38 #include "content/public/browser/storage_partition.h" |
| 38 #include "content/public/browser/web_contents.h" | 39 #include "content/public/browser/web_contents.h" |
| 39 #include "net/proxy/proxy_config_service_android.h" | 40 #include "net/proxy/proxy_config_service_android.h" |
| 40 #include "net/proxy/proxy_service.h" | 41 #include "net/proxy/proxy_service.h" |
| 41 | 42 |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 | 200 |
| 200 web_restriction_provider_.reset( | 201 web_restriction_provider_.reset( |
| 201 new web_restrictions::WebRestrictionsClient()); | 202 new web_restrictions::WebRestrictionsClient()); |
| 202 pref_change_registrar_.Add( | 203 pref_change_registrar_.Add( |
| 203 prefs::kWebRestrictionsAuthority, | 204 prefs::kWebRestrictionsAuthority, |
| 204 base::Bind(&AwBrowserContext::OnWebRestrictionsAuthorityChanged, | 205 base::Bind(&AwBrowserContext::OnWebRestrictionsAuthorityChanged, |
| 205 base::Unretained(this))); | 206 base::Unretained(this))); |
| 206 web_restriction_provider_->SetAuthority( | 207 web_restriction_provider_->SetAuthority( |
| 207 user_pref_service_->GetString(prefs::kWebRestrictionsAuthority)); | 208 user_pref_service_->GetString(prefs::kWebRestrictionsAuthority)); |
| 208 | 209 |
| 209 safe_browsing_ui_manager_ = new AwSafeBrowsingUIManager(); | 210 safe_browsing_ui_manager_ = |
| 211 new AwSafeBrowsingUIManager(GetAwURLRequestContext()); |
| 210 safe_browsing_db_manager_ = | 212 safe_browsing_db_manager_ = |
| 211 new safe_browsing::RemoteSafeBrowsingDatabaseManager(); | 213 new safe_browsing::RemoteSafeBrowsingDatabaseManager(); |
| 214 safe_browsing_trigger_manager_ = |
| 215 base::MakeUnique<safe_browsing::TriggerManager>( |
| 216 safe_browsing_ui_manager_.get()); |
| 212 } | 217 } |
| 213 | 218 |
| 214 void AwBrowserContext::OnWebRestrictionsAuthorityChanged() { | 219 void AwBrowserContext::OnWebRestrictionsAuthorityChanged() { |
| 215 web_restriction_provider_->SetAuthority( | 220 web_restriction_provider_->SetAuthority( |
| 216 user_pref_service_->GetString(prefs::kWebRestrictionsAuthority)); | 221 user_pref_service_->GetString(prefs::kWebRestrictionsAuthority)); |
| 217 } | 222 } |
| 218 | 223 |
| 219 void AwBrowserContext::AddVisitedURLs(const std::vector<GURL>& urls) { | 224 void AwBrowserContext::AddVisitedURLs(const std::vector<GURL>& urls) { |
| 220 DCHECK(visitedlink_master_); | 225 DCHECK(visitedlink_master_); |
| 221 visitedlink_master_->AddURLs(urls); | 226 visitedlink_master_->AddURLs(urls); |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 if (!safe_browsing_db_manager_started_) { | 393 if (!safe_browsing_db_manager_started_) { |
| 389 // V4ProtocolConfig is not used. Just create one with empty values.. | 394 // V4ProtocolConfig is not used. Just create one with empty values.. |
| 390 safe_browsing::V4ProtocolConfig config("", false, "", ""); | 395 safe_browsing::V4ProtocolConfig config("", false, "", ""); |
| 391 safe_browsing_db_manager_->StartOnIOThread( | 396 safe_browsing_db_manager_->StartOnIOThread( |
| 392 url_request_context_getter_.get(), config); | 397 url_request_context_getter_.get(), config); |
| 393 safe_browsing_db_manager_started_ = true; | 398 safe_browsing_db_manager_started_ = true; |
| 394 } | 399 } |
| 395 return safe_browsing_db_manager_.get(); | 400 return safe_browsing_db_manager_.get(); |
| 396 } | 401 } |
| 397 | 402 |
| 403 safe_browsing::TriggerManager* AwBrowserContext::GetSafeBrowsingTriggerManager() |
| 404 const { |
| 405 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 406 return safe_browsing_trigger_manager_.get(); |
| 407 } |
| 408 |
| 398 void AwBrowserContext::RebuildTable( | 409 void AwBrowserContext::RebuildTable( |
| 399 const scoped_refptr<URLEnumerator>& enumerator) { | 410 const scoped_refptr<URLEnumerator>& enumerator) { |
| 400 // Android WebView rebuilds from WebChromeClient.getVisitedHistory. The client | 411 // Android WebView rebuilds from WebChromeClient.getVisitedHistory. The client |
| 401 // can change in the lifetime of this WebView and may not yet be set here. | 412 // can change in the lifetime of this WebView and may not yet be set here. |
| 402 // Therefore this initialization path is not used. | 413 // Therefore this initialization path is not used. |
| 403 enumerator->OnComplete(true); | 414 enumerator->OnComplete(true); |
| 404 } | 415 } |
| 405 | 416 |
| 406 } // namespace android_webview | 417 } // namespace android_webview |
| OLD | NEW |