Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(72)

Side by Side Diff: chrome/browser/chromeos/options/wifi_config_view.h

Issue 4237001: Add support for different type of encyrption when adding a network.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
11 #include "app/combobox_model.h"
11 #include "base/gtest_prod_util.h" 12 #include "base/gtest_prod_util.h"
12 #include "base/string16.h" 13 #include "base/string16.h"
13 #include "chrome/browser/chromeos/cros/network_library.h" 14 #include "chrome/browser/chromeos/cros/network_library.h"
14 #include "chrome/browser/shell_dialogs.h" 15 #include "chrome/browser/shell_dialogs.h"
15 #include "views/controls/button/button.h" 16 #include "views/controls/button/button.h"
16 #include "views/controls/button/checkbox.h" 17 #include "views/controls/button/checkbox.h"
17 #include "views/controls/button/image_button.h" 18 #include "views/controls/button/image_button.h"
18 #include "views/controls/button/native_button.h" 19 #include "views/controls/button/native_button.h"
20 #include "views/controls/combobox/combobox.h"
19 #include "views/controls/textfield/textfield.h" 21 #include "views/controls/textfield/textfield.h"
20 #include "views/view.h" 22 #include "views/view.h"
21 23
22 class FilePath; 24 class FilePath;
23 25
24 namespace chromeos { 26 namespace chromeos {
25 27
26 class NetworkConfigView; 28 class NetworkConfigView;
27 29
28 // A dialog box for showing a password textfield. 30 // A dialog box for showing a password textfield.
29 class WifiConfigView : public views::View, 31 class WifiConfigView : public views::View,
30 public views::Textfield::Controller, 32 public views::Textfield::Controller,
31 public views::ButtonListener, 33 public views::ButtonListener,
34 public views::Combobox::Listener,
32 public SelectFileDialog::Listener { 35 public SelectFileDialog::Listener {
33 public: 36 public:
34 WifiConfigView(NetworkConfigView* parent, const WifiNetwork* wifi); 37 WifiConfigView(NetworkConfigView* parent, const WifiNetwork* wifi);
35 explicit WifiConfigView(NetworkConfigView* parent); 38 explicit WifiConfigView(NetworkConfigView* parent);
36 virtual ~WifiConfigView(); 39 virtual ~WifiConfigView();
37 40
38 // views::Textfield::Controller methods. 41 // views::Textfield::Controller methods.
39 virtual void ContentsChanged(views::Textfield* sender, 42 virtual void ContentsChanged(views::Textfield* sender,
40 const string16& new_contents); 43 const string16& new_contents);
41 virtual bool HandleKeystroke(views::Textfield* sender, 44 virtual bool HandleKeystroke(views::Textfield* sender,
42 const views::Textfield::Keystroke& keystroke); 45 const views::Textfield::Keystroke& keystroke);
43 46
44 // views::ButtonListener 47 // views::ButtonListener
45 virtual void ButtonPressed(views::Button* sender, const views::Event& event); 48 virtual void ButtonPressed(views::Button* sender, const views::Event& event);
46 49
50 // views::Combobox::Listener
51 virtual void ItemChanged(views::Combobox* combo_box,
52 int prev_index, int new_index);
53
47 // SelectFileDialog::Listener implementation. 54 // SelectFileDialog::Listener implementation.
48 virtual void FileSelected(const FilePath& path, int index, void* params); 55 virtual void FileSelected(const FilePath& path, int index, void* params);
49 56
50 // Login to network. 57 // Login to network.
51 virtual bool Login(); 58 virtual bool Login();
52 59
53 // Save network information. 60 // Save network information.
54 virtual bool Save(); 61 virtual bool Save();
55 62
56 // Get the typed in ssid. 63 // Get the typed in ssid.
57 const std::string GetSSID() const; 64 const std::string GetSSID() const;
58 // Get the typed in passphrase. 65 // Get the typed in passphrase.
59 const std::string GetPassphrase() const; 66 const std::string GetPassphrase() const;
60 67
61 // Returns true if the textfields are non-empty and we can login. 68 // Returns true if the textfields are non-empty and we can login.
62 bool can_login() const { return can_login_; } 69 bool can_login() const { return can_login_; }
63 70
64 // Focus the first field in the UI. 71 // Focus the first field in the UI.
65 void FocusFirstField(); 72 void FocusFirstField();
66 73
67 private: 74 private:
68 FRIEND_TEST_ALL_PREFIXES(WifiConfigViewTest, NoChangeSaveTest); 75 FRIEND_TEST_ALL_PREFIXES(WifiConfigViewTest, NoChangeSaveTest);
69 FRIEND_TEST_ALL_PREFIXES(WifiConfigViewTest, ChangeAutoConnectSaveTest); 76 FRIEND_TEST_ALL_PREFIXES(WifiConfigViewTest, ChangeAutoConnectSaveTest);
70 FRIEND_TEST_ALL_PREFIXES(WifiConfigViewTest, ChangePasswordSaveTest); 77 FRIEND_TEST_ALL_PREFIXES(WifiConfigViewTest, ChangePasswordSaveTest);
71 78
79 class SecurityComboboxModel : public ComboboxModel {
80 public:
81 SecurityComboboxModel() {}
82 virtual ~SecurityComboboxModel() {}
83 virtual int GetItemCount();
84 virtual string16 GetItemAt(int index);
85 private:
86 DISALLOW_COPY_AND_ASSIGN(SecurityComboboxModel);
87 };
88
72 // Initializes UI. 89 // Initializes UI.
73 void Init(); 90 void Init();
74 91
75 // Updates state of the Login button. 92 // Updates state of the Login button.
76 void UpdateCanLogin(); 93 void UpdateCanLogin();
77 94
78 // Updates state of the "view password" button. 95 // Updates state of the "view password" button.
79 void UpdateCanViewPassword(); 96 void UpdateCanViewPassword();
80 97
81 NetworkConfigView* parent_; 98 NetworkConfigView* parent_;
82 99
83 bool other_network_; 100 bool other_network_;
84 101
85 // Whether or not we can log in. This gets recalculated when textfield 102 // Whether or not we can log in. This gets recalculated when textfield
86 // contents change. 103 // contents change.
87 bool can_login_; 104 bool can_login_;
88 105
89 scoped_ptr<WifiNetwork> wifi_; 106 scoped_ptr<WifiNetwork> wifi_;
90 107
91 views::Textfield* ssid_textfield_; 108 views::Textfield* ssid_textfield_;
92 views::Textfield* identity_textfield_; 109 views::Textfield* identity_textfield_;
93 views::NativeButton* certificate_browse_button_; 110 views::NativeButton* certificate_browse_button_;
94 scoped_refptr<SelectFileDialog> select_file_dialog_; 111 scoped_refptr<SelectFileDialog> select_file_dialog_;
95 std::string certificate_path_; 112 std::string certificate_path_;
113 views::Combobox* security_combobox_;
96 views::Textfield* passphrase_textfield_; 114 views::Textfield* passphrase_textfield_;
97 views::ImageButton* passphrase_visible_button_; 115 views::ImageButton* passphrase_visible_button_;
98 views::Checkbox* autoconnect_checkbox_; 116 views::Checkbox* autoconnect_checkbox_;
99 117
100 DISALLOW_COPY_AND_ASSIGN(WifiConfigView); 118 DISALLOW_COPY_AND_ASSIGN(WifiConfigView);
101 }; 119 };
102 120
103 } // namespace chromeos 121 } // namespace chromeos
104 122
105 #endif // CHROME_BROWSER_CHROMEOS_OPTIONS_WIFI_CONFIG_VIEW_H_ 123 #endif // CHROME_BROWSER_CHROMEOS_OPTIONS_WIFI_CONFIG_VIEW_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/dom_ui/internet_options_handler.cc ('k') | chrome/browser/chromeos/options/wifi_config_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698