Chromium Code Reviews| Index: components/cronet/android/url_request_context_adapter.cc |
| diff --git a/components/cronet/android/url_request_context_adapter.cc b/components/cronet/android/url_request_context_adapter.cc |
| index fd262c2ca6bac34b9480ddf32caf266818e5af58..1405b3003b3f3418c756a58282b18b5ef3785518 100644 |
| --- a/components/cronet/android/url_request_context_adapter.cc |
| +++ b/components/cronet/android/url_request_context_adapter.cc |
| @@ -10,6 +10,7 @@ |
| #include "base/files/file_util.h" |
| #include "base/files/scoped_file.h" |
| #include "base/message_loop/message_loop.h" |
| +#include "base/prefs/pref_filter.h" |
| #include "base/single_thread_task_runner.h" |
| #include "components/cronet/url_request_context_config.h" |
| #include "net/android/network_change_notifier_factory_android.h" |
| @@ -150,12 +151,28 @@ void URLRequestContextAdapter::InitRequestContextOnNetworkThread() { |
| context_builder.set_proxy_config_service(proxy_config_service_.get()); |
| config_->ConfigureURLRequestContextBuilder(&context_builder); |
| + // Set up pref file if storage path is specified. |
| + if (!config_->storage_path.empty()) { |
|
mmenke
2015/05/20 18:33:42
Wonder if it's really worth hooking this up to the
xunjieli
2015/05/20 21:06:12
Send out an email. If there's no strong interest,
|
| + base::FilePath filepath(config_->storage_path); |
| + filepath = filepath.Append(FILE_PATH_LITERAL("local_prefs_legacy.json")); |
| + if (!file_thread_) { |
| + file_thread_.reset(new base::Thread("Network File Thread")); |
| + file_thread_->Start(); |
| + } |
| + json_pref_store_ = new JsonPrefStore(filepath, file_thread_->task_runner(), |
| + scoped_ptr<PrefFilter>()); |
| + json_pref_store_->ReadPrefsAsync(nullptr); |
| + context_builder.SetFileTaskRunner(file_thread_->task_runner()); |
| + } |
| + |
| context_.reset(context_builder.Build()); |
| if (config_->enable_sdch) { |
| DCHECK(context_->sdch_manager()); |
| sdch_owner_.reset( |
| new net::SdchOwner(context_->sdch_manager(), context_.get())); |
| + if (json_pref_store_) |
| + sdch_owner_->EnablePersistentStorage(json_pref_store_.get()); |
| } |
| // Currently (circa M39) enabling QUIC requires setting probability threshold. |