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/scoped_handle.h" | 17 #include "base/scoped_handle.h" |
18 #include "base/scoped_ptr.h" | 18 #include "base/scoped_ptr.h" |
19 #include "base/string_util.h" | 19 #include "base/string_util.h" |
20 #include "base/stringprintf.h" | 20 #include "base/stringprintf.h" |
21 #include "base/utf_string_conversions.h" | 21 #include "base/utf_string_conversions.h" |
22 #include "base/win_util.h" | 22 #include "base/win_util.h" |
23 #include "base/win/registry.h" | 23 #include "base/win/registry.h" |
24 #include "base/win/windows_version.h" | 24 #include "base/win/windows_version.h" |
| 25 #include "ceee/ie/common/ceee_util.h" |
25 #include "chrome/common/chrome_switches.h" | 26 #include "chrome/common/chrome_switches.h" |
26 #include "chrome/common/chrome_paths.h" | 27 #include "chrome/common/chrome_paths.h" |
27 #include "chrome/common/chrome_paths_internal.h" | 28 #include "chrome/common/chrome_paths_internal.h" |
28 #include "chrome_frame/utils.h" | 29 #include "chrome_frame/utils.h" |
29 | 30 |
30 namespace chrome_frame_test { | 31 namespace chrome_frame_test { |
31 | 32 |
32 const wchar_t kCrashServicePipeName[] = L"\\\\.\\pipe\\ChromeCrashServices"; | 33 const wchar_t kCrashServicePipeName[] = L"\\\\.\\pipe\\ChromeCrashServices"; |
33 | 34 |
34 const DWORD kCrashServicePipeDesiredAccess = FILE_READ_DATA | | 35 const DWORD kCrashServicePipeDesiredAccess = FILE_READ_DATA | |
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 cocreate_flags |= CLSCTX_ENABLE_CLOAKING; | 392 cocreate_flags |= CLSCTX_ENABLE_CLOAKING; |
392 } | 393 } |
393 | 394 |
394 hr = ::CoCreateInstance(CLSID_InternetExplorer, NULL, | 395 hr = ::CoCreateInstance(CLSID_InternetExplorer, NULL, |
395 cocreate_flags, IID_IWebBrowser2, | 396 cocreate_flags, IID_IWebBrowser2, |
396 reinterpret_cast<void**>(web_browser)); | 397 reinterpret_cast<void**>(web_browser)); |
397 // ~LowIntegrityToken() will switch integrity back to medium. | 398 // ~LowIntegrityToken() will switch integrity back to medium. |
398 return hr; | 399 return hr; |
399 } | 400 } |
400 | 401 |
| 402 // TODO(joi@chromium.org) Could share this code with chrome_frame_plugin.h |
401 FilePath GetProfilePath(const std::wstring& profile_name) { | 403 FilePath GetProfilePath(const std::wstring& profile_name) { |
402 FilePath profile_path; | 404 FilePath profile_path; |
403 chrome::GetChromeFrameUserDataDirectory(&profile_path); | 405 chrome::GetChromeFrameUserDataDirectory(&profile_path); |
404 return profile_path.Append(profile_name); | 406 return profile_path.Append(profile_name); |
405 } | 407 } |
406 | 408 |
407 std::wstring GetExeVersion(const std::wstring& exe_path) { | 409 std::wstring GetExeVersion(const std::wstring& exe_path) { |
408 scoped_ptr<FileVersionInfo> ie_version_info( | 410 scoped_ptr<FileVersionInfo> ie_version_info( |
409 FileVersionInfo::CreateFileVersionInfo(FilePath(exe_path))); | 411 FileVersionInfo::CreateFileVersionInfo(FilePath(exe_path))); |
410 return ie_version_info->product_version(); | 412 return ie_version_info->product_version(); |
(...skipping 12 matching lines...) Expand all Loading... |
423 return IE_8; | 425 return IE_8; |
424 case '9': | 426 case '9': |
425 return IE_9; | 427 return IE_9; |
426 default: | 428 default: |
427 break; | 429 break; |
428 } | 430 } |
429 | 431 |
430 return IE_UNSUPPORTED; | 432 return IE_UNSUPPORTED; |
431 } | 433 } |
432 | 434 |
| 435 // TODO(joi@chromium.org) Could share this code with chrome_frame_plugin.h |
433 FilePath GetProfilePathForIE() { | 436 FilePath GetProfilePathForIE() { |
434 FilePath profile_path; | 437 FilePath profile_path; |
435 // Browsers without IDeleteBrowsingHistory in non-priv mode | 438 // Browsers without IDeleteBrowsingHistory in non-priv mode |
436 // have their profiles moved into "Temporary Internet Files". | 439 // have their profiles moved into "Temporary Internet Files". |
437 // The code below basically retrieves the version of IE and computes | 440 // The code below basically retrieves the version of IE and computes |
438 // the profile directory accordingly. | 441 // the profile directory accordingly. |
439 if (GetInstalledIEVersion() >= IE_8) { | 442 if (GetInstalledIEVersion() <= IE_7 && !ceee_util::IsIeCeeeRegistered()) { |
440 profile_path = GetProfilePath(kIEProfileName); | |
441 } else { | |
442 profile_path = GetIETemporaryFilesFolder(); | 443 profile_path = GetIETemporaryFilesFolder(); |
443 profile_path = profile_path.Append(L"Google Chrome Frame"); | 444 profile_path = profile_path.Append(L"Google Chrome Frame"); |
| 445 } else { |
| 446 profile_path = GetProfilePath(kIEProfileName); |
444 } | 447 } |
445 return profile_path; | 448 return profile_path; |
446 } | 449 } |
447 | 450 |
448 FilePath GetTestDataFolder() { | 451 FilePath GetTestDataFolder() { |
449 FilePath test_dir; | 452 FilePath test_dir; |
450 PathService::Get(base::DIR_SOURCE_ROOT, &test_dir); | 453 PathService::Get(base::DIR_SOURCE_ROOT, &test_dir); |
451 test_dir = test_dir.Append(FILE_PATH_LITERAL("chrome_frame")) | 454 test_dir = test_dir.Append(FILE_PATH_LITERAL("chrome_frame")) |
452 .Append(FILE_PATH_LITERAL("test")) | 455 .Append(FILE_PATH_LITERAL("test")) |
453 .Append(FILE_PATH_LITERAL("data")); | 456 .Append(FILE_PATH_LITERAL("data")); |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
598 // First check to see if it's even still running just to minimize the | 601 // First check to see if it's even still running just to minimize the |
599 // likelihood of spurious error messages from KillProcess. | 602 // likelihood of spurious error messages from KillProcess. |
600 if (WAIT_OBJECT_0 != ::WaitForSingleObject(crash_service, 0)) { | 603 if (WAIT_OBJECT_0 != ::WaitForSingleObject(crash_service, 0)) { |
601 base::KillProcess(crash_service, 0, false); | 604 base::KillProcess(crash_service, 0, false); |
602 } | 605 } |
603 return NULL; | 606 return NULL; |
604 } | 607 } |
605 } | 608 } |
606 | 609 |
607 } // namespace chrome_frame_test | 610 } // namespace chrome_frame_test |
OLD | NEW |