Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(36)

Side by Side Diff: content/renderer/pepper/ppb_broker_impl.h

Issue 22300003: Move broker creation out of PepperHelperImpl to PPB_Broker_Impl in the effort to eliminate PepperHe… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 #ifndef CONTENT_RENDERER_PEPPER_PPB_BROKER_IMPL_H_ 5 #ifndef CONTENT_RENDERER_PEPPER_PPB_BROKER_IMPL_H_
6 #define CONTENT_RENDERER_PEPPER_PPB_BROKER_IMPL_H_ 6 #define CONTENT_RENDERER_PEPPER_PPB_BROKER_IMPL_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
11 #include "base/process/process.h"
12 #include "ipc/ipc_listener.h"
11 #include "ppapi/c/pp_completion_callback.h" 13 #include "ppapi/c/pp_completion_callback.h"
12 #include "ppapi/c/trusted/ppb_broker_trusted.h" 14 #include "ppapi/c/trusted/ppb_broker_trusted.h"
13 #include "ppapi/shared_impl/resource.h" 15 #include "ppapi/shared_impl/resource.h"
14 #include "ppapi/shared_impl/tracked_callback.h" 16 #include "ppapi/shared_impl/tracked_callback.h"
15 #include "ppapi/thunk/ppb_broker_api.h" 17 #include "ppapi/thunk/ppb_broker_api.h"
16 18
17 class GURL; 19 class GURL;
18 20
21 namespace IPC {
22 struct ChannelHandle;
23 }
24
19 namespace content { 25 namespace content {
20 class PepperBroker; 26 class PepperBroker;
21 27
22 class PPB_Broker_Impl : public ::ppapi::Resource, 28 class PPB_Broker_Impl : public ::ppapi::Resource,
23 public ::ppapi::thunk::PPB_Broker_API, 29 public ::ppapi::thunk::PPB_Broker_API,
30 public IPC::Listener,
24 public base::SupportsWeakPtr<PPB_Broker_Impl> { 31 public base::SupportsWeakPtr<PPB_Broker_Impl> {
25 public: 32 public:
26 explicit PPB_Broker_Impl(PP_Instance instance); 33 explicit PPB_Broker_Impl(PP_Instance instance);
27 34
28 // Resource override. 35 // Resource override.
29 virtual ::ppapi::thunk::PPB_Broker_API* AsPPB_Broker_API() OVERRIDE; 36 virtual ::ppapi::thunk::PPB_Broker_API* AsPPB_Broker_API() OVERRIDE;
30 37
31 // PPB_BrokerTrusted implementation. 38 // PPB_BrokerTrusted implementation.
32 virtual int32_t Connect( 39 virtual int32_t Connect(
33 scoped_refptr< ::ppapi::TrackedCallback> connect_callback) OVERRIDE; 40 scoped_refptr< ::ppapi::TrackedCallback> connect_callback) OVERRIDE;
34 virtual int32_t GetHandle(int32_t* handle) OVERRIDE; 41 virtual int32_t GetHandle(int32_t* handle) OVERRIDE;
35 42
36 // Returns the URL of the document this plug-in runs in. This is necessary to 43 // Returns the URL of the document this plug-in runs in. This is necessary to
37 // decide whether to grant access to the PPAPI broker. 44 // decide whether to grant access to the PPAPI broker.
38 GURL GetDocumentUrl(); 45 GURL GetDocumentUrl();
39 46
40 void BrokerConnected(int32_t handle, int32_t result); 47 void BrokerConnected(int32_t handle, int32_t result);
41 48
42 private: 49 private:
43 virtual ~PPB_Broker_Impl(); 50 virtual ~PPB_Broker_Impl();
44 51
52 // IPC::Listener implementation.
53 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
54
55 void OnPpapiBrokerChannelCreated(base::ProcessId broker_pid,
56 const IPC::ChannelHandle& handle);
57 void OnPpapiBrokerPermissionResult(bool result);
58
45 // PluginDelegate ppapi broker object. 59 // PluginDelegate ppapi broker object.
46 // We don't own this pointer but are responsible for calling Disconnect on it. 60 // We don't own this pointer but are responsible for calling Disconnect on it.
47 PepperBroker* broker_; 61 PepperBroker* broker_;
48 62
49 // Callback invoked from BrokerConnected. 63 // Callback invoked from BrokerConnected.
50 scoped_refptr< ::ppapi::TrackedCallback> connect_callback_; 64 scoped_refptr< ::ppapi::TrackedCallback> connect_callback_;
51 65
52 // Pipe handle for the plugin instance to use to communicate with the broker. 66 // Pipe handle for the plugin instance to use to communicate with the broker.
53 // Never owned by this object. 67 // Never owned by this object.
54 int32_t pipe_handle_; 68 int32_t pipe_handle_;
55 69
70 int routing_id_;
71
56 DISALLOW_COPY_AND_ASSIGN(PPB_Broker_Impl); 72 DISALLOW_COPY_AND_ASSIGN(PPB_Broker_Impl);
57 }; 73 };
58 74
59 } // namespace content 75 } // namespace content
60 76
61 #endif // CONTENT_RENDERER_PEPPER_PPB_BROKER_IMPL_H_ 77 #endif // CONTENT_RENDERER_PEPPER_PPB_BROKER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698