OLD | NEW |
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 "chrome/service/net/service_url_request_context_getter.h" | 5 #include "chrome/service/net/service_url_request_context_getter.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 return user_agent; | 95 return user_agent; |
96 } | 96 } |
97 | 97 |
98 } // namespace | 98 } // namespace |
99 | 99 |
100 ServiceURLRequestContextGetter::ServiceURLRequestContextGetter() | 100 ServiceURLRequestContextGetter::ServiceURLRequestContextGetter() |
101 : user_agent_(MakeUserAgentForServiceProcess()), | 101 : user_agent_(MakeUserAgentForServiceProcess()), |
102 network_task_runner_(g_service_process->io_task_runner()) { | 102 network_task_runner_(g_service_process->io_task_runner()) { |
103 DCHECK(g_service_process); | 103 DCHECK(g_service_process); |
104 proxy_config_service_ = net::ProxyService::CreateSystemProxyConfigService( | 104 proxy_config_service_ = net::ProxyService::CreateSystemProxyConfigService( |
105 g_service_process->io_task_runner(), | 105 g_service_process->io_task_runner()); |
106 g_service_process->file_task_runner()); | |
107 } | 106 } |
108 | 107 |
109 net::URLRequestContext* | 108 net::URLRequestContext* |
110 ServiceURLRequestContextGetter::GetURLRequestContext() { | 109 ServiceURLRequestContextGetter::GetURLRequestContext() { |
111 if (!url_request_context_.get()) { | 110 if (!url_request_context_.get()) { |
112 net::URLRequestContextBuilder builder; | 111 net::URLRequestContextBuilder builder; |
113 builder.set_user_agent(user_agent_); | 112 builder.set_user_agent(user_agent_); |
114 builder.set_accept_language("en-us,fr"); | 113 builder.set_accept_language("en-us,fr"); |
115 builder.set_proxy_config_service(std::move(proxy_config_service_)); | 114 builder.set_proxy_config_service(std::move(proxy_config_service_)); |
116 builder.set_throttling_enabled(true); | 115 builder.set_throttling_enabled(true); |
117 url_request_context_ = builder.Build(); | 116 url_request_context_ = builder.Build(); |
118 } | 117 } |
119 return url_request_context_.get(); | 118 return url_request_context_.get(); |
120 } | 119 } |
121 | 120 |
122 scoped_refptr<base::SingleThreadTaskRunner> | 121 scoped_refptr<base::SingleThreadTaskRunner> |
123 ServiceURLRequestContextGetter::GetNetworkTaskRunner() const { | 122 ServiceURLRequestContextGetter::GetNetworkTaskRunner() const { |
124 return network_task_runner_; | 123 return network_task_runner_; |
125 } | 124 } |
126 | 125 |
127 ServiceURLRequestContextGetter::~ServiceURLRequestContextGetter() {} | 126 ServiceURLRequestContextGetter::~ServiceURLRequestContextGetter() {} |
OLD | NEW |