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