OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "components/policy/core/common/preg_parser_win.h" | 5 #include "components/policy/core/common/preg_parser_win.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <iterator> | 10 #include <iterator> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
14 #include "base/files/file_path.h" | 14 #include "base/files/file_path.h" |
15 #include "base/files/memory_mapped_file.h" | 15 #include "base/files/memory_mapped_file.h" |
| 16 #include "base/i18n/case_conversion.h" |
16 #include "base/logging.h" | 17 #include "base/logging.h" |
17 #include "base/stl_util.h" | 18 #include "base/stl_util.h" |
18 #include "base/strings/string16.h" | 19 #include "base/strings/string16.h" |
19 #include "base/strings/string_split.h" | 20 #include "base/strings/string_split.h" |
20 #include "base/strings/string_util.h" | 21 #include "base/strings/string_util.h" |
21 #include "base/strings/utf_string_conversions.h" | 22 #include "base/strings/utf_string_conversions.h" |
22 #include "base/sys_byteorder.h" | 23 #include "base/sys_byteorder.h" |
23 #include "base/values.h" | 24 #include "base/values.h" |
24 #include "components/policy/core/common/policy_load_status.h" | 25 #include "components/policy/core/common/policy_load_status.h" |
25 #include "components/policy/core/common/registry_dict_win.h" | 26 #include "components/policy/core/common/registry_dict_win.h" |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 data.resize(size); | 292 data.resize(size); |
292 if (!ReadFieldBinary(&cursor, end, size, vector_as_array(&data))) | 293 if (!ReadFieldBinary(&cursor, end, size, vector_as_array(&data))) |
293 break; | 294 break; |
294 current = NextChar(&cursor, end); | 295 current = NextChar(&cursor, end); |
295 } | 296 } |
296 | 297 |
297 if (current != kDelimBracketClose) | 298 if (current != kDelimBracketClose) |
298 break; | 299 break; |
299 | 300 |
300 // Process the record if it is within the |root| subtree. | 301 // Process the record if it is within the |root| subtree. |
301 if (base::StartsWith(key_name, root, false)) | 302 if (base::StartsWith(base::i18n::ToLower(key_name), |
| 303 base::i18n::ToLower(root), |
| 304 base::CompareCase::SENSITIVE)) |
302 HandleRecord(key_name.substr(root.size()), value, type, data, dict); | 305 HandleRecord(key_name.substr(root.size()), value, type, data, dict); |
303 } | 306 } |
304 | 307 |
305 LOG(ERROR) << "Error parsing " << file_path.value() << " at offset " | 308 LOG(ERROR) << "Error parsing " << file_path.value() << " at offset " |
306 << reinterpret_cast<const uint8*>(cursor - 1) - mapped_file.data(); | 309 << reinterpret_cast<const uint8*>(cursor - 1) - mapped_file.data(); |
307 status->Add(POLICY_LOAD_STATUS_PARSE_ERROR); | 310 status->Add(POLICY_LOAD_STATUS_PARSE_ERROR); |
308 return false; | 311 return false; |
309 } | 312 } |
310 | 313 |
311 } // namespace preg_parser | 314 } // namespace preg_parser |
312 } // namespace policy | 315 } // namespace policy |
OLD | NEW |