OLD | NEW |
| (Empty) |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef UI_CHROMEOS_NETWORK_NETWORK_CONNECT_H | |
6 #define UI_CHROMEOS_NETWORK_NETWORK_CONNECT_H | |
7 | |
8 #include <string> | |
9 | |
10 #include "base/macros.h" | |
11 #include "base/strings/string16.h" | |
12 #include "ui/chromeos/ui_chromeos_export.h" | |
13 | |
14 namespace base { | |
15 class DictionaryValue; | |
16 } | |
17 | |
18 namespace chromeos { | |
19 class NetworkTypePattern; | |
20 } | |
21 | |
22 namespace ui { | |
23 | |
24 class UI_CHROMEOS_EXPORT NetworkConnect { | |
25 public: | |
26 class Delegate { | |
27 public: | |
28 // Shows UI to configure or activate the network specified by |network_id|, | |
29 // which may include showing Payment or Portal UI when appropriate. | |
30 virtual void ShowNetworkConfigure(const std::string& network_id) = 0; | |
31 | |
32 // Shows the settings related to network. If |network_id| is not empty, | |
33 // show the settings for that network. | |
34 virtual void ShowNetworkSettings(const std::string& network_id) = 0; | |
35 | |
36 // Shows UI to enroll the network specified by |network_id| if appropriate | |
37 // and returns true, otherwise returns false. | |
38 virtual bool ShowEnrollNetwork(const std::string& network_id) = 0; | |
39 | |
40 // Shows UI to unlock a mobile sim. | |
41 virtual void ShowMobileSimDialog() = 0; | |
42 | |
43 // Shows UI to setup a mobile network. | |
44 virtual void ShowMobileSetupDialog(const std::string& network_id) = 0; | |
45 | |
46 protected: | |
47 virtual ~Delegate() {} | |
48 }; | |
49 | |
50 // Creates the global NetworkConnect object. |delegate| is owned by the | |
51 // caller. | |
52 static void Initialize(Delegate* delegate); | |
53 | |
54 // Destroys the global NetworkConnect object. | |
55 static void Shutdown(); | |
56 | |
57 // Returns the global NetworkConnect object if initialized or NULL. | |
58 static NetworkConnect* Get(); | |
59 | |
60 static const char kErrorActivateFailed[]; | |
61 | |
62 virtual ~NetworkConnect(); | |
63 | |
64 // Requests a network connection and handles any errors and notifications. | |
65 virtual void ConnectToNetwork(const std::string& service_path) = 0; | |
66 | |
67 // Maybe show the configuration UI after a connect failure based on the | |
68 // network state and error name. Returns true if the UI is shown. | |
69 virtual bool MaybeShowConfigureUI(const std::string& service_path, | |
70 const std::string& connect_error) = 0; | |
71 | |
72 // Enables or disables a network technology. If |technology| refers to | |
73 // cellular and the device cannot be enabled due to a SIM lock, this function | |
74 // will launch the SIM unlock dialog. | |
75 virtual void SetTechnologyEnabled( | |
76 const chromeos::NetworkTypePattern& technology, | |
77 bool enabled_state) = 0; | |
78 | |
79 // Requests network activation and handles any errors and notifications. | |
80 virtual void ActivateCellular(const std::string& service_path) = 0; | |
81 | |
82 // Determines whether or not a network requires a connection to activate or | |
83 // setup and either shows a notification or opens the mobile setup dialog. | |
84 virtual void ShowMobileSetup(const std::string& service_path) = 0; | |
85 | |
86 // Configures a network with a dictionary of Shill properties, then sends a | |
87 // connect request. The profile is set according to 'shared' if allowed. | |
88 virtual void ConfigureNetworkAndConnect( | |
89 const std::string& service_path, | |
90 const base::DictionaryValue& shill_properties, | |
91 bool shared) = 0; | |
92 | |
93 // Requests a new network configuration to be created from a dictionary of | |
94 // Shill properties and sends a connect request if the configuration succeeds. | |
95 // The profile used is determined by |shared|. | |
96 virtual void CreateConfigurationAndConnect( | |
97 base::DictionaryValue* shill_properties, | |
98 bool shared) = 0; | |
99 | |
100 // Requests a new network configuration to be created from a dictionary of | |
101 // Shill properties. The profile used is determined by |shared|. | |
102 virtual void CreateConfiguration(base::DictionaryValue* shill_properties, | |
103 bool shared) = 0; | |
104 | |
105 // Returns the localized string for shill error string |error|. | |
106 virtual base::string16 GetShillErrorString( | |
107 const std::string& error, | |
108 const std::string& service_path) = 0; | |
109 | |
110 // Shows the settings for the network specified by |service_path|. If empty, | |
111 // or no matching network exists, shows the general internet settings page. | |
112 virtual void ShowNetworkSettingsForPath(const std::string& service_path) = 0; | |
113 | |
114 protected: | |
115 NetworkConnect(); | |
116 | |
117 private: | |
118 DISALLOW_COPY_AND_ASSIGN(NetworkConnect); | |
119 }; | |
120 | |
121 } // ui | |
122 | |
123 #endif // UI_CHROMEOS_NETWORK_NETWORK_CONNECT_H | |
OLD | NEW |