| 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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 class ChromeChannelListener : public IPC::Listener { | 150 class ChromeChannelListener : public IPC::Listener { |
| 151 public: | 151 public: |
| 152 ChromeChannelListener(base::MessageLoop* ui_loop, ChromeAppViewAsh* app_view) | 152 ChromeChannelListener(base::MessageLoop* ui_loop, ChromeAppViewAsh* app_view) |
| 153 : ui_proxy_(ui_loop->message_loop_proxy()), | 153 : ui_proxy_(ui_loop->message_loop_proxy()), |
| 154 app_view_(app_view) {} | 154 app_view_(app_view) {} |
| 155 | 155 |
| 156 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE { | 156 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE { |
| 157 IPC_BEGIN_MESSAGE_MAP(ChromeChannelListener, message) | 157 IPC_BEGIN_MESSAGE_MAP(ChromeChannelListener, message) |
| 158 IPC_MESSAGE_HANDLER(MetroViewerHostMsg_ActivateDesktop, | 158 IPC_MESSAGE_HANDLER(MetroViewerHostMsg_ActivateDesktop, |
| 159 OnActivateDesktop) | 159 OnActivateDesktop) |
| 160 IPC_MESSAGE_HANDLER(MetroViewerHostMsg_MetroExit, OnMetroExit) |
| 160 IPC_MESSAGE_HANDLER(MetroViewerHostMsg_OpenURLOnDesktop, | 161 IPC_MESSAGE_HANDLER(MetroViewerHostMsg_OpenURLOnDesktop, |
| 161 OnOpenURLOnDesktop) | 162 OnOpenURLOnDesktop) |
| 162 IPC_MESSAGE_HANDLER(MetroViewerHostMsg_SetCursor, OnSetCursor) | 163 IPC_MESSAGE_HANDLER(MetroViewerHostMsg_SetCursor, OnSetCursor) |
| 163 IPC_MESSAGE_HANDLER(MetroViewerHostMsg_DisplayFileOpen, | 164 IPC_MESSAGE_HANDLER(MetroViewerHostMsg_DisplayFileOpen, |
| 164 OnDisplayFileOpenDialog) | 165 OnDisplayFileOpenDialog) |
| 165 IPC_MESSAGE_HANDLER(MetroViewerHostMsg_DisplayFileSaveAs, | 166 IPC_MESSAGE_HANDLER(MetroViewerHostMsg_DisplayFileSaveAs, |
| 166 OnDisplayFileSaveAsDialog) | 167 OnDisplayFileSaveAsDialog) |
| 167 IPC_MESSAGE_HANDLER(MetroViewerHostMsg_DisplaySelectFolder, | 168 IPC_MESSAGE_HANDLER(MetroViewerHostMsg_DisplaySelectFolder, |
| 168 OnDisplayFolderPicker) | 169 OnDisplayFolderPicker) |
| 169 IPC_MESSAGE_HANDLER(MetroViewerHostMsg_SetCursorPos, OnSetCursorPos) | 170 IPC_MESSAGE_HANDLER(MetroViewerHostMsg_SetCursorPos, OnSetCursorPos) |
| (...skipping 17 matching lines...) Expand all Loading... |
| 187 } | 188 } |
| 188 | 189 |
| 189 private: | 190 private: |
| 190 void OnActivateDesktop(const base::FilePath& shortcut, bool ash_exit) { | 191 void OnActivateDesktop(const base::FilePath& shortcut, bool ash_exit) { |
| 191 ui_proxy_->PostTask(FROM_HERE, | 192 ui_proxy_->PostTask(FROM_HERE, |
| 192 base::Bind(&ChromeAppViewAsh::OnActivateDesktop, | 193 base::Bind(&ChromeAppViewAsh::OnActivateDesktop, |
| 193 base::Unretained(app_view_), | 194 base::Unretained(app_view_), |
| 194 shortcut, ash_exit)); | 195 shortcut, ash_exit)); |
| 195 } | 196 } |
| 196 | 197 |
| 198 void OnMetroExit() { |
| 199 MetroExit(app_view_->core_window_hwnd()); |
| 200 } |
| 201 |
| 197 void OnOpenURLOnDesktop(const base::FilePath& shortcut, | 202 void OnOpenURLOnDesktop(const base::FilePath& shortcut, |
| 198 const base::string16& url) { | 203 const base::string16& url) { |
| 199 ui_proxy_->PostTask(FROM_HERE, | 204 ui_proxy_->PostTask(FROM_HERE, |
| 200 base::Bind(&ChromeAppViewAsh::OnOpenURLOnDesktop, | 205 base::Bind(&ChromeAppViewAsh::OnOpenURLOnDesktop, |
| 201 base::Unretained(app_view_), | 206 base::Unretained(app_view_), |
| 202 shortcut, url)); | 207 shortcut, url)); |
| 203 } | 208 } |
| 204 | 209 |
| 205 void OnSetCursor(int64 cursor) { | 210 void OnSetCursor(int64 cursor) { |
| 206 ui_proxy_->PostTask(FROM_HERE, | 211 ui_proxy_->PostTask(FROM_HERE, |
| (...skipping 1109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1316 mswr::ComPtr<winapp::Core::ICoreApplicationExit> app_exit; | 1321 mswr::ComPtr<winapp::Core::ICoreApplicationExit> app_exit; |
| 1317 CheckHR(core_app.As(&app_exit)); | 1322 CheckHR(core_app.As(&app_exit)); |
| 1318 globals.app_exit = app_exit.Detach(); | 1323 globals.app_exit = app_exit.Detach(); |
| 1319 } | 1324 } |
| 1320 | 1325 |
| 1321 IFACEMETHODIMP | 1326 IFACEMETHODIMP |
| 1322 ChromeAppViewFactory::CreateView(winapp::Core::IFrameworkView** view) { | 1327 ChromeAppViewFactory::CreateView(winapp::Core::IFrameworkView** view) { |
| 1323 *view = mswr::Make<ChromeAppViewAsh>().Detach(); | 1328 *view = mswr::Make<ChromeAppViewAsh>().Detach(); |
| 1324 return (*view) ? S_OK : E_OUTOFMEMORY; | 1329 return (*view) ? S_OK : E_OUTOFMEMORY; |
| 1325 } | 1330 } |
| OLD | NEW |