| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "content/renderer/pepper/pepper_in_process_router.h" | 5 #include "content/renderer/pepper/pepper_in_process_router.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "content/public/renderer/render_thread.h" | 9 #include "content/public/renderer/render_thread.h" |
| 10 #include "content/renderer/pepper/renderer_ppapi_host_impl.h" | 10 #include "content/renderer/pepper/renderer_ppapi_host_impl.h" |
| 11 #include "content/renderer/render_frame_impl.h" | 11 #include "content/renderer/render_frame_impl.h" |
| 12 #include "ipc/ipc_message.h" | 12 #include "ipc/ipc_message.h" |
| 13 #include "ipc/ipc_sender.h" | 13 #include "ipc/ipc_sender.h" |
| 14 #include "ppapi/proxy/ppapi_messages.h" | 14 #include "ppapi/proxy/ppapi_messages.h" |
| 15 #include "ppapi/shared_impl/ppapi_globals.h" | 15 #include "ppapi/shared_impl/ppapi_globals.h" |
| 16 #include "ppapi/shared_impl/resource_tracker.h" | 16 #include "ppapi/shared_impl/resource_tracker.h" |
| 17 | 17 |
| 18 using ppapi::UnpackMessage; | 18 using ppapi::UnpackMessage; |
| 19 | 19 |
| 20 namespace content { | 20 namespace content { |
| 21 | 21 |
| 22 class PepperInProcessRouter::Channel : public IPC::Sender { | 22 class PepperInProcessRouter::Channel : public IPC::Sender { |
| 23 public: | 23 public: |
| 24 Channel(const base::Callback<bool(IPC::Message*)>& callback) | 24 Channel(const base::Callback<bool(IPC::Message*)>& callback) |
| 25 : callback_(callback) {} | 25 : callback_(callback) {} |
| 26 | 26 |
| 27 virtual ~Channel() {} | 27 ~Channel() override {} |
| 28 | 28 |
| 29 virtual bool Send(IPC::Message* message) override { | 29 bool Send(IPC::Message* message) override { return callback_.Run(message); } |
| 30 return callback_.Run(message); | |
| 31 } | |
| 32 | 30 |
| 33 private: | 31 private: |
| 34 base::Callback<bool(IPC::Message*)> callback_; | 32 base::Callback<bool(IPC::Message*)> callback_; |
| 35 }; | 33 }; |
| 36 | 34 |
| 37 PepperInProcessRouter::PepperInProcessRouter(RendererPpapiHostImpl* host_impl) | 35 PepperInProcessRouter::PepperInProcessRouter(RendererPpapiHostImpl* host_impl) |
| 38 : host_impl_(host_impl), | 36 : host_impl_(host_impl), |
| 39 pending_message_id_(0), | 37 pending_message_id_(0), |
| 40 reply_result_(false), | 38 reply_result_(false), |
| 41 weak_factory_(this) { | 39 weak_factory_(this) { |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 void PepperInProcessRouter::DispatchPluginMsg(IPC::Message* msg) { | 161 void PepperInProcessRouter::DispatchPluginMsg(IPC::Message* msg) { |
| 164 bool handled = OnPluginMsgReceived(*msg); | 162 bool handled = OnPluginMsgReceived(*msg); |
| 165 DCHECK(handled); | 163 DCHECK(handled); |
| 166 } | 164 } |
| 167 | 165 |
| 168 bool PepperInProcessRouter::SendToBrowser(IPC::Message* msg) { | 166 bool PepperInProcessRouter::SendToBrowser(IPC::Message* msg) { |
| 169 return RenderThread::Get()->Send(msg); | 167 return RenderThread::Get()->Send(msg); |
| 170 } | 168 } |
| 171 | 169 |
| 172 } // namespace content | 170 } // namespace content |
| OLD | NEW |