| 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_WIMAX_CONFIG_VIEW_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_OPTIONS_WIMAX_CONFIG_VIEW_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_OPTIONS_WIMAX_CONFIG_VIEW_H_ | 6 #define CHROME_BROWSER_CHROMEOS_OPTIONS_WIMAX_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/weak_ptr.h" |
| 12 #include "base/strings/string16.h" | 13 #include "base/strings/string16.h" |
| 13 #include "chrome/browser/chromeos/options/network_config_view.h" | 14 #include "chrome/browser/chromeos/options/network_config_view.h" |
| 14 #include "chrome/browser/chromeos/options/wifi_config_view.h" | 15 #include "chrome/browser/chromeos/options/wifi_config_view.h" |
| 15 #include "ui/views/controls/button/button.h" | 16 #include "ui/views/controls/button/button.h" |
| 16 #include "ui/views/controls/textfield/textfield_controller.h" | 17 #include "ui/views/controls/textfield/textfield_controller.h" |
| 17 #include "ui/views/view.h" | 18 #include "ui/views/view.h" |
| 18 | 19 |
| 19 namespace views { | 20 namespace views { |
| 20 class Checkbox; | 21 class Checkbox; |
| 21 class Label; | 22 class Label; |
| 22 class ToggleImageButton; | 23 class ToggleImageButton; |
| 23 } | 24 } |
| 24 | 25 |
| 25 namespace chromeos { | 26 namespace chromeos { |
| 26 | 27 |
| 27 // A dialog box for showing a password textfield. | 28 // A dialog box for showing a password textfield. |
| 28 class WimaxConfigView : public ChildNetworkConfigView, | 29 class WimaxConfigView : public ChildNetworkConfigView, |
| 29 public views::TextfieldController, | 30 public views::TextfieldController, |
| 30 public views::ButtonListener { | 31 public views::ButtonListener { |
| 31 public: | 32 public: |
| 32 // Wimax login dialog for wimax network |wimax|. |wimax| must be a non NULL | 33 // Wimax login dialog for wimax network |wimax|. |wimax| must be a non NULL |
| 33 // pointer to a WimaxNetwork in NetworkLibrary. | 34 // pointer to a WimaxNetwork in NetworkLibrary. |
| 34 WimaxConfigView(NetworkConfigView* parent, WimaxNetwork* wimax); | 35 WimaxConfigView(NetworkConfigView* parent, const std::string& service_path); |
| 35 virtual ~WimaxConfigView(); | 36 virtual ~WimaxConfigView(); |
| 36 | 37 |
| 37 // views::TextfieldController: | 38 // views::TextfieldController: |
| 38 virtual void ContentsChanged(views::Textfield* sender, | 39 virtual void ContentsChanged(views::Textfield* sender, |
| 39 const string16& new_contents) OVERRIDE; | 40 const string16& new_contents) OVERRIDE; |
| 40 virtual bool HandleKeyEvent(views::Textfield* sender, | 41 virtual bool HandleKeyEvent(views::Textfield* sender, |
| 41 const ui::KeyEvent& key_event) OVERRIDE; | 42 const ui::KeyEvent& key_event) OVERRIDE; |
| 42 | 43 |
| 43 // views::ButtonListener: | 44 // views::ButtonListener: |
| 44 virtual void ButtonPressed(views::Button* sender, | 45 virtual void ButtonPressed(views::Button* sender, |
| 45 const ui::Event& event) OVERRIDE; | 46 const ui::Event& event) OVERRIDE; |
| 46 | 47 |
| 47 // ChildNetworkConfigView: | 48 // ChildNetworkConfigView: |
| 48 virtual string16 GetTitle() const OVERRIDE; | 49 virtual string16 GetTitle() const OVERRIDE; |
| 49 virtual views::View* GetInitiallyFocusedView() OVERRIDE; | 50 virtual views::View* GetInitiallyFocusedView() OVERRIDE; |
| 50 virtual bool CanLogin() OVERRIDE; | 51 virtual bool CanLogin() OVERRIDE; |
| 51 virtual bool Login() OVERRIDE; | 52 virtual bool Login() OVERRIDE; |
| 52 virtual void Cancel() OVERRIDE; | 53 virtual void Cancel() OVERRIDE; |
| 53 virtual void InitFocus() OVERRIDE; | 54 virtual void InitFocus() OVERRIDE; |
| 54 | 55 |
| 55 private: | 56 private: |
| 56 void Init(WimaxNetwork* wimax); | 57 // Initializes UI. |
| 58 void Init(); |
| 59 |
| 60 // Callback to initialize fields from uncached network properties. |
| 61 void InitFromProperties(const std::string& service_path, |
| 62 const base::DictionaryValue& dictionary); |
| 57 | 63 |
| 58 // Get input values. | 64 // Get input values. |
| 59 std::string GetEapIdentity() const; | 65 std::string GetEapIdentity() const; |
| 60 std::string GetEapPassphrase() const; | 66 std::string GetEapPassphrase() const; |
| 61 bool GetSaveCredentials() const; | 67 bool GetSaveCredentials() const; |
| 62 bool GetShareNetwork(bool share_default) const; | 68 bool GetShareNetwork(bool share_default) const; |
| 63 | 69 |
| 64 // Updates state of the Login button. | 70 // Updates state of the Login button. |
| 65 void UpdateDialogButtons(); | 71 void UpdateDialogButtons(); |
| 66 | 72 |
| 67 // Updates the error text label. | 73 // Updates the error text label. |
| 68 void UpdateErrorLabel(); | 74 void UpdateErrorLabel(); |
| 69 | 75 |
| 70 NetworkPropertyUIData identity_ui_data_; | 76 NetworkPropertyUIData identity_ui_data_; |
| 71 NetworkPropertyUIData passphrase_ui_data_; | 77 NetworkPropertyUIData passphrase_ui_data_; |
| 72 NetworkPropertyUIData save_credentials_ui_data_; | 78 NetworkPropertyUIData save_credentials_ui_data_; |
| 73 | 79 |
| 74 views::Label* identity_label_; | 80 views::Label* identity_label_; |
| 75 views::Textfield* identity_textfield_; | 81 views::Textfield* identity_textfield_; |
| 76 views::Checkbox* save_credentials_checkbox_; | 82 views::Checkbox* save_credentials_checkbox_; |
| 77 views::Checkbox* share_network_checkbox_; | 83 views::Checkbox* share_network_checkbox_; |
| 78 views::Label* shared_network_label_; | 84 views::Label* shared_network_label_; |
| 79 views::Label* passphrase_label_; | 85 views::Label* passphrase_label_; |
| 80 views::Textfield* passphrase_textfield_; | 86 views::Textfield* passphrase_textfield_; |
| 81 views::ToggleImageButton* passphrase_visible_button_; | 87 views::ToggleImageButton* passphrase_visible_button_; |
| 82 views::Label* error_label_; | 88 views::Label* error_label_; |
| 83 | 89 |
| 90 base::WeakPtrFactory<WimaxConfigView> weak_ptr_factory_; |
| 91 |
| 84 DISALLOW_COPY_AND_ASSIGN(WimaxConfigView); | 92 DISALLOW_COPY_AND_ASSIGN(WimaxConfigView); |
| 85 }; | 93 }; |
| 86 | 94 |
| 87 } // namespace chromeos | 95 } // namespace chromeos |
| 88 | 96 |
| 89 #endif // CHROME_BROWSER_CHROMEOS_OPTIONS_WIMAX_CONFIG_VIEW_H_ | 97 #endif // CHROME_BROWSER_CHROMEOS_OPTIONS_WIMAX_CONFIG_VIEW_H_ |
| OLD | NEW |