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