OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include "chrome/browser/metro_viewer/metro_viewer_process_host_win.h" | |
6 | |
7 #include "base/logging.h" | |
8 #include "chrome/common/metro_viewer_messages.h" | |
9 #include "content/public/browser/browser_thread.h" | |
10 #include "ipc/ipc_channel_proxy.h" | |
11 #include "ui/surface/accelerated_surface_win.h" | |
12 | |
13 #if defined(USE_AURA) | |
Ben Goodger (Google)
2012/10/01 16:30:54
and we use gyp not to build these files
scottmg
2012/10/01 17:30:24
Done.
| |
14 | |
15 MetroViewerProcessHost::MetroViewerProcessHost() { | |
16 channel_.reset(new IPC::ChannelProxy( | |
17 // TODO(scottmg): Need to have a secure way to randomize and request | |
18 // this name from the viewer-side. | |
19 "viewer", | |
20 IPC::Channel::MODE_NAMED_SERVER, | |
21 this, | |
22 content::BrowserThread::GetMessageLoopProxyForThread( | |
23 content::BrowserThread::IO))); | |
24 } | |
25 | |
26 MetroViewerProcessHost::~MetroViewerProcessHost() { | |
27 } | |
28 | |
29 bool MetroViewerProcessHost::Send(IPC::Message* msg) { | |
30 return channel_->Send(msg); | |
31 } | |
32 | |
33 bool MetroViewerProcessHost::OnMessageReceived(const IPC::Message& message) { | |
34 DCHECK(CalledOnValidThread()); | |
35 bool handled = true; | |
36 IPC_BEGIN_MESSAGE_MAP(MetroViewerProcessHost, message) | |
37 IPC_MESSAGE_HANDLER(ViewerHostMsg_SetTargetSurface, OnSetTargetSurface) | |
38 IPC_MESSAGE_HANDLER(ViewerHostMsg_MouseEvent, OnMouseEvent) | |
39 IPC_MESSAGE_UNHANDLED(handled = false) | |
40 IPC_END_MESSAGE_MAP() | |
41 return handled; | |
42 } | |
43 | |
44 void MetroViewerProcessHost::OnSetTargetSurface( | |
45 gfx::NativeViewId target_surface) { | |
46 DLOG(INFO) << __FUNCTION__ << ", target_surface = " << target_surface; | |
47 HWND hwnd = reinterpret_cast<HWND>(target_surface); | |
48 | |
49 scoped_refptr<AcceleratedPresenter> any_window = | |
50 AcceleratedPresenter::GetForWindow(NULL); | |
51 any_window->SetNewTargetWindow(hwnd); | |
52 } | |
53 | |
54 void MetroViewerProcessHost::OnMouseEvent( | |
55 int msg, WPARAM w_param, LPARAM l_param) { | |
56 // TODO(scottmg): Pass to window. | |
57 } | |
58 | |
59 #endif // defined(USE_AURA) | |
OLD | NEW |