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

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

Issue 8930012: Revert 114236 - Options2: Pull the trigger. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years 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) 2011 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_HANDLER_H_
6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS2_CHROMEOS_INTERNET_OPTIONS_HANDLER_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_ui.h"
14 #include "content/public/browser/notification_registrar.h"
15 #include "ui/gfx/native_widget_types.h"
16
17 class SkBitmap;
18 namespace views {
19 class WidgetDelegate;
20 }
21
22 // ChromeOS internet options page UI handler.
23 class InternetOptionsHandler
24 : public OptionsPage2UIHandler,
25 public chromeos::NetworkLibrary::NetworkManagerObserver,
26 public chromeos::NetworkLibrary::NetworkObserver,
27 public chromeos::NetworkLibrary::CellularDataPlanObserver {
28 public:
29 InternetOptionsHandler();
30 virtual ~InternetOptionsHandler();
31
32 // OptionsPage2UIHandler implementation.
33 virtual void GetLocalizedValues(
34 base::DictionaryValue* localized_strings) OVERRIDE;
35 virtual void Initialize() OVERRIDE;
36
37 // WebUIMessageHandler implementation.
38 virtual void RegisterMessages() OVERRIDE;
39
40 // NetworkLibrary::NetworkManagerObserver implementation.
41 virtual void OnNetworkManagerChanged(
42 chromeos::NetworkLibrary* network_lib) OVERRIDE;
43 // NetworkLibrary::NetworkObserver implementation.
44 virtual void OnNetworkChanged(chromeos::NetworkLibrary* network_lib,
45 const chromeos::Network* network) OVERRIDE;
46 // NetworkLibrary::CellularDataPlanObserver implementation.
47 virtual void OnCellularDataPlanChanged(
48 chromeos::NetworkLibrary* network_lib) OVERRIDE;
49
50 // content::NotificationObserver implementation.
51 virtual void Observe(int type,
52 const content::NotificationSource& source,
53 const content::NotificationDetails& details) OVERRIDE;
54
55 private:
56 // Opens a modal popup dialog.
57 void CreateModalPopup(views::WidgetDelegate* view);
58 gfx::NativeWindow GetNativeWindow() const;
59
60 // Passes data needed to show details overlay for network.
61 // |args| will be [ network_type, service_path, command ]
62 // And command is one of 'options', 'connect', disconnect', 'activate' or
63 // 'forget'
64 // Handle{Wifi,Cellular}ButtonClick handles button click on a wireless
65 // network item and a cellular network item respectively.
66 void ButtonClickCallback(const base::ListValue* args);
67 void HandleWifiButtonClick(const std::string& service_path,
68 const std::string& command);
69 void HandleCellularButtonClick(const std::string& service_path,
70 const std::string& command);
71 void HandleVPNButtonClick(const std::string& service_path,
72 const std::string& command);
73
74 // Initiates cellular plan data refresh. The results from libcros will be
75 // passed through CellularDataPlanChanged() callback method.
76 // |args| will be [ service_path ]
77 void RefreshCellularPlanCallback(const base::ListValue* args);
78 void SetActivationButtonVisibility(
79 const chromeos::CellularNetwork* cellular,
80 base::DictionaryValue* dictionary);
81
82 void SetPreferNetworkCallback(const base::ListValue* args);
83 void SetAutoConnectCallback(const base::ListValue* args);
84 void SetSharedCallback(const base::ListValue* args);
85 void SetIPConfigCallback(const base::ListValue* args);
86 void EnableWifiCallback(const base::ListValue* args);
87 void DisableWifiCallback(const base::ListValue* args);
88 void EnableCellularCallback(const base::ListValue* args);
89 void DisableCellularCallback(const base::ListValue* args);
90 void BuyDataPlanCallback(const base::ListValue* args);
91 void SetApnCallback(const base::ListValue* args);
92 void SetSimCardLockCallback(const base::ListValue* args);
93 void ChangePinCallback(const base::ListValue* args);
94 void ShareNetworkCallback(const base::ListValue* args);
95
96 // Populates the ui with the details of the given device path. This forces
97 // an overlay to be displayed in the UI.
98 void PopulateDictionaryDetails(const chromeos::Network* network);
99 void PopulateWifiDetails(const chromeos::WifiNetwork* wifi,
100 base::DictionaryValue* dictionary);
101 void PopulateCellularDetails(const chromeos::CellularNetwork* cellular,
102 base::DictionaryValue* dictionary);
103 void PopulateVPNDetails(const chromeos::VirtualNetwork* vpn,
104 base::DictionaryValue* dictionary);
105
106 // Converts CellularDataPlan structure into dictionary for JS. Formats plan
107 // settings into human readable texts.
108 base::DictionaryValue* CellularDataPlanToDictionary(
109 const chromeos::CellularDataPlan* plan);
110
111 // Converts CellularApn stuct into dictionary for JS.
112 base::DictionaryValue* CreateDictionaryFromCellularApn(
113 const chromeos::CellularApn& apn);
114
115 // Creates the map of wired networks.
116 base::ListValue* GetWiredList();
117 // Creates the map of wireless networks.
118 base::ListValue* GetWirelessList();
119 // Creates the map of virtual networks.
120 base::ListValue* GetVPNList();
121 // Creates the map of remembered networks.
122 base::ListValue* GetRememberedList();
123 // Fills network information into JS dictionary for displaying network lists.
124 void FillNetworkInfo(base::DictionaryValue* dictionary);
125 // Refreshes the display of network information.
126 void RefreshNetworkData();
127 // Adds observers for wireless networks, if any, so that we can dynamically
128 // display the correct icon for that network's signal strength and, in the
129 // case of cellular networks, network technology and roaming status.
130 void MonitorNetworks();
131
132 // Stores a dictionary under |key| in |settings| that is suitable to be sent
133 // to the webui that contains the actual value of a setting and whether it's
134 // controlled by policy. Takes ownership of |value|.
135 void SetValueDictionary(DictionaryValue* settings,
136 const char* key,
137 base::Value* value,
138 const chromeos::NetworkPropertyUIData& ui_data);
139
140 // Convenience pointer to netwrok library (will not change).
141 chromeos::NetworkLibrary* cros_;
142
143 content::NotificationRegistrar registrar_;
144
145 DISALLOW_COPY_AND_ASSIGN(InternetOptionsHandler);
146 };
147
148 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS2_CHROMEOS_INTERNET_OPTIONS_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698