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

Side by Side Diff: components/update_client/utils.cc

Issue 1606943007: Implement Windows GPO support for "dlpref" in component updater. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: whitespace comments only Created 4 years, 11 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 | « components/update_client/utils.h ('k') | components/update_client/utils_unittest.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 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 "components/update_client/utils.h" 5 #include "components/update_client/utils.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <cmath> 9 #include <cmath>
10 10
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 57
58 return id; 58 return id;
59 } 59 }
60 60
61 } // namespace 61 } // namespace
62 62
63 std::string BuildProtocolRequest(const std::string& browser_version, 63 std::string BuildProtocolRequest(const std::string& browser_version,
64 const std::string& channel, 64 const std::string& channel,
65 const std::string& lang, 65 const std::string& lang,
66 const std::string& os_long_name, 66 const std::string& os_long_name,
67 const std::string& download_preference,
67 const std::string& request_body, 68 const std::string& request_body,
68 const std::string& additional_attributes) { 69 const std::string& additional_attributes) {
69 const std::string prod_id( 70 const std::string prod_id(
70 UpdateQueryParams::GetProdIdString(UpdateQueryParams::CHROME)); 71 UpdateQueryParams::GetProdIdString(UpdateQueryParams::CHROME));
71 72
72 std::string request( 73 std::string request(
73 "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" 74 "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
74 "<request protocol=\"3.0\" "); 75 "<request protocol=\"3.0\" ");
75 76
76 if (!additional_attributes.empty()) 77 if (!additional_attributes.empty())
(...skipping 14 matching lines...) Expand all
91 channel.c_str(), // "prodchannel" 92 channel.c_str(), // "prodchannel"
92 UpdateQueryParams::GetOS(), // "os" 93 UpdateQueryParams::GetOS(), // "os"
93 UpdateQueryParams::GetArch(), // "arch" 94 UpdateQueryParams::GetArch(), // "arch"
94 UpdateQueryParams::GetNaclArch()); // "nacl_arch" 95 UpdateQueryParams::GetNaclArch()); // "nacl_arch"
95 #if defined(OS_WIN) 96 #if defined(OS_WIN)
96 const bool is_wow64(base::win::OSInfo::GetInstance()->wow64_status() == 97 const bool is_wow64(base::win::OSInfo::GetInstance()->wow64_status() ==
97 base::win::OSInfo::WOW64_ENABLED); 98 base::win::OSInfo::WOW64_ENABLED);
98 if (is_wow64) 99 if (is_wow64)
99 base::StringAppendF(&request, " wow64=\"1\""); 100 base::StringAppendF(&request, " wow64=\"1\"");
100 #endif 101 #endif
102 if (!download_preference.empty())
103 base::StringAppendF(&request, " dlpref=\"%s\"",
104 download_preference.c_str());
101 base::StringAppendF(&request, ">"); 105 base::StringAppendF(&request, ">");
102 106
103 // HW platform information. 107 // HW platform information.
104 base::StringAppendF(&request, "<hw physmemory=\"%d\"/>", 108 base::StringAppendF(&request, "<hw physmemory=\"%d\"/>",
105 GetPhysicalMemoryGB()); // "physmem" in GB. 109 GetPhysicalMemoryGB()); // "physmem" in GB.
106 110
107 // OS version and platform information. 111 // OS version and platform information.
108 base::StringAppendF( 112 base::StringAppendF(
109 &request, "<os platform=\"%s\" version=\"%s\" arch=\"%s\"/>", 113 &request, "<os platform=\"%s\" version=\"%s\" arch=\"%s\"/>",
110 os_long_name.c_str(), // "platform" 114 os_long_name.c_str(), // "platform"
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 } 192 }
189 193
190 std::string GetCrxComponentID(const CrxComponent& component) { 194 std::string GetCrxComponentID(const CrxComponent& component) {
191 const size_t kCrxIdSize = 16; 195 const size_t kCrxIdSize = 16;
192 CHECK_GE(component.pk_hash.size(), kCrxIdSize); 196 CHECK_GE(component.pk_hash.size(), kCrxIdSize);
193 return HexStringToID(base::ToLowerASCII( 197 return HexStringToID(base::ToLowerASCII(
194 base::HexEncode(&component.pk_hash[0], kCrxIdSize))); 198 base::HexEncode(&component.pk_hash[0], kCrxIdSize)));
195 } 199 }
196 200
197 } // namespace update_client 201 } // namespace update_client
OLDNEW
« no previous file with comments | « components/update_client/utils.h ('k') | components/update_client/utils_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698