OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/common/omaha_query_params.h" | 5 #include "chrome/common/omaha_query_params.h" |
6 | 6 |
| 7 #include "base/compiler_specific.h" |
7 #include "base/stringprintf.h" | 8 #include "base/stringprintf.h" |
| 9 #include "base/win/windows_version.h" |
8 #include "chrome/common/chrome_version_info.h" | 10 #include "chrome/common/chrome_version_info.h" |
9 | 11 |
10 namespace { | 12 namespace { |
11 | 13 |
12 const char kUnknown[] = "unknown"; | 14 const char kUnknown[] = "unknown"; |
13 | 15 |
14 // The request extra information is the OS and architecture, this helps | 16 // The request extra information is the OS and architecture, this helps |
15 // the server select the right package to be delivered. | 17 // the server select the right package to be delivered. |
16 const char kOs[] = | 18 const char kOs[] = |
17 #if defined(OS_MACOSX) | 19 #if defined(OS_MACOSX) |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 } | 87 } |
86 return kUnknown; | 88 return kUnknown; |
87 } | 89 } |
88 | 90 |
89 } // namespace | 91 } // namespace |
90 | 92 |
91 namespace chrome { | 93 namespace chrome { |
92 | 94 |
93 std::string OmahaQueryParams::Get(ProdId prod) { | 95 std::string OmahaQueryParams::Get(ProdId prod) { |
94 return base::StringPrintf( | 96 return base::StringPrintf( |
95 "os=%s&arch=%s&prod=%s&prodchannel=%s&prodversion=%s", | 97 "os=%s&arch=%s&nacl_arch=%s&prod=%s&prodchannel=%s&prodversion=%s", |
96 kOs, | 98 kOs, |
97 kArch, | 99 kArch, |
| 100 getNaclArch(), |
98 GetProdIdString(prod), | 101 GetProdIdString(prod), |
99 GetChannelString(), | 102 GetChannelString(), |
100 chrome::VersionInfo().Version().c_str()); | 103 chrome::VersionInfo().Version().c_str()); |
101 } | 104 } |
102 | 105 |
| 106 // static |
| 107 const char* OmahaQueryParams::getOS() { |
| 108 return kOs; |
| 109 } |
| 110 |
| 111 // static |
| 112 const char* OmahaQueryParams::getArch() { |
| 113 return kArch; |
| 114 } |
| 115 |
| 116 // static |
| 117 const char* OmahaQueryParams::getNaclArch() { |
| 118 #if defined(ARCH_CPU_X86_FAMILY) |
| 119 #if defined(ARCH_CPU_X86_64) |
| 120 return "x86-64"; |
| 121 #elif defined(OS_WIN) |
| 122 bool x86_64 = (base::win::OSInfo::GetInstance()->wow64_status() == |
| 123 base::win::OSInfo::WOW64_ENABLED); |
| 124 return x86_64 ? "x86-64" : "x86-32"; |
| 125 #else |
| 126 return "x86-32"; |
| 127 #endif |
| 128 #elif defined(ARCH_CPU_ARMEL) |
| 129 return "arm"; |
| 130 #elif defined(ARCH_CPU_MIPSEL) |
| 131 return "mips32"; |
| 132 #else |
| 133 // NOTE: when adding new values here, please remember to update the |
| 134 // comment in the .h file about possible return values from this function. |
| 135 #error "You need to add support for your architecture here" |
| 136 #endif |
| 137 } |
| 138 |
103 } // namespace chrome | 139 } // namespace chrome |
OLD | NEW |