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 #include "chrome/browser/chromeos/options/wifi_config_view.h" | 5 #include "chrome/browser/chromeos/options/wifi_config_view.h" |
6 | 6 |
7 #include "base/string_util.h" | 7 #include "base/string_util.h" |
8 #include "base/stringprintf.h" | 8 #include "base/stringprintf.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "chrome/browser/chromeos/cros/cros_library.h" | 10 #include "chrome/browser/chromeos/cros/cros_library.h" |
11 #include "chrome/browser/chromeos/cros/network_library.h" | 11 #include "chrome/browser/chromeos/cros/network_library.h" |
12 #include "chrome/browser/chromeos/cros/onc_constants.h" | 12 #include "chrome/browser/chromeos/cros/onc_constants.h" |
13 #include "chrome/browser/chromeos/enrollment_dialog_view.h" | 13 #include "chrome/browser/chromeos/enrollment_dialog_view.h" |
14 #include "chrome/browser/chromeos/login/user_manager.h" | 14 #include "chrome/browser/chromeos/login/user_manager.h" |
15 #include "chrome/browser/profiles/profile_manager.h" | 15 #include "chrome/browser/profiles/profile_manager.h" |
16 #include "grit/chromium_strings.h" | 16 #include "grit/chromium_strings.h" |
17 #include "grit/generated_resources.h" | 17 #include "grit/generated_resources.h" |
18 #include "grit/locale_settings.h" | 18 #include "grit/locale_settings.h" |
19 #include "grit/theme_resources.h" | 19 #include "grit/theme_resources.h" |
20 #include "ui/base/events/event.h" | 20 #include "ui/base/events/event.h" |
21 #include "ui/base/l10n/l10n_util.h" | 21 #include "ui/base/l10n/l10n_util.h" |
22 #include "ui/base/resource/resource_bundle.h" | 22 #include "ui/base/resource/resource_bundle.h" |
23 #include "ui/views/controls/button/checkbox.h" | 23 #include "ui/views/controls/button/checkbox.h" |
24 #include "ui/views/controls/button/image_button.h" | 24 #include "ui/views/controls/button/image_button.h" |
25 #include "ui/views/controls/combobox/combobox.h" | 25 #include "ui/views/controls/combobox/combobox.h" |
26 #include "ui/views/controls/label.h" | 26 #include "ui/views/controls/label.h" |
27 #include "ui/views/controls/textfield/textfield.h" | 27 #include "ui/views/controls/textfield/textfield.h" |
28 #include "ui/views/focus/focus_manager.h" | |
29 #include "ui/views/layout/grid_layout.h" | 28 #include "ui/views/layout/grid_layout.h" |
30 #include "ui/views/layout/layout_constants.h" | 29 #include "ui/views/layout/layout_constants.h" |
31 #include "ui/views/widget/widget.h" | 30 #include "ui/views/widget/widget.h" |
32 | 31 |
33 namespace chromeos { | 32 namespace chromeos { |
34 | 33 |
35 namespace { | 34 namespace { |
36 | 35 |
37 // Returns true if network is known to require 802.1x. | 36 // Returns true if network is known to require 802.1x. |
38 bool Is8021x(const WifiNetwork* wifi) { | 37 bool Is8021x(const WifiNetwork* wifi) { |
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 shared_network_label_(NULL), | 370 shared_network_label_(NULL), |
372 security_combobox_(NULL), | 371 security_combobox_(NULL), |
373 passphrase_label_(NULL), | 372 passphrase_label_(NULL), |
374 passphrase_textfield_(NULL), | 373 passphrase_textfield_(NULL), |
375 passphrase_visible_button_(NULL), | 374 passphrase_visible_button_(NULL), |
376 error_label_(NULL) { | 375 error_label_(NULL) { |
377 Init(NULL, show_8021x); | 376 Init(NULL, show_8021x); |
378 } | 377 } |
379 | 378 |
380 WifiConfigView::~WifiConfigView() { | 379 WifiConfigView::~WifiConfigView() { |
381 views::FocusManager::set_shortcut_handling_suspended(false); | |
382 if (cert_library_) | 380 if (cert_library_) |
383 cert_library_->RemoveObserver(this); | 381 cert_library_->RemoveObserver(this); |
384 } | 382 } |
385 | 383 |
386 views::View* WifiConfigView::GetInitiallyFocusedView() { | 384 views::View* WifiConfigView::GetInitiallyFocusedView() { |
387 // Return a reasonable widget for initial focus, | 385 // Return a reasonable widget for initial focus, |
388 // depending on what we're showing. | 386 // depending on what we're showing. |
389 if (ssid_textfield_) | 387 if (ssid_textfield_) |
390 return ssid_textfield_; | 388 return ssid_textfield_; |
391 else if (eap_method_combobox_) | 389 else if (eap_method_combobox_) |
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
875 ParseWiFiEAPUIProperty(&save_credentials_ui_data_, wifi, | 873 ParseWiFiEAPUIProperty(&save_credentials_ui_data_, wifi, |
876 onc::eap::kSaveCredentials); | 874 onc::eap::kSaveCredentials); |
877 if (show_8021x) | 875 if (show_8021x) |
878 ParseWiFiEAPUIProperty(&passphrase_ui_data_, wifi, onc::eap::kPassword); | 876 ParseWiFiEAPUIProperty(&passphrase_ui_data_, wifi, onc::eap::kPassword); |
879 else | 877 else |
880 ParseWiFiUIProperty(&passphrase_ui_data_, wifi, onc::wifi::kPassphrase); | 878 ParseWiFiUIProperty(&passphrase_ui_data_, wifi, onc::wifi::kPassphrase); |
881 } | 879 } |
882 | 880 |
883 views::GridLayout* layout = views::GridLayout::CreatePanel(this); | 881 views::GridLayout* layout = views::GridLayout::CreatePanel(this); |
884 SetLayoutManager(layout); | 882 SetLayoutManager(layout); |
885 views::FocusManager::set_shortcut_handling_suspended(true); | |
886 | 883 |
887 const int column_view_set_id = 0; | 884 const int column_view_set_id = 0; |
888 views::ColumnSet* column_set = layout->AddColumnSet(column_view_set_id); | 885 views::ColumnSet* column_set = layout->AddColumnSet(column_view_set_id); |
889 const int kPasswordVisibleWidth = 20; | 886 const int kPasswordVisibleWidth = 20; |
890 // Label | 887 // Label |
891 column_set->AddColumn(views::GridLayout::LEADING, views::GridLayout::FILL, 1, | 888 column_set->AddColumn(views::GridLayout::LEADING, views::GridLayout::FILL, 1, |
892 views::GridLayout::USE_PREF, 0, 0); | 889 views::GridLayout::USE_PREF, 0, 0); |
893 column_set->AddPaddingColumn(0, views::kRelatedControlSmallHorizontalSpacing); | 890 column_set->AddPaddingColumn(0, views::kRelatedControlSmallHorizontalSpacing); |
894 // Textfield, combobox. | 891 // Textfield, combobox. |
895 column_set->AddColumn(views::GridLayout::FILL, views::GridLayout::FILL, 1, | 892 column_set->AddColumn(views::GridLayout::FILL, views::GridLayout::FILL, 1, |
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1265 void WifiConfigView::ParseWiFiEAPUIProperty( | 1262 void WifiConfigView::ParseWiFiEAPUIProperty( |
1266 NetworkPropertyUIData* property_ui_data, | 1263 NetworkPropertyUIData* property_ui_data, |
1267 Network* network, | 1264 Network* network, |
1268 const std::string& key) { | 1265 const std::string& key) { |
1269 ParseWiFiUIProperty( | 1266 ParseWiFiUIProperty( |
1270 property_ui_data, network, | 1267 property_ui_data, network, |
1271 base::StringPrintf("%s.%s", onc::wifi::kEAP, key.c_str())); | 1268 base::StringPrintf("%s.%s", onc::wifi::kEAP, key.c_str())); |
1272 } | 1269 } |
1273 | 1270 |
1274 } // namespace chromeos | 1271 } // namespace chromeos |
OLD | NEW |