| 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 | 4 |
| 5 #include <atlbase.h> | 5 #include <atlbase.h> |
| 6 #include <atlcom.h> | 6 #include <atlcom.h> |
| 7 #include <atlctl.h> | 7 #include <atlctl.h> |
| 8 #include <initguid.h> | 8 #include <initguid.h> |
| 9 #include <shellapi.h> | 9 #include <shellapi.h> |
| 10 | 10 |
| 11 #include "base/at_exit.h" | 11 #include "base/at_exit.h" |
| 12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
| 13 #include "base/file_util.h" | 13 #include "base/file_util.h" |
| 14 #include "base/process_util.h" | 14 #include "base/process_util.h" |
| 15 #include "base/string16.h" | 15 #include "base/string16.h" |
| 16 #include "base/utf_string_conversions.h" | |
| 17 #include "base/win/scoped_com_initializer.h" | 16 #include "base/win/scoped_com_initializer.h" |
| 18 #include "base/win/scoped_handle.h" | 17 #include "base/win/scoped_handle.h" |
| 19 #include "chrome/common/chrome_switches.h" | 18 #include "chrome/common/chrome_switches.h" |
| 20 #include "command_execute_impl.h" | 19 #include "command_execute_impl.h" |
| 21 #include "win8/delegate_execute/delegate_execute_operation.h" | 20 #include "win8/delegate_execute/delegate_execute_operation.h" |
| 22 #include "win8/delegate_execute/resource.h" | 21 #include "win8/delegate_execute/resource.h" |
| 23 | 22 |
| 24 using namespace ATL; | 23 using namespace ATL; |
| 25 | 24 |
| 26 class DelegateExecuteModule | 25 class DelegateExecuteModule |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 } else { | 77 } else { |
| 79 AtlTrace("Failed to wait for relaunch mutex, result is 0x%x\n", result); | 78 AtlTrace("Failed to wait for relaunch mutex, result is 0x%x\n", result); |
| 80 } | 79 } |
| 81 } else { | 80 } else { |
| 82 // It is possible that chrome exits so fast that the mutex is not there. | 81 // It is possible that chrome exits so fast that the mutex is not there. |
| 83 AtlTrace("No relaunch mutex found\n"); | 82 AtlTrace("No relaunch mutex found\n"); |
| 84 } | 83 } |
| 85 | 84 |
| 86 base::win::ScopedCOMInitializer com_initializer; | 85 base::win::ScopedCOMInitializer com_initializer; |
| 87 | 86 |
| 88 string16 flags(ASCIIToWide(operation.relaunch_flags())); | 87 string16 relaunch_flags(operation.relaunch_flags()); |
| 89 SHELLEXECUTEINFO sei = { sizeof(sei) }; | 88 SHELLEXECUTEINFO sei = { sizeof(sei) }; |
| 90 sei.fMask = SEE_MASK_FLAG_LOG_USAGE; | 89 sei.fMask = SEE_MASK_FLAG_LOG_USAGE; |
| 91 sei.nShow = SW_SHOWNORMAL; | 90 sei.nShow = SW_SHOWNORMAL; |
| 92 sei.lpFile = operation.shortcut().value().c_str(); | 91 sei.lpFile = operation.shortcut().value().c_str(); |
| 93 sei.lpParameters = flags.c_str(); | 92 sei.lpParameters = relaunch_flags.c_str(); |
| 94 | 93 |
| 95 AtlTrace(L"Relaunching Chrome via shortcut [%ls]\n", sei.lpFile); | 94 AtlTrace(L"Relaunching Chrome via shortcut [%ls]\n", sei.lpFile); |
| 96 | 95 |
| 97 if (!::ShellExecuteExW(&sei)) { | 96 if (!::ShellExecuteExW(&sei)) { |
| 98 int error = HRESULT_FROM_WIN32(::GetLastError()); | 97 int error = HRESULT_FROM_WIN32(::GetLastError()); |
| 99 AtlTrace("ShellExecute returned 0x%08X\n", error); | 98 AtlTrace("ShellExecute returned 0x%08X\n", error); |
| 100 return error; | 99 return error; |
| 101 } | 100 } |
| 102 return S_OK; | 101 return S_OK; |
| 103 } | 102 } |
| (...skipping 13 matching lines...) Expand all Loading... |
| 117 case DelegateExecuteOperation::RELAUNCH_CHROME: | 116 case DelegateExecuteOperation::RELAUNCH_CHROME: |
| 118 ret_code = RelaunchChrome(operation); | 117 ret_code = RelaunchChrome(operation); |
| 119 break; | 118 break; |
| 120 default: | 119 default: |
| 121 NOTREACHED(); | 120 NOTREACHED(); |
| 122 } | 121 } |
| 123 } | 122 } |
| 124 AtlTrace("delegate_execute exit, code = %d\n", ret_code); | 123 AtlTrace("delegate_execute exit, code = %d\n", ret_code); |
| 125 return ret_code; | 124 return ret_code; |
| 126 } | 125 } |
| OLD | NEW |