| 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 "ash/system/chromeos/network/network_connect.h" | 7 #include "ash/system/chromeos/network/network_connect.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 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 return false; | 307 return false; |
| 308 | 308 |
| 309 return true; | 309 return true; |
| 310 } | 310 } |
| 311 | 311 |
| 312 void VPNConfigView::ContentsChanged(views::Textfield* sender, | 312 void VPNConfigView::ContentsChanged(views::Textfield* sender, |
| 313 const base::string16& new_contents) { | 313 const base::string16& new_contents) { |
| 314 if (sender == server_textfield_ && !service_text_modified_) { | 314 if (sender == server_textfield_ && !service_text_modified_) { |
| 315 // Set the service name to the server name up to '.', unless it has | 315 // Set the service name to the server name up to '.', unless it has |
| 316 // been explicitly set by the user. | 316 // been explicitly set by the user. |
| 317 base::string16 server = server_textfield_->text(); | 317 base::string16 server = server_textfield_->GetText(); |
| 318 base::string16::size_type n = server.find_first_of(L'.'); | 318 base::string16::size_type n = server.find_first_of(L'.'); |
| 319 service_name_from_server_ = server.substr(0, n); | 319 service_name_from_server_ = server.substr(0, n); |
| 320 service_textfield_->SetText(service_name_from_server_); | 320 service_textfield_->SetText(service_name_from_server_); |
| 321 } | 321 } |
| 322 if (sender == service_textfield_) { | 322 if (sender == service_textfield_) { |
| 323 if (new_contents.empty()) | 323 if (new_contents.empty()) |
| 324 service_text_modified_ = false; | 324 service_text_modified_ = false; |
| 325 else if (new_contents != service_name_from_server_) | 325 else if (new_contents != service_name_from_server_) |
| 326 service_text_modified_ = true; | 326 service_text_modified_ = true; |
| 327 } | 327 } |
| (...skipping 689 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1017 !CertLibrary::Get()->IsCertHardwareBackedAt( | 1017 !CertLibrary::Get()->IsCertHardwareBackedAt( |
| 1018 CertLibrary::CERT_TYPE_USER, index)) | 1018 CertLibrary::CERT_TYPE_USER, index)) |
| 1019 return false; | 1019 return false; |
| 1020 return true; | 1020 return true; |
| 1021 } | 1021 } |
| 1022 | 1022 |
| 1023 const std::string VPNConfigView::GetTextFromField(views::Textfield* textfield, | 1023 const std::string VPNConfigView::GetTextFromField(views::Textfield* textfield, |
| 1024 bool trim_whitespace) const { | 1024 bool trim_whitespace) const { |
| 1025 if (!textfield) | 1025 if (!textfield) |
| 1026 return std::string(); | 1026 return std::string(); |
| 1027 std::string untrimmed = base::UTF16ToUTF8(textfield->text()); | 1027 std::string untrimmed = base::UTF16ToUTF8(textfield->GetText()); |
| 1028 if (!trim_whitespace) | 1028 if (!trim_whitespace) |
| 1029 return untrimmed; | 1029 return untrimmed; |
| 1030 std::string result; | 1030 std::string result; |
| 1031 TrimWhitespaceASCII(untrimmed, TRIM_ALL, &result); | 1031 TrimWhitespaceASCII(untrimmed, TRIM_ALL, &result); |
| 1032 return result; | 1032 return result; |
| 1033 } | 1033 } |
| 1034 | 1034 |
| 1035 const std::string VPNConfigView::GetPassphraseFromField( | 1035 const std::string VPNConfigView::GetPassphraseFromField( |
| 1036 PassphraseTextfield* textfield) const { | 1036 PassphraseTextfield* textfield) const { |
| 1037 if (!textfield) | 1037 if (!textfield) |
| (...skipping 14 matching lines...) Expand all Loading... |
| 1052 property_ui_data->ParseOncProperty( | 1052 property_ui_data->ParseOncProperty( |
| 1053 onc_source, | 1053 onc_source, |
| 1054 onc, | 1054 onc, |
| 1055 base::StringPrintf("%s.%s.%s", | 1055 base::StringPrintf("%s.%s.%s", |
| 1056 ::onc::network_config::kVPN, | 1056 ::onc::network_config::kVPN, |
| 1057 dict_key.c_str(), | 1057 dict_key.c_str(), |
| 1058 key.c_str())); | 1058 key.c_str())); |
| 1059 } | 1059 } |
| 1060 | 1060 |
| 1061 } // namespace chromeos | 1061 } // namespace chromeos |
| OLD | NEW |