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

Side by Side Diff: chrome/browser/chromeos/options/vpn_config_view.cc

Issue 673713003: Create a NetworkConnect class and Delegate (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More virtual fixes Created 6 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
OLDNEW
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 "ash/system/chromeos/network/network_connect.h" 7 #include "ash/system/chromeos/network/network_connect.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 bool modifiable = false; 367 bool modifiable = false;
368 ChildNetworkConfigView::GetShareStateForLoginState(&shared, &modifiable); 368 ChildNetworkConfigView::GetShareStateForLoginState(&shared, &modifiable);
369 369
370 bool only_policy_autoconnect = 370 bool only_policy_autoconnect =
371 onc::PolicyAllowsOnlyPolicyNetworksToAutoconnect(!shared); 371 onc::PolicyAllowsOnlyPolicyNetworksToAutoconnect(!shared);
372 if (only_policy_autoconnect) { 372 if (only_policy_autoconnect) {
373 properties.SetBooleanWithoutPathExpansion(shill::kAutoConnectProperty, 373 properties.SetBooleanWithoutPathExpansion(shill::kAutoConnectProperty,
374 false); 374 false);
375 } 375 }
376 376
377 ash::network_connect::CreateConfigurationAndConnect(&properties, shared); 377 ash::NetworkConnect::Get()->CreateConfigurationAndConnect(&properties,
378 shared);
378 } else { 379 } else {
379 const NetworkState* vpn = NetworkHandler::Get()->network_state_handler()-> 380 const NetworkState* vpn = NetworkHandler::Get()->network_state_handler()->
380 GetNetworkState(service_path_); 381 GetNetworkState(service_path_);
381 if (!vpn) { 382 if (!vpn) {
382 // Shill no longer knows about this network (edge case). 383 // Shill no longer knows about this network (edge case).
383 // TODO(stevenjb): Add notification for this. 384 // TODO(stevenjb): Add notification for this.
384 NET_LOG_ERROR("Network not found", service_path_); 385 NET_LOG_ERROR("Network not found", service_path_);
385 return true; // Close dialog 386 return true; // Close dialog
386 } 387 }
387 base::DictionaryValue properties; 388 base::DictionaryValue properties;
388 SetConfigProperties(&properties); 389 SetConfigProperties(&properties);
389 ash::network_connect::ConfigureNetworkAndConnect( 390 ash::NetworkConnect::Get()->ConfigureNetworkAndConnect(
390 service_path_, properties, false /* not shared */); 391 service_path_, properties, false /* not shared */);
391 } 392 }
392 return true; // Close dialog. 393 return true; // Close dialog.
393 } 394 }
394 395
395 void VPNConfigView::Cancel() { 396 void VPNConfigView::Cancel() {
396 } 397 }
397 398
398 void VPNConfigView::InitFocus() { 399 void VPNConfigView::InitFocus() {
399 views::View* view_to_focus = GetInitiallyFocusedView(); 400 views::View* view_to_focus = GetInitiallyFocusedView();
(...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after
992 } else if (!IsUserCertValid()) { 993 } else if (!IsUserCertValid()) {
993 error_msg = l10n_util::GetStringUTF16( 994 error_msg = l10n_util::GetStringUTF16(
994 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_REQUIRE_HARDWARE_BACKED); 995 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_REQUIRE_HARDWARE_BACKED);
995 } 996 }
996 } 997 }
997 if (error_msg.empty() && !service_path_.empty()) { 998 if (error_msg.empty() && !service_path_.empty()) {
998 // TODO(kuan): differentiate between bad psk and user passphrases. 999 // TODO(kuan): differentiate between bad psk and user passphrases.
999 const NetworkState* vpn = NetworkHandler::Get()->network_state_handler()-> 1000 const NetworkState* vpn = NetworkHandler::Get()->network_state_handler()->
1000 GetNetworkState(service_path_); 1001 GetNetworkState(service_path_);
1001 if (vpn && vpn->connection_state() == shill::kStateFailure) 1002 if (vpn && vpn->connection_state() == shill::kStateFailure)
1002 error_msg = ash::network_connect::ErrorString( 1003 error_msg = ash::NetworkConnect::Get()->GetErrorString(
1003 vpn->last_error(), vpn->path()); 1004 vpn->last_error(), vpn->path());
1004 } 1005 }
1005 if (!error_msg.empty()) { 1006 if (!error_msg.empty()) {
1006 error_label_->SetText(error_msg); 1007 error_label_->SetText(error_msg);
1007 error_label_->SetVisible(true); 1008 error_label_->SetVisible(true);
1008 } else { 1009 } else {
1009 error_label_->SetVisible(false); 1010 error_label_->SetVisible(false);
1010 } 1011 }
1011 } 1012 }
1012 1013
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
1064 property_ui_data->ParseOncProperty( 1065 property_ui_data->ParseOncProperty(
1065 onc_source, 1066 onc_source,
1066 onc, 1067 onc,
1067 base::StringPrintf("%s.%s.%s", 1068 base::StringPrintf("%s.%s.%s",
1068 ::onc::network_config::kVPN, 1069 ::onc::network_config::kVPN,
1069 dict_key.c_str(), 1070 dict_key.c_str(),
1070 key.c_str())); 1071 key.c_str()));
1071 } 1072 }
1072 1073
1073 } // namespace chromeos 1074 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/mobile/mobile_activator.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