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

Side by Side Diff: chrome/browser/component_updater/component_updater_utils.cc

Issue 153273002: Include the language (locale) info in the update ping (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comments, Unittest Created 6 years, 10 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
« no previous file with comments | « no previous file | chrome/browser/component_updater/pnacl/pnacl_component_installer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/browser/component_updater/component_updater_utils.h" 5 #include "chrome/browser/component_updater/component_updater_utils.h"
6
6 #include "base/file_util.h" 7 #include "base/file_util.h"
7 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
8 #include "base/guid.h" 9 #include "base/guid.h"
9 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
10 #include "base/strings/string_piece.h" 11 #include "base/strings/string_piece.h"
11 #include "base/strings/string_util.h" 12 #include "base/strings/string_util.h"
12 #include "base/strings/stringprintf.h" 13 #include "base/strings/stringprintf.h"
13 #include "base/sys_info.h" 14 #include "base/sys_info.h"
14 #include "base/win/windows_version.h" 15 #include "base/win/windows_version.h"
15 #include "chrome/browser/component_updater/component_updater_service.h" 16 #include "chrome/browser/component_updater/component_updater_service.h"
16 #include "chrome/browser/component_updater/crx_update_item.h" 17 #include "chrome/browser/component_updater/crx_update_item.h"
18 #include "chrome/browser/omaha_query_params/omaha_query_params.h"
17 #include "chrome/common/chrome_version_info.h" 19 #include "chrome/common/chrome_version_info.h"
18 #include "chrome/common/omaha_query_params/omaha_query_params.h"
19 #include "extensions/common/extension.h" 20 #include "extensions/common/extension.h"
20 #include "net/base/load_flags.h" 21 #include "net/base/load_flags.h"
21 #include "net/url_request/url_fetcher.h" 22 #include "net/url_request/url_fetcher.h"
22 #include "net/url_request/url_request_context_getter.h" 23 #include "net/url_request/url_request_context_getter.h"
23 #include "net/url_request/url_request_status.h" 24 #include "net/url_request/url_request_status.h"
24 25
25 namespace component_updater { 26 namespace component_updater {
26 27
27 std::string BuildProtocolRequest(const std::string& request_body, 28 std::string BuildProtocolRequest(const std::string& request_body,
28 const std::string& additional_attributes) { 29 const std::string& additional_attributes) {
29 const std::string prod_id(chrome::OmahaQueryParams::GetProdIdString( 30 const std::string prod_id(chrome::OmahaQueryParams::GetProdIdString(
30 chrome::OmahaQueryParams::CHROME)); 31 chrome::OmahaQueryParams::CHROME));
31 const chrome::VersionInfo chrome_version_info; 32 const chrome::VersionInfo chrome_version_info;
32 const std::string chrome_version(chrome_version_info.Version()); 33 const std::string chrome_version(chrome_version_info.Version());
33 34
34 std::string request( 35 std::string request(
35 "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" 36 "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
36 "<request protocol=\"3.0\" "); 37 "<request protocol=\"3.0\" ");
37 38
38 if (!additional_attributes.empty()) 39 if (!additional_attributes.empty())
39 base::StringAppendF(&request, "%s ", additional_attributes.c_str()); 40 base::StringAppendF(&request, "%s ", additional_attributes.c_str());
40 41
41 // Chrome version and platform information. 42 // Chrome version and platform information.
42 base::StringAppendF( 43 base::StringAppendF(
43 &request, 44 &request,
44 "version=\"%s-%s\" prodversion=\"%s\" " 45 "version=\"%s-%s\" prodversion=\"%s\" "
45 "requestid=\"{%s}\" updaterchannel=\"%s\" prodchannel=\"%s\" " 46 "requestid=\"{%s}\" updaterchannel=\"%s\" prodchannel=\"%s\" "
46 "os=\"%s\" arch=\"%s\" nacl_arch=\"%s\"", 47 "os=\"%s\" arch=\"%s\" nacl_arch=\"%s\"",
47 prod_id.c_str(), chrome_version.c_str(), // "version" 48 prod_id.c_str(),
48 chrome_version.c_str(), // "prodversion" 49 chrome_version.c_str(), // "version"
49 base::GenerateGUID().c_str(), // "requestid" 50 chrome_version.c_str(), // "prodversion"
50 chrome::OmahaQueryParams::GetChannelString(), // "updaterchannel" 51 base::GenerateGUID().c_str(), // "requestid"
51 chrome::OmahaQueryParams::GetChannelString(), // "prodchannel" 52 chrome::OmahaQueryParams::GetChannelString(), // "updaterchannel"
52 chrome::OmahaQueryParams::getOS(), // "os" 53 chrome::OmahaQueryParams::GetChannelString(), // "prodchannel"
53 chrome::OmahaQueryParams::getArch(), // "arch" 54 chrome::OmahaQueryParams::GetOS(), // "os"
54 chrome::OmahaQueryParams::getNaclArch()); // "nacl_arch" 55 chrome::OmahaQueryParams::GetArch(), // "arch"
56 chrome::OmahaQueryParams::GetNaclArch()); // "nacl_arch"
55 #if defined(OS_WIN) 57 #if defined(OS_WIN)
56 const bool is_wow64( 58 const bool is_wow64(
57 base::win::OSInfo::GetInstance()->wow64_status() == 59 base::win::OSInfo::GetInstance()->wow64_status() ==
58 base::win::OSInfo::WOW64_ENABLED); 60 base::win::OSInfo::WOW64_ENABLED);
59 if (is_wow64) 61 if (is_wow64)
60 base::StringAppendF(&request, " wow64=\"1\""); 62 base::StringAppendF(&request, " wow64=\"1\"");
61 #endif 63 #endif
62 base::StringAppendF(&request, ">"); 64 base::StringAppendF(&request, ">");
63 65
64 // OS version and platform information. 66 // OS version and platform information.
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 return id; 167 return id;
166 } 168 }
167 169
168 std::string GetCrxComponentID(const CrxComponent& component) { 170 std::string GetCrxComponentID(const CrxComponent& component) {
169 return HexStringToID(StringToLowerASCII(base::HexEncode(&component.pk_hash[0], 171 return HexStringToID(StringToLowerASCII(base::HexEncode(&component.pk_hash[0],
170 component.pk_hash.size()/2))); 172 component.pk_hash.size()/2)));
171 } 173 }
172 174
173 } // namespace component_updater 175 } // namespace component_updater
174 176
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/component_updater/pnacl/pnacl_component_installer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698