| 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, |
| 32 public base::SupportsWeakPtr<WimaxConfigView> { |
| 31 public: | 33 public: |
| 32 // Wimax login dialog for wimax network |wimax|. |wimax| must be a non NULL | 34 // Wimax login dialog for wimax network |wimax|. |wimax| must be a non NULL |
| 33 // pointer to a WimaxNetwork in NetworkLibrary. | 35 // pointer to a WimaxNetwork in NetworkLibrary. |
| 34 WimaxConfigView(NetworkConfigView* parent, WimaxNetwork* wimax); | 36 WimaxConfigView(NetworkConfigView* parent, const std::string& service_path); |
| 35 virtual ~WimaxConfigView(); | 37 virtual ~WimaxConfigView(); |
| 36 | 38 |
| 37 // views::TextfieldController: | 39 // views::TextfieldController: |
| 38 virtual void ContentsChanged(views::Textfield* sender, | 40 virtual void ContentsChanged(views::Textfield* sender, |
| 39 const string16& new_contents) OVERRIDE; | 41 const string16& new_contents) OVERRIDE; |
| 40 virtual bool HandleKeyEvent(views::Textfield* sender, | 42 virtual bool HandleKeyEvent(views::Textfield* sender, |
| 41 const ui::KeyEvent& key_event) OVERRIDE; | 43 const ui::KeyEvent& key_event) OVERRIDE; |
| 42 | 44 |
| 43 // views::ButtonListener: | 45 // views::ButtonListener: |
| 44 virtual void ButtonPressed(views::Button* sender, | 46 virtual void ButtonPressed(views::Button* sender, |
| 45 const ui::Event& event) OVERRIDE; | 47 const ui::Event& event) OVERRIDE; |
| 46 | 48 |
| 47 // ChildNetworkConfigView: | 49 // ChildNetworkConfigView: |
| 48 virtual string16 GetTitle() const OVERRIDE; | 50 virtual string16 GetTitle() const OVERRIDE; |
| 49 virtual views::View* GetInitiallyFocusedView() OVERRIDE; | 51 virtual views::View* GetInitiallyFocusedView() OVERRIDE; |
| 50 virtual bool CanLogin() OVERRIDE; | 52 virtual bool CanLogin() OVERRIDE; |
| 51 virtual bool Login() OVERRIDE; | 53 virtual bool Login() OVERRIDE; |
| 52 virtual void Cancel() OVERRIDE; | 54 virtual void Cancel() OVERRIDE; |
| 53 virtual void InitFocus() OVERRIDE; | 55 virtual void InitFocus() OVERRIDE; |
| 54 | 56 |
| 55 private: | 57 private: |
| 56 void Init(WimaxNetwork* wimax); | 58 // Initializes UI. |
| 59 void Init(const std::string& service_path); |
| 60 |
| 61 // Callback to initialize fields from uncached network properties. |
| 62 void InitFromProperties(const std::string& service_path, |
| 63 const base::DictionaryValue& dictionary); |
| 57 | 64 |
| 58 // Get input values. | 65 // Get input values. |
| 59 std::string GetEapIdentity() const; | 66 std::string GetEapIdentity() const; |
| 60 std::string GetEapPassphrase() const; | 67 std::string GetEapPassphrase() const; |
| 61 bool GetSaveCredentials() const; | 68 bool GetSaveCredentials() const; |
| 62 bool GetShareNetwork(bool share_default) const; | 69 bool GetShareNetwork(bool share_default) const; |
| 63 | 70 |
| 64 // Updates state of the Login button. | 71 // Updates state of the Login button. |
| 65 void UpdateDialogButtons(); | 72 void UpdateDialogButtons(); |
| 66 | 73 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 80 views::Textfield* passphrase_textfield_; | 87 views::Textfield* passphrase_textfield_; |
| 81 views::ToggleImageButton* passphrase_visible_button_; | 88 views::ToggleImageButton* passphrase_visible_button_; |
| 82 views::Label* error_label_; | 89 views::Label* error_label_; |
| 83 | 90 |
| 84 DISALLOW_COPY_AND_ASSIGN(WimaxConfigView); | 91 DISALLOW_COPY_AND_ASSIGN(WimaxConfigView); |
| 85 }; | 92 }; |
| 86 | 93 |
| 87 } // namespace chromeos | 94 } // namespace chromeos |
| 88 | 95 |
| 89 #endif // CHROME_BROWSER_CHROMEOS_OPTIONS_WIMAX_CONFIG_VIEW_H_ | 96 #endif // CHROME_BROWSER_CHROMEOS_OPTIONS_WIMAX_CONFIG_VIEW_H_ |
| OLD | NEW |