| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 EXTENSIONS_BROWSER_API_NETWORKING_PRIVATE_NETWORKING_PRIVATE_DELEGATE_H_ | 5 #ifndef EXTENSIONS_BROWSER_API_NETWORKING_PRIVATE_NETWORKING_PRIVATE_DELEGATE_H_ |
| 6 #define EXTENSIONS_BROWSER_API_NETWORKING_PRIVATE_NETWORKING_PRIVATE_DELEGATE_H_ | 6 #define EXTENSIONS_BROWSER_API_NETWORKING_PRIVATE_NETWORKING_PRIVATE_DELEGATE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/callback.h" | 11 #include "base/callback.h" |
| 12 #include "base/memory/linked_ptr.h" |
| 12 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/memory/scoped_vector.h" | 14 #include "base/memory/scoped_vector.h" |
| 14 #include "base/values.h" | 15 #include "base/values.h" |
| 15 #include "components/keyed_service/core/keyed_service.h" | 16 #include "components/keyed_service/core/keyed_service.h" |
| 16 #include "extensions/common/api/networking_private.h" | 17 #include "extensions/common/api/networking_private.h" |
| 17 | 18 |
| 18 namespace content { | |
| 19 class BrowserContext; | |
| 20 } | |
| 21 | |
| 22 namespace extensions { | 19 namespace extensions { |
| 23 | 20 |
| 24 class NetworkingPrivateDelegateObserver; | 21 class NetworkingPrivateDelegateObserver; |
| 25 | 22 |
| 26 namespace api { | 23 namespace api { |
| 27 namespace networking_private { | 24 namespace networking_private { |
| 28 struct DeviceStateProperties; | 25 struct DeviceStateProperties; |
| 29 struct VerificationProperties; | 26 struct VerificationProperties; |
| 30 } // networking_private | 27 } // networking_private |
| 31 } // api | 28 } // api |
| 32 | 29 |
| 33 // Base class for platform dependent networkingPrivate API implementations. | 30 // Base class for platform dependent networkingPrivate API implementations. |
| 34 // All inputs and results for this class use ONC values. See | 31 // All inputs and results for this class use ONC values. See |
| 35 // networking_private.idl for descriptions of the expected inputs and results. | 32 // networking_private.idl for descriptions of the expected inputs and results. |
| 36 class NetworkingPrivateDelegate : public KeyedService { | 33 class NetworkingPrivateDelegate : public KeyedService { |
| 37 public: | 34 public: |
| 38 using DictionaryCallback = | 35 using DictionaryCallback = |
| 39 base::Callback<void(scoped_ptr<base::DictionaryValue>)>; | 36 base::Callback<void(scoped_ptr<base::DictionaryValue>)>; |
| 40 using VoidCallback = base::Callback<void()>; | 37 using VoidCallback = base::Callback<void()>; |
| 41 using BoolCallback = base::Callback<void(bool)>; | 38 using BoolCallback = base::Callback<void(bool)>; |
| 42 using StringCallback = base::Callback<void(const std::string&)>; | 39 using StringCallback = base::Callback<void(const std::string&)>; |
| 43 using NetworkListCallback = base::Callback<void(scoped_ptr<base::ListValue>)>; | 40 using NetworkListCallback = base::Callback<void(scoped_ptr<base::ListValue>)>; |
| 44 using FailureCallback = base::Callback<void(const std::string&)>; | 41 using FailureCallback = base::Callback<void(const std::string&)>; |
| 45 using DeviceStateList = | 42 using DeviceStateList = |
| 46 ScopedVector<api::networking_private::DeviceStateProperties>; | 43 ScopedVector<api::networking_private::DeviceStateProperties>; |
| 47 using VerificationProperties = | 44 using VerificationProperties = |
| 48 api::networking_private::VerificationProperties; | 45 api::networking_private::VerificationProperties; |
| 46 using ThirdPartyVPNPropertyList = |
| 47 std::vector<linked_ptr<api::networking_private::ThirdPartyVPNProperties>>; |
| 49 | 48 |
| 50 // The Verify* methods will be forwarded to a delegate implementation if | 49 // The Verify* methods will be forwarded to a delegate implementation if |
| 51 // provided, otherwise they will fail. A separate delegate it used so that the | 50 // provided, otherwise they will fail. A separate delegate it used so that the |
| 52 // current Verify* implementations are not exposed outside of src/chrome. | 51 // current Verify* implementations are not exposed outside of src/chrome. |
| 53 class VerifyDelegate { | 52 class VerifyDelegate { |
| 54 public: | 53 public: |
| 55 typedef NetworkingPrivateDelegate::VerificationProperties | 54 typedef NetworkingPrivateDelegate::VerificationProperties |
| 56 VerificationProperties; | 55 VerificationProperties; |
| 57 typedef NetworkingPrivateDelegate::BoolCallback BoolCallback; | 56 typedef NetworkingPrivateDelegate::BoolCallback BoolCallback; |
| 58 typedef NetworkingPrivateDelegate::StringCallback StringCallback; | 57 typedef NetworkingPrivateDelegate::StringCallback StringCallback; |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 // Returns true if the ONC network type |type| is enabled. | 184 // Returns true if the ONC network type |type| is enabled. |
| 186 virtual bool EnableNetworkType(const std::string& type) = 0; | 185 virtual bool EnableNetworkType(const std::string& type) = 0; |
| 187 | 186 |
| 188 // Returns true if the ONC network type |type| is disabled. | 187 // Returns true if the ONC network type |type| is disabled. |
| 189 virtual bool DisableNetworkType(const std::string& type) = 0; | 188 virtual bool DisableNetworkType(const std::string& type) = 0; |
| 190 | 189 |
| 191 // Returns true if a scan was requested. It may take many seconds for a scan | 190 // Returns true if a scan was requested. It may take many seconds for a scan |
| 192 // to complete. The scan may or may not trigger API events when complete. | 191 // to complete. The scan may or may not trigger API events when complete. |
| 193 virtual bool RequestScan() = 0; | 192 virtual bool RequestScan() = 0; |
| 194 | 193 |
| 194 // Returns a list of ThirdPartyVPNProperties dictionaries. The default |
| 195 // implementation returns an empty list. |
| 196 virtual scoped_ptr<base::ListValue> GetThirdPartyVpnProviderList(); |
| 197 |
| 195 // Optional methods for adding a NetworkingPrivateDelegateObserver for | 198 // Optional methods for adding a NetworkingPrivateDelegateObserver for |
| 196 // implementations that require it (non-chromeos). | 199 // implementations that require it (non-chromeos). |
| 197 virtual void AddObserver(NetworkingPrivateDelegateObserver* observer); | 200 virtual void AddObserver(NetworkingPrivateDelegateObserver* observer); |
| 198 virtual void RemoveObserver(NetworkingPrivateDelegateObserver* observer); | 201 virtual void RemoveObserver(NetworkingPrivateDelegateObserver* observer); |
| 199 | 202 |
| 200 // Verify* methods are forwarded to |verify_delegate_| if not NULL. | 203 // Verify* methods are forwarded to |verify_delegate_| if not NULL. |
| 201 void VerifyDestination(const VerificationProperties& verification_properties, | 204 void VerifyDestination(const VerificationProperties& verification_properties, |
| 202 const BoolCallback& success_callback, | 205 const BoolCallback& success_callback, |
| 203 const FailureCallback& failure_callback); | 206 const FailureCallback& failure_callback); |
| 204 void VerifyAndEncryptCredentials( | 207 void VerifyAndEncryptCredentials( |
| (...skipping 13 matching lines...) Expand all Loading... |
| 218 | 221 |
| 219 // Interface for UI methods. May be null. | 222 // Interface for UI methods. May be null. |
| 220 scoped_ptr<UIDelegate> ui_delegate_; | 223 scoped_ptr<UIDelegate> ui_delegate_; |
| 221 | 224 |
| 222 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateDelegate); | 225 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateDelegate); |
| 223 }; | 226 }; |
| 224 | 227 |
| 225 } // namespace extensions | 228 } // namespace extensions |
| 226 | 229 |
| 227 #endif // EXTENSIONS_BROWSER_API_NETWORKING_PRIVATE_NETWORKING_PRIVATE_DELEGATE
_H_ | 230 #endif // EXTENSIONS_BROWSER_API_NETWORKING_PRIVATE_NETWORKING_PRIVATE_DELEGATE
_H_ |
| OLD | NEW |