| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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.h" | 5 #include "chrome/service/net/service_url_request_context.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/message_loop_proxy.h" | 11 #include "base/message_loop_proxy.h" |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 cookie_store_ = new net::CookieMonster(NULL, NULL); | 141 cookie_store_ = new net::CookieMonster(NULL, NULL); |
| 142 accept_language_ = "en-us,fr"; | 142 accept_language_ = "en-us,fr"; |
| 143 accept_charset_ = "iso-8859-1,*,utf-8"; | 143 accept_charset_ = "iso-8859-1,*,utf-8"; |
| 144 } | 144 } |
| 145 | 145 |
| 146 const std::string& ServiceURLRequestContext::GetUserAgent( | 146 const std::string& ServiceURLRequestContext::GetUserAgent( |
| 147 const GURL& url) const { | 147 const GURL& url) const { |
| 148 // If the user agent is set explicitly return that, otherwise call the | 148 // If the user agent is set explicitly return that, otherwise call the |
| 149 // base class method to return default value. | 149 // base class method to return default value. |
| 150 return user_agent_.empty() ? | 150 return user_agent_.empty() ? |
| 151 URLRequestContext::GetUserAgent(url) : user_agent_; | 151 net::URLRequestContext::GetUserAgent(url) : user_agent_; |
| 152 } | 152 } |
| 153 | 153 |
| 154 ServiceURLRequestContext::~ServiceURLRequestContext() { | 154 ServiceURLRequestContext::~ServiceURLRequestContext() { |
| 155 delete ftp_transaction_factory_; | 155 delete ftp_transaction_factory_; |
| 156 delete http_transaction_factory_; | 156 delete http_transaction_factory_; |
| 157 delete http_auth_handler_factory_; | 157 delete http_auth_handler_factory_; |
| 158 delete cert_verifier_; | 158 delete cert_verifier_; |
| 159 delete dnsrr_resolver_; | 159 delete dnsrr_resolver_; |
| 160 } | 160 } |
| 161 | 161 |
| 162 ServiceURLRequestContextGetter::ServiceURLRequestContextGetter() | 162 ServiceURLRequestContextGetter::ServiceURLRequestContextGetter() |
| 163 : io_message_loop_proxy_( | 163 : io_message_loop_proxy_( |
| 164 g_service_process->io_thread()->message_loop_proxy()) { | 164 g_service_process->io_thread()->message_loop_proxy()) { |
| 165 // Build the default user agent. | 165 // Build the default user agent. |
| 166 user_agent_ = MakeUserAgentForServiceProcess(); | 166 user_agent_ = MakeUserAgentForServiceProcess(); |
| 167 } | 167 } |
| 168 | 168 |
| 169 URLRequestContext* | 169 net::URLRequestContext* |
| 170 ServiceURLRequestContextGetter::GetURLRequestContext() { | 170 ServiceURLRequestContextGetter::GetURLRequestContext() { |
| 171 if (!url_request_context_) | 171 if (!url_request_context_) |
| 172 url_request_context_ = new ServiceURLRequestContext(user_agent_); | 172 url_request_context_ = new ServiceURLRequestContext(user_agent_); |
| 173 return url_request_context_; | 173 return url_request_context_; |
| 174 } | 174 } |
| 175 | 175 |
| 176 scoped_refptr<base::MessageLoopProxy> | 176 scoped_refptr<base::MessageLoopProxy> |
| 177 ServiceURLRequestContextGetter::GetIOMessageLoopProxy() const { | 177 ServiceURLRequestContextGetter::GetIOMessageLoopProxy() const { |
| 178 return io_message_loop_proxy_; | 178 return io_message_loop_proxy_; |
| 179 } | 179 } |
| 180 | 180 |
| 181 ServiceURLRequestContextGetter::~ServiceURLRequestContextGetter() {} | 181 ServiceURLRequestContextGetter::~ServiceURLRequestContextGetter() {} |
| OLD | NEW |