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_CHROMEOS_OPTIONS_WIFI_CONFIG_VIEW_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_OPTIONS_WIFI_CONFIG_VIEW_H_ |
6 #define CHROME_BROWSER_CHROMEOS_OPTIONS_WIFI_CONFIG_VIEW_H_ | 6 #define CHROME_BROWSER_CHROMEOS_OPTIONS_WIFI_CONFIG_VIEW_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
14 #include "base/strings/string16.h" | 14 #include "base/strings/string16.h" |
15 #include "chrome/browser/chromeos/cros/cert_library.h" | 15 #include "chrome/browser/chromeos/cros/cert_library.h" |
16 #include "chrome/browser/chromeos/cros/network_property_ui_data.h" | 16 #include "chrome/browser/chromeos/cros/network_property_ui_data.h" |
17 #include "chrome/browser/chromeos/options/network_config_view.h" | 17 #include "chrome/browser/chromeos/options/network_config_view.h" |
| 18 #include "chromeos/network/network_state_handler_observer.h" |
18 #include "third_party/cros_system_api/dbus/service_constants.h" | 19 #include "third_party/cros_system_api/dbus/service_constants.h" |
19 #include "ui/base/models/combobox_model.h" | 20 #include "ui/base/models/combobox_model.h" |
20 #include "ui/views/controls/button/button.h" | 21 #include "ui/views/controls/button/button.h" |
21 #include "ui/views/controls/combobox/combobox_listener.h" | 22 #include "ui/views/controls/combobox/combobox_listener.h" |
22 #include "ui/views/controls/textfield/textfield_controller.h" | 23 #include "ui/views/controls/textfield/textfield_controller.h" |
23 #include "ui/views/view.h" | 24 #include "ui/views/view.h" |
24 | 25 |
25 namespace views { | 26 namespace views { |
26 class Checkbox; | 27 class Checkbox; |
27 class Label; | 28 class Label; |
(...skipping 10 matching lines...) Expand all Loading... |
38 class SecurityComboboxModel; | 39 class SecurityComboboxModel; |
39 class ServerCACertComboboxModel; | 40 class ServerCACertComboboxModel; |
40 class UserCertComboboxModel; | 41 class UserCertComboboxModel; |
41 } | 42 } |
42 | 43 |
43 // A dialog box for showing a password textfield. | 44 // A dialog box for showing a password textfield. |
44 class WifiConfigView : public ChildNetworkConfigView, | 45 class WifiConfigView : public ChildNetworkConfigView, |
45 public views::TextfieldController, | 46 public views::TextfieldController, |
46 public views::ButtonListener, | 47 public views::ButtonListener, |
47 public views::ComboboxListener, | 48 public views::ComboboxListener, |
48 public CertLibrary::Observer { | 49 public CertLibrary::Observer, |
| 50 public NetworkStateHandlerObserver { |
49 public: | 51 public: |
50 WifiConfigView(NetworkConfigView* parent, | 52 WifiConfigView(NetworkConfigView* parent, |
51 const std::string& service_path, | 53 const std::string& service_path, |
52 bool show_8021x); | 54 bool show_8021x); |
53 virtual ~WifiConfigView(); | 55 virtual ~WifiConfigView(); |
54 | 56 |
55 // views::TextfieldController: | 57 // views::TextfieldController |
56 virtual void ContentsChanged(views::Textfield* sender, | 58 virtual void ContentsChanged(views::Textfield* sender, |
57 const string16& new_contents) OVERRIDE; | 59 const string16& new_contents) OVERRIDE; |
58 virtual bool HandleKeyEvent(views::Textfield* sender, | 60 virtual bool HandleKeyEvent(views::Textfield* sender, |
59 const ui::KeyEvent& key_event) OVERRIDE; | 61 const ui::KeyEvent& key_event) OVERRIDE; |
60 | 62 |
61 // views::ButtonListener: | 63 // views::ButtonListener |
62 virtual void ButtonPressed(views::Button* sender, | 64 virtual void ButtonPressed(views::Button* sender, |
63 const ui::Event& event) OVERRIDE; | 65 const ui::Event& event) OVERRIDE; |
64 | 66 |
65 // views::ComboboxListener: | 67 // views::ComboboxListener |
66 virtual void OnSelectedIndexChanged(views::Combobox* combobox) OVERRIDE; | 68 virtual void OnSelectedIndexChanged(views::Combobox* combobox) OVERRIDE; |
67 | 69 |
68 // CertLibrary::Observer: | 70 // CertLibrary::Observer |
69 virtual void OnCertificatesLoaded(bool initial_load) OVERRIDE; | 71 virtual void OnCertificatesLoaded(bool initial_load) OVERRIDE; |
70 | 72 |
71 // ChildNetworkConfigView: | 73 // ChildNetworkConfigView |
72 virtual string16 GetTitle() const OVERRIDE; | 74 virtual string16 GetTitle() const OVERRIDE; |
73 virtual views::View* GetInitiallyFocusedView() OVERRIDE; | 75 virtual views::View* GetInitiallyFocusedView() OVERRIDE; |
74 virtual bool CanLogin() OVERRIDE; | 76 virtual bool CanLogin() OVERRIDE; |
75 virtual bool Login() OVERRIDE; | 77 virtual bool Login() OVERRIDE; |
76 virtual void Cancel() OVERRIDE; | 78 virtual void Cancel() OVERRIDE; |
77 virtual void InitFocus() OVERRIDE; | 79 virtual void InitFocus() OVERRIDE; |
78 | 80 |
| 81 // NetworkStateHandlerObserver |
| 82 virtual void NetworkPropertiesUpdated(const NetworkState* network) OVERRIDE; |
| 83 |
79 // Parses a WiFi UI |property| from the ONC associated with |network|. |key| | 84 // Parses a WiFi UI |property| from the ONC associated with |network|. |key| |
80 // is the property name within the ONC WiFi dictionary. | 85 // is the property name within the ONC WiFi dictionary. |
81 static void ParseWiFiUIProperty(NetworkPropertyUIData* property_ui_data, | 86 static void ParseWiFiUIProperty(NetworkPropertyUIData* property_ui_data, |
82 const NetworkState* network, | 87 const NetworkState* network, |
83 const std::string& key); | 88 const std::string& key); |
84 | 89 |
85 // Parses a WiFi EAP UI |property| from the ONC associated with |network|. | 90 // Parses a WiFi EAP UI |property| from the ONC associated with |network|. |
86 // |key| is the property name within the ONC WiFi.EAP dictionary. | 91 // |key| is the property name within the ONC WiFi.EAP dictionary. |
87 static void ParseWiFiEAPUIProperty(NetworkPropertyUIData* property_ui_data, | 92 static void ParseWiFiEAPUIProperty(NetworkPropertyUIData* property_ui_data, |
88 const NetworkState* network, | 93 const NetworkState* network, |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 views::Label* error_label_; | 190 views::Label* error_label_; |
186 | 191 |
187 base::WeakPtrFactory<WifiConfigView> weak_ptr_factory_; | 192 base::WeakPtrFactory<WifiConfigView> weak_ptr_factory_; |
188 | 193 |
189 DISALLOW_COPY_AND_ASSIGN(WifiConfigView); | 194 DISALLOW_COPY_AND_ASSIGN(WifiConfigView); |
190 }; | 195 }; |
191 | 196 |
192 } // namespace chromeos | 197 } // namespace chromeos |
193 | 198 |
194 #endif // CHROME_BROWSER_CHROMEOS_OPTIONS_WIFI_CONFIG_VIEW_H_ | 199 #endif // CHROME_BROWSER_CHROMEOS_OPTIONS_WIFI_CONFIG_VIEW_H_ |
OLD | NEW |