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 "chrome/browser/policy/preg_parser_win.h" | 5 #include "chrome/browser/policy/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/logging.h" | 16 #include "base/logging.h" |
17 #include "base/stl_util.h" | 17 #include "base/stl_util.h" |
18 #include "base/string16.h" | 18 #include "base/string16.h" |
19 #include "base/string_util.h" | 19 #include "base/string_util.h" |
| 20 #include "base/strings/utf_string_conversions.h" |
20 #include "base/sys_byteorder.h" | 21 #include "base/sys_byteorder.h" |
21 #include "base/utf_string_conversions.h" | |
22 #include "base/values.h" | 22 #include "base/values.h" |
23 #include "chrome/browser/policy/policy_load_status.h" | 23 #include "chrome/browser/policy/policy_load_status.h" |
24 | 24 |
25 namespace policy { | 25 namespace policy { |
26 namespace preg_parser { | 26 namespace preg_parser { |
27 | 27 |
28 const char kPRegFileHeader[8] = | 28 const char kPRegFileHeader[8] = |
29 { 'P', 'R', 'e', 'g', '\x01', '\x00', '\x00', '\x00' }; | 29 { 'P', 'R', 'e', 'g', '\x01', '\x00', '\x00', '\x00' }; |
30 | 30 |
31 // Maximum PReg file size we're willing to accept. | 31 // Maximum PReg file size we're willing to accept. |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 } | 300 } |
301 | 301 |
302 LOG(ERROR) << "Error parsing " << file_path.value() << " at offset " | 302 LOG(ERROR) << "Error parsing " << file_path.value() << " at offset " |
303 << reinterpret_cast<const uint8*>(cursor - 1) - mapped_file.data(); | 303 << reinterpret_cast<const uint8*>(cursor - 1) - mapped_file.data(); |
304 status->Add(POLICY_LOAD_STATUS_PARSE_ERROR); | 304 status->Add(POLICY_LOAD_STATUS_PARSE_ERROR); |
305 return false; | 305 return false; |
306 } | 306 } |
307 | 307 |
308 } // namespace preg_parser | 308 } // namespace preg_parser |
309 } // namespace policy | 309 } // namespace policy |
OLD | NEW |