| 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 "build/intsafe_workaround.h" | 5 #include "build/intsafe_workaround.h" |
| 6 | 6 |
| 7 #include <atlbase.h> | 7 #include <atlbase.h> |
| 8 #include <atlcom.h> | 8 #include <atlcom.h> |
| 9 #include <atlctl.h> | 9 #include <atlctl.h> |
| 10 #include <initguid.h> | 10 #include <initguid.h> |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 public : | 40 public : |
| 41 typedef ATL::CAtlExeModuleT<DelegateExecuteModule> ParentClass; | 41 typedef ATL::CAtlExeModuleT<DelegateExecuteModule> ParentClass; |
| 42 typedef CComObject<CommandExecuteImpl> ImplType; | 42 typedef CComObject<CommandExecuteImpl> ImplType; |
| 43 | 43 |
| 44 DelegateExecuteModule() | 44 DelegateExecuteModule() |
| 45 : registration_token_(0) { | 45 : registration_token_(0) { |
| 46 } | 46 } |
| 47 | 47 |
| 48 HRESULT PreMessageLoop(int nShowCmd) { | 48 HRESULT PreMessageLoop(int nShowCmd) { |
| 49 HRESULT hr = S_OK; | 49 HRESULT hr = S_OK; |
| 50 string16 clsid_string; | 50 base::string16 clsid_string; |
| 51 GUID clsid; | 51 GUID clsid; |
| 52 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); | 52 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); |
| 53 if (!dist->GetCommandExecuteImplClsid(&clsid_string)) | 53 if (!dist->GetCommandExecuteImplClsid(&clsid_string)) |
| 54 return E_FAIL; | 54 return E_FAIL; |
| 55 hr = ::CLSIDFromString(clsid_string.c_str(), &clsid); | 55 hr = ::CLSIDFromString(clsid_string.c_str(), &clsid); |
| 56 if (FAILED(hr)) | 56 if (FAILED(hr)) |
| 57 return hr; | 57 return hr; |
| 58 | 58 |
| 59 // We use the same class creation logic as ATL itself. See | 59 // We use the same class creation logic as ATL itself. See |
| 60 // _ATL_OBJMAP_ENTRY::RegisterClassObject() in atlbase.h | 60 // _ATL_OBJMAP_ENTRY::RegisterClassObject() in atlbase.h |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 } else { | 114 } else { |
| 115 AtlTrace("Failed to wait for relaunch mutex, result is 0x%x\n", result); | 115 AtlTrace("Failed to wait for relaunch mutex, result is 0x%x\n", result); |
| 116 } | 116 } |
| 117 } else { | 117 } else { |
| 118 // It is possible that chrome exits so fast that the mutex is not there. | 118 // It is possible that chrome exits so fast that the mutex is not there. |
| 119 AtlTrace("No relaunch mutex found\n"); | 119 AtlTrace("No relaunch mutex found\n"); |
| 120 } | 120 } |
| 121 | 121 |
| 122 base::win::ScopedCOMInitializer com_initializer; | 122 base::win::ScopedCOMInitializer com_initializer; |
| 123 | 123 |
| 124 string16 relaunch_flags(operation.relaunch_flags()); | 124 base::string16 relaunch_flags(operation.relaunch_flags()); |
| 125 SHELLEXECUTEINFO sei = { sizeof(sei) }; | 125 SHELLEXECUTEINFO sei = { sizeof(sei) }; |
| 126 sei.fMask = SEE_MASK_FLAG_LOG_USAGE; | 126 sei.fMask = SEE_MASK_FLAG_LOG_USAGE; |
| 127 sei.nShow = SW_SHOWNORMAL; | 127 sei.nShow = SW_SHOWNORMAL; |
| 128 sei.lpFile = operation.shortcut().value().c_str(); | 128 sei.lpFile = operation.shortcut().value().c_str(); |
| 129 sei.lpParameters = relaunch_flags.c_str(); | 129 sei.lpParameters = relaunch_flags.c_str(); |
| 130 | 130 |
| 131 AtlTrace(L"Relaunching Chrome via shortcut [%ls]\n", sei.lpFile); | 131 AtlTrace(L"Relaunching Chrome via shortcut [%ls]\n", sei.lpFile); |
| 132 | 132 |
| 133 if (!::ShellExecuteExW(&sei)) { | 133 if (!::ShellExecuteExW(&sei)) { |
| 134 int error = HRESULT_FROM_WIN32(::GetLastError()); | 134 int error = HRESULT_FROM_WIN32(::GetLastError()); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 156 case DelegateExecuteOperation::RELAUNCH_CHROME: | 156 case DelegateExecuteOperation::RELAUNCH_CHROME: |
| 157 ret_code = RelaunchChrome(operation); | 157 ret_code = RelaunchChrome(operation); |
| 158 break; | 158 break; |
| 159 default: | 159 default: |
| 160 NOTREACHED(); | 160 NOTREACHED(); |
| 161 } | 161 } |
| 162 } | 162 } |
| 163 AtlTrace("delegate_execute exit, code = %d\n", ret_code); | 163 AtlTrace("delegate_execute exit, code = %d\n", ret_code); |
| 164 return ret_code; | 164 return ret_code; |
| 165 } | 165 } |
| OLD | NEW |