Index: content/browser/renderer_host/pepper/pepper_vpn_provider_message_filter_chromeos.h |
diff --git a/content/browser/renderer_host/pepper/pepper_vpn_provider_message_filter_chromeos.h b/content/browser/renderer_host/pepper/pepper_vpn_provider_message_filter_chromeos.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..07d8e8a7d21a937dbea4a5f3df65c9fa84f2b215 |
--- /dev/null |
+++ b/content/browser/renderer_host/pepper/pepper_vpn_provider_message_filter_chromeos.h |
@@ -0,0 +1,134 @@ |
+// Copyright 2015 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CONTENT_BROWSER_RENDERER_HOST_PEPPER_PEPPER_VPN_PROVIDER_MESSAGE_FILTER_CHROMEOS_H_ |
+#define CONTENT_BROWSER_RENDERER_HOST_PEPPER_PEPPER_VPN_PROVIDER_MESSAGE_FILTER_CHROMEOS_H_ |
+ |
+#include "base/basictypes.h" |
+ |
+#include "base/memory/weak_ptr.h" |
+#include "content/browser/renderer_host/pepper/browser_ppapi_host_impl.h" |
+#include "ppapi/c/ppb_vpn_provider.h" |
+#include "ppapi/host/resource_host.h" |
+#include "ppapi/host/resource_message_filter.h" |
+#include "ppapi/proxy/serialized_structs.h" |
+ |
+namespace content { |
+ |
+class PepperVpnProviderMessageFilterChromeOS |
+ : public ppapi::host::ResourceMessageFilter { |
+ public: |
+ PepperVpnProviderMessageFilterChromeOS(BrowserPpapiHostImpl* host, |
+ PP_Instance instance); |
+ |
+ // ppapi::host::ResourceMessageFilter overrides. |
+ scoped_refptr<base::TaskRunner> OverrideTaskRunnerForMessage( |
+ const IPC::Message& message) override; |
+ int32_t OnResourceMessageReceived( |
+ const IPC::Message& msg, |
+ ppapi::host::HostMessageContext* context) override; |
+ |
+ void Send_OnPlatformMessage(std::string id, |
+ PP_VpnProvider_PlatformMessage status, |
+ std::string message); |
+ void Send_OnPacketReceived(const std::vector<char>& data); |
+ void Send_OnConfigurationEvent(const std::string& id, |
+ PP_VpnProvider_ConfigMessage message, |
+ const std::string& name, |
+ const std::string& data); |
+ void Send_OnUIEvent(PP_VpnProvider_UIEvent event, const std::string& id); |
+ |
+ private: |
+ using SuccessCallback = base::Closure; |
+ using StringCallback = base::Callback<void(const std::string& result)>; |
+ using FailureCallback = |
+ base::Callback<void(const std::string& error_name, |
+ const std::string& error_message)>; |
+ ~PepperVpnProviderMessageFilterChromeOS() override; |
+ |
+ // Message handlers |
+ int32_t OnCreateConfig(ppapi::host::HostMessageContext* context, |
+ const std::string& name); |
+ int32_t OnDestroyConfig(ppapi::host::HostMessageContext* context, |
+ const std::string& id); |
+ int32_t OnSetParameters( |
+ ppapi::host::HostMessageContext* context, |
+ const ppapi::proxy::SerializedVpnProviderParameters& params); |
+ int32_t OnSendPacket(ppapi::host::HostMessageContext* context, |
+ const std::vector<char>& data); |
+ int32_t OnNotifyConnectionStateChanged( |
+ ppapi::host::HostMessageContext* context, |
+ PP_VpnProvider_VpnConnectionState status); |
+ |
+ // OnCreateConfig helpers |
+ int32_t DoCreateConfig(const std::string& name, |
+ SuccessCallback success, |
+ FailureCallback failure); |
+ void OnCreateConfigSuccess(const ppapi::host::ReplyMessageContext& context, |
+ const std::string& id); |
+ void OnCreateConfigFailure(const ppapi::host::ReplyMessageContext& context, |
+ const std::string& error_name, |
+ const std::string& error_message); |
+ void OnCreateConfigReply(const ppapi::host::ReplyMessageContext& context, |
+ int32_t reply, |
+ const std::string& id); |
+ |
+ // OnDestroyConfig helpers |
+ int32_t DoDestroyConfig(const std::string& id, |
+ SuccessCallback success, |
+ FailureCallback failure); |
+ void OnDestroyConfigSuccess(const ppapi::host::ReplyMessageContext& context); |
+ void OnDestroyConfigFailure(const ppapi::host::ReplyMessageContext& context, |
+ const std::string& error_name, |
+ const std::string& error_message); |
+ void OnDestroyConfigReply(const ppapi::host::ReplyMessageContext& context, |
+ int32_t reply); |
+ |
+ // OnSendPacket helpers |
+ int32_t DoSendPacket(const std::vector<char>& data, |
+ SuccessCallback success, |
+ FailureCallback failure); |
+ |
+ // OnSetParameters helpers |
+ int32_t DoSetParameters( |
+ const ppapi::proxy::SerializedVpnProviderParameters& params, |
+ StringCallback success, |
+ FailureCallback failure); |
+ void OnSetParametersSuccess(const ppapi::host::ReplyMessageContext& context, |
+ const std::string& result); |
+ void OnSetParametersFailure(const ppapi::host::ReplyMessageContext& context, |
+ const std::string& error_name, |
+ const std::string& error_message); |
+ void OnSetParametersReply(const ppapi::host::ReplyMessageContext& context, |
+ int32_t reply); |
+ |
+ // OnNotifyConnectionStateChanged helpers |
+ int32_t DoNotifyConnectionStateChanged( |
+ PP_VpnProvider_VpnConnectionState status, |
+ SuccessCallback success, |
+ FailureCallback failure); |
+ void OnNotifyConnectionStateChangedSuccess( |
+ const ppapi::host::ReplyMessageContext& context); |
+ void OnNotifyConnectionStateChangedFailure( |
+ const ppapi::host::ReplyMessageContext& context, |
+ const std::string& error_name, |
+ const std::string& error_message); |
+ void OnNotifyConnectionStateChangedReply( |
+ const ppapi::host::ReplyMessageContext& context, |
+ int32_t reply); |
+ |
+ std::set<std::string> created_configs_; |
+ std::string service_id_; |
+ |
+ int render_process_id_; |
+ int render_frame_id_; |
+ |
+ base::WeakPtrFactory<PepperVpnProviderMessageFilterChromeOS> weak_factory_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(PepperVpnProviderMessageFilterChromeOS); |
+}; |
+ |
+} // namespace content |
+ |
+#endif // CONTENT_BROWSER_RENDERER_HOST_PEPPER_PEPPER_VPN_PROVIDER_MESSAGE_FILTER_CHROMEOS_H_ |