Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: chrome/browser/metro_viewer/metro_viewer_process_host_win.cc

Issue 11047012: Wiring metro mouse events to aura viewer (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 "chrome/browser/metro_viewer/metro_viewer_process_host_win.h" 5 #include "chrome/browser/metro_viewer/metro_viewer_process_host_win.h"
6 6
7 #include "ui/aura/remote_root_window_host_win.h"
8
7 #include "base/logging.h" 9 #include "base/logging.h"
8 #include "content/public/browser/browser_thread.h" 10 #include "content/public/browser/browser_thread.h"
9 #include "ipc/ipc_channel_proxy.h" 11 #include "ipc/ipc_channel_proxy.h"
10 #include "ui/metro_viewer/metro_viewer_messages.h" 12 #include "ui/metro_viewer/metro_viewer_messages.h"
11 #include "ui/surface/accelerated_surface_win.h" 13 #include "ui/surface/accelerated_surface_win.h"
12 14
13 MetroViewerProcessHost::MetroViewerProcessHost() { 15 MetroViewerProcessHost::MetroViewerProcessHost() {
14 channel_.reset(new IPC::ChannelProxy( 16 channel_.reset(new IPC::ChannelProxy(
15 // TODO(scottmg): Need to have a secure way to randomize and request 17 // TODO(scottmg): Need to have a secure way to randomize and request
16 // this name from the viewer-side. 18 // this name from the viewer-side.
17 "viewer", 19 "viewer",
18 IPC::Channel::MODE_NAMED_SERVER, 20 IPC::Channel::MODE_NAMED_SERVER,
19 this, 21 this,
20 content::BrowserThread::GetMessageLoopProxyForThread( 22 content::BrowserThread::GetMessageLoopProxyForThread(
21 content::BrowserThread::IO))); 23 content::BrowserThread::IO)));
22 } 24 }
23 25
24 MetroViewerProcessHost::~MetroViewerProcessHost() { 26 MetroViewerProcessHost::~MetroViewerProcessHost() {
25 } 27 }
26 28
27 bool MetroViewerProcessHost::Send(IPC::Message* msg) { 29 bool MetroViewerProcessHost::Send(IPC::Message* msg) {
28 return channel_->Send(msg); 30 return channel_->Send(msg);
29 } 31 }
30 32
31 bool MetroViewerProcessHost::OnMessageReceived(const IPC::Message& message) { 33 bool MetroViewerProcessHost::OnMessageReceived(const IPC::Message& message) {
32 DCHECK(CalledOnValidThread()); 34 DCHECK(CalledOnValidThread());
33 bool handled = true; 35 bool handled = true;
34 IPC_BEGIN_MESSAGE_MAP(MetroViewerProcessHost, message) 36 IPC_BEGIN_MESSAGE_MAP(MetroViewerProcessHost, message)
35 IPC_MESSAGE_HANDLER(MetroViewerHostMsg_SetTargetSurface, OnSetTargetSurface) 37 IPC_MESSAGE_HANDLER(MetroViewerHostMsg_SetTargetSurface, OnSetTargetSurface)
36 IPC_MESSAGE_HANDLER(MetroViewerHostMsg_MouseEvent, OnMouseEvent) 38 IPC_MESSAGE_HANDLER(MetroViewerHostMsg_MouseMoved, OnMouseMoved)
39 IPC_MESSAGE_HANDLER(MetroViewerHostMsg_MouseButton, OnMouseButton)
37 IPC_MESSAGE_UNHANDLED(handled = false) 40 IPC_MESSAGE_UNHANDLED(handled = false)
38 IPC_END_MESSAGE_MAP() 41 IPC_END_MESSAGE_MAP()
39 return handled; 42 return handled;
40 } 43 }
41 44
42 void MetroViewerProcessHost::OnSetTargetSurface( 45 void MetroViewerProcessHost::OnSetTargetSurface(
43 gfx::NativeViewId target_surface) { 46 gfx::NativeViewId target_surface) {
44 DLOG(INFO) << __FUNCTION__ << ", target_surface = " << target_surface; 47 DLOG(INFO) << __FUNCTION__ << ", target_surface = " << target_surface;
45 HWND hwnd = reinterpret_cast<HWND>(target_surface); 48 HWND hwnd = reinterpret_cast<HWND>(target_surface);
46 49
47 scoped_refptr<AcceleratedPresenter> any_window = 50 scoped_refptr<AcceleratedPresenter> any_window =
48 AcceleratedPresenter::GetForWindow(NULL); 51 AcceleratedPresenter::GetForWindow(NULL);
49 any_window->SetNewTargetWindow(hwnd); 52 any_window->SetNewTargetWindow(hwnd);
50 } 53 }
51 54
52 void MetroViewerProcessHost::OnMouseEvent( 55 void MetroViewerProcessHost::OnMouseMoved(int x, int y, int modifiers) {
53 int msg, WPARAM w_param, LPARAM l_param) { 56 // TODO(cpu): Find a decent way to get to the root window host.
54 // TODO(scottmg): Pass to window. 57 aura::RemoteRootWindowHostWin::Instance()->OnMouseMoved(x, y, modifiers);
Ben Goodger (Google) 2012/10/03 19:52:59 I wonder if it'd be nicer to have this guy have a
55 } 58 }
59
60 void MetroViewerProcessHost::OnMouseButton(int x, int y, int modifiers) {
61 // TODO(cpu): Find a decent way to get to the root window host.
62 aura::RemoteRootWindowHostWin::Instance()->OnMouseClick(x, y, modifiers);
63 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698