| 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/wimax_config_view.h" | 5 #include "chrome/browser/chromeos/options/wimax_config_view.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
| 9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| 11 #include "chrome/browser/chromeos/enrollment_dialog_view.h" | 11 #include "chrome/browser/chromeos/enrollment_dialog_view.h" |
| 12 #include "chrome/browser/chromeos/login/startup_utils.h" | 12 #include "chrome/browser/chromeos/login/startup_utils.h" |
| 13 #include "chrome/browser/chromeos/net/onc_utils.h" | 13 #include "chrome/browser/chromeos/net/onc_utils.h" |
| 14 #include "chrome/browser/chromeos/net/shill_error.h" |
| 14 #include "chrome/browser/profiles/profile_manager.h" | 15 #include "chrome/browser/profiles/profile_manager.h" |
| 15 #include "chrome/grit/generated_resources.h" | 16 #include "chrome/grit/generated_resources.h" |
| 16 #include "chrome/grit/theme_resources.h" | 17 #include "chrome/grit/theme_resources.h" |
| 17 #include "chromeos/login/login_state.h" | 18 #include "chromeos/login/login_state.h" |
| 18 #include "chromeos/network/network_configuration_handler.h" | 19 #include "chromeos/network/network_configuration_handler.h" |
| 20 #include "chromeos/network/network_connect.h" |
| 19 #include "chromeos/network/network_event_log.h" | 21 #include "chromeos/network/network_event_log.h" |
| 20 #include "chromeos/network/network_profile.h" | 22 #include "chromeos/network/network_profile.h" |
| 21 #include "chromeos/network/network_profile_handler.h" | 23 #include "chromeos/network/network_profile_handler.h" |
| 22 #include "chromeos/network/network_state.h" | 24 #include "chromeos/network/network_state.h" |
| 23 #include "chromeos/network/network_state_handler.h" | 25 #include "chromeos/network/network_state_handler.h" |
| 24 #include "components/onc/onc_constants.h" | 26 #include "components/onc/onc_constants.h" |
| 25 #include "third_party/cros_system_api/dbus/service_constants.h" | 27 #include "third_party/cros_system_api/dbus/service_constants.h" |
| 26 #include "ui/base/l10n/l10n_util.h" | 28 #include "ui/base/l10n/l10n_util.h" |
| 27 #include "ui/base/resource/resource_bundle.h" | 29 #include "ui/base/resource/resource_bundle.h" |
| 28 #include "ui/chromeos/network/network_connect.h" | |
| 29 #include "ui/events/event.h" | 30 #include "ui/events/event.h" |
| 30 #include "ui/views/controls/button/checkbox.h" | 31 #include "ui/views/controls/button/checkbox.h" |
| 31 #include "ui/views/controls/button/image_button.h" | 32 #include "ui/views/controls/button/image_button.h" |
| 32 #include "ui/views/controls/label.h" | 33 #include "ui/views/controls/label.h" |
| 33 #include "ui/views/controls/textfield/textfield.h" | 34 #include "ui/views/controls/textfield/textfield.h" |
| 34 #include "ui/views/layout/grid_layout.h" | 35 #include "ui/views/layout/grid_layout.h" |
| 35 #include "ui/views/layout/layout_constants.h" | 36 #include "ui/views/layout/layout_constants.h" |
| 36 #include "ui/views/widget/widget.h" | 37 #include "ui/views/widget/widget.h" |
| 37 #include "ui/views/window/dialog_client_view.h" | 38 #include "ui/views/window/dialog_client_view.h" |
| 38 | 39 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 void WimaxConfigView::UpdateDialogButtons() { | 94 void WimaxConfigView::UpdateDialogButtons() { |
| 94 parent_->GetDialogClientView()->UpdateDialogButtons(); | 95 parent_->GetDialogClientView()->UpdateDialogButtons(); |
| 95 } | 96 } |
| 96 | 97 |
| 97 void WimaxConfigView::UpdateErrorLabel() { | 98 void WimaxConfigView::UpdateErrorLabel() { |
| 98 base::string16 error_msg; | 99 base::string16 error_msg; |
| 99 if (!service_path_.empty()) { | 100 if (!service_path_.empty()) { |
| 100 const NetworkState* wimax = NetworkHandler::Get()->network_state_handler()-> | 101 const NetworkState* wimax = NetworkHandler::Get()->network_state_handler()-> |
| 101 GetNetworkState(service_path_); | 102 GetNetworkState(service_path_); |
| 102 if (wimax && wimax->connection_state() == shill::kStateFailure) | 103 if (wimax && wimax->connection_state() == shill::kStateFailure) |
| 103 error_msg = ui::NetworkConnect::Get()->GetShillErrorString( | 104 error_msg = |
| 104 wimax->last_error(), wimax->path()); | 105 shill_error::GetShillErrorString(wimax->last_error(), wimax->guid()); |
| 105 } | 106 } |
| 106 if (!error_msg.empty()) { | 107 if (!error_msg.empty()) { |
| 107 error_label_->SetText(error_msg); | 108 error_label_->SetText(error_msg); |
| 108 error_label_->SetVisible(true); | 109 error_label_->SetVisible(true); |
| 109 } else { | 110 } else { |
| 110 error_label_->SetVisible(false); | 111 error_label_->SetVisible(false); |
| 111 } | 112 } |
| 112 } | 113 } |
| 113 | 114 |
| 114 void WimaxConfigView::ContentsChanged(views::Textfield* sender, | 115 void WimaxConfigView::ContentsChanged(views::Textfield* sender, |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 const bool share_default = true; | 162 const bool share_default = true; |
| 162 bool share_network = GetShareNetwork(share_default); | 163 bool share_network = GetShareNetwork(share_default); |
| 163 | 164 |
| 164 bool only_policy_autoconnect = | 165 bool only_policy_autoconnect = |
| 165 onc::PolicyAllowsOnlyPolicyNetworksToAutoconnect(!share_network); | 166 onc::PolicyAllowsOnlyPolicyNetworksToAutoconnect(!share_network); |
| 166 if (only_policy_autoconnect) { | 167 if (only_policy_autoconnect) { |
| 167 properties.SetBooleanWithoutPathExpansion(shill::kAutoConnectProperty, | 168 properties.SetBooleanWithoutPathExpansion(shill::kAutoConnectProperty, |
| 168 false); | 169 false); |
| 169 } | 170 } |
| 170 | 171 |
| 171 ui::NetworkConnect::Get()->ConfigureNetworkAndConnect( | 172 NetworkConnect::Get()->ConfigureNetworkAndConnect(service_path_, properties, |
| 172 service_path_, properties, share_network); | 173 share_network); |
| 173 return true; // dialog will be closed | 174 return true; // dialog will be closed |
| 174 } | 175 } |
| 175 | 176 |
| 176 std::string WimaxConfigView::GetEapIdentity() const { | 177 std::string WimaxConfigView::GetEapIdentity() const { |
| 177 DCHECK(identity_textfield_); | 178 DCHECK(identity_textfield_); |
| 178 return base::UTF16ToUTF8(identity_textfield_->text()); | 179 return base::UTF16ToUTF8(identity_textfield_->text()); |
| 179 } | 180 } |
| 180 | 181 |
| 181 std::string WimaxConfigView::GetEapPassphrase() const { | 182 std::string WimaxConfigView::GetEapPassphrase() const { |
| 182 return passphrase_textfield_ ? base::UTF16ToUTF8( | 183 return passphrase_textfield_ ? base::UTF16ToUTF8( |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 374 } | 375 } |
| 375 } | 376 } |
| 376 | 377 |
| 377 void WimaxConfigView::InitFocus() { | 378 void WimaxConfigView::InitFocus() { |
| 378 views::View* view_to_focus = GetInitiallyFocusedView(); | 379 views::View* view_to_focus = GetInitiallyFocusedView(); |
| 379 if (view_to_focus) | 380 if (view_to_focus) |
| 380 view_to_focus->RequestFocus(); | 381 view_to_focus->RequestFocus(); |
| 381 } | 382 } |
| 382 | 383 |
| 383 } // namespace chromeos | 384 } // namespace chromeos |
| OLD | NEW |