| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 | 27 |
| 28 class NetworkConfigView; | 28 class NetworkConfigView; |
| 29 | 29 |
| 30 // A dialog box for showing a password textfield. | 30 // A dialog box for showing a password textfield. |
| 31 class WifiConfigView : public views::View, | 31 class WifiConfigView : public views::View, |
| 32 public views::Textfield::Controller, | 32 public views::Textfield::Controller, |
| 33 public views::ButtonListener, | 33 public views::ButtonListener, |
| 34 public views::Combobox::Listener, | 34 public views::Combobox::Listener, |
| 35 public SelectFileDialog::Listener { | 35 public SelectFileDialog::Listener { |
| 36 public: | 36 public: |
| 37 // Wifi login dialog for wifi network |wifi| |
| 37 WifiConfigView(NetworkConfigView* parent, const WifiNetwork* wifi); | 38 WifiConfigView(NetworkConfigView* parent, const WifiNetwork* wifi); |
| 39 // Wifi login dialog for "Joining other network..." |
| 38 explicit WifiConfigView(NetworkConfigView* parent); | 40 explicit WifiConfigView(NetworkConfigView* parent); |
| 39 virtual ~WifiConfigView(); | 41 virtual ~WifiConfigView(); |
| 40 | 42 |
| 41 // views::Textfield::Controller methods. | 43 // views::Textfield::Controller methods. |
| 42 virtual void ContentsChanged(views::Textfield* sender, | 44 virtual void ContentsChanged(views::Textfield* sender, |
| 43 const string16& new_contents); | 45 const string16& new_contents); |
| 44 virtual bool HandleKeyEvent(views::Textfield* sender, | 46 virtual bool HandleKeyEvent(views::Textfield* sender, |
| 45 const views::KeyEvent& key_event); | 47 const views::KeyEvent& key_event); |
| 46 | 48 |
| 47 // views::ButtonListener | 49 // views::ButtonListener |
| (...skipping 13 matching lines...) Expand all Loading... |
| 61 virtual bool Save(); | 63 virtual bool Save(); |
| 62 | 64 |
| 63 // Cancel the dialog. | 65 // Cancel the dialog. |
| 64 virtual void Cancel(); | 66 virtual void Cancel(); |
| 65 | 67 |
| 66 // Get the typed in ssid. | 68 // Get the typed in ssid. |
| 67 const std::string GetSSID() const; | 69 const std::string GetSSID() const; |
| 68 // Get the typed in passphrase. | 70 // Get the typed in passphrase. |
| 69 const std::string GetPassphrase() const; | 71 const std::string GetPassphrase() const; |
| 70 | 72 |
| 71 // Returns true if the textfields are non-empty and we can login. | 73 // Returns whether or not we can login. |
| 72 bool can_login() const { return can_login_; } | 74 bool CanLogin(); |
| 73 | 75 |
| 74 private: | 76 private: |
| 75 class SecurityComboboxModel : public ui::ComboboxModel { | |
| 76 public: | |
| 77 SecurityComboboxModel() {} | |
| 78 virtual ~SecurityComboboxModel() {} | |
| 79 virtual int GetItemCount(); | |
| 80 virtual string16 GetItemAt(int index); | |
| 81 private: | |
| 82 DISALLOW_COPY_AND_ASSIGN(SecurityComboboxModel); | |
| 83 }; | |
| 84 | |
| 85 // Initializes UI. | 77 // Initializes UI. |
| 86 void Init(); | 78 void Init(); |
| 87 | 79 |
| 88 // Updates state of the Login button. | 80 // Updates state of the Login button. |
| 89 void UpdateCanLogin(); | 81 void UpdateCanLogin(); |
| 90 | 82 |
| 91 // Updates the error text label. | 83 // Updates the error text label. |
| 92 void UpdateErrorLabel(bool failed); | 84 void UpdateErrorLabel(bool failed); |
| 93 | 85 |
| 94 NetworkConfigView* parent_; | 86 NetworkConfigView* parent_; |
| 95 | 87 |
| 96 // Whether or not we can log in. This gets recalculated when textfield | 88 // Whether or not it is an 802.1x network. |
| 97 // contents change. | 89 bool is_8021x_; |
| 98 bool can_login_; | |
| 99 | 90 |
| 100 scoped_ptr<WifiNetwork> wifi_; | 91 scoped_ptr<WifiNetwork> wifi_; |
| 101 | 92 |
| 102 views::Textfield* ssid_textfield_; | 93 views::Textfield* ssid_textfield_; |
| 94 views::Combobox* eap_method_combobox_; |
| 95 views::Combobox* phase_2_auth_combobox_; |
| 103 views::Textfield* identity_textfield_; | 96 views::Textfield* identity_textfield_; |
| 97 views::Textfield* identity_anonymous_textfield_; |
| 104 views::NativeButton* certificate_browse_button_; | 98 views::NativeButton* certificate_browse_button_; |
| 105 scoped_refptr<SelectFileDialog> select_file_dialog_; | 99 scoped_refptr<SelectFileDialog> select_file_dialog_; |
| 106 std::string certificate_path_; | 100 std::string certificate_path_; |
| 107 views::Combobox* security_combobox_; | 101 views::Combobox* security_combobox_; |
| 108 views::Textfield* passphrase_textfield_; | 102 views::Textfield* passphrase_textfield_; |
| 109 views::ImageButton* passphrase_visible_button_; | 103 views::ImageButton* passphrase_visible_button_; |
| 110 views::Label* error_label_; | 104 views::Label* error_label_; |
| 111 | 105 |
| 112 DISALLOW_COPY_AND_ASSIGN(WifiConfigView); | 106 DISALLOW_COPY_AND_ASSIGN(WifiConfigView); |
| 113 }; | 107 }; |
| 114 | 108 |
| 115 } // namespace chromeos | 109 } // namespace chromeos |
| 116 | 110 |
| 117 #endif // CHROME_BROWSER_CHROMEOS_OPTIONS_WIFI_CONFIG_VIEW_H_ | 111 #endif // CHROME_BROWSER_CHROMEOS_OPTIONS_WIFI_CONFIG_VIEW_H_ |
| OLD | NEW |