| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 std::string cputype; | 48 std::string cputype; |
| 49 // special case for biarch systems | 49 // special case for biarch systems |
| 50 if (strcmp(unixinfo.machine, "x86_64") == 0 && | 50 if (strcmp(unixinfo.machine, "x86_64") == 0 && |
| 51 sizeof(void*) == sizeof(int32)) { // NOLINT | 51 sizeof(void*) == sizeof(int32)) { // NOLINT |
| 52 cputype.assign("i686 (x86_64)"); | 52 cputype.assign("i686 (x86_64)"); |
| 53 } else { | 53 } else { |
| 54 cputype.assign(unixinfo.machine); | 54 cputype.assign(unixinfo.machine); |
| 55 } | 55 } |
| 56 #endif | 56 #endif |
| 57 | 57 |
| 58 StringAppendF( | 58 base::StringAppendF( |
| 59 &os_cpu, | 59 &os_cpu, |
| 60 #if defined(OS_WIN) | 60 #if defined(OS_WIN) |
| 61 "Windows NT %d.%d", | 61 "Windows NT %d.%d", |
| 62 os_major_version, | 62 os_major_version, |
| 63 os_minor_version | 63 os_minor_version |
| 64 #elif defined(OS_MACOSX) | 64 #elif defined(OS_MACOSX) |
| 65 "Intel Mac OS X %d_%d_%d", | 65 "Intel Mac OS X %d_%d_%d", |
| 66 os_major_version, | 66 os_major_version, |
| 67 os_minor_version, | 67 os_minor_version, |
| 68 os_bugfix_version | 68 os_bugfix_version |
| (...skipping 15 matching lines...) Expand all Loading... |
| 84 | 84 |
| 85 std::string MakeUserAgentForServiceProcess() { | 85 std::string MakeUserAgentForServiceProcess() { |
| 86 std::string user_agent; | 86 std::string user_agent; |
| 87 chrome::VersionInfo version_info; | 87 chrome::VersionInfo version_info; |
| 88 if (!version_info.is_valid()) { | 88 if (!version_info.is_valid()) { |
| 89 DLOG(ERROR) << "Unable to create chrome::VersionInfo object"; | 89 DLOG(ERROR) << "Unable to create chrome::VersionInfo object"; |
| 90 } | 90 } |
| 91 std::string extra_version_info; | 91 std::string extra_version_info; |
| 92 if (!version_info.IsOfficialBuild()) | 92 if (!version_info.IsOfficialBuild()) |
| 93 extra_version_info = "-devel"; | 93 extra_version_info = "-devel"; |
| 94 StringAppendF(&user_agent, | 94 base::StringAppendF(&user_agent, |
| 95 "Chrome Service %s(%s)%s %s ", | 95 "Chrome Service %s(%s)%s %s ", |
| 96 version_info.Version().c_str(), | 96 version_info.Version().c_str(), |
| 97 version_info.LastChange().c_str(), | 97 version_info.LastChange().c_str(), |
| 98 extra_version_info.c_str(), | 98 extra_version_info.c_str(), |
| 99 BuildOSCpuInfo().c_str()); | 99 BuildOSCpuInfo().c_str()); |
| 100 return user_agent; | 100 return user_agent; |
| 101 } | 101 } |
| 102 | 102 |
| 103 } // namespace | 103 } // namespace |
| 104 | 104 |
| 105 ServiceURLRequestContext::ServiceURLRequestContext( | 105 ServiceURLRequestContext::ServiceURLRequestContext( |
| 106 const std::string& user_agent) : user_agent_(user_agent) { | 106 const std::string& user_agent) : user_agent_(user_agent) { |
| 107 host_resolver_ = | 107 host_resolver_ = |
| 108 net::CreateSystemHostResolver(net::HostResolver::kDefaultParallelism, | 108 net::CreateSystemHostResolver(net::HostResolver::kDefaultParallelism, |
| 109 NULL, NULL); | 109 NULL, NULL); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 url_request_context_ = new ServiceURLRequestContext(user_agent_); | 158 url_request_context_ = new ServiceURLRequestContext(user_agent_); |
| 159 return url_request_context_; | 159 return url_request_context_; |
| 160 } | 160 } |
| 161 | 161 |
| 162 scoped_refptr<base::MessageLoopProxy> | 162 scoped_refptr<base::MessageLoopProxy> |
| 163 ServiceURLRequestContextGetter::GetIOMessageLoopProxy() const { | 163 ServiceURLRequestContextGetter::GetIOMessageLoopProxy() const { |
| 164 return io_message_loop_proxy_; | 164 return io_message_loop_proxy_; |
| 165 } | 165 } |
| 166 | 166 |
| 167 ServiceURLRequestContextGetter::~ServiceURLRequestContextGetter() {} | 167 ServiceURLRequestContextGetter::~ServiceURLRequestContextGetter() {} |
| OLD | NEW |