Chromium Code Reviews| 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> | 7 #include <string> |
| 8 | 8 |
| 9 #include <string.h> | 9 #include <string.h> |
| 10 | 10 |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 81 { kRegistryRecommendedSubKey, POLICY_LEVEL_RECOMMENDED }, | 81 { kRegistryRecommendedSubKey, POLICY_LEVEL_RECOMMENDED }, |
| 82 }; | 82 }; |
| 83 | 83 |
| 84 // Lookup at the mandatory path for both user and machine policies first, and | 84 // Lookup at the mandatory path for both user and machine policies first, and |
| 85 // then at the recommended path. | 85 // then at the recommended path. |
| 86 for (size_t k = 0; k < arraysize(kKeyPaths); ++k) { | 86 for (size_t k = 0; k < arraysize(kKeyPaths); ++k) { |
| 87 for (size_t h = 0; h < arraysize(kHives); ++h) { | 87 for (size_t h = 0; h < arraysize(kHives); ++h) { |
| 88 string16 path(kKeyPaths[k].path); | 88 string16 path(kKeyPaths[k].path); |
| 89 if (!key_path.empty()) | 89 if (!key_path.empty()) |
| 90 path += kPathSep + key_path; | 90 path += kPathSep + key_path; |
| 91 key->Open(kHives[h].hive, path.c_str(), KEY_READ); | 91 if (key->Open(kHives[h].hive, path.c_str(), KEY_READ) != ERROR_SUCCESS || |
| 92 if (!key->Valid()) | 92 !key->Valid()) |
|
Joao da Silva
2012/07/26 16:19:02
Nit: add braces when the test or the body spans mo
Danh Nguyen
2012/07/26 17:08:05
Done.
| |
| 93 continue; | 93 continue; |
| 94 if (value_name.empty() || key->HasValue(value_name.c_str())) { | 94 if (value_name.empty() || key->HasValue(value_name.c_str())) { |
| 95 *level = kKeyPaths[k].level; | 95 *level = kKeyPaths[k].level; |
| 96 *scope = kHives[h].scope; | 96 *scope = kHives[h].scope; |
| 97 return true; | 97 return true; |
| 98 } | 98 } |
| 99 } | 99 } |
| 100 } | 100 } |
| 101 return false; | 101 return false; |
| 102 } | 102 } |
| (...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 680 | 680 |
| 681 void PolicyLoaderWin::OnObjectSignaled(HANDLE object) { | 681 void PolicyLoaderWin::OnObjectSignaled(HANDLE object) { |
| 682 DCHECK(object == user_policy_changed_event_.handle() || | 682 DCHECK(object == user_policy_changed_event_.handle() || |
| 683 object == machine_policy_changed_event_.handle()) | 683 object == machine_policy_changed_event_.handle()) |
| 684 << "unexpected object signaled policy reload, obj = " | 684 << "unexpected object signaled policy reload, obj = " |
| 685 << std::showbase << std::hex << object; | 685 << std::showbase << std::hex << object; |
| 686 Reload(false); | 686 Reload(false); |
| 687 } | 687 } |
| 688 | 688 |
| 689 } // namespace policy | 689 } // namespace policy |
| OLD | NEW |