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/ppb_broker_impl.h" | 5 #include "content/renderer/pepper/ppb_broker_impl.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "content/common/view_messages.h" | 8 #include "content/common/view_messages.h" |
9 #include "content/renderer/pepper/common.h" | 9 #include "content/renderer/pepper/common.h" |
10 #include "content/renderer/pepper/host_globals.h" | 10 #include "content/renderer/pepper/host_globals.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 namespace content { | 26 namespace content { |
27 | 27 |
28 // PPB_Broker_Impl ------------------------------------------------------ | 28 // PPB_Broker_Impl ------------------------------------------------------ |
29 | 29 |
30 PPB_Broker_Impl::PPB_Broker_Impl(PP_Instance instance) | 30 PPB_Broker_Impl::PPB_Broker_Impl(PP_Instance instance) |
31 : Resource(ppapi::OBJECT_IS_IMPL, instance), | 31 : Resource(ppapi::OBJECT_IS_IMPL, instance), |
32 broker_(NULL), | 32 broker_(NULL), |
33 connect_callback_(), | 33 connect_callback_(), |
34 pipe_handle_(PlatformFileToInt(base::kInvalidPlatformFileValue)), | 34 pipe_handle_(PlatformFileToInt(base::kInvalidPlatformFileValue)), |
35 routing_id_(RenderThreadImpl::current()->GenerateRoutingID()) { | 35 routing_id_(RenderThreadImpl::current()->GenerateRoutingID()) { |
36 ChildThread::current()->AddRoute(routing_id_, this); | 36 ChildThread::current()->GetRouter()->AddRoute(routing_id_, this); |
37 } | 37 } |
38 | 38 |
39 PPB_Broker_Impl::~PPB_Broker_Impl() { | 39 PPB_Broker_Impl::~PPB_Broker_Impl() { |
40 if (broker_) { | 40 if (broker_) { |
41 broker_->Disconnect(this); | 41 broker_->Disconnect(this); |
42 broker_ = NULL; | 42 broker_ = NULL; |
43 } | 43 } |
44 | 44 |
45 // The plugin owns the handle. | 45 // The plugin owns the handle. |
46 pipe_handle_ = PlatformFileToInt(base::kInvalidPlatformFileValue); | 46 pipe_handle_ = PlatformFileToInt(base::kInvalidPlatformFileValue); |
47 ChildThread::current()->RemoveRoute(routing_id_); | 47 ChildThread::current()->GetRouter()->RemoveRoute(routing_id_); |
48 } | 48 } |
49 | 49 |
50 PPB_Broker_API* PPB_Broker_Impl::AsPPB_Broker_API() { | 50 PPB_Broker_API* PPB_Broker_Impl::AsPPB_Broker_API() { |
51 return this; | 51 return this; |
52 } | 52 } |
53 | 53 |
54 int32_t PPB_Broker_Impl::Connect( | 54 int32_t PPB_Broker_Impl::Connect( |
55 scoped_refptr<TrackedCallback> connect_callback) { | 55 scoped_refptr<TrackedCallback> connect_callback) { |
56 // TODO(ddorwin): Return PP_ERROR_FAILED if plugin is in-process. | 56 // TODO(ddorwin): Return PP_ERROR_FAILED if plugin is in-process. |
57 | 57 |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 base::ProcessId broker_pid, | 140 base::ProcessId broker_pid, |
141 const IPC::ChannelHandle& handle) { | 141 const IPC::ChannelHandle& handle) { |
142 broker_->OnBrokerChannelConnected(broker_pid, handle); | 142 broker_->OnBrokerChannelConnected(broker_pid, handle); |
143 } | 143 } |
144 | 144 |
145 void PPB_Broker_Impl::OnPpapiBrokerPermissionResult(bool result) { | 145 void PPB_Broker_Impl::OnPpapiBrokerPermissionResult(bool result) { |
146 broker_->OnBrokerPermissionResult(this, result); | 146 broker_->OnBrokerPermissionResult(this, result); |
147 } | 147 } |
148 | 148 |
149 } // namespace content | 149 } // namespace content |
OLD | NEW |