Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(170)

Side by Side Diff: chrome/browser/ui/webui/options2/chromeos/internet_options_handler2.h

Issue 10698140: Remove "2" suffixes from options2 code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix tests Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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 CHROME_BROWSER_UI_WEBUI_OPTIONS2_CHROMEOS_INTERNET_OPTIONS_HANDLER2_H_
6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS2_CHROMEOS_INTERNET_OPTIONS_HANDLER2_H_
7
8 #include <string>
9
10 #include "base/compiler_specific.h"
11 #include "chrome/browser/chromeos/cros/network_library.h"
12 #include "chrome/browser/chromeos/cros/network_ui_data.h"
13 #include "chrome/browser/ui/webui/options2/options_ui2.h"
14 #include "content/public/browser/notification_registrar.h"
15 #include "ui/gfx/native_widget_types.h"
16
17 class Browser;
18
19 namespace gfx {
20 class ImageSkia;
21 }
22
23 namespace views {
24 class WidgetDelegate;
25 }
26
27 namespace options2 {
28
29 // ChromeOS internet options page UI handler.
30 class InternetOptionsHandler
31 : public OptionsPageUIHandler,
32 public chromeos::NetworkLibrary::NetworkManagerObserver,
33 public chromeos::NetworkLibrary::NetworkObserver,
34 public chromeos::NetworkLibrary::CellularDataPlanObserver {
35 public:
36 InternetOptionsHandler();
37 virtual ~InternetOptionsHandler();
38
39 // OptionsPageUIHandler implementation.
40 virtual void GetLocalizedValues(
41 base::DictionaryValue* localized_strings) OVERRIDE;
42 virtual void InitializePage() OVERRIDE;
43
44 // WebUIMessageHandler implementation.
45 virtual void RegisterMessages() OVERRIDE;
46
47 // NetworkLibrary::NetworkManagerObserver implementation.
48 virtual void OnNetworkManagerChanged(
49 chromeos::NetworkLibrary* network_lib) OVERRIDE;
50 // NetworkLibrary::NetworkObserver implementation.
51 virtual void OnNetworkChanged(chromeos::NetworkLibrary* network_lib,
52 const chromeos::Network* network) OVERRIDE;
53 // NetworkLibrary::CellularDataPlanObserver implementation.
54 virtual void OnCellularDataPlanChanged(
55 chromeos::NetworkLibrary* network_lib) OVERRIDE;
56
57 // content::NotificationObserver implementation.
58 virtual void Observe(int type,
59 const content::NotificationSource& source,
60 const content::NotificationDetails& details) OVERRIDE;
61
62 private:
63 // Opens a modal popup dialog.
64 void CreateModalPopup(views::WidgetDelegate* view);
65 gfx::NativeWindow GetNativeWindow() const;
66
67 // Returns the last active browser. If there is no such browser, creates a new
68 // browser window with an empty tab and returns it.
69 Browser* GetAppropriateBrowser();
70
71 // Passes data needed to show the details overlay for a network.
72 // |args| will be [ network_type, service_path, command ]
73 // And command is one of 'options', 'connect', disconnect', 'activate' or
74 // 'forget'
75 void NetworkCommandCallback(const base::ListValue* args);
76
77 // Handle{Wifi,Wimax,Cellular,VPN}ButtonClick handles button click on a
78 // wireless, wimax, cellular or VPN network item, respectively.
79 void HandleWifiButtonClick(const std::string& service_path,
80 const std::string& command);
81 void HandleWimaxButtonClick(const std::string& service_path,
82 const std::string& command);
83 void HandleCellularButtonClick(const std::string& service_path,
84 const std::string& command);
85 void HandleVPNButtonClick(const std::string& service_path,
86 const std::string& command);
87
88 // Used to finish up async connection to the |network|. |network| cannot
89 // be NULL.
90 void DoConnect(chromeos::Network* network);
91
92 // Initiates cellular plan data refresh. The results from libcros will be
93 // passed through CellularDataPlanChanged() callback method.
94 // |args| will be [ service_path ]
95 void RefreshCellularPlanCallback(const base::ListValue* args);
96 void SetActivationButtonVisibility(
97 const chromeos::CellularNetwork* cellular,
98 base::DictionaryValue* dictionary,
99 const std::string& carrier_id);
100
101 void SetPreferNetworkCallback(const base::ListValue* args);
102 void SetAutoConnectCallback(const base::ListValue* args);
103 void SetSharedCallback(const base::ListValue* args);
104 void SetIPConfigCallback(const base::ListValue* args);
105 void EnableWifiCallback(const base::ListValue* args);
106 void DisableWifiCallback(const base::ListValue* args);
107 void EnableCellularCallback(const base::ListValue* args);
108 void DisableCellularCallback(const base::ListValue* args);
109 void EnableWimaxCallback(const base::ListValue* args);
110 void DisableWimaxCallback(const base::ListValue* args);
111 void BuyDataPlanCallback(const base::ListValue* args);
112 void SetApnCallback(const base::ListValue* args);
113 void SetSimCardLockCallback(const base::ListValue* args);
114 void ChangePinCallback(const base::ListValue* args);
115 void ShareNetworkCallback(const base::ListValue* args);
116 void ShowMorePlanInfoCallback(const base::ListValue* args);
117 void RefreshNetworksCallback(const base::ListValue* args);
118
119 /**
120 * Toggle airplane mode. Disables all wireless networks when activated.
121 * Celluar and Bluetooth connections remain disabled while active, but
122 * Wi-Fi can be reactivated. |args| is unused.
123 */
124 void ToggleAirplaneModeCallback(const ListValue* args);
125
126 // Populates the ui with the details of the given device path. This forces
127 // an overlay to be displayed in the UI.
128 void PopulateDictionaryDetails(const chromeos::Network* network);
129 void PopulateWifiDetails(const chromeos::WifiNetwork* wifi,
130 base::DictionaryValue* dictionary);
131 void PopulateWimaxDetails(const chromeos::WimaxNetwork* wimax,
132 base::DictionaryValue* dictionary);
133 void PopulateCellularDetails(const chromeos::CellularNetwork* cellular,
134 base::DictionaryValue* dictionary);
135 void PopulateVPNDetails(const chromeos::VirtualNetwork* vpn,
136 base::DictionaryValue* dictionary);
137
138 // Converts CellularDataPlan structure into dictionary for JS. Formats plan
139 // settings into human readable texts.
140 base::DictionaryValue* CellularDataPlanToDictionary(
141 const chromeos::CellularDataPlan* plan);
142
143 // Converts CellularApn stuct into dictionary for JS.
144 base::DictionaryValue* CreateDictionaryFromCellularApn(
145 const chromeos::CellularApn& apn);
146
147 // Creates the map of wired networks.
148 base::ListValue* GetWiredList();
149 // Creates the map of wireless networks.
150 base::ListValue* GetWirelessList();
151 // Creates the map of virtual networks.
152 base::ListValue* GetVPNList();
153 // Creates the map of remembered networks.
154 base::ListValue* GetRememberedList();
155 // Fills network information into JS dictionary for displaying network lists.
156 void FillNetworkInfo(base::DictionaryValue* dictionary);
157 // Refreshes the display of network information.
158 void RefreshNetworkData();
159 // Adds observers for wireless networks, if any, so that we can dynamically
160 // display the correct icon for that network's signal strength and, in the
161 // case of cellular networks, network technology and roaming status.
162 void MonitorNetworks();
163
164 // Stores a dictionary under |key| in |settings| that is suitable to be sent
165 // to the webui that contains the actual value of a setting and whether it's
166 // controlled by policy. Takes ownership of |value|.
167 void SetValueDictionary(DictionaryValue* settings,
168 const char* key,
169 base::Value* value,
170 const chromeos::NetworkPropertyUIData& ui_data);
171
172 // Convenience pointer to netwrok library (will not change).
173 chromeos::NetworkLibrary* cros_;
174
175 content::NotificationRegistrar registrar_;
176
177 // Weak pointer factory so we can start connections at a later time
178 // without worrying that they will actually try to happen after the lifetime
179 // of this object.
180 base::WeakPtrFactory<InternetOptionsHandler> weak_factory_;
181
182 DISALLOW_COPY_AND_ASSIGN(InternetOptionsHandler);
183 };
184
185 } // namespace options2
186
187 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS2_CHROMEOS_INTERNET_OPTIONS_HANDLER2_H _
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698