diff options
-rw-r--r-- | ui/aura/remote_root_window_host_win.cc | 4 | ||||
-rw-r--r-- | ui/metro_viewer/metro_viewer_messages.h | 9 | ||||
-rw-r--r-- | win8/metro_driver/chrome_app_view_ash.cc | 27 | ||||
-rw-r--r-- | win8/metro_driver/chrome_app_view_ash.h | 2 |
4 files changed, 39 insertions, 3 deletions
diff --git a/ui/aura/remote_root_window_host_win.cc b/ui/aura/remote_root_window_host_win.cc index 051cdcd..9a97ca3 100644 --- a/ui/aura/remote_root_window_host_win.cc +++ b/ui/aura/remote_root_window_host_win.cc @@ -121,6 +121,10 @@ gfx::Point RemoteRootWindowHostWin::GetLocationOnNativeScreen() const { } void RemoteRootWindowHostWin::SetCursor(gfx::NativeCursor native_cursor) { + if (!host_) + return; + host_->Send( + new MetroViewerHostMsg_SetCursor(uint64(native_cursor.platform()))); } void RemoteRootWindowHostWin::SetCapture() { diff --git a/ui/metro_viewer/metro_viewer_messages.h b/ui/metro_viewer/metro_viewer_messages.h index 994b40f..2b4a083 100644 --- a/ui/metro_viewer/metro_viewer_messages.h +++ b/ui/metro_viewer/metro_viewer_messages.h @@ -14,7 +14,7 @@ IPC_ENUM_TRAITS(ui::EventType) IPC_ENUM_TRAITS(ui::EventFlags) -// Messages sent from the viewer to the browser. +// Messages sent from the viewer to the browser: // Inform the browser of the surface to target for compositing. IPC_MESSAGE_CONTROL1(MetroViewerHostMsg_SetTargetSurface, @@ -51,6 +51,7 @@ IPC_MESSAGE_CONTROL4(MetroViewerHostMsg_Character, // Informs the browser that the visibiliy of the viewer has changed. IPC_MESSAGE_CONTROL1(MetroViewerHostMsg_VisibilityChanged, bool /* visible */); + IPC_MESSAGE_CONTROL3(MetroViewerHostMsg_TouchDown, int32, /* x-coordinate */ int32, /* y-coordinate */ @@ -63,3 +64,9 @@ IPC_MESSAGE_CONTROL3(MetroViewerHostMsg_TouchMoved, int32, /* x-coordinate */ int32, /* y-coordinate */ uint64) /* timestamp */ + +// Messages sent from the browser to the viewer: + +// Requests the viewer to change the pointer to a new cursor. +IPC_MESSAGE_CONTROL1(MetroViewerHostMsg_SetCursor, + int64 /* cursor */); diff --git a/win8/metro_driver/chrome_app_view_ash.cc b/win8/metro_driver/chrome_app_view_ash.cc index b01716b..3e4803b 100644 --- a/win8/metro_driver/chrome_app_view_ash.cc +++ b/win8/metro_driver/chrome_app_view_ash.cc @@ -66,8 +66,16 @@ void MetroExit() { class ChromeChannelListener : public IPC::Listener { public: + ChromeChannelListener(MessageLoop* ui_loop, ChromeAppViewAsh* app_view) + : ui_proxy_(ui_loop->message_loop_proxy()), + app_view_(app_view) { + } + virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE { - DVLOG(1) << "Received ipc message " << message.type(); + IPC_BEGIN_MESSAGE_MAP(ChromeChannelListener, message) + IPC_MESSAGE_HANDLER(MetroViewerHostMsg_SetCursor, OnSetCursor) + IPC_MESSAGE_UNHANDLED(__debugbreak()) + IPC_END_MESSAGE_MAP() return true; } @@ -75,6 +83,17 @@ class ChromeChannelListener : public IPC::Listener { DVLOG(1) << "Channel error"; MetroExit(); } + + private: + void OnSetCursor(int64 cursor) { + ui_proxy_->PostTask(FROM_HERE, + base::Bind(&ChromeAppViewAsh::OnSetCursor, + base::Unretained(app_view_), + reinterpret_cast<HCURSOR>(cursor))); + } + + scoped_refptr<base::MessageLoopProxy> ui_proxy_; + ChromeAppViewAsh* app_view_; }; bool WaitForChromeIPCConnection(const std::string& channel_name) { @@ -328,7 +347,7 @@ ChromeAppViewAsh::Run() { // In Aura mode we create an IPC channel to the browser, then ask it to // connect to us. - ChromeChannelListener ui_channel_listener; + ChromeChannelListener ui_channel_listener(&msg_loop, this); IPC::ChannelProxy ui_channel(ipc_channel_name, IPC::Channel::MODE_NAMED_CLIENT, &ui_channel_listener, @@ -355,6 +374,10 @@ ChromeAppViewAsh::Uninitialize() { return S_OK; } +void ChromeAppViewAsh::OnSetCursor(HCURSOR cursor) { + ::SetCursor(HCURSOR(cursor)); +} + HRESULT ChromeAppViewAsh::OnActivate( winapp::Core::ICoreApplicationView*, winapp::Activation::IActivatedEventArgs* args) { diff --git a/win8/metro_driver/chrome_app_view_ash.h b/win8/metro_driver/chrome_app_view_ash.h index 7191473..ec06938 100644 --- a/win8/metro_driver/chrome_app_view_ash.h +++ b/win8/metro_driver/chrome_app_view_ash.h @@ -32,6 +32,8 @@ class ChromeAppViewAsh IFACEMETHOD(Run)(); IFACEMETHOD(Uninitialize)(); + void OnSetCursor(HCURSOR cursor); + private: HRESULT OnActivate(winapp::Core::ICoreApplicationView* view, winapp::Activation::IActivatedEventArgs* args); |