| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/chrome_frame_test_utils.h" | 5 #include "chrome_frame/test/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 <iepmapi.h> | 9 #include <iepmapi.h> |
| 10 #include <sddl.h> | 10 #include <sddl.h> |
| 11 | 11 |
| 12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
| 13 #include "base/file_path.h" | 13 #include "base/file_path.h" |
| 14 #include "base/file_version_info.h" | 14 #include "base/file_version_info.h" |
| 15 #include "base/path_service.h" | 15 #include "base/path_service.h" |
| 16 #include "base/process_util.h" | 16 #include "base/process_util.h" |
| 17 #include "base/registry.h" // to find IE and firefox | |
| 18 #include "base/scoped_handle.h" | 17 #include "base/scoped_handle.h" |
| 19 #include "base/scoped_ptr.h" | 18 #include "base/scoped_ptr.h" |
| 20 #include "base/string_util.h" | 19 #include "base/string_util.h" |
| 21 #include "base/stringprintf.h" | 20 #include "base/stringprintf.h" |
| 22 #include "base/utf_string_conversions.h" | 21 #include "base/utf_string_conversions.h" |
| 23 #include "base/win_util.h" | 22 #include "base/win_util.h" |
| 23 #include "base/win/registry.h" |
| 24 #include "base/win/windows_version.h" | 24 #include "base/win/windows_version.h" |
| 25 #include "chrome/common/chrome_switches.h" | 25 #include "chrome/common/chrome_switches.h" |
| 26 #include "chrome/common/chrome_paths.h" | 26 #include "chrome/common/chrome_paths.h" |
| 27 #include "chrome/common/chrome_paths_internal.h" | 27 #include "chrome/common/chrome_paths_internal.h" |
| 28 #include "chrome_frame/utils.h" | 28 #include "chrome_frame/utils.h" |
| 29 | 29 |
| 30 namespace chrome_frame_test { | 30 namespace chrome_frame_test { |
| 31 | 31 |
| 32 const wchar_t kCrashServicePipeName[] = L"\\\\.\\pipe\\ChromeCrashServices"; | 32 const wchar_t kCrashServicePipeName[] = L"\\\\.\\pipe\\ChromeCrashServices"; |
| 33 | 33 |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 } | 109 } |
| 110 | 110 |
| 111 return window_close_attempts; | 111 return window_close_attempts; |
| 112 } | 112 } |
| 113 | 113 |
| 114 std::wstring GetExecutableAppPath(const std::wstring& file) { | 114 std::wstring GetExecutableAppPath(const std::wstring& file) { |
| 115 std::wstring kAppPathsKey = | 115 std::wstring kAppPathsKey = |
| 116 L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\"; | 116 L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\"; |
| 117 | 117 |
| 118 std::wstring app_path; | 118 std::wstring app_path; |
| 119 RegKey key(HKEY_LOCAL_MACHINE, (kAppPathsKey + file).c_str(), KEY_READ); | 119 base::win::RegKey key(HKEY_LOCAL_MACHINE, (kAppPathsKey + file).c_str(), |
| 120 KEY_READ); |
| 120 if (key.Handle()) { | 121 if (key.Handle()) { |
| 121 key.ReadValue(NULL, &app_path); | 122 key.ReadValue(NULL, &app_path); |
| 122 } | 123 } |
| 123 | 124 |
| 124 return app_path; | 125 return app_path; |
| 125 } | 126 } |
| 126 | 127 |
| 127 std::wstring FormatCommandForApp(const std::wstring& exe_name, | 128 std::wstring FormatCommandForApp(const std::wstring& exe_name, |
| 128 const std::wstring& argument) { | 129 const std::wstring& argument) { |
| 129 std::wstring reg_path( | 130 std::wstring reg_path( |
| 130 base::StringPrintf(L"Applications\\%ls\\shell\\open\\command", | 131 base::StringPrintf(L"Applications\\%ls\\shell\\open\\command", |
| 131 exe_name.c_str())); | 132 exe_name.c_str())); |
| 132 RegKey key(HKEY_CLASSES_ROOT, reg_path.c_str(), KEY_READ); | 133 base::win::RegKey key(HKEY_CLASSES_ROOT, reg_path.c_str(), KEY_READ); |
| 133 | 134 |
| 134 std::wstring command; | 135 std::wstring command; |
| 135 if (key.Handle()) { | 136 if (key.Handle()) { |
| 136 key.ReadValue(NULL, &command); | 137 key.ReadValue(NULL, &command); |
| 137 int found = command.find(L"%1"); | 138 int found = command.find(L"%1"); |
| 138 if (found >= 0) { | 139 if (found >= 0) { |
| 139 command.replace(found, 2, argument); | 140 command.replace(found, 2, argument); |
| 140 } | 141 } |
| 141 } | 142 } |
| 142 return command; | 143 return command; |
| (...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 589 // First check to see if it's even still running just to minimize the | 590 // First check to see if it's even still running just to minimize the |
| 590 // likelihood of spurious error messages from KillProcess. | 591 // likelihood of spurious error messages from KillProcess. |
| 591 if (WAIT_OBJECT_0 != ::WaitForSingleObject(crash_service, 0)) { | 592 if (WAIT_OBJECT_0 != ::WaitForSingleObject(crash_service, 0)) { |
| 592 base::KillProcess(crash_service, 0, false); | 593 base::KillProcess(crash_service, 0, false); |
| 593 } | 594 } |
| 594 return NULL; | 595 return NULL; |
| 595 } | 596 } |
| 596 } | 597 } |
| 597 | 598 |
| 598 } // namespace chrome_frame_test | 599 } // namespace chrome_frame_test |
| OLD | NEW |