OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_INTERNET_OPTIONS_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_INTERNET_OPTIONS_HANDLER_H_ |
6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_INTERNET_OPTIONS_HANDLER_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_INTERNET_OPTIONS_HANDLER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
12 #include "chrome/browser/ui/webui/options/options_ui.h" | 12 #include "chrome/browser/ui/webui/options/options_ui.h" |
13 #include "chromeos/network/network_state_handler_observer.h" | 13 #include "chromeos/network/network_state_handler_observer.h" |
14 #include "content/public/browser/notification_observer.h" | |
15 #include "content/public/browser/notification_registrar.h" | |
16 #include "ui/gfx/native_widget_types.h" | 14 #include "ui/gfx/native_widget_types.h" |
17 | 15 |
18 class Browser; | 16 class Browser; |
19 class PrefService; | 17 class PrefService; |
20 | 18 |
21 namespace chromeos { | 19 namespace chromeos { |
22 class DeviceState; | 20 class DeviceState; |
23 class NetworkState; | 21 class NetworkState; |
24 class NetworkStateHandlerObserver; | 22 class NetworkStateHandlerObserver; |
25 } | 23 } |
26 | 24 |
27 namespace gfx { | 25 namespace gfx { |
28 class ImageSkia; | 26 class ImageSkia; |
29 } | 27 } |
30 | 28 |
31 namespace views { | 29 namespace views { |
32 class WidgetDelegate; | 30 class WidgetDelegate; |
33 } | 31 } |
34 | 32 |
35 namespace chromeos { | 33 namespace chromeos { |
36 namespace options { | 34 namespace options { |
37 | 35 |
38 // ChromeOS internet options page UI handler. | 36 // ChromeOS internet options page UI handler. |
39 class InternetOptionsHandler | 37 class InternetOptionsHandler |
40 : public ::options::OptionsPageUIHandler, | 38 : public ::options::OptionsPageUIHandler, |
41 public chromeos::NetworkStateHandlerObserver, | 39 public chromeos::NetworkStateHandlerObserver { |
42 public content::NotificationObserver { | |
43 public: | 40 public: |
44 InternetOptionsHandler(); | 41 InternetOptionsHandler(); |
45 virtual ~InternetOptionsHandler(); | 42 virtual ~InternetOptionsHandler(); |
46 | 43 |
47 private: | 44 private: |
48 // OptionsPageUIHandler | 45 // OptionsPageUIHandler |
49 virtual void GetLocalizedValues( | 46 virtual void GetLocalizedValues( |
50 base::DictionaryValue* localized_strings) OVERRIDE; | 47 base::DictionaryValue* localized_strings) OVERRIDE; |
51 virtual void InitializePage() OVERRIDE; | 48 virtual void InitializePage() OVERRIDE; |
52 | 49 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 // Called when carrier data has been updated to informs the JS. | 84 // Called when carrier data has been updated to informs the JS. |
88 void UpdateCarrier(); | 85 void UpdateCarrier(); |
89 | 86 |
90 // NetworkStateHandlerObserver | 87 // NetworkStateHandlerObserver |
91 virtual void DeviceListChanged() OVERRIDE; | 88 virtual void DeviceListChanged() OVERRIDE; |
92 virtual void NetworkListChanged() OVERRIDE; | 89 virtual void NetworkListChanged() OVERRIDE; |
93 virtual void NetworkConnectionStateChanged( | 90 virtual void NetworkConnectionStateChanged( |
94 const chromeos::NetworkState* network) OVERRIDE; | 91 const chromeos::NetworkState* network) OVERRIDE; |
95 virtual void NetworkPropertiesUpdated( | 92 virtual void NetworkPropertiesUpdated( |
96 const chromeos::NetworkState* network) OVERRIDE; | 93 const chromeos::NetworkState* network) OVERRIDE; |
| 94 virtual void DevicePropertiesUpdated( |
| 95 const chromeos::DeviceState* device) OVERRIDE; |
97 | 96 |
98 // Updates the logged in user type. | 97 // Updates the logged in user type. |
99 void UpdateLoggedInUserType(); | 98 void UpdateLoggedInUserType(); |
100 | 99 |
101 // content::NotificationObserver | |
102 virtual void Observe(int type, | |
103 const content::NotificationSource& source, | |
104 const content::NotificationDetails& details) OVERRIDE; | |
105 | |
106 // Additional callbacks to set network state properties. | 100 // Additional callbacks to set network state properties. |
107 void SetServerHostnameCallback(const base::ListValue* args); | 101 void SetServerHostnameCallback(const base::ListValue* args); |
108 void SetPreferNetworkCallback(const base::ListValue* args); | 102 void SetPreferNetworkCallback(const base::ListValue* args); |
109 void SetAutoConnectCallback(const base::ListValue* args); | 103 void SetAutoConnectCallback(const base::ListValue* args); |
110 void SetIPConfigCallback(const base::ListValue* args); | 104 void SetIPConfigCallback(const base::ListValue* args); |
111 void SetIPConfigProperties(const base::ListValue* args, | 105 void SetIPConfigProperties(const base::ListValue* args, |
112 const std::string& service_path, | 106 const std::string& service_path, |
113 const base::DictionaryValue& shill_properties); | 107 const base::DictionaryValue& shill_properties); |
114 | 108 |
115 // Retrieves the properties for |service_path| and calls showDetailedInfo | 109 // Retrieves the properties for |service_path| and calls showDetailedInfo |
(...skipping 28 matching lines...) Expand all Loading... |
144 | 138 |
145 // Creates the map of virtual networks. | 139 // Creates the map of virtual networks. |
146 base::ListValue* GetVPNList(); | 140 base::ListValue* GetVPNList(); |
147 | 141 |
148 // Creates the map of remembered networks. | 142 // Creates the map of remembered networks. |
149 base::ListValue* GetRememberedList(); | 143 base::ListValue* GetRememberedList(); |
150 | 144 |
151 // Fills network information into JS dictionary for displaying network lists. | 145 // Fills network information into JS dictionary for displaying network lists. |
152 void FillNetworkInfo(base::DictionaryValue* dictionary); | 146 void FillNetworkInfo(base::DictionaryValue* dictionary); |
153 | 147 |
154 content::NotificationRegistrar registrar_; | |
155 | |
156 // Keep track of the service path for the network shown in the Details view. | 148 // Keep track of the service path for the network shown in the Details view. |
157 std::string details_path_; | 149 std::string details_path_; |
158 | 150 |
159 // Weak pointer factory so we can start connections at a later time | 151 // Weak pointer factory so we can start connections at a later time |
160 // without worrying that they will actually try to happen after the lifetime | 152 // without worrying that they will actually try to happen after the lifetime |
161 // of this object. | 153 // of this object. |
162 base::WeakPtrFactory<InternetOptionsHandler> weak_factory_; | 154 base::WeakPtrFactory<InternetOptionsHandler> weak_factory_; |
163 | 155 |
164 DISALLOW_COPY_AND_ASSIGN(InternetOptionsHandler); | 156 DISALLOW_COPY_AND_ASSIGN(InternetOptionsHandler); |
165 }; | 157 }; |
166 | 158 |
167 } // namespace options | 159 } // namespace options |
168 } // namespace chromeos | 160 } // namespace chromeos |
169 | 161 |
170 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_INTERNET_OPTIONS_HANDLER_H_ | 162 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_INTERNET_OPTIONS_HANDLER_H_ |
OLD | NEW |