OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "sandbox/tests/common/controller.h" | 5 #include "sandbox/tests/common/controller.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/win/windows_version.h" | 9 #include "base/win/windows_version.h" |
10 #include "sandbox/src/sandbox_factory.h" | 10 #include "sandbox/src/sandbox_factory.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
48 full_path += L"\\SysWOW64\\"; | 48 full_path += L"\\SysWOW64\\"; |
49 full_path += name; | 49 full_path += name; |
50 return full_path; | 50 return full_path; |
51 } | 51 } |
52 | 52 |
53 } // namespace | 53 } // namespace |
54 | 54 |
55 namespace sandbox { | 55 namespace sandbox { |
56 | 56 |
57 std::wstring MakePathToSys(const wchar_t* name, bool is_obj_man_path) { | 57 std::wstring MakePathToSys(const wchar_t* name, bool is_obj_man_path) { |
58 if (base::win::GetWOW64Status() == base::win::WOW64_ENABLED) | 58 return (base::win::OSInfo::GetInstance()->wow64_status() == |
59 return MakePathToSysWow64(name, is_obj_man_path); | 59 base::win::OSInfo::WOW64_ENABLED) ? |
rvargas (doing something else)
2011/04/06 23:28:05
nit: The previous structure was easier to read...
Peter Kasting
2011/04/07 00:29:19
Yeah, having to linebreak + indent the conditional
| |
60 return MakePathToSys32(name, is_obj_man_path); | 60 MakePathToSysWow64(name, is_obj_man_path) : |
61 MakePathToSys32(name, is_obj_man_path); | |
61 } | 62 } |
62 | 63 |
63 BrokerServices* GetBroker() { | 64 BrokerServices* GetBroker() { |
64 static BrokerServices* broker = SandboxFactory::GetBrokerServices(); | 65 static BrokerServices* broker = SandboxFactory::GetBrokerServices(); |
65 static bool is_initialized = false; | 66 static bool is_initialized = false; |
66 | 67 |
67 if (!broker) { | 68 if (!broker) { |
68 return NULL; | 69 return NULL; |
69 } | 70 } |
70 | 71 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
131 if (!is_init_) | 132 if (!is_init_) |
132 return false; | 133 return false; |
133 | 134 |
134 std::wstring win32_path = MakePathToSys32(pattern, false); | 135 std::wstring win32_path = MakePathToSys32(pattern, false); |
135 if (win32_path.empty()) | 136 if (win32_path.empty()) |
136 return false; | 137 return false; |
137 | 138 |
138 if (!AddRule(TargetPolicy::SUBSYS_FILES, semantics, win32_path.c_str())) | 139 if (!AddRule(TargetPolicy::SUBSYS_FILES, semantics, win32_path.c_str())) |
139 return false; | 140 return false; |
140 | 141 |
141 if (base::win::GetWOW64Status() != base::win::WOW64_ENABLED) | 142 if (base::win::OSInfo::GetInstance()->wow64_status() != |
143 base::win::OSInfo::WOW64_ENABLED) | |
142 return true; | 144 return true; |
143 | 145 |
144 win32_path = MakePathToSysWow64(pattern, false); | 146 win32_path = MakePathToSysWow64(pattern, false); |
145 if (win32_path.empty()) | 147 if (win32_path.empty()) |
146 return false; | 148 return false; |
147 | 149 |
148 return AddRule(TargetPolicy::SUBSYS_FILES, semantics, win32_path.c_str()); | 150 return AddRule(TargetPolicy::SUBSYS_FILES, semantics, win32_path.c_str()); |
149 } | 151 } |
150 | 152 |
151 bool TestRunner::AddFsRule(TargetPolicy::Semantics semantics, | 153 bool TestRunner::AddFsRule(TargetPolicy::Semantics semantics, |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
280 if (BEFORE_REVERT == state) | 282 if (BEFORE_REVERT == state) |
281 return command(argc - 4, argv + 4); | 283 return command(argc - 4, argv + 4); |
282 else if (EVERY_STATE == state) | 284 else if (EVERY_STATE == state) |
283 command(argc - 4, argv + 4); | 285 command(argc - 4, argv + 4); |
284 | 286 |
285 target->LowerToken(); | 287 target->LowerToken(); |
286 return command(argc - 4, argv + 4); | 288 return command(argc - 4, argv + 4); |
287 } | 289 } |
288 | 290 |
289 } // namespace sandbox | 291 } // namespace sandbox |
OLD | NEW |