Index: ash/system/chromeos/network/network_connect.h |
diff --git a/ash/system/chromeos/network/network_connect.h b/ash/system/chromeos/network/network_connect.h |
index 9869dcfb5bfabac41199299d3def26da37f7be8f..382eb20c7ab802dedf2503b72fcff9c1d4b63951 100644 |
--- a/ash/system/chromeos/network/network_connect.h |
+++ b/ash/system/chromeos/network/network_connect.h |
@@ -19,57 +19,97 @@ class NetworkTypePattern; |
} |
namespace ash { |
-namespace network_connect { |
-ASH_EXPORT extern const char kNetworkConnectNotificationId[]; |
-ASH_EXPORT extern const char kNetworkActivateNotificationId[]; |
+class ASH_EXPORT NetworkConnect { |
+ public: |
+ class Delegate { |
+ public: |
+ // Shows UI to configure or activate the network specified by |network_id|, |
+ // which may include showing Payment or Portal UI when appropriate. |
+ virtual void ShowNetworkConfigure(const std::string& network_id) = 0; |
-ASH_EXPORT extern const char kErrorActivateFailed[]; |
+ // Shows the settings related to network. If |network_id| is not empty, |
+ // show the settings for that network. |
+ virtual void ShowNetworkSettings(const std::string& network_id) = 0; |
-// Requests a network connection and handles any errors and notifications. |
-ASH_EXPORT void ConnectToNetwork(const std::string& service_path); |
+ // Shows UI to enroll the network specified by |network_id| if appropriate |
+ // and returns true, otherwise returns false. |
+ virtual bool ShowEnrollNetwork(const std::string& network_id) = 0; |
-// Enables or disables a network technology. If |technology| refers to cellular |
-// and the device cannot be enabled due to a SIM lock, this function will |
-// launch the SIM unlock dialog. |
-ASH_EXPORT void SetTechnologyEnabled( |
- const chromeos::NetworkTypePattern& technology, |
- bool enabled_state); |
+ // Shows UI to unlock a mobile sim. |
+ virtual void ShowMobileSimDialog() = 0; |
-// Requests network activation and handles any errors and notifications. |
-ASH_EXPORT void ActivateCellular(const std::string& service_path); |
+ // Shows UI to setup a mobile network. |
+ virtual void ShowMobileSetupDialog(const std::string& service_path) = 0; |
-// Determines whether or not a network requires a connection to activate or |
-// setup and either shows a notification or opens the mobile setup dialog. |
-ASH_EXPORT void ShowMobileSetup(const std::string& service_path); |
+ protected: |
+ virtual ~Delegate() {} |
+ }; |
-// Configures a network with a dictionary of Shill properties, then sends a |
-// connect request. The profile is set according to 'shared' if allowed. |
-ASH_EXPORT void ConfigureNetworkAndConnect( |
- const std::string& service_path, |
- const base::DictionaryValue& properties, |
- bool shared); |
+ // Creates the global NetworkConnect object. |delegate| is owned by the |
+ // caller. |
+ static void Initialize(Delegate* delegate); |
-// Requests a new network configuration to be created from a dictionary of |
-// Shill properties and sends a connect request if the configuration succeeds. |
-// The profile used is determined by |shared|. |
-ASH_EXPORT void CreateConfigurationAndConnect(base::DictionaryValue* properties, |
- bool shared); |
+ // Destroys the global NetworkConnect object. |
+ static void Shutdown(); |
-// Requests a new network configuration to be created from a dictionary of |
-// Shill properties. The profile used is determined by |shared|. |
-ASH_EXPORT void CreateConfiguration(base::DictionaryValue* properties, |
- bool shared); |
+ // Returns the global NetworkConnect object if initialized or NULL. |
+ static NetworkConnect* Get(); |
-// Returns the localized string for shill error string |error|. |
-ASH_EXPORT base::string16 ErrorString(const std::string& error, |
- const std::string& service_path); |
+ static const char kErrorActivateFailed[]; |
-// Shows the settings for the network specified by |service_path|. If empty, |
-// or no matching network exists, shows the general internet settings page. |
-ASH_EXPORT void ShowNetworkSettings(const std::string& service_path); |
+ virtual ~NetworkConnect(); |
+ |
+ // Requests a network connection and handles any errors and notifications. |
+ virtual void ConnectToNetwork(const std::string& service_path) = 0; |
+ |
+ // Enables or disables a network technology. If |technology| refers to |
+ // cellular and the device cannot be enabled due to a SIM lock, this function |
+ // will launch the SIM unlock dialog. |
+ virtual void SetTechnologyEnabled( |
+ const chromeos::NetworkTypePattern& technology, |
+ bool enabled_state) = 0; |
+ |
+ // Requests network activation and handles any errors and notifications. |
+ virtual void ActivateCellular(const std::string& service_path) = 0; |
+ |
+ // Determines whether or not a network requires a connection to activate or |
+ // setup and either shows a notification or opens the mobile setup dialog. |
+ virtual void ShowMobileSetup(const std::string& service_path) = 0; |
+ |
+ // Configures a network with a dictionary of Shill properties, then sends a |
+ // connect request. The profile is set according to 'shared' if allowed. |
+ virtual void ConfigureNetworkAndConnect( |
+ const std::string& service_path, |
+ const base::DictionaryValue& properties, |
+ bool shared) = 0; |
+ |
+ // Requests a new network configuration to be created from a dictionary of |
+ // Shill properties and sends a connect request if the configuration succeeds. |
+ // The profile used is determined by |shared|. |
+ virtual void CreateConfigurationAndConnect(base::DictionaryValue* properties, |
+ bool shared) = 0; |
+ |
+ // Requests a new network configuration to be created from a dictionary of |
+ // Shill properties. The profile used is determined by |shared|. |
+ virtual void CreateConfiguration(base::DictionaryValue* properties, |
+ bool shared) = 0; |
+ |
+ // Returns the localized string for shill error string |error|. |
+ virtual base::string16 GetErrorString(const std::string& error, |
+ const std::string& service_path) = 0; |
+ |
+ // Shows the settings for the network specified by |service_path|. If empty, |
+ // or no matching network exists, shows the general internet settings page. |
+ virtual void ShowNetworkSettings(const std::string& service_path) = 0; |
+ |
+ protected: |
+ NetworkConnect(); |
+ |
+ private: |
+ DISALLOW_COPY_AND_ASSIGN(NetworkConnect); |
+}; |
-} // network_connect |
} // ash |
#endif // ASH_SYSTEM_CHROMEOS_NETWORK_NETWORK_CONNECT_H |