Chromium Code Reviews| 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/vpn_config_view.h" | 5 #include "chrome/browser/chromeos/options/vpn_config_view.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/strings/string_util.h" | 11 #include "base/strings/string_util.h" |
| 12 #include "base/strings/stringprintf.h" | 12 #include "base/strings/stringprintf.h" |
| 13 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
| 14 #include "chrome/browser/chromeos/enrollment_dialog_view.h" | 14 #include "chrome/browser/chromeos/enrollment_dialog_view.h" |
| 15 #include "chrome/browser/chromeos/net/onc_utils.h" | 15 #include "chrome/browser/chromeos/net/onc_utils.h" |
| 16 #include "chrome/browser/chromeos/net/shill_error.h" | |
| 16 #include "chrome/browser/profiles/profile_manager.h" | 17 #include "chrome/browser/profiles/profile_manager.h" |
| 17 #include "chrome/common/net/x509_certificate_model.h" | 18 #include "chrome/common/net/x509_certificate_model.h" |
| 18 #include "chrome/grit/generated_resources.h" | 19 #include "chrome/grit/generated_resources.h" |
| 19 #include "chromeos/login/login_state.h" | 20 #include "chromeos/login/login_state.h" |
| 20 #include "chromeos/network/network_configuration_handler.h" | 21 #include "chromeos/network/network_configuration_handler.h" |
| 22 #include "chromeos/network/network_connect.h" | |
| 21 #include "chromeos/network/network_event_log.h" | 23 #include "chromeos/network/network_event_log.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 "chromeos/network/network_ui_data.h" | 26 #include "chromeos/network/network_ui_data.h" |
| 25 #include "components/onc/onc_constants.h" | 27 #include "components/onc/onc_constants.h" |
| 26 #include "third_party/cros_system_api/dbus/service_constants.h" | 28 #include "third_party/cros_system_api/dbus/service_constants.h" |
| 27 #include "ui/base/l10n/l10n_util.h" | 29 #include "ui/base/l10n/l10n_util.h" |
| 28 #include "ui/base/models/combobox_model.h" | 30 #include "ui/base/models/combobox_model.h" |
| 29 #include "ui/chromeos/network/network_connect.h" | |
| 30 #include "ui/events/event.h" | 31 #include "ui/events/event.h" |
| 31 #include "ui/views/controls/button/checkbox.h" | 32 #include "ui/views/controls/button/checkbox.h" |
| 32 #include "ui/views/controls/combobox/combobox.h" | 33 #include "ui/views/controls/combobox/combobox.h" |
| 33 #include "ui/views/controls/label.h" | 34 #include "ui/views/controls/label.h" |
| 34 #include "ui/views/controls/textfield/textfield.h" | 35 #include "ui/views/controls/textfield/textfield.h" |
| 35 #include "ui/views/layout/grid_layout.h" | 36 #include "ui/views/layout/grid_layout.h" |
| 36 #include "ui/views/layout/layout_constants.h" | 37 #include "ui/views/layout/layout_constants.h" |
| 37 #include "ui/views/widget/widget.h" | 38 #include "ui/views/widget/widget.h" |
| 38 #include "ui/views/window/dialog_client_view.h" | 39 #include "ui/views/window/dialog_client_view.h" |
| 39 | 40 |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 372 bool modifiable = false; | 373 bool modifiable = false; |
| 373 ChildNetworkConfigView::GetShareStateForLoginState(&shared, &modifiable); | 374 ChildNetworkConfigView::GetShareStateForLoginState(&shared, &modifiable); |
| 374 | 375 |
| 375 bool only_policy_autoconnect = | 376 bool only_policy_autoconnect = |
| 376 onc::PolicyAllowsOnlyPolicyNetworksToAutoconnect(!shared); | 377 onc::PolicyAllowsOnlyPolicyNetworksToAutoconnect(!shared); |
| 377 if (only_policy_autoconnect) { | 378 if (only_policy_autoconnect) { |
| 378 properties.SetBooleanWithoutPathExpansion(shill::kAutoConnectProperty, | 379 properties.SetBooleanWithoutPathExpansion(shill::kAutoConnectProperty, |
| 379 false); | 380 false); |
| 380 } | 381 } |
| 381 | 382 |
| 382 ui::NetworkConnect::Get()->CreateConfigurationAndConnect(&properties, | 383 chromeos::NetworkConnect::Get()->CreateConfigurationAndConnect(&properties, |
|
James Cook
2016/10/20 00:11:43
chromeos:: not needed (and probably in many other
stevenjb
2016/10/20 00:57:23
Fixed throughout.
| |
| 383 shared); | 384 shared); |
| 384 } else { | 385 } else { |
| 385 const NetworkState* vpn = NetworkHandler::Get()->network_state_handler()-> | 386 const NetworkState* vpn = NetworkHandler::Get()->network_state_handler()-> |
| 386 GetNetworkState(service_path_); | 387 GetNetworkState(service_path_); |
| 387 if (!vpn) { | 388 if (!vpn) { |
| 388 // Shill no longer knows about this network (edge case). | 389 // Shill no longer knows about this network (edge case). |
| 389 // TODO(stevenjb): Add notification for this. | 390 // TODO(stevenjb): Add notification for this. |
| 390 NET_LOG_ERROR("Network not found", service_path_); | 391 NET_LOG_ERROR("Network not found", service_path_); |
| 391 return true; // Close dialog | 392 return true; // Close dialog |
| 392 } | 393 } |
| 393 base::DictionaryValue properties; | 394 base::DictionaryValue properties; |
| 394 SetConfigProperties(&properties); | 395 SetConfigProperties(&properties); |
| 395 ui::NetworkConnect::Get()->ConfigureNetworkAndConnect( | 396 chromeos::NetworkConnect::Get()->ConfigureNetworkAndConnect( |
| 396 service_path_, properties, false /* not shared */); | 397 service_path_, properties, false /* not shared */); |
| 397 } | 398 } |
| 398 return true; // Close dialog. | 399 return true; // Close dialog. |
| 399 } | 400 } |
| 400 | 401 |
| 401 void VPNConfigView::Cancel() { | 402 void VPNConfigView::Cancel() { |
| 402 } | 403 } |
| 403 | 404 |
| 404 void VPNConfigView::InitFocus() { | 405 void VPNConfigView::InitFocus() { |
| 405 views::View* view_to_focus = GetInitiallyFocusedView(); | 406 views::View* view_to_focus = GetInitiallyFocusedView(); |
| (...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 997 } else if (!IsUserCertValid()) { | 998 } else if (!IsUserCertValid()) { |
| 998 error_msg = l10n_util::GetStringUTF16( | 999 error_msg = l10n_util::GetStringUTF16( |
| 999 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_REQUIRE_HARDWARE_BACKED); | 1000 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_REQUIRE_HARDWARE_BACKED); |
| 1000 } | 1001 } |
| 1001 } | 1002 } |
| 1002 if (error_msg.empty() && !service_path_.empty()) { | 1003 if (error_msg.empty() && !service_path_.empty()) { |
| 1003 // TODO(kuan): differentiate between bad psk and user passphrases. | 1004 // TODO(kuan): differentiate between bad psk and user passphrases. |
| 1004 const NetworkState* vpn = NetworkHandler::Get()->network_state_handler()-> | 1005 const NetworkState* vpn = NetworkHandler::Get()->network_state_handler()-> |
| 1005 GetNetworkState(service_path_); | 1006 GetNetworkState(service_path_); |
| 1006 if (vpn && vpn->connection_state() == shill::kStateFailure) | 1007 if (vpn && vpn->connection_state() == shill::kStateFailure) |
| 1007 error_msg = ui::NetworkConnect::Get()->GetShillErrorString( | 1008 error_msg = |
| 1008 vpn->last_error(), vpn->path()); | 1009 shill_error::GetShillErrorString(vpn->last_error(), vpn->guid()); |
| 1009 } | 1010 } |
| 1010 if (!error_msg.empty()) { | 1011 if (!error_msg.empty()) { |
| 1011 error_label_->SetText(error_msg); | 1012 error_label_->SetText(error_msg); |
| 1012 error_label_->SetVisible(true); | 1013 error_label_->SetVisible(true); |
| 1013 } else { | 1014 } else { |
| 1014 error_label_->SetVisible(false); | 1015 error_label_->SetVisible(false); |
| 1015 } | 1016 } |
| 1016 } | 1017 } |
| 1017 | 1018 |
| 1018 void VPNConfigView::UpdateCanLogin() { | 1019 void VPNConfigView::UpdateCanLogin() { |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1069 property_ui_data->ParseOncProperty( | 1070 property_ui_data->ParseOncProperty( |
| 1070 onc_source, | 1071 onc_source, |
| 1071 onc, | 1072 onc, |
| 1072 base::StringPrintf("%s.%s.%s", | 1073 base::StringPrintf("%s.%s.%s", |
| 1073 ::onc::network_config::kVPN, | 1074 ::onc::network_config::kVPN, |
| 1074 dict_key.c_str(), | 1075 dict_key.c_str(), |
| 1075 key.c_str())); | 1076 key.c_str())); |
| 1076 } | 1077 } |
| 1077 | 1078 |
| 1078 } // namespace chromeos | 1079 } // namespace chromeos |
| OLD | NEW |