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_frame/test_utils.h" | 5 #include "chrome_frame/test_utils.h" |
6 | 6 |
7 #include <atlbase.h> | 7 #include <atlbase.h> |
8 #include <atlwin.h> | 8 #include <atlwin.h> |
9 #include <shellapi.h> | 9 #include <shellapi.h> |
10 #include <winternl.h> | 10 #include <winternl.h> |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 ScopedChromeFrameRegistrar::~ScopedChromeFrameRegistrar() { | 240 ScopedChromeFrameRegistrar::~ScopedChromeFrameRegistrar() { |
241 if (FilePath(original_dll_path_) != FilePath(new_chrome_frame_dll_path_)) { | 241 if (FilePath(original_dll_path_) != FilePath(new_chrome_frame_dll_path_)) { |
242 RegisterChromeFrameAtPath(original_dll_path_); | 242 RegisterChromeFrameAtPath(original_dll_path_); |
243 } else if (registration_type_ == PER_USER) { | 243 } else if (registration_type_ == PER_USER) { |
244 UnregisterAtPath(new_chrome_frame_dll_path_, registration_type_); | 244 UnregisterAtPath(new_chrome_frame_dll_path_, registration_type_); |
245 HWND chrome_frame_helper_window = | 245 HWND chrome_frame_helper_window = |
246 FindWindow(L"ChromeFrameHelperWindowClass", NULL); | 246 FindWindow(L"ChromeFrameHelperWindowClass", NULL); |
247 if (IsWindow(chrome_frame_helper_window)) { | 247 if (IsWindow(chrome_frame_helper_window)) { |
248 PostMessage(chrome_frame_helper_window, WM_CLOSE, 0, 0); | 248 PostMessage(chrome_frame_helper_window, WM_CLOSE, 0, 0); |
249 } else { | 249 } else { |
250 chrome_frame_test::KillProcesses(L"chrome_frame_helper.exe", 0, false); | 250 base::KillProcesses(L"chrome_frame_helper.exe", 0, NULL); |
251 } | 251 } |
252 } | 252 } |
253 } | 253 } |
254 | 254 |
255 void ScopedChromeFrameRegistrar::RegisterChromeFrameAtPath( | 255 void ScopedChromeFrameRegistrar::RegisterChromeFrameAtPath( |
256 const std::wstring& path) { | 256 const std::wstring& path) { |
257 RegisterAtPath(path, registration_type_); | 257 RegisterAtPath(path, registration_type_); |
258 new_chrome_frame_dll_path_ = path; | 258 new_chrome_frame_dll_path_ = path; |
259 } | 259 } |
260 | 260 |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 } | 403 } |
404 | 404 |
405 protected: | 405 protected: |
406 std::wstring argument_to_find_; | 406 std::wstring argument_to_find_; |
407 }; | 407 }; |
408 | 408 |
409 } // namespace | 409 } // namespace |
410 | 410 |
411 bool KillAllNamedProcessesWithArgument(const std::wstring& process_name, | 411 bool KillAllNamedProcessesWithArgument(const std::wstring& process_name, |
412 const std::wstring& argument) { | 412 const std::wstring& argument) { |
413 bool result = true; | 413 return base::KillProcesses(process_name, 0, &ArgumentFilter(argument)); |
414 ArgumentFilter filter(argument); | |
415 base::NamedProcessIterator iter(process_name, &filter); | |
416 while (const base::ProcessEntry* entry = iter.NextProcessEntry()) { | |
417 if (!base::KillProcessById(entry->pid(), 0, true)) { | |
418 result = false; | |
419 } | |
420 } | |
421 | |
422 return result; | |
423 } | 414 } |
424 | 415 |
425 bool IsWorkstationLocked() { | 416 bool IsWorkstationLocked() { |
426 bool is_locked = true; | 417 bool is_locked = true; |
427 HDESK input_desk = ::OpenInputDesktop(0, 0, GENERIC_READ); | 418 HDESK input_desk = ::OpenInputDesktop(0, 0, GENERIC_READ); |
428 if (input_desk) { | 419 if (input_desk) { |
429 wchar_t name[256] = {0}; | 420 wchar_t name[256] = {0}; |
430 DWORD needed = 0; | 421 DWORD needed = 0; |
431 if (::GetUserObjectInformation(input_desk, | 422 if (::GetUserObjectInformation(input_desk, |
432 UOI_NAME, | 423 UOI_NAME, |
433 name, | 424 name, |
434 sizeof(name), | 425 sizeof(name), |
435 &needed)) { | 426 &needed)) { |
436 is_locked = lstrcmpi(name, L"default") != 0; | 427 is_locked = lstrcmpi(name, L"default") != 0; |
437 } | 428 } |
438 ::CloseDesktop(input_desk); | 429 ::CloseDesktop(input_desk); |
439 } | 430 } |
440 return is_locked; | 431 return is_locked; |
441 } | 432 } |
OLD | NEW |