Remove render view id from the audio input and output, part two!
[chromium-blink-merge.git] / content / renderer / pepper / ppb_broker_impl.h
blobb43d3a6a371c1b0560f539e51d27456396bfe374
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
3 // found in the LICENSE file.
5 #ifndef CONTENT_RENDERER_PEPPER_PPB_BROKER_IMPL_H_
6 #define CONTENT_RENDERER_PEPPER_PPB_BROKER_IMPL_H_
8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h"
10 #include "base/memory/weak_ptr.h"
11 #include "base/process/process.h"
12 #include "ipc/ipc_listener.h"
13 #include "ppapi/c/pp_completion_callback.h"
14 #include "ppapi/c/trusted/ppb_broker_trusted.h"
15 #include "ppapi/shared_impl/resource.h"
16 #include "ppapi/shared_impl/tracked_callback.h"
17 #include "ppapi/thunk/ppb_broker_api.h"
19 class GURL;
21 namespace IPC {
22 struct ChannelHandle;
25 namespace content {
26 class PepperBroker;
28 class PPB_Broker_Impl : public ppapi::Resource,
29 public ppapi::thunk::PPB_Broker_API,
30 public IPC::Listener,
31 public base::SupportsWeakPtr<PPB_Broker_Impl> {
32 public:
33 explicit PPB_Broker_Impl(PP_Instance instance);
35 // Resource override.
36 ppapi::thunk::PPB_Broker_API* AsPPB_Broker_API() override;
38 // PPB_BrokerTrusted implementation.
39 int32_t Connect(
40 scoped_refptr<ppapi::TrackedCallback> connect_callback) override;
41 int32_t GetHandle(int32_t* handle) override;
43 // Returns the URL of the document this plugin runs in. This is necessary to
44 // decide whether to grant access to the PPAPI broker.
45 GURL GetDocumentUrl();
47 void BrokerConnected(int32_t handle, int32_t result);
49 private:
50 ~PPB_Broker_Impl() override;
52 // IPC::Listener implementation.
53 bool OnMessageReceived(const IPC::Message& message) override;
55 void OnPpapiBrokerChannelCreated(base::ProcessId broker_pid,
56 const IPC::ChannelHandle& handle);
57 void OnPpapiBrokerPermissionResult(bool result);
59 // PluginDelegate ppapi broker object.
60 // We don't own this pointer but are responsible for calling Disconnect on it.
61 PepperBroker* broker_;
63 // Callback invoked from BrokerConnected.
64 scoped_refptr<ppapi::TrackedCallback> connect_callback_;
66 // Pipe handle for the plugin instance to use to communicate with the broker.
67 // Never owned by this object.
68 int32_t pipe_handle_;
70 int routing_id_;
72 DISALLOW_COPY_AND_ASSIGN(PPB_Broker_Impl);
75 } // namespace content
77 #endif // CONTENT_RENDERER_PEPPER_PPB_BROKER_IMPL_H_