| OLD | NEW |
| 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 <stdint.h> | 7 #include <stdint.h> |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 | 9 |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 os_long_name.c_str(), // "platform" | 108 os_long_name.c_str(), // "platform" |
| 109 base::SysInfo().OperatingSystemVersion().c_str(), // "version" | 109 base::SysInfo().OperatingSystemVersion().c_str(), // "version" |
| 110 base::SysInfo().OperatingSystemArchitecture().c_str()); // "arch" | 110 base::SysInfo().OperatingSystemArchitecture().c_str()); // "arch" |
| 111 | 111 |
| 112 // The actual payload of the request. | 112 // The actual payload of the request. |
| 113 base::StringAppendF(&request, "%s</request>", request_body.c_str()); | 113 base::StringAppendF(&request, "%s</request>", request_body.c_str()); |
| 114 | 114 |
| 115 return request; | 115 return request; |
| 116 } | 116 } |
| 117 | 117 |
| 118 net::URLFetcher* SendProtocolRequest( | 118 scoped_ptr<net::URLFetcher> SendProtocolRequest( |
| 119 const GURL& url, | 119 const GURL& url, |
| 120 const std::string& protocol_request, | 120 const std::string& protocol_request, |
| 121 net::URLFetcherDelegate* url_fetcher_delegate, | 121 net::URLFetcherDelegate* url_fetcher_delegate, |
| 122 net::URLRequestContextGetter* url_request_context_getter) { | 122 net::URLRequestContextGetter* url_request_context_getter) { |
| 123 net::URLFetcher* url_fetcher(net::URLFetcher::Create( | 123 scoped_ptr<net::URLFetcher> url_fetcher = net::URLFetcher::Create( |
| 124 0, url, net::URLFetcher::POST, url_fetcher_delegate)); | 124 0, url, net::URLFetcher::POST, url_fetcher_delegate); |
| 125 | 125 |
| 126 url_fetcher->SetUploadData("application/xml", protocol_request); | 126 url_fetcher->SetUploadData("application/xml", protocol_request); |
| 127 url_fetcher->SetRequestContext(url_request_context_getter); | 127 url_fetcher->SetRequestContext(url_request_context_getter); |
| 128 url_fetcher->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES | | 128 url_fetcher->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES | |
| 129 net::LOAD_DO_NOT_SAVE_COOKIES | | 129 net::LOAD_DO_NOT_SAVE_COOKIES | |
| 130 net::LOAD_DISABLE_CACHE); | 130 net::LOAD_DISABLE_CACHE); |
| 131 url_fetcher->SetAutomaticallyRetryOn5xx(false); | 131 url_fetcher->SetAutomaticallyRetryOn5xx(false); |
| 132 url_fetcher->Start(); | 132 url_fetcher->Start(); |
| 133 | 133 |
| 134 return url_fetcher; | 134 return url_fetcher; |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 } | 186 } |
| 187 | 187 |
| 188 std::string GetCrxComponentID(const CrxComponent& component) { | 188 std::string GetCrxComponentID(const CrxComponent& component) { |
| 189 const size_t kCrxIdSize = 16; | 189 const size_t kCrxIdSize = 16; |
| 190 CHECK_GE(component.pk_hash.size(), kCrxIdSize); | 190 CHECK_GE(component.pk_hash.size(), kCrxIdSize); |
| 191 return HexStringToID(base::StringToLowerASCII( | 191 return HexStringToID(base::StringToLowerASCII( |
| 192 base::HexEncode(&component.pk_hash[0], kCrxIdSize))); | 192 base::HexEncode(&component.pk_hash[0], kCrxIdSize))); |
| 193 } | 193 } |
| 194 | 194 |
| 195 } // namespace update_client | 195 } // namespace update_client |
| OLD | NEW |