Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(131)

Side by Side Diff: components/cronet/android/cronet_url_request_context_adapter.cc

Issue 1662843002: Revert of Delete base/prefs and update callers to use components. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "components/cronet/android/cronet_url_request_context_adapter.h" 5 #include "components/cronet/android/cronet_url_request_context_adapter.h"
6 6
7 #include <limits.h> 7 #include <limits.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <map> 9 #include <map>
10 #include <utility> 10 #include <utility>
11 11
12 #include "base/android/jni_android.h" 12 #include "base/android/jni_android.h"
13 #include "base/android/jni_array.h" 13 #include "base/android/jni_array.h"
14 #include "base/android/jni_string.h" 14 #include "base/android/jni_string.h"
15 #include "base/bind.h" 15 #include "base/bind.h"
16 #include "base/files/file_path.h" 16 #include "base/files/file_path.h"
17 #include "base/files/file_util.h" 17 #include "base/files/file_util.h"
18 #include "base/files/scoped_file.h" 18 #include "base/files/scoped_file.h"
19 #include "base/logging.h" 19 #include "base/logging.h"
20 #include "base/macros.h" 20 #include "base/macros.h"
21 #include "base/memory/scoped_vector.h" 21 #include "base/memory/scoped_vector.h"
22 #include "base/message_loop/message_loop.h" 22 #include "base/message_loop/message_loop.h"
23 #include "base/metrics/statistics_recorder.h" 23 #include "base/metrics/statistics_recorder.h"
24 #include "base/prefs/pref_change_registrar.h"
25 #include "base/prefs/pref_filter.h"
26 #include "base/prefs/pref_registry_simple.h"
27 #include "base/prefs/pref_service.h"
28 #include "base/prefs/pref_service_factory.h"
24 #include "base/single_thread_task_runner.h" 29 #include "base/single_thread_task_runner.h"
25 #include "base/time/time.h" 30 #include "base/time/time.h"
26 #include "base/values.h" 31 #include "base/values.h"
27 #include "components/cronet/histogram_manager.h" 32 #include "components/cronet/histogram_manager.h"
28 #include "components/cronet/url_request_context_config.h" 33 #include "components/cronet/url_request_context_config.h"
29 #include "components/prefs/pref_change_registrar.h"
30 #include "components/prefs/pref_filter.h"
31 #include "components/prefs/pref_registry_simple.h"
32 #include "components/prefs/pref_service.h"
33 #include "components/prefs/pref_service_factory.h"
34 #include "jni/CronetUrlRequestContext_jni.h" 34 #include "jni/CronetUrlRequestContext_jni.h"
35 #include "net/base/external_estimate_provider.h" 35 #include "net/base/external_estimate_provider.h"
36 #include "net/base/load_flags.h" 36 #include "net/base/load_flags.h"
37 #include "net/base/net_errors.h" 37 #include "net/base/net_errors.h"
38 #include "net/base/network_delegate_impl.h" 38 #include "net/base/network_delegate_impl.h"
39 #include "net/base/url_util.h" 39 #include "net/base/url_util.h"
40 #include "net/cert/cert_verifier.h" 40 #include "net/cert/cert_verifier.h"
41 #include "net/http/http_auth_handler_factory.h" 41 #include "net/http/http_auth_handler_factory.h"
42 #include "net/http/http_server_properties_manager.h" 42 #include "net/http/http_server_properties_manager.h"
43 #include "net/log/write_to_file_net_log_observer.h" 43 #include "net/log/write_to_file_net_log_observer.h"
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
436 436
437 // Set up pref file if storage path is specified. 437 // Set up pref file if storage path is specified.
438 if (!config->storage_path.empty()) { 438 if (!config->storage_path.empty()) {
439 base::FilePath filepath(config->storage_path); 439 base::FilePath filepath(config->storage_path);
440 filepath = filepath.Append(FILE_PATH_LITERAL("local_prefs.json")); 440 filepath = filepath.Append(FILE_PATH_LITERAL("local_prefs.json"));
441 json_pref_store_ = new JsonPrefStore( 441 json_pref_store_ = new JsonPrefStore(
442 filepath, GetFileThread()->task_runner(), scoped_ptr<PrefFilter>()); 442 filepath, GetFileThread()->task_runner(), scoped_ptr<PrefFilter>());
443 context_builder.SetFileTaskRunner(GetFileThread()->task_runner()); 443 context_builder.SetFileTaskRunner(GetFileThread()->task_runner());
444 444
445 // Set up HttpServerPropertiesManager. 445 // Set up HttpServerPropertiesManager.
446 PrefServiceFactory factory; 446 base::PrefServiceFactory factory;
447 factory.set_user_prefs(json_pref_store_); 447 factory.set_user_prefs(json_pref_store_);
448 scoped_refptr<PrefRegistrySimple> registry(new PrefRegistrySimple()); 448 scoped_refptr<PrefRegistrySimple> registry(new PrefRegistrySimple());
449 registry->RegisterDictionaryPref(kHttpServerProperties, 449 registry->RegisterDictionaryPref(kHttpServerProperties,
450 new base::DictionaryValue()); 450 new base::DictionaryValue());
451 pref_service_ = factory.Create(registry.get()); 451 pref_service_ = factory.Create(registry.get());
452 452
453 scoped_ptr<net::HttpServerPropertiesManager> http_server_properties_manager( 453 scoped_ptr<net::HttpServerPropertiesManager> http_server_properties_manager(
454 new net::HttpServerPropertiesManager( 454 new net::HttpServerPropertiesManager(
455 new PrefServiceAdapter(pref_service_.get()), 455 new PrefServiceAdapter(pref_service_.get()),
456 GetNetworkTaskRunner())); 456 GetNetworkTaskRunner()));
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
798 JNIEnv* env, 798 JNIEnv* env,
799 const JavaParamRef<jclass>& jcaller) { 799 const JavaParamRef<jclass>& jcaller) {
800 base::StatisticsRecorder::Initialize(); 800 base::StatisticsRecorder::Initialize();
801 std::vector<uint8_t> data; 801 std::vector<uint8_t> data;
802 if (!HistogramManager::GetInstance()->GetDeltas(&data)) 802 if (!HistogramManager::GetInstance()->GetDeltas(&data))
803 return ScopedJavaLocalRef<jbyteArray>(); 803 return ScopedJavaLocalRef<jbyteArray>();
804 return base::android::ToJavaByteArray(env, &data[0], data.size()); 804 return base::android::ToJavaByteArray(env, &data[0], data.size());
805 } 805 }
806 806
807 } // namespace cronet 807 } // namespace cronet
OLDNEW
« no previous file with comments | « components/cronet/android/cronet_url_request_context_adapter.h ('k') | components/data_reduction_proxy/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698