| 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 "android_webview/browser/aw_form_database_service.h" | 7 #include "android_webview/browser/aw_form_database_service.h" |
| 8 #include "android_webview/browser/aw_pref_store.h" | 8 #include "android_webview/browser/aw_pref_store.h" |
| 9 #include "android_webview/browser/aw_quota_manager_bridge.h" | 9 #include "android_webview/browser/aw_quota_manager_bridge.h" |
| 10 #include "android_webview/browser/aw_resource_context.h" | 10 #include "android_webview/browser/aw_resource_context.h" |
| 11 #include "android_webview/browser/jni_dependency_factory.h" | 11 #include "android_webview/browser/jni_dependency_factory.h" |
| 12 #include "android_webview/browser/net/aw_url_request_context_getter.h" | 12 #include "android_webview/browser/net/aw_url_request_context_getter.h" |
| 13 #include "android_webview/browser/net/init_native_callback.h" | 13 #include "android_webview/browser/net/init_native_callback.h" |
| 14 #include "base/base_paths_android.h" | 14 #include "base/base_paths_android.h" |
| 15 #include "base/bind.h" | 15 #include "base/bind.h" |
| 16 #include "base/path_service.h" | 16 #include "base/path_service.h" |
| 17 #include "base/prefs/pref_registry_simple.h" | 17 #include "base/prefs/pref_registry_simple.h" |
| 18 #include "base/prefs/pref_service.h" | 18 #include "base/prefs/pref_service.h" |
| 19 #include "base/prefs/pref_service_factory.h" | 19 #include "base/prefs/pref_service_factory.h" |
| 20 #include "components/autofill/core/common/autofill_pref_names.h" | 20 #include "components/autofill/core/common/autofill_pref_names.h" |
| 21 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_io_d
ata.h" | 21 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_io_d
ata.h" |
| 22 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_pref
s.h" | 22 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_pref
s.h" |
| 23 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_sett
ings.h" | 23 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_sett
ings.h" |
| 24 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_stat
istics_prefs.h" |
| 24 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param
s.h" | 25 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param
s.h" |
| 25 #include "components/user_prefs/user_prefs.h" | 26 #include "components/user_prefs/user_prefs.h" |
| 26 #include "components/visitedlink/browser/visitedlink_master.h" | 27 #include "components/visitedlink/browser/visitedlink_master.h" |
| 27 #include "content/public/browser/browser_thread.h" | 28 #include "content/public/browser/browser_thread.h" |
| 28 #include "content/public/browser/ssl_host_state_delegate.h" | 29 #include "content/public/browser/ssl_host_state_delegate.h" |
| 29 #include "content/public/browser/storage_partition.h" | 30 #include "content/public/browser/storage_partition.h" |
| 30 #include "content/public/browser/web_contents.h" | 31 #include "content/public/browser/web_contents.h" |
| 31 #include "net/cookies/cookie_store.h" | 32 #include "net/cookies/cookie_store.h" |
| 32 #include "net/proxy/proxy_config_service_android.h" | 33 #include "net/proxy/proxy_config_service_android.h" |
| 33 #include "net/proxy/proxy_service.h" | 34 #include "net/proxy/proxy_service.h" |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 cache_path = fallback_cache_dir; | 153 cache_path = fallback_cache_dir; |
| 153 LOG(WARNING) << "Failed to get cache directory for Android WebView. " | 154 LOG(WARNING) << "Failed to get cache directory for Android WebView. " |
| 154 << "Using app data directory as a fallback."; | 155 << "Using app data directory as a fallback."; |
| 155 } | 156 } |
| 156 url_request_context_getter_ = | 157 url_request_context_getter_ = |
| 157 new AwURLRequestContextGetter( | 158 new AwURLRequestContextGetter( |
| 158 cache_path, cookie_store_.get(), | 159 cache_path, cookie_store_.get(), |
| 159 make_scoped_ptr(CreateProxyConfigService()).Pass()); | 160 make_scoped_ptr(CreateProxyConfigService()).Pass()); |
| 160 | 161 |
| 161 data_reduction_proxy_settings_.reset( | 162 data_reduction_proxy_settings_.reset( |
| 162 new data_reduction_proxy::DataReductionProxySettings( | 163 new data_reduction_proxy::DataReductionProxySettings()); |
| 163 scoped_ptr<data_reduction_proxy::DataReductionProxyParams>( | |
| 164 new data_reduction_proxy::DataReductionProxyParams( | |
| 165 data_reduction_proxy::DataReductionProxyParams::kAllowed)) | |
| 166 .Pass())); | |
| 167 data_reduction_proxy_io_data_.reset( | 164 data_reduction_proxy_io_data_.reset( |
| 168 new data_reduction_proxy::DataReductionProxyIOData( | 165 new data_reduction_proxy::DataReductionProxyIOData( |
| 169 data_reduction_proxy::Client::WEBVIEW_ANDROID, | 166 data_reduction_proxy::Client::WEBVIEW_ANDROID, |
| 170 scoped_ptr< | 167 scoped_ptr< |
| 171 data_reduction_proxy::DataReductionProxyStatisticsPrefs>(), | 168 data_reduction_proxy::DataReductionProxyStatisticsPrefs>(), |
| 172 data_reduction_proxy_settings_.get(), | 169 data_reduction_proxy_settings_.get(), |
| 173 url_request_context_getter_->GetNetLog(), | 170 url_request_context_getter_->GetNetLog(), |
| 174 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO), | 171 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO), |
| 175 BrowserThread::GetMessageLoopProxyForThread( | 172 BrowserThread::GetMessageLoopProxyForThread( |
| 176 BrowserThread::UI))); | 173 BrowserThread::UI))); |
| 177 data_reduction_proxy_settings_->SetProxyConfigurator( | |
| 178 data_reduction_proxy_io_data_->configurator()); | |
| 179 | 174 |
| 180 visitedlink_master_.reset( | 175 visitedlink_master_.reset( |
| 181 new visitedlink::VisitedLinkMaster(this, this, false)); | 176 new visitedlink::VisitedLinkMaster(this, this, false)); |
| 182 visitedlink_master_->Init(); | 177 visitedlink_master_->Init(); |
| 183 | 178 |
| 184 form_database_service_.reset( | 179 form_database_service_.reset( |
| 185 new AwFormDatabaseService(context_storage_path_)); | 180 new AwFormDatabaseService(context_storage_path_)); |
| 186 } | 181 } |
| 187 | 182 |
| 188 void AwBrowserContext::AddVisitedURLs(const std::vector<GURL>& urls) { | 183 void AwBrowserContext::AddVisitedURLs(const std::vector<GURL>& urls) { |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 base::PrefServiceFactory pref_service_factory; | 267 base::PrefServiceFactory pref_service_factory; |
| 273 pref_service_factory.set_user_prefs(make_scoped_refptr(new AwPrefStore())); | 268 pref_service_factory.set_user_prefs(make_scoped_refptr(new AwPrefStore())); |
| 274 pref_service_factory.set_read_error_callback(base::Bind(&HandleReadError)); | 269 pref_service_factory.set_read_error_callback(base::Bind(&HandleReadError)); |
| 275 user_pref_service_ = pref_service_factory.Create(pref_registry).Pass(); | 270 user_pref_service_ = pref_service_factory.Create(pref_registry).Pass(); |
| 276 | 271 |
| 277 user_prefs::UserPrefs::Set(this, user_pref_service_.get()); | 272 user_prefs::UserPrefs::Set(this, user_pref_service_.get()); |
| 278 | 273 |
| 279 if (data_reduction_proxy_settings_) { | 274 if (data_reduction_proxy_settings_) { |
| 280 data_reduction_proxy_settings_->InitDataReductionProxySettings( | 275 data_reduction_proxy_settings_->InitDataReductionProxySettings( |
| 281 user_pref_service_.get(), | 276 user_pref_service_.get(), |
| 282 GetRequestContext(), | 277 data_reduction_proxy_io_data_->config(), |
| 283 GetAwURLRequestContext()->GetNetLog(), | |
| 284 data_reduction_proxy_io_data_->event_store()); | 278 data_reduction_proxy_io_data_->event_store()); |
| 285 data_reduction_proxy_settings_->MaybeActivateDataReductionProxy(true); | 279 data_reduction_proxy_settings_->MaybeActivateDataReductionProxy(true); |
| 286 | 280 |
| 287 SetDataReductionProxyEnabled(data_reduction_proxy_enabled_); | 281 SetDataReductionProxyEnabled(data_reduction_proxy_enabled_); |
| 288 } | 282 } |
| 289 } | 283 } |
| 290 | 284 |
| 291 scoped_ptr<content::ZoomLevelDelegate> | 285 scoped_ptr<content::ZoomLevelDelegate> |
| 292 AwBrowserContext::CreateZoomLevelDelegate( | 286 AwBrowserContext::CreateZoomLevelDelegate( |
| 293 const base::FilePath& partition_path) { | 287 const base::FilePath& partition_path) { |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 378 DCHECK(GetDataReductionProxyIOData()); | 372 DCHECK(GetDataReductionProxyIOData()); |
| 379 if (GetDataReductionProxyIOData()->statistics_prefs()) | 373 if (GetDataReductionProxyIOData()->statistics_prefs()) |
| 380 return; | 374 return; |
| 381 // We don't care about commit_delay for now. It is just a dummy value. | 375 // We don't care about commit_delay for now. It is just a dummy value. |
| 382 base::TimeDelta commit_delay = base::TimeDelta::FromMinutes(60); | 376 base::TimeDelta commit_delay = base::TimeDelta::FromMinutes(60); |
| 383 GetDataReductionProxyIOData()->EnableCompressionStatisticsLogging( | 377 GetDataReductionProxyIOData()->EnableCompressionStatisticsLogging( |
| 384 user_pref_service_.get(), commit_delay); | 378 user_pref_service_.get(), commit_delay); |
| 385 } | 379 } |
| 386 | 380 |
| 387 } // namespace android_webview | 381 } // namespace android_webview |
| OLD | NEW |