OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/policy_loader_win.h" | 5 #include "chrome/browser/policy/policy_loader_win.h" |
6 | 6 |
7 #include <string> | |
8 #include <vector> | |
9 | |
10 #include <rpc.h> // For struct GUID | 7 #include <rpc.h> // For struct GUID |
11 #include <shlwapi.h> // For PathIsUNC() | 8 #include <shlwapi.h> // For PathIsUNC() |
12 #include <userenv.h> // For GPO functions | 9 #include <userenv.h> // For GPO functions |
13 #include <windows.h> | 10 #include <windows.h> |
14 | 11 |
| 12 #include <string> |
| 13 #include <vector> |
| 14 |
15 // shlwapi.dll is required for PathIsUNC(). | 15 // shlwapi.dll is required for PathIsUNC(). |
16 #pragma comment(lib, "shlwapi.lib") | 16 #pragma comment(lib, "shlwapi.lib") |
17 // userenv.dll is required for various GPO functions. | 17 // userenv.dll is required for various GPO functions. |
18 #pragma comment(lib, "userenv.lib") | 18 #pragma comment(lib, "userenv.lib") |
19 | 19 |
20 #include "base/basictypes.h" | 20 #include "base/basictypes.h" |
21 #include "base/file_util.h" | 21 #include "base/file_util.h" |
22 #include "base/files/file_path.h" | |
23 #include "base/json/json_reader.h" | 22 #include "base/json/json_reader.h" |
24 #include "base/lazy_instance.h" | 23 #include "base/lazy_instance.h" |
25 #include "base/logging.h" | 24 #include "base/logging.h" |
26 #include "base/scoped_native_library.h" | 25 #include "base/scoped_native_library.h" |
27 #include "base/stl_util.h" | 26 #include "base/stl_util.h" |
28 #include "base/string16.h" | 27 #include "base/string16.h" |
29 #include "base/string_util.h" | 28 #include "base/string_util.h" |
30 #include "base/strings/string_number_conversions.h" | 29 #include "base/strings/string_number_conversions.h" |
31 #include "base/sys_byteorder.h" | 30 #include "base/sys_byteorder.h" |
32 #include "base/utf_string_conversions.h" | 31 #include "base/utf_string_conversions.h" |
(...skipping 15 matching lines...) Expand all Loading... |
48 namespace { | 47 namespace { |
49 | 48 |
50 const char kKeyMandatory[] = "policy"; | 49 const char kKeyMandatory[] = "policy"; |
51 const char kKeyRecommended[] = "recommended"; | 50 const char kKeyRecommended[] = "recommended"; |
52 const char kKeySchema[] = "schema"; | 51 const char kKeySchema[] = "schema"; |
53 const char kKeyThirdParty[] = "3rdparty"; | 52 const char kKeyThirdParty[] = "3rdparty"; |
54 | 53 |
55 // The GUID of the registry settings group policy extension. | 54 // The GUID of the registry settings group policy extension. |
56 GUID kRegistrySettingsCSEGUID = REGISTRY_EXTENSION_GUID; | 55 GUID kRegistrySettingsCSEGUID = REGISTRY_EXTENSION_GUID; |
57 | 56 |
58 // The PReg file name. | |
59 const base::FilePath::CharType kPRegFileName[] = | |
60 FILE_PATH_LITERAL("Registry.pol"); | |
61 | |
62 // A helper class encapsulating run-time-linked function calls to Wow64 APIs. | 57 // A helper class encapsulating run-time-linked function calls to Wow64 APIs. |
63 class Wow64Functions { | 58 class Wow64Functions { |
64 public: | 59 public: |
65 Wow64Functions() | 60 Wow64Functions() |
66 : kernel32_lib_(base::FilePath(L"kernel32")), | 61 : kernel32_lib_(base::FilePath(L"kernel32")), |
67 is_wow_64_process_(NULL), | 62 is_wow_64_process_(NULL), |
68 wow_64_disable_wow_64_fs_redirection_(NULL), | 63 wow_64_disable_wow_64_fs_redirection_(NULL), |
69 wow_64_revert_wow_64_fs_redirection_(NULL) { | 64 wow_64_revert_wow_64_fs_redirection_(NULL) { |
70 if (kernel32_lib_.is_valid()) { | 65 if (kernel32_lib_.is_valid()) { |
71 is_wow_64_process_ = static_cast<IsWow64Process>( | 66 is_wow_64_process_ = static_cast<IsWow64Process>( |
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
442 if (!policy_value->GetAsDictionary(&policy_dict) || !policy_dict) { | 437 if (!policy_value->GetAsDictionary(&policy_dict) || !policy_dict) { |
443 LOG(WARNING) << "Root policy object is not a dictionary!"; | 438 LOG(WARNING) << "Root policy object is not a dictionary!"; |
444 return; | 439 return; |
445 } | 440 } |
446 | 441 |
447 policy->LoadFrom(policy_dict, level, scope); | 442 policy->LoadFrom(policy_dict, level, scope); |
448 } | 443 } |
449 | 444 |
450 } // namespace | 445 } // namespace |
451 | 446 |
| 447 const base::FilePath::CharType PolicyLoaderWin::kPRegFileName[] = |
| 448 FILE_PATH_LITERAL("Registry.pol"); |
| 449 |
452 PolicyLoaderWin::PolicyLoaderWin(const PolicyDefinitionList* policy_list, | 450 PolicyLoaderWin::PolicyLoaderWin(const PolicyDefinitionList* policy_list, |
453 const string16& chrome_policy_key, | 451 const string16& chrome_policy_key, |
454 AppliedGPOListProvider* gpo_provider) | 452 AppliedGPOListProvider* gpo_provider) |
455 : is_initialized_(false), | 453 : is_initialized_(false), |
456 policy_list_(policy_list), | 454 policy_list_(policy_list), |
457 chrome_policy_key_(chrome_policy_key), | 455 chrome_policy_key_(chrome_policy_key), |
458 gpo_provider_(gpo_provider), | 456 gpo_provider_(gpo_provider), |
459 user_policy_changed_event_(false, false), | 457 user_policy_changed_event_(false, false), |
460 machine_policy_changed_event_(false, false), | 458 machine_policy_changed_event_(false, false), |
461 user_policy_watcher_failed_(false), | 459 user_policy_watcher_failed_(false), |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
753 | 751 |
754 void PolicyLoaderWin::OnObjectSignaled(HANDLE object) { | 752 void PolicyLoaderWin::OnObjectSignaled(HANDLE object) { |
755 DCHECK(object == user_policy_changed_event_.handle() || | 753 DCHECK(object == user_policy_changed_event_.handle() || |
756 object == machine_policy_changed_event_.handle()) | 754 object == machine_policy_changed_event_.handle()) |
757 << "unexpected object signaled policy reload, obj = " | 755 << "unexpected object signaled policy reload, obj = " |
758 << std::showbase << std::hex << object; | 756 << std::showbase << std::hex << object; |
759 Reload(false); | 757 Reload(false); |
760 } | 758 } |
761 | 759 |
762 } // namespace policy | 760 } // namespace policy |
OLD | NEW |