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

Unified Diff: chrome/browser/chromeos/vpn_provider/pepper_vpn_provider_service_helper.h

Issue 1307173009: rebased ppapi vpnProvider (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkcr
Patch Set: fix compile Created 5 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/vpn_provider/pepper_vpn_provider_service_helper.h
diff --git a/chrome/browser/chromeos/vpn_provider/pepper_vpn_provider_service_helper.h b/chrome/browser/chromeos/vpn_provider/pepper_vpn_provider_service_helper.h
new file mode 100644
index 0000000000000000000000000000000000000000..0cf11a218b611db81e91aeeb63b15b56f4cf20c7
--- /dev/null
+++ b/chrome/browser/chromeos/vpn_provider/pepper_vpn_provider_service_helper.h
@@ -0,0 +1,138 @@
+ // 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 CHROME_BROWSER_CHROMEOS_VPN_PROVIDER_PEPPER_VPN_PROVIDER_SERVICE_HELPER_H_
+#define CHROME_BROWSER_CHROMEOS_VPN_PROVIDER_PEPPER_VPN_PROVIDER_SERVICE_HELPER_H_
+
+#include <map>
+
+#include "base/callback.h"
+#include "base/macros.h"
+#include "base/memory/weak_ptr.h"
+#include "ppapi/c/ppb_vpn_provider.h"
+#include "ppapi/proxy/serialized_structs.h"
+
+namespace base {
+template <typename T>
+struct DefaultSingletonTraits;
+} // namespace base
+
+namespace base {
+class DictionaryValue;
+} // namespace base
+
+namespace content {
+class PepperVpnProviderMessageFilterChromeOS;
+} // namespace content
+
+namespace chromeos {
+class VpnService;
+
+namespace vpn_provider {
+class VpnProviderServiceHelper {
+ public:
+ 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)>;
+
+ static VpnProviderServiceHelper* GetInstance();
+
+ // These functions must get called on the IO thread
+ void AddServiceID_IO(
+ const std::string& service_id,
+ base::WeakPtr<content::PepperVpnProviderMessageFilterChromeOS>
+ vpn_provider,
+ int render_process_id);
+ void RemoveServiceID_IO(const std::string& service_id, int render_process_id);
+
+ // These functions must get called on the UI thread
+ void CreateConfig_UI(const std::string& service_id,
+ const std::string& name,
+ int render_process_id,
+ SuccessCallback success,
+ FailureCallback failure);
+ void DestroyConfig_UI(const std::string& service_id,
+ const std::string& id,
+ int render_process_id,
+ SuccessCallback success,
+ FailureCallback failure);
+ void SetParameters_UI(
+ const std::string& service_id,
+ const ppapi::proxy::SerializedVpnProviderParameters& serialized_params,
+ int render_process_id,
+ StringCallback success,
+ FailureCallback failure);
+ void SendPacket_UI(const std::string& service_id,
+ const std::vector<char>& data,
+ int render_process_id,
+ SuccessCallback success,
+ FailureCallback failure);
+ void NotifyConnectionStateChanged_UI(const std::string& service_id,
+ PP_VpnProvider_VpnConnectionState status,
+ int render_process_id,
+ SuccessCallback success,
+ FailureCallback failure);
+
+ void OnPlatformMessage_UI(const std::string& service_id,
+ std::string id,
+ PP_VpnProvider_PlatformMessage status,
+ std::string message);
+ void OnPacketReceived_UI(const std::string& service_id,
+ const std::vector<char>& data);
+ void OnConfigurationRemoved_UI(const std::string& service_id,
+ const std::string& id);
+ void OnConfigurationCreated_UI(const std::string& service_id,
+ const std::string& id,
+ const std::string& name,
+ const std::string& data);
+ void OnUIEvent_UI(const std::string& service_id,
+ PP_VpnProvider_UIEvent event,
+ const std::string& id);
+
+ private:
+ VpnProviderServiceHelper();
+ ~VpnProviderServiceHelper();
+ friend struct base::DefaultSingletonTraits<VpnProviderServiceHelper>;
+
+ // These functions must get called on the UI thread
+ chromeos::VpnService* GetVpnService_UI(int render_process_id);
+ void AddServiceID_UI(const std::string& service_id, int render_process_id);
+ void RemoveServiceID_UI(const std::string& service_id, int render_process_id);
+
+ // These functions must get called on the IO thread
+ void OnPlatformMessage_IO(const std::string& service_id,
+ std::string id,
+ PP_VpnProvider_PlatformMessage status,
+ std::string message);
+ void OnPacketReceived_IO(const std::string& service_id,
+ const std::vector<char>& data);
+ void OnConfigurationEvent_IO(const std::string& service_id,
+ const std::string& id,
+ PP_VpnProvider_ConfigMessage message,
+ const std::string& name,
+ const std::string& data);
+ void OnUIEvent_IO(const std::string& service_id,
+ PP_VpnProvider_UIEvent event,
+ const std::string& id);
+
+ // Utility Functions
+ void ConvertParams(
+ const ppapi::proxy::SerializedVpnProviderParameters& serialized_params,
+ base::DictionaryValue* dictionary_params);
+
+ std::map<std::string,
+ base::WeakPtr<content::PepperVpnProviderMessageFilterChromeOS>>
+ service_to_host_map_;
+
+ base::WeakPtrFactory<VpnProviderServiceHelper> weak_factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(VpnProviderServiceHelper);
+};
+
+} // namespace vpn_provider
+} // namespace chromeos
+
+#endif // CHROME_BROWSER_CHROMEOS_VPN_PROVIDER_PEPPER_VPN_PROVIDER_SERVICE_HELPER_H_
« no previous file with comments | « chrome/browser/chromeos/vpn_provider/DEPS ('k') | chrome/browser/chromeos/vpn_provider/pepper_vpn_provider_service_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698