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 "win8/metro_driver/stdafx.h" | 5 #include "win8/metro_driver/stdafx.h" |
6 #include "win8/metro_driver/chrome_app_view_ash.h" | 6 #include "win8/metro_driver/chrome_app_view_ash.h" |
7 | 7 |
8 #include <corewindow.h> | 8 #include <corewindow.h> |
9 #include <shellapi.h> | 9 #include <shellapi.h> |
10 #include <windows.foundation.h> | 10 #include <windows.foundation.h> |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 Sleep(10); | 139 Sleep(10); |
140 } | 140 } |
141 } | 141 } |
142 | 142 |
143 class ChromeChannelListener : public IPC::Listener { | 143 class ChromeChannelListener : public IPC::Listener { |
144 public: | 144 public: |
145 ChromeChannelListener(base::MessageLoop* ui_loop, ChromeAppViewAsh* app_view) | 145 ChromeChannelListener(base::MessageLoop* ui_loop, ChromeAppViewAsh* app_view) |
146 : ui_proxy_(ui_loop->message_loop_proxy()), | 146 : ui_proxy_(ui_loop->message_loop_proxy()), |
147 app_view_(app_view) {} | 147 app_view_(app_view) {} |
148 | 148 |
149 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE { | 149 virtual bool OnMessageReceived(const IPC::Message& message) override { |
150 IPC_BEGIN_MESSAGE_MAP(ChromeChannelListener, message) | 150 IPC_BEGIN_MESSAGE_MAP(ChromeChannelListener, message) |
151 IPC_MESSAGE_HANDLER(MetroViewerHostMsg_ActivateDesktop, | 151 IPC_MESSAGE_HANDLER(MetroViewerHostMsg_ActivateDesktop, |
152 OnActivateDesktop) | 152 OnActivateDesktop) |
153 IPC_MESSAGE_HANDLER(MetroViewerHostMsg_MetroExit, OnMetroExit) | 153 IPC_MESSAGE_HANDLER(MetroViewerHostMsg_MetroExit, OnMetroExit) |
154 IPC_MESSAGE_HANDLER(MetroViewerHostMsg_OpenURLOnDesktop, | 154 IPC_MESSAGE_HANDLER(MetroViewerHostMsg_OpenURLOnDesktop, |
155 OnOpenURLOnDesktop) | 155 OnOpenURLOnDesktop) |
156 IPC_MESSAGE_HANDLER(MetroViewerHostMsg_SetCursor, OnSetCursor) | 156 IPC_MESSAGE_HANDLER(MetroViewerHostMsg_SetCursor, OnSetCursor) |
157 IPC_MESSAGE_HANDLER(MetroViewerHostMsg_DisplayFileOpen, | 157 IPC_MESSAGE_HANDLER(MetroViewerHostMsg_DisplayFileOpen, |
158 OnDisplayFileOpenDialog) | 158 OnDisplayFileOpenDialog) |
159 IPC_MESSAGE_HANDLER(MetroViewerHostMsg_DisplayFileSaveAs, | 159 IPC_MESSAGE_HANDLER(MetroViewerHostMsg_DisplayFileSaveAs, |
160 OnDisplayFileSaveAsDialog) | 160 OnDisplayFileSaveAsDialog) |
161 IPC_MESSAGE_HANDLER(MetroViewerHostMsg_DisplaySelectFolder, | 161 IPC_MESSAGE_HANDLER(MetroViewerHostMsg_DisplaySelectFolder, |
162 OnDisplayFolderPicker) | 162 OnDisplayFolderPicker) |
163 IPC_MESSAGE_HANDLER(MetroViewerHostMsg_SetCursorPos, OnSetCursorPos) | 163 IPC_MESSAGE_HANDLER(MetroViewerHostMsg_SetCursorPos, OnSetCursorPos) |
164 IPC_MESSAGE_HANDLER(MetroViewerHostMsg_ImeCancelComposition, | 164 IPC_MESSAGE_HANDLER(MetroViewerHostMsg_ImeCancelComposition, |
165 OnImeCancelComposition) | 165 OnImeCancelComposition) |
166 IPC_MESSAGE_HANDLER(MetroViewerHostMsg_ImeTextInputClientUpdated, | 166 IPC_MESSAGE_HANDLER(MetroViewerHostMsg_ImeTextInputClientUpdated, |
167 OnImeTextInputClientChanged) | 167 OnImeTextInputClientChanged) |
168 IPC_MESSAGE_UNHANDLED(__debugbreak()) | 168 IPC_MESSAGE_UNHANDLED(__debugbreak()) |
169 IPC_END_MESSAGE_MAP() | 169 IPC_END_MESSAGE_MAP() |
170 return true; | 170 return true; |
171 } | 171 } |
172 | 172 |
173 virtual void OnChannelError() OVERRIDE { | 173 virtual void OnChannelError() override { |
174 DVLOG(1) << "Channel error. Exiting."; | 174 DVLOG(1) << "Channel error. Exiting."; |
175 ui_proxy_->PostTask(FROM_HERE, | 175 ui_proxy_->PostTask(FROM_HERE, |
176 base::Bind(&ChromeAppViewAsh::OnMetroExit, base::Unretained(app_view_), | 176 base::Bind(&ChromeAppViewAsh::OnMetroExit, base::Unretained(app_view_), |
177 TERMINATE_USING_KEY_SEQUENCE)); | 177 TERMINATE_USING_KEY_SEQUENCE)); |
178 | 178 |
179 // In early Windows 8 versions the code above sometimes fails so we call | 179 // In early Windows 8 versions the code above sometimes fails so we call |
180 // it a second time with a NULL window which just calls Exit(). | 180 // it a second time with a NULL window which just calls Exit(). |
181 ui_proxy_->PostDelayedTask(FROM_HERE, | 181 ui_proxy_->PostDelayedTask(FROM_HERE, |
182 base::Bind(&ChromeAppViewAsh::OnMetroExit, base::Unretained(app_view_), | 182 base::Bind(&ChromeAppViewAsh::OnMetroExit, base::Unretained(app_view_), |
183 TERMINATE_USING_PROCESS_EXIT), | 183 TERMINATE_USING_PROCESS_EXIT), |
(...skipping 1280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1464 mswr::ComPtr<winapp::Core::ICoreApplicationExit> app_exit; | 1464 mswr::ComPtr<winapp::Core::ICoreApplicationExit> app_exit; |
1465 CheckHR(core_app.As(&app_exit)); | 1465 CheckHR(core_app.As(&app_exit)); |
1466 globals.app_exit = app_exit.Detach(); | 1466 globals.app_exit = app_exit.Detach(); |
1467 } | 1467 } |
1468 | 1468 |
1469 IFACEMETHODIMP | 1469 IFACEMETHODIMP |
1470 ChromeAppViewFactory::CreateView(winapp::Core::IFrameworkView** view) { | 1470 ChromeAppViewFactory::CreateView(winapp::Core::IFrameworkView** view) { |
1471 *view = mswr::Make<ChromeAppViewAsh>().Detach(); | 1471 *view = mswr::Make<ChromeAppViewAsh>().Detach(); |
1472 return (*view) ? S_OK : E_OUTOFMEMORY; | 1472 return (*view) ? S_OK : E_OUTOFMEMORY; |
1473 } | 1473 } |
OLD | NEW |