| 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 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 guid_file_path); | 201 guid_file_path); |
| 202 | 202 |
| 203 web_restriction_provider_.reset( | 203 web_restriction_provider_.reset( |
| 204 new web_restrictions::WebRestrictionsClient()); | 204 new web_restrictions::WebRestrictionsClient()); |
| 205 pref_change_registrar_.Add( | 205 pref_change_registrar_.Add( |
| 206 prefs::kWebRestrictionsAuthority, | 206 prefs::kWebRestrictionsAuthority, |
| 207 base::Bind(&AwBrowserContext::OnWebRestrictionsAuthorityChanged, | 207 base::Bind(&AwBrowserContext::OnWebRestrictionsAuthorityChanged, |
| 208 base::Unretained(this))); | 208 base::Unretained(this))); |
| 209 web_restriction_provider_->SetAuthority( | 209 web_restriction_provider_->SetAuthority( |
| 210 user_pref_service_->GetString(prefs::kWebRestrictionsAuthority)); | 210 user_pref_service_->GetString(prefs::kWebRestrictionsAuthority)); |
| 211 |
| 212 safe_browsing_ui_manager_ = new AwSafeBrowsingUIManager(); |
| 213 safe_browsing_db_manager_ = |
| 214 new safe_browsing::RemoteSafeBrowsingDatabaseManager(); |
| 211 } | 215 } |
| 212 | 216 |
| 213 void AwBrowserContext::OnWebRestrictionsAuthorityChanged() { | 217 void AwBrowserContext::OnWebRestrictionsAuthorityChanged() { |
| 214 web_restriction_provider_->SetAuthority( | 218 web_restriction_provider_->SetAuthority( |
| 215 user_pref_service_->GetString(prefs::kWebRestrictionsAuthority)); | 219 user_pref_service_->GetString(prefs::kWebRestrictionsAuthority)); |
| 216 } | 220 } |
| 217 | 221 |
| 218 void AwBrowserContext::AddVisitedURLs(const std::vector<GURL>& urls) { | 222 void AwBrowserContext::AddVisitedURLs(const std::vector<GURL>& urls) { |
| 219 DCHECK(visitedlink_master_); | 223 DCHECK(visitedlink_master_); |
| 220 visitedlink_master_->AddURLs(urls); | 224 visitedlink_master_->AddURLs(urls); |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 DCHECK(blacklist_manager_); | 374 DCHECK(blacklist_manager_); |
| 371 return blacklist_manager_.get(); | 375 return blacklist_manager_.get(); |
| 372 } | 376 } |
| 373 | 377 |
| 374 web_restrictions::WebRestrictionsClient* | 378 web_restrictions::WebRestrictionsClient* |
| 375 AwBrowserContext::GetWebRestrictionProvider() { | 379 AwBrowserContext::GetWebRestrictionProvider() { |
| 376 DCHECK(web_restriction_provider_); | 380 DCHECK(web_restriction_provider_); |
| 377 return web_restriction_provider_.get(); | 381 return web_restriction_provider_.get(); |
| 378 } | 382 } |
| 379 | 383 |
| 384 AwSafeBrowsingUIManager* AwBrowserContext::GetSafeBrowsingUIManager() { |
| 385 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 386 return safe_browsing_ui_manager_.get(); |
| 387 } |
| 388 |
| 389 safe_browsing::RemoteSafeBrowsingDatabaseManager* |
| 390 AwBrowserContext::GetSafeBrowsingDBManager() { |
| 391 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 392 if (!safe_browsing_db_manager_started_) { |
| 393 // V4ProtocolConfig is not used. Just create one with empty values.. |
| 394 safe_browsing::V4ProtocolConfig config("", false, "", ""); |
| 395 safe_browsing_db_manager_->StartOnIOThread( |
| 396 url_request_context_getter_.get(), config); |
| 397 safe_browsing_db_manager_started_ = true; |
| 398 } |
| 399 return safe_browsing_db_manager_.get(); |
| 400 } |
| 401 |
| 380 void AwBrowserContext::RebuildTable( | 402 void AwBrowserContext::RebuildTable( |
| 381 const scoped_refptr<URLEnumerator>& enumerator) { | 403 const scoped_refptr<URLEnumerator>& enumerator) { |
| 382 // Android WebView rebuilds from WebChromeClient.getVisitedHistory. The client | 404 // Android WebView rebuilds from WebChromeClient.getVisitedHistory. The client |
| 383 // can change in the lifetime of this WebView and may not yet be set here. | 405 // can change in the lifetime of this WebView and may not yet be set here. |
| 384 // Therefore this initialization path is not used. | 406 // Therefore this initialization path is not used. |
| 385 enumerator->OnComplete(true); | 407 enumerator->OnComplete(true); |
| 386 } | 408 } |
| 387 | 409 |
| 388 } // namespace android_webview | 410 } // namespace android_webview |
| OLD | NEW |