| OLD | NEW | 
|   1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |   1 // Copyright (c) 2006-2008 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/file_path.h" | 
|  10 #include "base/string16.h" |  11 #include "base/string16.h" | 
|  11 #include "chrome/browser/chromeos/cros/network_library.h" |  12 #include "chrome/browser/chromeos/cros/network_library.h" | 
 |  13 #include "chrome/browser/shell_dialogs.h" | 
|  12 #include "views/controls/button/button.h" |  14 #include "views/controls/button/button.h" | 
 |  15 #include "views/controls/button/image_button.h" | 
 |  16 #include "views/controls/button/native_button.h" | 
|  13 #include "views/controls/textfield/textfield.h" |  17 #include "views/controls/textfield/textfield.h" | 
|  14 #include "views/view.h" |  18 #include "views/view.h" | 
|  15  |  19  | 
|  16 namespace chromeos { |  20 namespace chromeos { | 
|  17  |  21  | 
|  18 class NetworkConfigView; |  22 class NetworkConfigView; | 
|  19  |  23  | 
|  20 // A dialog box for showing a password textfield. |  24 // A dialog box for showing a password textfield. | 
|  21 class WifiConfigView : public views::View, |  25 class WifiConfigView : public views::View, | 
|  22                        public views::Textfield::Controller, |  26                        public views::Textfield::Controller, | 
|  23                        public views::ButtonListener { |  27                        public views::ButtonListener, | 
 |  28                        public SelectFileDialog::Listener { | 
|  24  public: |  29  public: | 
|  25   WifiConfigView(NetworkConfigView* parent, WifiNetwork wifi); |  30   WifiConfigView(NetworkConfigView* parent, WifiNetwork wifi); | 
|  26   explicit WifiConfigView(NetworkConfigView* parent); |  31   explicit WifiConfigView(NetworkConfigView* parent); | 
|  27   virtual ~WifiConfigView() {} |  32   virtual ~WifiConfigView() {} | 
|  28  |  33  | 
|  29   // views::Textfield::Controller methods. |  34   // views::Textfield::Controller methods. | 
|  30   virtual void ContentsChanged(views::Textfield* sender, |  35   virtual void ContentsChanged(views::Textfield* sender, | 
|  31                                const string16& new_contents); |  36                                const string16& new_contents); | 
|  32   virtual bool HandleKeystroke(views::Textfield* sender, |  37   virtual bool HandleKeystroke(views::Textfield* sender, | 
|  33                                const views::Textfield::Keystroke& keystroke) { |  38                                const views::Textfield::Keystroke& keystroke) { | 
|  34     return false; |  39     return false; | 
|  35   } |  40   } | 
|  36  |  41  | 
|  37   // views::ButtonListener |  42   // views::ButtonListener | 
|  38   virtual void ButtonPressed(views::Button* sender, const views::Event& event); |  43   virtual void ButtonPressed(views::Button* sender, const views::Event& event); | 
|  39  |  44  | 
 |  45   // SelectFileDialog::Listener implementation. | 
 |  46   virtual void FileSelected(const FilePath& path, int index, void* params); | 
 |  47  | 
 |  48   virtual bool Accept(); | 
 |  49  | 
|  40   // Get the typed in ssid. |  50   // Get the typed in ssid. | 
|  41   const string16& GetSSID() const; |  51   const string16& GetSSID() const; | 
|  42   // Get the typed in passphrase. |  52   // Get the typed in passphrase. | 
|  43   const string16& GetPassphrase() const; |  53   const string16& GetPassphrase() const; | 
|  44  |  54  | 
|  45   // Returns true if the textfields are non-empty and we can login. |  55   // Returns true if the textfields are non-empty and we can login. | 
|  46   bool can_login() const { return can_login_; } |  56   bool can_login() const { return can_login_; } | 
|  47  |  57  | 
|  48   // Focus the first field in the UI. |  58   // Focus the first field in the UI. | 
|  49   void FocusFirstField(); |  59   void FocusFirstField(); | 
|  50  |  60  | 
|  51  private: |  61  private: | 
|  52   // Initializes UI. |  62   // Initializes UI. | 
|  53   void Init(); |  63   void Init(); | 
|  54  |  64  | 
 |  65   void UpdateCanLogin(); | 
 |  66  | 
|  55   NetworkConfigView* parent_; |  67   NetworkConfigView* parent_; | 
|  56  |  68  | 
|  57   bool other_network_; |  69   bool other_network_; | 
|  58  |  70  | 
|  59   // Whether or not we can log in. This gets recalculated when textfield |  71   // Whether or not we can log in. This gets recalculated when textfield | 
|  60   // contents change. |  72   // contents change. | 
|  61   bool can_login_; |  73   bool can_login_; | 
|  62  |  74  | 
|  63   WifiNetwork wifi_; |  75   WifiNetwork wifi_; | 
|  64  |  76  | 
|  65   views::Textfield* ssid_textfield_; |  77   views::Textfield* ssid_textfield_; | 
 |  78   views::Textfield* identity_textfield_; | 
 |  79   views::NativeButton* certificate_browse_button_; | 
 |  80   scoped_refptr<SelectFileDialog> select_file_dialog_; | 
 |  81   FilePath certificate_path_; | 
|  66   views::Textfield* passphrase_textfield_; |  82   views::Textfield* passphrase_textfield_; | 
 |  83   views::ImageButton* passphrase_visible_button_; | 
|  67  |  84  | 
|  68   DISALLOW_COPY_AND_ASSIGN(WifiConfigView); |  85   DISALLOW_COPY_AND_ASSIGN(WifiConfigView); | 
|  69 }; |  86 }; | 
|  70  |  87  | 
|  71 }  // namespace chromeos |  88 }  // namespace chromeos | 
|  72  |  89  | 
|  73 #endif  // CHROME_BROWSER_CHROMEOS_OPTIONS_WIFI_CONFIG_VIEW_H_ |  90 #endif  // CHROME_BROWSER_CHROMEOS_OPTIONS_WIFI_CONFIG_VIEW_H_ | 
| OLD | NEW |