| 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_CHROMEOS_H_ | 5 #ifndef EXTENSIONS_BROWSER_API_NETWORKING_PRIVATE_NETWORKING_PRIVATE_CHROMEOS_H_ |
| 6 #define EXTENSIONS_BROWSER_API_NETWORKING_PRIVATE_NETWORKING_PRIVATE_CHROMEOS_H_ | 6 #define EXTENSIONS_BROWSER_API_NETWORKING_PRIVATE_NETWORKING_PRIVATE_CHROMEOS_H_ |
| 7 | 7 |
| 8 #include <memory> |
| 8 #include <string> | 9 #include <string> |
| 9 | 10 |
| 10 #include "base/macros.h" | 11 #include "base/macros.h" |
| 11 #include "base/memory/scoped_ptr.h" | |
| 12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
| 13 #include "extensions/browser/api/networking_private/networking_private_delegate.
h" | 13 #include "extensions/browser/api/networking_private/networking_private_delegate.
h" |
| 14 | 14 |
| 15 namespace base { | 15 namespace base { |
| 16 class DictionaryValue; | 16 class DictionaryValue; |
| 17 } | 17 } |
| 18 | 18 |
| 19 namespace content { | 19 namespace content { |
| 20 class BrowserContext; | 20 class BrowserContext; |
| 21 } | 21 } |
| 22 | 22 |
| 23 namespace extensions { | 23 namespace extensions { |
| 24 | 24 |
| 25 // Chrome OS NetworkingPrivateDelegate implementation. | 25 // Chrome OS NetworkingPrivateDelegate implementation. |
| 26 | 26 |
| 27 class NetworkingPrivateChromeOS : public NetworkingPrivateDelegate { | 27 class NetworkingPrivateChromeOS : public NetworkingPrivateDelegate { |
| 28 public: | 28 public: |
| 29 // |verify_delegate| is passed to NetworkingPrivateDelegate and may be NULL. | 29 // |verify_delegate| is passed to NetworkingPrivateDelegate and may be NULL. |
| 30 NetworkingPrivateChromeOS(content::BrowserContext* browser_context, | 30 NetworkingPrivateChromeOS(content::BrowserContext* browser_context, |
| 31 scoped_ptr<VerifyDelegate> verify_delegate); | 31 std::unique_ptr<VerifyDelegate> verify_delegate); |
| 32 ~NetworkingPrivateChromeOS() override; | 32 ~NetworkingPrivateChromeOS() override; |
| 33 | 33 |
| 34 // NetworkingPrivateApi | 34 // NetworkingPrivateApi |
| 35 void GetProperties(const std::string& guid, | 35 void GetProperties(const std::string& guid, |
| 36 const DictionaryCallback& success_callback, | 36 const DictionaryCallback& success_callback, |
| 37 const FailureCallback& failure_callback) override; | 37 const FailureCallback& failure_callback) override; |
| 38 void GetManagedProperties(const std::string& guid, | 38 void GetManagedProperties(const std::string& guid, |
| 39 const DictionaryCallback& success_callback, | 39 const DictionaryCallback& success_callback, |
| 40 const FailureCallback& failure_callback) override; | 40 const FailureCallback& failure_callback) override; |
| 41 void GetState(const std::string& guid, | 41 void GetState(const std::string& guid, |
| 42 const DictionaryCallback& success_callback, | 42 const DictionaryCallback& success_callback, |
| 43 const FailureCallback& failure_callback) override; | 43 const FailureCallback& failure_callback) override; |
| 44 void SetProperties(const std::string& guid, | 44 void SetProperties(const std::string& guid, |
| 45 scoped_ptr<base::DictionaryValue> properties, | 45 std::unique_ptr<base::DictionaryValue> properties, |
| 46 const VoidCallback& success_callback, | 46 const VoidCallback& success_callback, |
| 47 const FailureCallback& failure_callback) override; | 47 const FailureCallback& failure_callback) override; |
| 48 void CreateNetwork(bool shared, | 48 void CreateNetwork(bool shared, |
| 49 scoped_ptr<base::DictionaryValue> properties, | 49 std::unique_ptr<base::DictionaryValue> properties, |
| 50 const StringCallback& success_callback, | 50 const StringCallback& success_callback, |
| 51 const FailureCallback& failure_callback) override; | 51 const FailureCallback& failure_callback) override; |
| 52 void ForgetNetwork(const std::string& guid, | 52 void ForgetNetwork(const std::string& guid, |
| 53 const VoidCallback& success_callback, | 53 const VoidCallback& success_callback, |
| 54 const FailureCallback& failure_callback) override; | 54 const FailureCallback& failure_callback) override; |
| 55 void GetNetworks(const std::string& network_type, | 55 void GetNetworks(const std::string& network_type, |
| 56 bool configured_only, | 56 bool configured_only, |
| 57 bool visible_only, | 57 bool visible_only, |
| 58 int limit, | 58 int limit, |
| 59 const NetworkListCallback& success_callback, | 59 const NetworkListCallback& success_callback, |
| (...skipping 23 matching lines...) Expand all Loading... |
| 83 const std::string& pin, | 83 const std::string& pin, |
| 84 const std::string& puk, | 84 const std::string& puk, |
| 85 const VoidCallback& success_callback, | 85 const VoidCallback& success_callback, |
| 86 const FailureCallback& failure_callback) override; | 86 const FailureCallback& failure_callback) override; |
| 87 void SetCellularSimState(const std::string& guid, | 87 void SetCellularSimState(const std::string& guid, |
| 88 bool require_pin, | 88 bool require_pin, |
| 89 const std::string& current_pin, | 89 const std::string& current_pin, |
| 90 const std::string& new_pin, | 90 const std::string& new_pin, |
| 91 const VoidCallback& success_callback, | 91 const VoidCallback& success_callback, |
| 92 const FailureCallback& failure_callback) override; | 92 const FailureCallback& failure_callback) override; |
| 93 scoped_ptr<base::ListValue> GetEnabledNetworkTypes() override; | 93 std::unique_ptr<base::ListValue> GetEnabledNetworkTypes() override; |
| 94 scoped_ptr<DeviceStateList> GetDeviceStateList() override; | 94 std::unique_ptr<DeviceStateList> GetDeviceStateList() override; |
| 95 bool EnableNetworkType(const std::string& type) override; | 95 bool EnableNetworkType(const std::string& type) override; |
| 96 bool DisableNetworkType(const std::string& type) override; | 96 bool DisableNetworkType(const std::string& type) override; |
| 97 bool RequestScan() override; | 97 bool RequestScan() override; |
| 98 | 98 |
| 99 private: | 99 private: |
| 100 // Callback for both GetProperties and GetManagedProperties. Copies | 100 // Callback for both GetProperties and GetManagedProperties. Copies |
| 101 // |dictionary| and appends any networkingPrivate API specific properties, | 101 // |dictionary| and appends any networkingPrivate API specific properties, |
| 102 // then calls |callback| with the result. | 102 // then calls |callback| with the result. |
| 103 void GetPropertiesCallback(const DictionaryCallback& callback, | 103 void GetPropertiesCallback(const DictionaryCallback& callback, |
| 104 const std::string& service_path, | 104 const std::string& service_path, |
| 105 const base::DictionaryValue& dictionary); | 105 const base::DictionaryValue& dictionary); |
| 106 | 106 |
| 107 // Populate ThirdPartyVPN.ProviderName with the provider name for third-party | 107 // Populate ThirdPartyVPN.ProviderName with the provider name for third-party |
| 108 // VPNs. The provider name needs to be looked up from the list of extensions | 108 // VPNs. The provider name needs to be looked up from the list of extensions |
| 109 // which is not available to the chromeos/network module. | 109 // which is not available to the chromeos/network module. |
| 110 void AppendThirdPartyProviderName(base::DictionaryValue* dictionary); | 110 void AppendThirdPartyProviderName(base::DictionaryValue* dictionary); |
| 111 | 111 |
| 112 // Handles connection failures, possibly showing UI for configuration | 112 // Handles connection failures, possibly showing UI for configuration |
| 113 // failures, then calls the appropriate callback. | 113 // failures, then calls the appropriate callback. |
| 114 void ConnectFailureCallback(const std::string& guid, | 114 void ConnectFailureCallback( |
| 115 const VoidCallback& success_callback, | 115 const std::string& guid, |
| 116 const FailureCallback& failure_callback, | 116 const VoidCallback& success_callback, |
| 117 const std::string& error_name, | 117 const FailureCallback& failure_callback, |
| 118 scoped_ptr<base::DictionaryValue> error_data); | 118 const std::string& error_name, |
| 119 std::unique_ptr<base::DictionaryValue> error_data); |
| 119 | 120 |
| 120 content::BrowserContext* browser_context_; | 121 content::BrowserContext* browser_context_; |
| 121 base::WeakPtrFactory<NetworkingPrivateChromeOS> weak_ptr_factory_; | 122 base::WeakPtrFactory<NetworkingPrivateChromeOS> weak_ptr_factory_; |
| 122 | 123 |
| 123 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateChromeOS); | 124 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateChromeOS); |
| 124 }; | 125 }; |
| 125 | 126 |
| 126 } // namespace extensions | 127 } // namespace extensions |
| 127 | 128 |
| 128 #endif // EXTENSIONS_BROWSER_API_NETWORKING_PRIVATE_NETWORKING_PRIVATE_CHROMEOS
_H_ | 129 #endif // EXTENSIONS_BROWSER_API_NETWORKING_PRIVATE_NETWORKING_PRIVATE_CHROMEOS
_H_ |
| OLD | NEW |