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

Side by Side Diff: ppapi/proxy/vpn_provider_resource.h

Issue 1726303003: ppapi: PPB_VpnProvider: Define API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Simplify IDL Created 4 years, 9 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
OLDNEW
(Empty)
1 // Copyright (c) 2015 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 #ifndef PPAPI_PROXY_VPN_PROVIDER_RESOURCE_H_
6 #define PPAPI_PROXY_VPN_PROVIDER_RESOURCE_H_
7
8 #include "ppapi/c/ppb_vpn_provider.h"
9 #include "ppapi/proxy/plugin_dispatcher.h"
10 #include "ppapi/proxy/plugin_resource.h"
11 #include "ppapi/proxy/serialized_structs.h"
12 #include "ppapi/shared_impl/tracked_callback.h"
13 #include "ppapi/thunk/ppb_vpn_provider_api.h"
14
15 namespace ppapi {
16 namespace proxy {
17
18 class PPAPI_PROXY_EXPORT VpnProviderResource
19 : public PluginResource,
20 public NON_EXPORTED_BASE(thunk::PPB_VpnProvider_API) {
21 public:
22 VpnProviderResource(Connection connection, PP_Instance instance);
23 virtual ~VpnProviderResource();
24
25 // PluginResource implementation.
26 virtual thunk::PPB_VpnProvider_API* AsPPB_VpnProvider_API() override;
27
28 // PPB_VpnProvider_API implementation.
29 virtual int32_t Bind(const PP_Var& name,
30 const PP_Var& id,
31 const scoped_refptr<TrackedCallback>& callback) override;
32 virtual int32_t GetUnBindEvent(
33 const scoped_refptr<TrackedCallback>& callback) override;
34 virtual int32_t SendPacket(
35 const PP_Var& packet,
36 const scoped_refptr<TrackedCallback>& callback) override;
37 virtual int32_t GetPacket(
38 PP_Var* packet,
39 const scoped_refptr<TrackedCallback>& callback) override;
40
41 private:
42 // PluginResource overrides.
43 virtual void OnReplyReceived(const ResourceMessageReplyParams& params,
44 const IPC::Message& msg) override;
45
46 // PPB_VpnProvider IPC Replies
47 void OnPluginMsgBindReply(const ResourceMessageReplyParams& params,
48 int32_t result);
49 void OnPluginMsgSendPacketReply(const ResourceMessageReplyParams& params,
50 int32_t result);
51
52 // Browser callbacks
53 void OnPluginMsgOnUnBindReceived(const ResourceMessageReplyParams& params);
54 void OnPluginMsgOnPacketReceived(const ResourceMessageReplyParams& params,
55 const std::vector<char>& data);
56
57 // Picks up a received message and moves it to user receiving buffer. This
58 // function is used in both Get*() for fast returning path, and
59 // OnPluginMsgOn*() for delayed callback invocations.
60 void WritePacket();
61
62 // Holds user callbacks to invoke later.
63 scoped_refptr<TrackedCallback> bind_callback_;
64 scoped_refptr<TrackedCallback> get_unbind_event_callback_;
65 scoped_refptr<TrackedCallback> send_packet_callback_;
66 scoped_refptr<TrackedCallback> get_packet_callback_;
67
68 // Keeps a pointer to the callback variable provided.
69 // Received data will be copied to this variable on ready.
70 PP_Var* get_packet_callback_var_;
71
72 bool received_unbind_event_;
73
74 // Packet buffers
75 std::queue<scoped_refptr<Var>> send_packets_;
76 std::queue<scoped_refptr<Var>> received_packets_;
77
78 DISALLOW_COPY_AND_ASSIGN(VpnProviderResource);
79 };
80
81 } // namespace proxy
82 } // namespace ppapi
83
84 #endif // PPAPI_PROXY_VPN_PROVIDER_RESOURCE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698