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/component_updater/component_updater_utils.h" | 5 #include "components/component_updater/component_updater_utils.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 | 8 |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
11 #include "base/guid.h" | 11 #include "base/guid.h" |
12 #include "base/strings/string_number_conversions.h" | 12 #include "base/strings/string_number_conversions.h" |
13 #include "base/strings/string_piece.h" | 13 #include "base/strings/string_piece.h" |
14 #include "base/strings/string_util.h" | 14 #include "base/strings/string_util.h" |
15 #include "base/strings/stringprintf.h" | 15 #include "base/strings/stringprintf.h" |
16 #include "base/sys_info.h" | 16 #include "base/sys_info.h" |
17 #include "base/win/windows_version.h" | 17 #include "base/win/windows_version.h" |
18 #include "components/component_updater/component_updater_configurator.h" | 18 #include "components/component_updater/component_updater_configurator.h" |
19 #include "components/component_updater/crx_update_item.h" | 19 #include "components/component_updater/crx_update_item.h" |
| 20 #include "components/crx_file/id_util.h" |
20 #include "components/omaha_query_params/omaha_query_params.h" | 21 #include "components/omaha_query_params/omaha_query_params.h" |
21 #include "net/base/load_flags.h" | 22 #include "net/base/load_flags.h" |
22 #include "net/url_request/url_fetcher.h" | 23 #include "net/url_request/url_fetcher.h" |
23 #include "net/url_request/url_request_context_getter.h" | 24 #include "net/url_request/url_request_context_getter.h" |
24 #include "net/url_request/url_request_status.h" | 25 #include "net/url_request/url_request_status.h" |
25 | 26 |
26 using omaha_query_params::OmahaQueryParams; | 27 using omaha_query_params::OmahaQueryParams; |
27 | 28 |
28 namespace component_updater { | 29 namespace component_updater { |
29 | 30 |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 int val = 0; | 175 int val = 0; |
175 if (base::HexStringToInt( | 176 if (base::HexStringToInt( |
176 base::StringPiece(hexstr.begin() + i, hexstr.begin() + i + 1), | 177 base::StringPiece(hexstr.begin() + i, hexstr.begin() + i + 1), |
177 &val)) { | 178 &val)) { |
178 id.append(1, val + 'a'); | 179 id.append(1, val + 'a'); |
179 } else { | 180 } else { |
180 id.append(1, 'a'); | 181 id.append(1, 'a'); |
181 } | 182 } |
182 } | 183 } |
183 | 184 |
184 // TODO(tommycli): Add back the DCHECK validating the generated id. This | 185 DCHECK(crx_file::id_util::IdIsValid(id)); |
185 // requires moving the extension id_util functions into components/crx_file. | |
186 | 186 |
187 return id; | 187 return id; |
188 } | 188 } |
189 | 189 |
190 std::string GetCrxComponentID(const CrxComponent& component) { | 190 std::string GetCrxComponentID(const CrxComponent& component) { |
191 return HexStringToID(base::StringToLowerASCII( | 191 return HexStringToID(base::StringToLowerASCII( |
192 base::HexEncode(&component.pk_hash[0], component.pk_hash.size() / 2))); | 192 base::HexEncode(&component.pk_hash[0], component.pk_hash.size() / 2))); |
193 } | 193 } |
194 | 194 |
195 } // namespace component_updater | 195 } // namespace component_updater |
OLD | NEW |