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 // Implementation of the CommandExecuteImpl class which implements the | 4 // Implementation of the CommandExecuteImpl class which implements the |
5 // IExecuteCommand and related interfaces for handling ShellExecute based | 5 // IExecuteCommand and related interfaces for handling ShellExecute based |
6 // launches of the Chrome browser. | 6 // launches of the Chrome browser. |
7 | 7 |
8 #include "win8/delegate_execute/command_execute_impl.h" | 8 #include "win8/delegate_execute/command_execute_impl.h" |
9 | 9 |
10 #include <shlguid.h> | 10 #include <shlguid.h> |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 bool LaunchChromeBrowserProcess() { | 63 bool LaunchChromeBrowserProcess() { |
64 base::FilePath delegate_exe_path; | 64 base::FilePath delegate_exe_path; |
65 if (!PathService::Get(base::FILE_EXE, &delegate_exe_path)) | 65 if (!PathService::Get(base::FILE_EXE, &delegate_exe_path)) |
66 return false; | 66 return false; |
67 | 67 |
68 // First try and go up a level to find chrome.exe. | 68 // First try and go up a level to find chrome.exe. |
69 base::FilePath chrome_exe_path = | 69 base::FilePath chrome_exe_path = |
70 delegate_exe_path.DirName() | 70 delegate_exe_path.DirName() |
71 .DirName() | 71 .DirName() |
72 .Append(chrome::kBrowserProcessExecutableName); | 72 .Append(chrome::kBrowserProcessExecutableName); |
73 if (!file_util::PathExists(chrome_exe_path)) { | 73 if (!base::PathExists(chrome_exe_path)) { |
74 // Try looking in the current directory if we couldn't find it one up in | 74 // Try looking in the current directory if we couldn't find it one up in |
75 // order to support developer installs. | 75 // order to support developer installs. |
76 chrome_exe_path = | 76 chrome_exe_path = |
77 delegate_exe_path.DirName() | 77 delegate_exe_path.DirName() |
78 .Append(chrome::kBrowserProcessExecutableName); | 78 .Append(chrome::kBrowserProcessExecutableName); |
79 } | 79 } |
80 | 80 |
81 if (!file_util::PathExists(chrome_exe_path)) { | 81 if (!base::PathExists(chrome_exe_path)) { |
82 AtlTrace("Could not locate chrome.exe at: %ls\n", | 82 AtlTrace("Could not locate chrome.exe at: %ls\n", |
83 chrome_exe_path.value().c_str()); | 83 chrome_exe_path.value().c_str()); |
84 return false; | 84 return false; |
85 } | 85 } |
86 | 86 |
87 CommandLine cl(chrome_exe_path); | 87 CommandLine cl(chrome_exe_path); |
88 | 88 |
89 // Prevent a Chrome window from showing up on the desktop. | 89 // Prevent a Chrome window from showing up on the desktop. |
90 cl.AppendSwitch(switches::kSilentLaunch); | 90 cl.AppendSwitch(switches::kSilentLaunch); |
91 | 91 |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
385 AtlTrace("In %hs\n", __FUNCTION__); | 385 AtlTrace("In %hs\n", __FUNCTION__); |
386 // Look for chrome.exe one folder above delegate_execute.exe (as expected in | 386 // Look for chrome.exe one folder above delegate_execute.exe (as expected in |
387 // Chrome installs). Failing that, look for it alonside delegate_execute.exe. | 387 // Chrome installs). Failing that, look for it alonside delegate_execute.exe. |
388 base::FilePath dir_exe; | 388 base::FilePath dir_exe; |
389 if (!PathService::Get(base::DIR_EXE, &dir_exe)) { | 389 if (!PathService::Get(base::DIR_EXE, &dir_exe)) { |
390 AtlTrace("Failed to get current exe path\n"); | 390 AtlTrace("Failed to get current exe path\n"); |
391 return false; | 391 return false; |
392 } | 392 } |
393 | 393 |
394 *chrome_exe = dir_exe.DirName().Append(chrome::kBrowserProcessExecutableName); | 394 *chrome_exe = dir_exe.DirName().Append(chrome::kBrowserProcessExecutableName); |
395 if (!file_util::PathExists(*chrome_exe)) { | 395 if (!base::PathExists(*chrome_exe)) { |
396 *chrome_exe = dir_exe.Append(chrome::kBrowserProcessExecutableName); | 396 *chrome_exe = dir_exe.Append(chrome::kBrowserProcessExecutableName); |
397 if (!file_util::PathExists(*chrome_exe)) { | 397 if (!base::PathExists(*chrome_exe)) { |
398 AtlTrace("Failed to find chrome exe file\n"); | 398 AtlTrace("Failed to find chrome exe file\n"); |
399 return false; | 399 return false; |
400 } | 400 } |
401 } | 401 } |
402 | 402 |
403 AtlTrace("Got chrome exe path as %ls\n", chrome_exe->value().c_str()); | 403 AtlTrace("Got chrome exe path as %ls\n", chrome_exe->value().c_str()); |
404 return true; | 404 return true; |
405 } | 405 } |
406 | 406 |
407 bool CommandExecuteImpl::GetLaunchScheme( | 407 bool CommandExecuteImpl::GetLaunchScheme( |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
576 AtlTrace("Invalid registry launch mode value %u\n", reg_value); | 576 AtlTrace("Invalid registry launch mode value %u\n", reg_value); |
577 launch_mode = ECHUIM_DESKTOP; | 577 launch_mode = ECHUIM_DESKTOP; |
578 } else { | 578 } else { |
579 launch_mode = static_cast<EC_HOST_UI_MODE>(reg_value); | 579 launch_mode = static_cast<EC_HOST_UI_MODE>(reg_value); |
580 AtlTrace("Launch mode forced by registry to %s\n", modes[launch_mode]); | 580 AtlTrace("Launch mode forced by registry to %s\n", modes[launch_mode]); |
581 } | 581 } |
582 | 582 |
583 launch_mode_determined = true; | 583 launch_mode_determined = true; |
584 return launch_mode; | 584 return launch_mode; |
585 } | 585 } |
OLD | NEW |