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> |
11 | 11 |
12 #include "base/bind.h" | 12 #include "base/bind.h" |
13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
14 #include "base/files/file_path.h" | 14 #include "base/files/file_path.h" |
15 #include "base/message_loop/message_loop.h" | 15 #include "base/message_loop/message_loop.h" |
16 #include "base/path_service.h" | 16 #include "base/path_service.h" |
17 #include "base/single_thread_task_runner.h" | 17 #include "base/single_thread_task_runner.h" |
18 #include "base/win/metro.h" | 18 #include "base/win/metro.h" |
19 #include "base/win/win_util.h" | 19 #include "base/win/win_util.h" |
20 #include "base/win/windows_version.h" | 20 #include "base/win/windows_version.h" |
21 #include "chrome/common/chrome_switches.h" | 21 #include "chrome/common/chrome_switches.h" |
| 22 #include "ipc/attachment_broker_win.h" |
22 #include "ipc/ipc_channel.h" | 23 #include "ipc/ipc_channel.h" |
23 #include "ipc/ipc_channel_proxy.h" | 24 #include "ipc/ipc_channel_proxy.h" |
24 #include "ipc/ipc_sender.h" | 25 #include "ipc/ipc_sender.h" |
25 #include "ui/events/gesture_detection/motion_event.h" | 26 #include "ui/events/gesture_detection/motion_event.h" |
26 #include "ui/gfx/geometry/point_conversions.h" | 27 #include "ui/gfx/geometry/point_conversions.h" |
27 #include "ui/gfx/win/dpi.h" | 28 #include "ui/gfx/win/dpi.h" |
28 #include "ui/metro_viewer/metro_viewer_messages.h" | 29 #include "ui/metro_viewer/metro_viewer_messages.h" |
29 #include "win8/metro_driver/file_picker_ash.h" | 30 #include "win8/metro_driver/file_picker_ash.h" |
30 #include "win8/metro_driver/ime/ime_popup_monitor.h" | 31 #include "win8/metro_driver/ime/ime_popup_monitor.h" |
31 #include "win8/metro_driver/ime/input_source.h" | 32 #include "win8/metro_driver/ime/input_source.h" |
(...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
651 return S_OK; | 652 return S_OK; |
652 } | 653 } |
653 | 654 |
654 IFACEMETHODIMP | 655 IFACEMETHODIMP |
655 ChromeAppViewAsh::Run() { | 656 ChromeAppViewAsh::Run() { |
656 DVLOG(1) << __FUNCTION__; | 657 DVLOG(1) << __FUNCTION__; |
657 mswr::ComPtr<winui::Core::ICoreDispatcher> dispatcher; | 658 mswr::ComPtr<winui::Core::ICoreDispatcher> dispatcher; |
658 HRESULT hr = window_->get_Dispatcher(dispatcher.GetAddressOf()); | 659 HRESULT hr = window_->get_Dispatcher(dispatcher.GetAddressOf()); |
659 CheckHR(hr, "Dispatcher failed."); | 660 CheckHR(hr, "Dispatcher failed."); |
660 | 661 |
| 662 attachment_broker_.reset(new IPC::AttachmentBrokerWin); |
661 // Create the IPC channel IO thread. It needs to out-live the ChannelProxy. | 663 // Create the IPC channel IO thread. It needs to out-live the ChannelProxy. |
662 io_thread_.reset(new base::Thread("metro_IO_thread")); | 664 io_thread_.reset(new base::Thread("metro_IO_thread")); |
663 base::Thread::Options options; | 665 base::Thread::Options options; |
664 options.message_loop_type = base::MessageLoop::TYPE_IO; | 666 options.message_loop_type = base::MessageLoop::TYPE_IO; |
665 io_thread_->StartWithOptions(options); | 667 io_thread_->StartWithOptions(options); |
666 | 668 |
667 ChromeChannelListener ui_channel_listener(&ui_loop_, this); | 669 ChromeChannelListener ui_channel_listener(&ui_loop_, this); |
668 channel_listener_ = &ui_channel_listener; | 670 channel_listener_ = &ui_channel_listener; |
669 | 671 |
670 // We can't do anything until the Chrome browser IPC channel is initialized. | 672 // We can't do anything until the Chrome browser IPC channel is initialized. |
(...skipping 739 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1410 PostMessage(core_window_hwnd_, WM_CLOSE, 0, 0); | 1412 PostMessage(core_window_hwnd_, WM_CLOSE, 0, 0); |
1411 return; | 1413 return; |
1412 } | 1414 } |
1413 | 1415 |
1414 DVLOG(1) << "Found channel : " << win8::kMetroViewerIPCChannelName; | 1416 DVLOG(1) << "Found channel : " << win8::kMetroViewerIPCChannelName; |
1415 | 1417 |
1416 DCHECK(channel_listener_); | 1418 DCHECK(channel_listener_); |
1417 | 1419 |
1418 // In Aura mode we create an IPC channel to the browser, then ask it to | 1420 // In Aura mode we create an IPC channel to the browser, then ask it to |
1419 // connect to us. | 1421 // connect to us. |
1420 ui_channel_ = | 1422 ui_channel_ = IPC::ChannelProxy::Create( |
1421 IPC::ChannelProxy::Create(win8::kMetroViewerIPCChannelName, | 1423 win8::kMetroViewerIPCChannelName, IPC::Channel::MODE_NAMED_CLIENT, |
1422 IPC::Channel::MODE_NAMED_CLIENT, | 1424 channel_listener_, io_thread_->message_loop_proxy(), |
1423 channel_listener_, | 1425 attachment_broker_.get()); |
1424 io_thread_->message_loop_proxy()); | |
1425 DVLOG(1) << "Created channel proxy"; | 1426 DVLOG(1) << "Created channel proxy"; |
1426 | 1427 |
1427 // Upon receipt of the MetroViewerHostMsg_SetTargetSurface message the | 1428 // Upon receipt of the MetroViewerHostMsg_SetTargetSurface message the |
1428 // browser will use D3D from the browser process to present to our Window. | 1429 // browser will use D3D from the browser process to present to our Window. |
1429 ui_channel_->Send(new MetroViewerHostMsg_SetTargetSurface( | 1430 ui_channel_->Send(new MetroViewerHostMsg_SetTargetSurface( |
1430 gfx::NativeViewId(core_window_hwnd_), | 1431 gfx::NativeViewId(core_window_hwnd_), |
1431 win32_dpi_scale_)); | 1432 win32_dpi_scale_)); |
1432 DVLOG(1) << "ICoreWindow sent " << core_window_hwnd_; | 1433 DVLOG(1) << "ICoreWindow sent " << core_window_hwnd_; |
1433 | 1434 |
1434 // Send an initial size message so that the Ash root window host gets sized | 1435 // Send an initial size message so that the Ash root window host gets sized |
(...skipping 25 matching lines...) Expand all Loading... |
1460 mswr::ComPtr<winapp::Core::ICoreApplicationExit> app_exit; | 1461 mswr::ComPtr<winapp::Core::ICoreApplicationExit> app_exit; |
1461 CheckHR(core_app.As(&app_exit)); | 1462 CheckHR(core_app.As(&app_exit)); |
1462 globals.app_exit = app_exit.Detach(); | 1463 globals.app_exit = app_exit.Detach(); |
1463 } | 1464 } |
1464 | 1465 |
1465 IFACEMETHODIMP | 1466 IFACEMETHODIMP |
1466 ChromeAppViewFactory::CreateView(winapp::Core::IFrameworkView** view) { | 1467 ChromeAppViewFactory::CreateView(winapp::Core::IFrameworkView** view) { |
1467 *view = mswr::Make<ChromeAppViewAsh>().Detach(); | 1468 *view = mswr::Make<ChromeAppViewAsh>().Detach(); |
1468 return (*view) ? S_OK : E_OUTOFMEMORY; | 1469 return (*view) ? S_OK : E_OUTOFMEMORY; |
1469 } | 1470 } |
OLD | NEW |