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

Side by Side Diff: chrome/service/net/service_url_request_context_getter.cc

Issue 1167163002: chrome: Remove use of MessageLoopProxy and deprecated MessageLoop APIs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added some missing message_loop.h includes. Created 5 years, 6 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 "chrome/service/net/service_url_request_context_getter.h" 5 #include "chrome/service/net/service_url_request_context_getter.h"
6 6
7 #if defined(OS_POSIX) && !defined(OS_MACOSX) 7 #if defined(OS_POSIX) && !defined(OS_MACOSX)
8 #include <sys/utsname.h> 8 #include <sys/utsname.h>
9 #endif 9 #endif
10 10
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "base/message_loop/message_loop_proxy.h" 12 #include "base/single_thread_task_runner.h"
13 #include "base/strings/stringprintf.h" 13 #include "base/strings/stringprintf.h"
14 #include "base/sys_info.h" 14 #include "base/sys_info.h"
15 #include "chrome/common/chrome_version_info.h" 15 #include "chrome/common/chrome_version_info.h"
16 #include "chrome/service/service_process.h" 16 #include "chrome/service/service_process.h"
17 #include "net/proxy/proxy_config_service.h" 17 #include "net/proxy/proxy_config_service.h"
18 #include "net/proxy/proxy_service.h" 18 #include "net/proxy/proxy_service.h"
19 #include "net/url_request/url_request_context_builder.h" 19 #include "net/url_request/url_request_context_builder.h"
20 20
21 namespace { 21 namespace {
22 // Copied from webkit/glue/user_agent.cc. We don't want to pull in a dependency 22 // Copied from webkit/glue/user_agent.cc. We don't want to pull in a dependency
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 version_info.LastChange().c_str(), 89 version_info.LastChange().c_str(),
90 extra_version_info.c_str(), 90 extra_version_info.c_str(),
91 BuildOSCpuInfo().c_str()); 91 BuildOSCpuInfo().c_str());
92 return user_agent; 92 return user_agent;
93 } 93 }
94 94
95 } // namespace 95 } // namespace
96 96
97 ServiceURLRequestContextGetter::ServiceURLRequestContextGetter() 97 ServiceURLRequestContextGetter::ServiceURLRequestContextGetter()
98 : user_agent_(MakeUserAgentForServiceProcess()), 98 : user_agent_(MakeUserAgentForServiceProcess()),
99 network_task_runner_( 99 network_task_runner_(g_service_process->io_thread()->task_runner()) {
100 g_service_process->io_thread()->message_loop_proxy()) {
101 // TODO(sanjeevr): Change CreateSystemProxyConfigService to accept a 100 // TODO(sanjeevr): Change CreateSystemProxyConfigService to accept a
102 // MessageLoopProxy* instead of MessageLoop*. 101 // SingleThreadTaskRunner* instead of MessageLoop*.
103 DCHECK(g_service_process); 102 DCHECK(g_service_process);
104 proxy_config_service_.reset(net::ProxyService::CreateSystemProxyConfigService( 103 proxy_config_service_.reset(net::ProxyService::CreateSystemProxyConfigService(
105 g_service_process->io_thread()->message_loop_proxy(), 104 g_service_process->io_thread()->task_runner(),
106 g_service_process->file_thread()->message_loop_proxy())); 105 g_service_process->file_thread()->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(proxy_config_service_.release()); 114 builder.set_proxy_config_service(proxy_config_service_.release());
116 builder.set_throttling_enabled(true); 115 builder.set_throttling_enabled(true);
117 url_request_context_.reset(builder.Build()); 116 url_request_context_.reset(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() {}
OLDNEW
« no previous file with comments | « chrome/service/net/service_url_request_context_getter.h ('k') | chrome/service/service_ipc_server.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698