summaryrefslogtreecommitdiffstats
path: root/win8
diff options
context:
space:
mode:
authorcpu@chromium.org <cpu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-12-11 04:33:08 +0000
committercpu@chromium.org <cpu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-12-11 04:33:08 +0000
commit28b0e8f8e5941ab8f0737ec3e075551e73f36b2f (patch)
treec27af2fac3d774613b951d3d9d952581f94ee671 /win8
parent7aa96b1b38820c6b1e45774fe0c381537586374e (diff)
downloadchromium_src-28b0e8f8e5941ab8f0737ec3e075551e73f36b2f.zip
chromium_src-28b0e8f8e5941ab8f0737ec3e075551e73f36b2f.tar.gz
chromium_src-28b0e8f8e5941ab8f0737ec3e075551e73f36b2f.tar.bz2
Win8 Aura :add suport for changing cursors
To change the cursor we need to send a message from the browser to the viewer with the right HCURSOR. Since the cursors are a GDI shared resource, we can call ::LoadCursor in the browser and ::SetCursor in the viewer. BUG=151718 TEST= moving pointer to a chrome window edge changes cursor to resize cursor Review URL: https://codereview.chromium.org/11446078 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@172265 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'win8')
-rw-r--r--win8/metro_driver/chrome_app_view_ash.cc27
-rw-r--r--win8/metro_driver/chrome_app_view_ash.h2
2 files changed, 27 insertions, 2 deletions
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);