| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 CHROMEOS_NETWORK_MANAGED_NETWORK_CONFIGURATION_HANDLER_H_ | 5 #ifndef CHROMEOS_NETWORK_MANAGED_NETWORK_CONFIGURATION_HANDLER_H_ |
| 6 #define CHROMEOS_NETWORK_MANAGED_NETWORK_CONFIGURATION_HANDLER_H_ | 6 #define CHROMEOS_NETWORK_MANAGED_NETWORK_CONFIGURATION_HANDLER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/callback.h" | 11 #include "base/callback.h" |
| 12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "base/memory/scoped_ptr.h" | |
| 14 #include "base/observer_list.h" | 13 #include "base/observer_list.h" |
| 15 #include "chromeos/chromeos_export.h" | 14 #include "chromeos/chromeos_export.h" |
| 16 #include "chromeos/network/network_handler.h" | 15 #include "chromeos/network/network_handler.h" |
| 17 #include "chromeos/network/network_handler_callbacks.h" | 16 #include "chromeos/network/network_handler_callbacks.h" |
| 18 #include "chromeos/network/onc/onc_constants.h" | 17 #include "chromeos/network/onc/onc_constants.h" |
| 19 | 18 |
| 20 namespace base { | 19 namespace base { |
| 21 class DictionaryValue; | 20 class DictionaryValue; |
| 22 class ListValue; | 21 class ListValue; |
| 23 } | 22 } |
| 24 | 23 |
| 25 namespace chromeos { | 24 namespace chromeos { |
| 26 | 25 |
| 27 class NetworkPolicyObserver; | 26 class NetworkPolicyObserver; |
| 28 class NetworkUIData; | |
| 29 | 27 |
| 30 // The ManagedNetworkConfigurationHandler class is used to create and configure | 28 // The ManagedNetworkConfigurationHandler class is used to create and configure |
| 31 // networks in ChromeOS using ONC and takes care of network policies. | 29 // networks in ChromeOS using ONC and takes care of network policies. |
| 32 // | 30 // |
| 33 // Its interface exposes only ONC and should decouple users from Shill. | 31 // Its interface exposes only ONC and should decouple users from Shill. |
| 34 // Internally it translates ONC to Shill dictionaries and calls through to the | 32 // Internally it translates ONC to Shill dictionaries and calls through to the |
| 35 // NetworkConfigurationHandler. | 33 // NetworkConfigurationHandler. |
| 36 // | 34 // |
| 37 // For accessing lists of visible networks, and other state information, see the | 35 // For accessing lists of visible networks, and other state information, see the |
| 38 // class NetworkStateHandler. | 36 // class NetworkStateHandler. |
| 39 // | 37 // |
| 40 // This is a singleton and its lifetime is managed by the Chrome startup code. | 38 // This is a singleton and its lifetime is managed by the Chrome startup code. |
| 41 // | 39 // |
| 42 // Network configurations are referred to by Shill's service path. These | 40 // Network configurations are referred to by Shill's service path. These |
| 43 // identifiers should at most be used to also access network state using the | 41 // identifiers should at most be used to also access network state using the |
| 44 // NetworkStateHandler, but dependencies to Shill should be avoided. In the | 42 // NetworkStateHandler, but dependencies to Shill should be avoided. In the |
| 45 // future, we may switch to other identifiers. | 43 // future, we may switch to other identifiers. |
| 46 // | 44 // |
| 47 // Note on callbacks: Because all the functions here are meant to be | 45 // Note on callbacks: Because all the functions here are meant to be |
| 48 // asynchronous, they all take a |callback| of some type, and an | 46 // asynchronous, they all take a |callback| of some type, and an |
| 49 // |error_callback|. When the operation succeeds, |callback| will be called, and | 47 // |error_callback|. When the operation succeeds, |callback| will be called, and |
| 50 // when it doesn't, |error_callback| will be called with information about the | 48 // when it doesn't, |error_callback| will be called with information about the |
| 51 // error, including a symbolic name for the error and often some error message | 49 // error, including a symbolic name for the error and often some error message |
| 52 // that is suitable for logging. None of the error message text is meant for | 50 // that is suitable for logging. None of the error message text is meant for |
| 53 // user consumption. | 51 // user consumption. |
| 54 class CHROMEOS_EXPORT ManagedNetworkConfigurationHandler { | 52 class CHROMEOS_EXPORT ManagedNetworkConfigurationHandler { |
| 55 public: | 53 public: |
| 56 virtual ~ManagedNetworkConfigurationHandler(); | 54 virtual ~ManagedNetworkConfigurationHandler(); |
| 57 | 55 |
| 58 // Returns the NetworkUIData parsed from the UIData property of | |
| 59 // |shill_dictionary|. If parsing fails or the field doesn't exist, returns | |
| 60 // NULL. | |
| 61 static scoped_ptr<NetworkUIData> GetUIData( | |
| 62 const base::DictionaryValue& shill_dictionary); | |
| 63 | |
| 64 virtual void AddObserver(NetworkPolicyObserver* observer) = 0; | 56 virtual void AddObserver(NetworkPolicyObserver* observer) = 0; |
| 65 virtual void RemoveObserver(NetworkPolicyObserver* observer) = 0; | 57 virtual void RemoveObserver(NetworkPolicyObserver* observer) = 0; |
| 66 | 58 |
| 67 // Provides the properties of the network with |service_path| to |callback|. | 59 // Provides the properties of the network with |service_path| to |callback|. |
| 68 virtual void GetProperties( | 60 virtual void GetProperties( |
| 69 const std::string& service_path, | 61 const std::string& service_path, |
| 70 const network_handler::DictionaryResultCallback& callback, | 62 const network_handler::DictionaryResultCallback& callback, |
| 71 const network_handler::ErrorCallback& error_callback) const = 0; | 63 const network_handler::ErrorCallback& error_callback) const = 0; |
| 72 | 64 |
| 73 // Provides the managed properties of the network with |service_path| to | 65 // Provides the managed properties of the network with |service_path| to |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 const std::string& guid, | 125 const std::string& guid, |
| 134 const std::string& profile_path) const = 0; | 126 const std::string& profile_path) const = 0; |
| 135 | 127 |
| 136 private: | 128 private: |
| 137 DISALLOW_ASSIGN(ManagedNetworkConfigurationHandler); | 129 DISALLOW_ASSIGN(ManagedNetworkConfigurationHandler); |
| 138 }; | 130 }; |
| 139 | 131 |
| 140 } // namespace chromeos | 132 } // namespace chromeos |
| 141 | 133 |
| 142 #endif // CHROMEOS_NETWORK_MANAGED_NETWORK_CONFIGURATION_HANDLER_H_ | 134 #endif // CHROMEOS_NETWORK_MANAGED_NETWORK_CONFIGURATION_HANDLER_H_ |
| OLD | NEW |