| 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 "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" |
| (...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 396 | 396 |
| 397 void VPNConfigView::Cancel() { | 397 void VPNConfigView::Cancel() { |
| 398 } | 398 } |
| 399 | 399 |
| 400 void VPNConfigView::InitFocus() { | 400 void VPNConfigView::InitFocus() { |
| 401 views::View* view_to_focus = GetInitiallyFocusedView(); | 401 views::View* view_to_focus = GetInitiallyFocusedView(); |
| 402 if (view_to_focus) | 402 if (view_to_focus) |
| 403 view_to_focus->RequestFocus(); | 403 view_to_focus->RequestFocus(); |
| 404 } | 404 } |
| 405 | 405 |
| 406 const std::string VPNConfigView::GetService() const { | 406 std::string VPNConfigView::GetService() const { |
| 407 if (service_textfield_ != NULL) | 407 if (service_textfield_ != NULL) |
| 408 return GetTextFromField(service_textfield_, true); | 408 return GetTextFromField(service_textfield_, true); |
| 409 return service_path_; | 409 return service_path_; |
| 410 } | 410 } |
| 411 | 411 |
| 412 const std::string VPNConfigView::GetServer() const { | 412 std::string VPNConfigView::GetServer() const { |
| 413 if (server_textfield_ != NULL) | 413 if (server_textfield_ != NULL) |
| 414 return GetTextFromField(server_textfield_, true); | 414 return GetTextFromField(server_textfield_, true); |
| 415 return std::string(); | 415 return std::string(); |
| 416 } | 416 } |
| 417 | 417 |
| 418 const std::string VPNConfigView::GetPSKPassphrase() const { | 418 std::string VPNConfigView::GetPSKPassphrase() const { |
| 419 if (psk_passphrase_textfield_ && | 419 if (psk_passphrase_textfield_ && |
| 420 enable_psk_passphrase_ && | 420 enable_psk_passphrase_ && |
| 421 psk_passphrase_textfield_->visible()) | 421 psk_passphrase_textfield_->visible()) |
| 422 return GetPassphraseFromField(psk_passphrase_textfield_); | 422 return GetPassphraseFromField(psk_passphrase_textfield_); |
| 423 return std::string(); | 423 return std::string(); |
| 424 } | 424 } |
| 425 | 425 |
| 426 const std::string VPNConfigView::GetUsername() const { | 426 std::string VPNConfigView::GetUsername() const { |
| 427 return GetTextFromField(username_textfield_, true); | 427 return GetTextFromField(username_textfield_, true); |
| 428 } | 428 } |
| 429 | 429 |
| 430 const std::string VPNConfigView::GetUserPassphrase() const { | 430 std::string VPNConfigView::GetUserPassphrase() const { |
| 431 return GetPassphraseFromField(user_passphrase_textfield_); | 431 return GetPassphraseFromField(user_passphrase_textfield_); |
| 432 } | 432 } |
| 433 | 433 |
| 434 const std::string VPNConfigView::GetGroupName() const { | 434 std::string VPNConfigView::GetGroupName() const { |
| 435 return GetTextFromField(group_name_textfield_, false); | 435 return GetTextFromField(group_name_textfield_, false); |
| 436 } | 436 } |
| 437 | 437 |
| 438 const std::string VPNConfigView::GetOTP() const { | 438 std::string VPNConfigView::GetOTP() const { |
| 439 return GetTextFromField(otp_textfield_, true); | 439 return GetTextFromField(otp_textfield_, true); |
| 440 } | 440 } |
| 441 | 441 |
| 442 const std::string VPNConfigView::GetServerCACertPEM() const { | 442 std::string VPNConfigView::GetServerCACertPEM() const { |
| 443 int index = server_ca_cert_combobox_ ? | 443 int index = server_ca_cert_combobox_ ? |
| 444 server_ca_cert_combobox_->selected_index() : 0; | 444 server_ca_cert_combobox_->selected_index() : 0; |
| 445 if (index == 0) { | 445 if (index == 0) { |
| 446 // First item is "Default". | 446 // First item is "Default". |
| 447 return std::string(); | 447 return std::string(); |
| 448 } else { | 448 } else { |
| 449 int cert_index = index - 1; | 449 int cert_index = index - 1; |
| 450 return CertLibrary::Get()->GetServerCACertPEMAt(cert_index); | 450 return CertLibrary::Get()->GetServerCACertPEMAt(cert_index); |
| 451 } | 451 } |
| 452 } | 452 } |
| (...skipping 612 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1065 property_ui_data->ParseOncProperty( | 1065 property_ui_data->ParseOncProperty( |
| 1066 onc_source, | 1066 onc_source, |
| 1067 onc, | 1067 onc, |
| 1068 base::StringPrintf("%s.%s.%s", | 1068 base::StringPrintf("%s.%s.%s", |
| 1069 ::onc::network_config::kVPN, | 1069 ::onc::network_config::kVPN, |
| 1070 dict_key.c_str(), | 1070 dict_key.c_str(), |
| 1071 key.c_str())); | 1071 key.c_str())); |
| 1072 } | 1072 } |
| 1073 | 1073 |
| 1074 } // namespace chromeos | 1074 } // namespace chromeos |
| OLD | NEW |