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" | |
28 #include "ui/views/layout/grid_layout.h" | 29 #include "ui/views/layout/grid_layout.h" |
29 #include "ui/views/layout/layout_constants.h" | 30 #include "ui/views/layout/layout_constants.h" |
30 #include "ui/views/widget/widget.h" | 31 #include "ui/views/widget/widget.h" |
31 | 32 |
32 namespace chromeos { | 33 namespace chromeos { |
33 | 34 |
34 namespace { | 35 namespace { |
35 | 36 |
36 // Returns true if network is known to require 802.1x. | 37 // Returns true if network is known to require 802.1x. |
37 bool Is8021x(const WifiNetwork* wifi) { | 38 bool Is8021x(const WifiNetwork* wifi) { |
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
370 shared_network_label_(NULL), | 371 shared_network_label_(NULL), |
371 security_combobox_(NULL), | 372 security_combobox_(NULL), |
372 passphrase_label_(NULL), | 373 passphrase_label_(NULL), |
373 passphrase_textfield_(NULL), | 374 passphrase_textfield_(NULL), |
374 passphrase_visible_button_(NULL), | 375 passphrase_visible_button_(NULL), |
375 error_label_(NULL) { | 376 error_label_(NULL) { |
376 Init(NULL, show_8021x); | 377 Init(NULL, show_8021x); |
377 } | 378 } |
378 | 379 |
379 WifiConfigView::~WifiConfigView() { | 380 WifiConfigView::~WifiConfigView() { |
381 views::FocusManager::set_shortcut_handling_suspended(false); | |
Daniel Erat
2012/09/27 22:24:30
the fact that FocusManager doesn't keep a count of
| |
380 if (cert_library_) | 382 if (cert_library_) |
381 cert_library_->RemoveObserver(this); | 383 cert_library_->RemoveObserver(this); |
382 } | 384 } |
383 | 385 |
384 views::View* WifiConfigView::GetInitiallyFocusedView() { | 386 views::View* WifiConfigView::GetInitiallyFocusedView() { |
385 // Return a reasonable widget for initial focus, | 387 // Return a reasonable widget for initial focus, |
386 // depending on what we're showing. | 388 // depending on what we're showing. |
387 if (ssid_textfield_) | 389 if (ssid_textfield_) |
388 return ssid_textfield_; | 390 return ssid_textfield_; |
389 else if (eap_method_combobox_) | 391 else if (eap_method_combobox_) |
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
873 ParseWiFiEAPUIProperty(&save_credentials_ui_data_, wifi, | 875 ParseWiFiEAPUIProperty(&save_credentials_ui_data_, wifi, |
874 onc::eap::kSaveCredentials); | 876 onc::eap::kSaveCredentials); |
875 if (show_8021x) | 877 if (show_8021x) |
876 ParseWiFiEAPUIProperty(&passphrase_ui_data_, wifi, onc::eap::kPassword); | 878 ParseWiFiEAPUIProperty(&passphrase_ui_data_, wifi, onc::eap::kPassword); |
877 else | 879 else |
878 ParseWiFiUIProperty(&passphrase_ui_data_, wifi, onc::wifi::kPassphrase); | 880 ParseWiFiUIProperty(&passphrase_ui_data_, wifi, onc::wifi::kPassphrase); |
879 } | 881 } |
880 | 882 |
881 views::GridLayout* layout = views::GridLayout::CreatePanel(this); | 883 views::GridLayout* layout = views::GridLayout::CreatePanel(this); |
882 SetLayoutManager(layout); | 884 SetLayoutManager(layout); |
885 views::FocusManager::set_shortcut_handling_suspended(true); | |
883 | 886 |
884 const int column_view_set_id = 0; | 887 const int column_view_set_id = 0; |
885 views::ColumnSet* column_set = layout->AddColumnSet(column_view_set_id); | 888 views::ColumnSet* column_set = layout->AddColumnSet(column_view_set_id); |
886 const int kPasswordVisibleWidth = 20; | 889 const int kPasswordVisibleWidth = 20; |
887 // Label | 890 // Label |
888 column_set->AddColumn(views::GridLayout::LEADING, views::GridLayout::FILL, 1, | 891 column_set->AddColumn(views::GridLayout::LEADING, views::GridLayout::FILL, 1, |
889 views::GridLayout::USE_PREF, 0, 0); | 892 views::GridLayout::USE_PREF, 0, 0); |
890 column_set->AddPaddingColumn(0, views::kRelatedControlSmallHorizontalSpacing); | 893 column_set->AddPaddingColumn(0, views::kRelatedControlSmallHorizontalSpacing); |
891 // Textfield, combobox. | 894 // Textfield, combobox. |
892 column_set->AddColumn(views::GridLayout::FILL, views::GridLayout::FILL, 1, | 895 column_set->AddColumn(views::GridLayout::FILL, views::GridLayout::FILL, 1, |
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1262 void WifiConfigView::ParseWiFiEAPUIProperty( | 1265 void WifiConfigView::ParseWiFiEAPUIProperty( |
1263 NetworkPropertyUIData* property_ui_data, | 1266 NetworkPropertyUIData* property_ui_data, |
1264 Network* network, | 1267 Network* network, |
1265 const std::string& key) { | 1268 const std::string& key) { |
1266 ParseWiFiUIProperty( | 1269 ParseWiFiUIProperty( |
1267 property_ui_data, network, | 1270 property_ui_data, network, |
1268 base::StringPrintf("%s.%s", onc::wifi::kEAP, key.c_str())); | 1271 base::StringPrintf("%s.%s", onc::wifi::kEAP, key.c_str())); |
1269 } | 1272 } |
1270 | 1273 |
1271 } // namespace chromeos | 1274 } // namespace chromeos |
OLD | NEW |