Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(89)

Side by Side Diff: chrome_frame/test/chrome_frame_test_utils.cc

Issue 3823002: Move windows version-related stuff out of base/win_util and into base/win/win... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 17 #include "base/registry.h" // to find IE and firefox
18 #include "base/scoped_handle.h" 18 #include "base/scoped_handle.h"
19 #include "base/scoped_ptr.h" 19 #include "base/scoped_ptr.h"
20 #include "base/string_util.h" 20 #include "base/string_util.h"
21 #include "base/stringprintf.h" 21 #include "base/stringprintf.h"
22 #include "base/utf_string_conversions.h" 22 #include "base/utf_string_conversions.h"
23 #include "base/win_util.h" 23 #include "base/win_util.h"
24 #include "base/win/windows_version.h"
24 #include "chrome/common/chrome_switches.h" 25 #include "chrome/common/chrome_switches.h"
25 #include "chrome/common/chrome_paths.h" 26 #include "chrome/common/chrome_paths.h"
26 #include "chrome/common/chrome_paths_internal.h" 27 #include "chrome/common/chrome_paths_internal.h"
27 #include "chrome_frame/utils.h" 28 #include "chrome_frame/utils.h"
28 29
29 namespace chrome_frame_test { 30 namespace chrome_frame_test {
30 31
31 const wchar_t kCrashServicePipeName[] = L"\\\\.\\pipe\\ChromeCrashServices"; 32 const wchar_t kCrashServicePipeName[] = L"\\\\.\\pipe\\ChromeCrashServices";
32 33
33 const DWORD kCrashServicePipeDesiredAccess = FILE_READ_DATA | 34 const DWORD kCrashServicePipeDesiredAccess = FILE_READ_DATA |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 FreeLibrary(h); 218 FreeLibrary(h);
218 if (SUCCEEDED(hr)) { 219 if (SUCCEEDED(hr)) {
219 CloseHandle(pi.hThread); 220 CloseHandle(pi.hThread);
220 } else { 221 } else {
221 LOG(ERROR) << base::StringPrintf("IELaunchURL failed: 0x%08X", hr); 222 LOG(ERROR) << base::StringPrintf("IELaunchURL failed: 0x%08X", hr);
222 } 223 }
223 return pi.hProcess; 224 return pi.hProcess;
224 } 225 }
225 226
226 base::ProcessHandle LaunchIE(const std::wstring& url) { 227 base::ProcessHandle LaunchIE(const std::wstring& url) {
227 if (win_util::GetWinVersion() >= win_util::WINVERSION_VISTA) { 228 if (base::win::GetVersion() >= base::win::VERSION_VISTA) {
228 return LaunchIEOnVista(url); 229 return LaunchIEOnVista(url);
229 } else { 230 return LaunchExecutable(kIEImageName, url);
230 return LaunchExecutable(kIEImageName, url);
231 }
232 } 231 }
233 232
234 int CloseAllIEWindows() { 233 int CloseAllIEWindows() {
235 int ret = 0; 234 int ret = 0;
236 235
237 ScopedComPtr<IShellWindows> windows; 236 ScopedComPtr<IShellWindows> windows;
238 HRESULT hr = ::CoCreateInstance(__uuidof(ShellWindows), NULL, CLSCTX_ALL, 237 HRESULT hr = ::CoCreateInstance(__uuidof(ShellWindows), NULL, CLSCTX_ALL,
239 IID_IShellWindows, reinterpret_cast<void**>(windows.Receive())); 238 IID_IShellWindows, reinterpret_cast<void**>(windows.Receive()));
240 DCHECK(SUCCEEDED(hr)); 239 DCHECK(SUCCEEDED(hr));
241 240
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 AllowSetForegroundWindow(ASFW_ANY); 364 AllowSetForegroundWindow(ASFW_ANY);
366 365
367 HRESULT hr = S_OK; 366 HRESULT hr = S_OK;
368 DWORD cocreate_flags = CLSCTX_LOCAL_SERVER; 367 DWORD cocreate_flags = CLSCTX_LOCAL_SERVER;
369 chrome_frame_test::LowIntegrityToken token; 368 chrome_frame_test::LowIntegrityToken token;
370 // Vista has a bug which manifests itself when a medium integrity process 369 // Vista has a bug which manifests itself when a medium integrity process
371 // launches a COM server like IE which runs in protected mode due to UAC. 370 // launches a COM server like IE which runs in protected mode due to UAC.
372 // This causes the IWebBrowser2 interface which is returned to be useless, 371 // This causes the IWebBrowser2 interface which is returned to be useless,
373 // i.e it does not receive any events, etc. Our workaround for this is 372 // i.e it does not receive any events, etc. Our workaround for this is
374 // to impersonate a low integrity token and then launch IE. 373 // to impersonate a low integrity token and then launch IE.
375 if (win_util::GetWinVersion() == win_util::WINVERSION_VISTA && 374 if (base::win::GetVersion() == base::win::VERSION_VISTA &&
376 GetInstalledIEVersion() == IE_7) { 375 GetInstalledIEVersion() == IE_7) {
377 // Create medium integrity browser that will launch IE broker. 376 // Create medium integrity browser that will launch IE broker.
378 ScopedComPtr<IWebBrowser2> medium_integrity_browser; 377 ScopedComPtr<IWebBrowser2> medium_integrity_browser;
379 hr = medium_integrity_browser.CreateInstance(CLSID_InternetExplorer, NULL, 378 hr = medium_integrity_browser.CreateInstance(CLSID_InternetExplorer, NULL,
380 CLSCTX_LOCAL_SERVER); 379 CLSCTX_LOCAL_SERVER);
381 if (FAILED(hr)) 380 if (FAILED(hr))
382 return hr; 381 return hr;
383 medium_integrity_browser->Quit(); 382 medium_integrity_browser->Quit();
384 // Broker remains alive. 383 // Broker remains alive.
385 if (!token.Impersonate()) { 384 if (!token.Impersonate()) {
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
589 // First check to see if it's even still running just to minimize the 588 // First check to see if it's even still running just to minimize the
590 // likelihood of spurious error messages from KillProcess. 589 // likelihood of spurious error messages from KillProcess.
591 if (WAIT_OBJECT_0 != ::WaitForSingleObject(crash_service, 0)) { 590 if (WAIT_OBJECT_0 != ::WaitForSingleObject(crash_service, 0)) {
592 base::KillProcess(crash_service, 0, false); 591 base::KillProcess(crash_service, 0, false);
593 } 592 }
594 return NULL; 593 return NULL;
595 } 594 }
596 } 595 }
597 596
598 } // namespace chrome_frame_test 597 } // namespace chrome_frame_test
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698