Chromium Code Reviews| 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/viewer/viewer_process_host.h" | |
| 6 | |
| 7 #include "base/logging.h" | |
| 8 #include "chrome/common/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 namespace chrome { | |
| 14 | |
| 15 ViewerProcessHost::ViewerProcessHost() | |
| 16 : ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) { | |
|
jam
2012/09/28 17:07:54
nit: not needed now that you use channelproxy
| |
| 17 channel_.reset(new IPC::ChannelProxy( | |
| 18 "viewer", | |
| 19 IPC::Channel::MODE_NAMED_SERVER, | |
| 20 this, | |
| 21 content::BrowserThread::GetMessageLoopProxyForThread( | |
| 22 content::BrowserThread::IO))); | |
| 23 } | |
| 24 | |
| 25 ViewerProcessHost::~ViewerProcessHost() { | |
| 26 } | |
| 27 | |
| 28 bool ViewerProcessHost::Send(IPC::Message* msg) { | |
| 29 return channel_->Send(msg); | |
| 30 } | |
| 31 | |
| 32 bool ViewerProcessHost::OnMessageReceived(const IPC::Message& message) { | |
| 33 DCHECK(CalledOnValidThread()); | |
| 34 bool handled = true; | |
| 35 IPC_BEGIN_MESSAGE_MAP(ViewerProcessHost, message) | |
| 36 IPC_MESSAGE_HANDLER(ViewerHostMsg_SetTargetSurface, OnSetTargetSurface) | |
| 37 IPC_MESSAGE_UNHANDLED(handled = false) | |
| 38 IPC_END_MESSAGE_MAP() | |
| 39 return handled; | |
| 40 } | |
| 41 | |
| 42 void ViewerProcessHost::OnSetTargetSurface(uint32 target_surface) { | |
| 43 DLOG(INFO) << __FUNCTION__ << ", target_surface = " << target_surface; | |
| 44 HWND hwnd = reinterpret_cast<HWND>(target_surface); | |
| 45 | |
| 46 scoped_refptr<AcceleratedPresenter> any_window = | |
| 47 AcceleratedPresenter::GetForWindow(NULL); | |
| 48 any_window->SetNewTargetWindow(hwnd); | |
| 49 } | |
| 50 | |
| 51 } // namespace chrome | |
| OLD | NEW |