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