| 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> |
| 11 | 11 |
| 12 #include "base/file_util.h" | 12 #include "base/file_util.h" |
| 13 #include "base/path_service.h" | 13 #include "base/path_service.h" |
| 14 #include "base/process/launch.h" | 14 #include "base/process/launch.h" |
| 15 #include "base/process/process_handle.h" | 15 #include "base/process/process_handle.h" |
| 16 #include "base/strings/utf_string_conversions.h" | 16 #include "base/strings/utf_string_conversions.h" |
| 17 #include "base/win/message_window.h" | 17 #include "base/win/message_window.h" |
| 18 #include "base/win/registry.h" | 18 #include "base/win/registry.h" |
| 19 #include "base/win/scoped_co_mem.h" | 19 #include "base/win/scoped_co_mem.h" |
| 20 #include "base/win/scoped_handle.h" | 20 #include "base/win/scoped_handle.h" |
| 21 #include "base/win/scoped_process_information.h" | 21 #include "base/win/scoped_process_information.h" |
| 22 #include "base/win/win_util.h" | 22 #include "base/win/win_util.h" |
| 23 #include "chrome/common/chrome_constants.h" | 23 #include "chrome/common/chrome_constants.h" |
| 24 #include "chrome/common/chrome_paths.h" | 24 #include "chrome/common/chrome_paths.h" |
| 25 #include "chrome/common/chrome_switches.h" | 25 #include "chrome/common/chrome_switches.h" |
| 26 #include "chrome/installer/util/browser_distribution.h" |
| 27 #include "chrome/installer/util/install_util.h" |
| 28 #include "chrome/installer/util/shell_util.h" |
| 26 #include "chrome/installer/util/util_constants.h" | 29 #include "chrome/installer/util/util_constants.h" |
| 27 #include "ui/base/clipboard/clipboard_util_win.h" | 30 #include "ui/base/clipboard/clipboard_util_win.h" |
| 28 #include "win8/delegate_execute/chrome_util.h" | 31 #include "win8/delegate_execute/chrome_util.h" |
| 29 #include "win8/delegate_execute/delegate_execute_util.h" | 32 #include "win8/delegate_execute/delegate_execute_util.h" |
| 30 | 33 |
| 31 namespace { | 34 namespace { |
| 32 | 35 |
| 33 // Helper function to retrieve the url from IShellItem interface passed in. | 36 // Helper function to retrieve the url from IShellItem interface passed in. |
| 34 // Returns S_OK on success. | 37 // Returns S_OK on success. |
| 35 HRESULT GetUrlFromShellItem(IShellItem* shell_item, string16* url) { | 38 HRESULT GetUrlFromShellItem(IShellItem* shell_item, string16* url) { |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 return LaunchDesktopChrome(); | 318 return LaunchDesktopChrome(); |
| 316 | 319 |
| 317 HRESULT hr = E_FAIL; | 320 HRESULT hr = E_FAIL; |
| 318 CComPtr<IApplicationActivationManager> activation_manager; | 321 CComPtr<IApplicationActivationManager> activation_manager; |
| 319 hr = activation_manager.CoCreateInstance(CLSID_ApplicationActivationManager); | 322 hr = activation_manager.CoCreateInstance(CLSID_ApplicationActivationManager); |
| 320 if (!activation_manager) { | 323 if (!activation_manager) { |
| 321 AtlTrace("Failed to get the activation manager, error 0x%x\n", hr); | 324 AtlTrace("Failed to get the activation manager, error 0x%x\n", hr); |
| 322 return S_OK; | 325 return S_OK; |
| 323 } | 326 } |
| 324 | 327 |
| 325 string16 app_id = delegate_execute::GetAppId(chrome_exe_); | 328 BrowserDistribution* distribution = BrowserDistribution::GetDistribution(); |
| 329 bool is_per_user_install = InstallUtil::IsPerUserInstall( |
| 330 chrome_exe_.value().c_str()); |
| 331 string16 app_id = ShellUtil::GetBrowserModelId( |
| 332 distribution, is_per_user_install); |
| 326 | 333 |
| 327 DWORD pid = 0; | 334 DWORD pid = 0; |
| 328 if (launch_scheme_ == INTERNET_SCHEME_FILE && | 335 if (launch_scheme_ == INTERNET_SCHEME_FILE && |
| 329 display_name_.find(installer::kChromeExe) != string16::npos) { | 336 display_name_.find(installer::kChromeExe) != string16::npos) { |
| 330 AtlTrace("Activating for file\n"); | 337 AtlTrace("Activating for file\n"); |
| 331 hr = activation_manager->ActivateApplication(app_id.c_str(), | 338 hr = activation_manager->ActivateApplication(app_id.c_str(), |
| 332 verb_.c_str(), | 339 verb_.c_str(), |
| 333 AO_NONE, | 340 AO_NONE, |
| 334 &pid); | 341 &pid); |
| 335 } else { | 342 } else { |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 586 AtlTrace("Invalid registry launch mode value %u\n", reg_value); | 593 AtlTrace("Invalid registry launch mode value %u\n", reg_value); |
| 587 launch_mode = ECHUIM_DESKTOP; | 594 launch_mode = ECHUIM_DESKTOP; |
| 588 } else { | 595 } else { |
| 589 launch_mode = static_cast<EC_HOST_UI_MODE>(reg_value); | 596 launch_mode = static_cast<EC_HOST_UI_MODE>(reg_value); |
| 590 AtlTrace("Launch mode forced by registry to %s\n", modes[launch_mode]); | 597 AtlTrace("Launch mode forced by registry to %s\n", modes[launch_mode]); |
| 591 } | 598 } |
| 592 | 599 |
| 593 launch_mode_determined = true; | 600 launch_mode_determined = true; |
| 594 return launch_mode; | 601 return launch_mode; |
| 595 } | 602 } |
| OLD | NEW |