Update V8 to version 4.7.45.
[chromium-blink-merge.git] / ui / chromeos / network / network_connect.h
blob6a9a2755507947d3304550652591c4acec0d144e
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.
5 #ifndef UI_CHROMEOS_NETWORK_NETWORK_CONNECT_H
6 #define UI_CHROMEOS_NETWORK_NETWORK_CONNECT_H
8 #include <string>
10 #include "base/strings/string16.h"
11 #include "ui/chromeos/ui_chromeos_export.h"
13 namespace base {
14 class DictionaryValue;
17 namespace chromeos {
18 class NetworkTypePattern;
21 namespace ui {
23 class UI_CHROMEOS_EXPORT NetworkConnect {
24 public:
25 class Delegate {
26 public:
27 // Shows UI to configure or activate the network specified by |network_id|,
28 // which may include showing Payment or Portal UI when appropriate.
29 virtual void ShowNetworkConfigure(const std::string& network_id) = 0;
31 // Shows the settings related to network. If |network_id| is not empty,
32 // show the settings for that network.
33 virtual void ShowNetworkSettingsForGuid(const std::string& network_id) = 0;
35 // Shows UI to enroll the network specified by |network_id| if appropriate
36 // and returns true, otherwise returns false.
37 virtual bool ShowEnrollNetwork(const std::string& network_id) = 0;
39 // Shows UI to unlock a mobile sim.
40 virtual void ShowMobileSimDialog() = 0;
42 // Shows UI to setup a mobile network.
43 virtual void ShowMobileSetupDialog(const std::string& service_path) = 0;
45 protected:
46 virtual ~Delegate() {}
49 // Creates the global NetworkConnect object. |delegate| is owned by the
50 // caller.
51 static void Initialize(Delegate* delegate);
53 // Destroys the global NetworkConnect object.
54 static void Shutdown();
56 // Returns the global NetworkConnect object if initialized or NULL.
57 static NetworkConnect* Get();
59 static const char kErrorActivateFailed[];
61 virtual ~NetworkConnect();
63 // Requests a network connection and handles any errors and notifications.
64 virtual void ConnectToNetwork(const std::string& service_path) = 0;
66 // Maybe show the configuration UI after a connect failure based on the
67 // network state and error name. Returns true if the UI is shown.
68 virtual bool MaybeShowConfigureUI(const std::string& service_path,
69 const std::string& connect_error) = 0;
71 // Enables or disables a network technology. If |technology| refers to
72 // cellular and the device cannot be enabled due to a SIM lock, this function
73 // will launch the SIM unlock dialog.
74 virtual void SetTechnologyEnabled(
75 const chromeos::NetworkTypePattern& technology,
76 bool enabled_state) = 0;
78 // Requests network activation and handles any errors and notifications.
79 virtual void ActivateCellular(const std::string& service_path) = 0;
81 // Determines whether or not a network requires a connection to activate or
82 // setup and either shows a notification or opens the mobile setup dialog.
83 virtual void ShowMobileSetup(const std::string& service_path) = 0;
85 // Configures a network with a dictionary of Shill properties, then sends a
86 // connect request. The profile is set according to 'shared' if allowed.
87 virtual void ConfigureNetworkAndConnect(
88 const std::string& service_path,
89 const base::DictionaryValue& shill_properties,
90 bool shared) = 0;
92 // Requests a new network configuration to be created from a dictionary of
93 // Shill properties and sends a connect request if the configuration succeeds.
94 // The profile used is determined by |shared|.
95 virtual void CreateConfigurationAndConnect(
96 base::DictionaryValue* shill_properties,
97 bool shared) = 0;
99 // Requests a new network configuration to be created from a dictionary of
100 // Shill properties. The profile used is determined by |shared|.
101 virtual void CreateConfiguration(base::DictionaryValue* shill_properties,
102 bool shared) = 0;
104 // Returns the localized string for shill error string |error|.
105 virtual base::string16 GetShillErrorString(
106 const std::string& error,
107 const std::string& service_path) = 0;
109 // Shows the settings for the network specified by |service_path|. If empty,
110 // or no matching network exists, shows the general internet settings page.
111 virtual void ShowNetworkSettingsForPath(const std::string& service_path) = 0;
113 protected:
114 NetworkConnect();
116 private:
117 DISALLOW_COPY_AND_ASSIGN(NetworkConnect);
120 } // ui
122 #endif // UI_CHROMEOS_NETWORK_NETWORK_CONNECT_H