| 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/memory/scoped_ptr.h" |
| 14 #include "base/process_util.h" | 15 #include "base/process_util.h" |
| 15 #include "base/string16.h" | 16 #include "base/string16.h" |
| 16 #include "base/win/scoped_com_initializer.h" | 17 #include "base/win/scoped_com_initializer.h" |
| 17 #include "base/win/scoped_handle.h" | 18 #include "base/win/scoped_handle.h" |
| 19 #include "breakpad/src/client/windows/handler/exception_handler.h" |
| 18 #include "chrome/common/chrome_switches.h" | 20 #include "chrome/common/chrome_switches.h" |
| 19 #include "command_execute_impl.h" | 21 #include "command_execute_impl.h" |
| 22 #include "win8/delegate_execute/crash_server_init.h" |
| 20 #include "win8/delegate_execute/delegate_execute_operation.h" | 23 #include "win8/delegate_execute/delegate_execute_operation.h" |
| 21 #include "win8/delegate_execute/resource.h" | 24 #include "win8/delegate_execute/resource.h" |
| 22 | 25 |
| 23 using namespace ATL; | 26 using namespace ATL; |
| 24 | 27 |
| 25 class DelegateExecuteModule | 28 class DelegateExecuteModule |
| 26 : public ATL::CAtlExeModuleT< DelegateExecuteModule > { | 29 : public ATL::CAtlExeModuleT< DelegateExecuteModule > { |
| 27 public : | 30 public : |
| 28 typedef ATL::CAtlExeModuleT<DelegateExecuteModule> ParentClass; | 31 typedef ATL::CAtlExeModuleT<DelegateExecuteModule> ParentClass; |
| 29 | 32 |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 | 102 |
| 100 if (!::ShellExecuteExW(&sei)) { | 103 if (!::ShellExecuteExW(&sei)) { |
| 101 int error = HRESULT_FROM_WIN32(::GetLastError()); | 104 int error = HRESULT_FROM_WIN32(::GetLastError()); |
| 102 AtlTrace("ShellExecute returned 0x%08X\n", error); | 105 AtlTrace("ShellExecute returned 0x%08X\n", error); |
| 103 return error; | 106 return error; |
| 104 } | 107 } |
| 105 return S_OK; | 108 return S_OK; |
| 106 } | 109 } |
| 107 | 110 |
| 108 extern "C" int WINAPI _tWinMain(HINSTANCE , HINSTANCE, LPTSTR, int nShowCmd) { | 111 extern "C" int WINAPI _tWinMain(HINSTANCE , HINSTANCE, LPTSTR, int nShowCmd) { |
| 112 scoped_ptr<google_breakpad::ExceptionHandler> breakpad = |
| 113 delegate_execute::InitializeCrashReporting(); |
| 114 |
| 109 base::AtExitManager exit_manager; | 115 base::AtExitManager exit_manager; |
| 110 AtlTrace("delegate_execute enter\n"); | 116 AtlTrace("delegate_execute enter\n"); |
| 111 | 117 |
| 112 CommandLine::Init(0, NULL); | 118 CommandLine::Init(0, NULL); |
| 113 HRESULT ret_code = E_UNEXPECTED; | 119 HRESULT ret_code = E_UNEXPECTED; |
| 114 DelegateExecuteOperation operation; | 120 DelegateExecuteOperation operation; |
| 115 if (operation.Init(CommandLine::ForCurrentProcess())) { | 121 if (operation.Init(CommandLine::ForCurrentProcess())) { |
| 116 switch (operation.operation_type()) { | 122 switch (operation.operation_type()) { |
| 117 case DelegateExecuteOperation::DELEGATE_EXECUTE: | 123 case DelegateExecuteOperation::DELEGATE_EXECUTE: |
| 118 ret_code = _AtlModule.WinMain(nShowCmd); | 124 ret_code = _AtlModule.WinMain(nShowCmd); |
| 119 break; | 125 break; |
| 120 case DelegateExecuteOperation::RELAUNCH_CHROME: | 126 case DelegateExecuteOperation::RELAUNCH_CHROME: |
| 121 ret_code = RelaunchChrome(operation); | 127 ret_code = RelaunchChrome(operation); |
| 122 break; | 128 break; |
| 123 default: | 129 default: |
| 124 NOTREACHED(); | 130 NOTREACHED(); |
| 125 } | 131 } |
| 126 } | 132 } |
| 127 AtlTrace("delegate_execute exit, code = %d\n", ret_code); | 133 AtlTrace("delegate_execute exit, code = %d\n", ret_code); |
| 128 return ret_code; | 134 return ret_code; |
| 129 } | 135 } |
| OLD | NEW |