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

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

Issue 8142026: Revert 104076 - Change std::wstring to string16 for views::Link (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 2 months 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/string_util.h" 7 #include "base/string_util.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "chrome/browser/chromeos/cros/cros_library.h" 9 #include "chrome/browser/chromeos/cros/cros_library.h"
10 #include "chrome/browser/chromeos/login/user_manager.h" 10 #include "chrome/browser/chromeos/login/user_manager.h"
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 virtual string16 GetItemAt(int combo_index) { 80 virtual string16 GetItemAt(int combo_index) {
81 if (!cert_library_->CertificatesLoaded()) 81 if (!cert_library_->CertificatesLoaded())
82 return l10n_util::GetStringUTF16( 82 return l10n_util::GetStringUTF16(
83 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CERT_LOADING); 83 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CERT_LOADING);
84 if (combo_index == 0) 84 if (combo_index == 0)
85 return l10n_util::GetStringUTF16( 85 return l10n_util::GetStringUTF16(
86 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CERT_SERVER_CA_DEFAULT); 86 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CERT_SERVER_CA_DEFAULT);
87 int cert_index = combo_index - 1; 87 int cert_index = combo_index - 1;
88 return cert_library_->GetCACertificates().GetDisplayStringAt(cert_index); 88 return cert_library_->GetCACertificates().GetDisplayStringAt(cert_index);
89 } 89 }
90
91 private: 90 private:
92 CertLibrary* cert_library_; 91 CertLibrary* cert_library_;
93 DISALLOW_COPY_AND_ASSIGN(ServerCACertComboboxModel); 92 DISALLOW_COPY_AND_ASSIGN(ServerCACertComboboxModel);
94 }; 93 };
95 94
96 class UserCertComboboxModel : public ui::ComboboxModel { 95 class UserCertComboboxModel : public ui::ComboboxModel {
97 public: 96 public:
98 explicit UserCertComboboxModel(CertLibrary* cert_library) 97 explicit UserCertComboboxModel(CertLibrary* cert_library)
99 : cert_library_(cert_library) { 98 : cert_library_(cert_library) {
100 } 99 }
101 virtual ~UserCertComboboxModel() {} 100 virtual ~UserCertComboboxModel() {}
102 virtual int GetItemCount() { 101 virtual int GetItemCount() {
103 if (!cert_library_->CertificatesLoaded()) 102 if (!cert_library_->CertificatesLoaded())
104 return 1; // "Loading" 103 return 1; // "Loading"
105 int num_certs = cert_library_->GetUserCertificates().Size(); 104 int num_certs = cert_library_->GetUserCertificates().Size();
106 if (num_certs == 0) 105 if (num_certs == 0)
107 return 1; // "None installed" 106 return 1; // "None installed"
108 return num_certs; 107 return num_certs;
109 } 108 }
110 virtual string16 GetItemAt(int combo_index) { 109 virtual string16 GetItemAt(int combo_index) {
111 if (!cert_library_->CertificatesLoaded()) 110 if (!cert_library_->CertificatesLoaded())
112 return l10n_util::GetStringUTF16( 111 return l10n_util::GetStringUTF16(
113 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CERT_LOADING); 112 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CERT_LOADING);
114 if (cert_library_->GetUserCertificates().Size() == 0) 113 if (cert_library_->GetUserCertificates().Size() == 0)
115 return l10n_util::GetStringUTF16( 114 return l10n_util::GetStringUTF16(
116 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_USER_CERT_NONE_INSTALLED); 115 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_USER_CERT_NONE_INSTALLED);
117 return cert_library_->GetUserCertificates().GetDisplayStringAt(combo_index); 116 return cert_library_->GetUserCertificates().GetDisplayStringAt(combo_index);
118 } 117 }
119
120 private: 118 private:
121 CertLibrary* cert_library_; 119 CertLibrary* cert_library_;
122 DISALLOW_COPY_AND_ASSIGN(UserCertComboboxModel); 120 DISALLOW_COPY_AND_ASSIGN(UserCertComboboxModel);
123 }; 121 };
124 122
125 VPNConfigView::VPNConfigView(NetworkConfigView* parent, VirtualNetwork* vpn) 123 VPNConfigView::VPNConfigView(NetworkConfigView* parent, VirtualNetwork* vpn)
126 : ChildNetworkConfigView(parent, vpn), 124 : ChildNetworkConfigView(parent, vpn),
127 cert_library_(NULL) { 125 cert_library_(NULL) {
128 Init(vpn); 126 Init(vpn);
129 } 127 }
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 337
340 const std::string VPNConfigView::GetServerCACertNssNickname() const { 338 const std::string VPNConfigView::GetServerCACertNssNickname() const {
341 DCHECK(server_ca_cert_combobox_); 339 DCHECK(server_ca_cert_combobox_);
342 DCHECK(cert_library_); 340 DCHECK(cert_library_);
343 int selected = server_ca_cert_combobox_->selected_item(); 341 int selected = server_ca_cert_combobox_->selected_item();
344 if (selected == 0) { 342 if (selected == 0) {
345 // First item is "Default". 343 // First item is "Default".
346 return std::string(); 344 return std::string();
347 } else { 345 } else {
348 DCHECK(cert_library_); 346 DCHECK(cert_library_);
349 DCHECK_GT(cert_library_->GetCACertificates().Size(), 0); 347 DCHECK(cert_library_->GetCACertificates().Size() > 0);
350 int cert_index = selected - 1; 348 int cert_index = selected - 1;
351 return cert_library_->GetCACertificates().GetNicknameAt(cert_index); 349 return cert_library_->GetCACertificates().GetNicknameAt(cert_index);
352 } 350 }
353 } 351 }
354 352
355 const std::string VPNConfigView::GetUserCertID() const { 353 const std::string VPNConfigView::GetUserCertID() const {
356 DCHECK(user_cert_combobox_); 354 DCHECK(user_cert_combobox_);
357 DCHECK(cert_library_); 355 DCHECK(cert_library_);
358 if (!HaveUserCerts()) { 356 if (!HaveUserCerts()) {
359 return std::string(); // "None installed" 357 return std::string(); // "None installed"
(...skipping 26 matching lines...) Expand all
386 column_set->AddPaddingColumn(0, views::kRelatedControlSmallHorizontalSpacing); 384 column_set->AddPaddingColumn(0, views::kRelatedControlSmallHorizontalSpacing);
387 385
388 // Initialize members. 386 // Initialize members.
389 service_text_modified_ = false; 387 service_text_modified_ = false;
390 provider_type_ = vpn ? 388 provider_type_ = vpn ?
391 vpn->provider_type() : 389 vpn->provider_type() :
392 chromeos::PROVIDER_TYPE_L2TP_IPSEC_PSK; 390 chromeos::PROVIDER_TYPE_L2TP_IPSEC_PSK;
393 391
394 // Server label and input. 392 // Server label and input.
395 layout->StartRow(0, column_view_set_id); 393 layout->StartRow(0, column_view_set_id);
396 layout->AddView(new views::Label(l10n_util::GetStringUTF16( 394 layout->AddView(new views::Label(UTF16ToWide(l10n_util::GetStringUTF16(
397 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_VPN_SERVER_HOSTNAME))); 395 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_VPN_SERVER_HOSTNAME))));
398 if (!vpn) { 396 if (!vpn) {
399 server_textfield_ = new views::Textfield(views::Textfield::STYLE_DEFAULT); 397 server_textfield_ = new views::Textfield(views::Textfield::STYLE_DEFAULT);
400 server_textfield_->SetController(this); 398 server_textfield_->SetController(this);
401 layout->AddView(server_textfield_); 399 layout->AddView(server_textfield_);
402 server_text_ = NULL; 400 server_text_ = NULL;
403 } else { 401 } else {
404 server_hostname_ = vpn->server_hostname(); 402 server_hostname_ = vpn->server_hostname();
405 server_text_ = new views::Label(UTF8ToUTF16(server_hostname_)); 403 server_text_ = new views::Label(UTF8ToWide(server_hostname_));
406 server_text_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); 404 server_text_->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
407 layout->AddView(server_text_); 405 layout->AddView(server_text_);
408 server_textfield_ = NULL; 406 server_textfield_ = NULL;
409 } 407 }
410 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); 408 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing);
411 409
412 // Service label and name or input. 410 // Service label and name or input.
413 layout->StartRow(0, column_view_set_id); 411 layout->StartRow(0, column_view_set_id);
414 layout->AddView(new views::Label(l10n_util::GetStringUTF16( 412 layout->AddView(new views::Label(UTF16ToWide(l10n_util::GetStringUTF16(
415 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_VPN_SERVICE_NAME))); 413 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_VPN_SERVICE_NAME))));
416 if (!vpn) { 414 if (!vpn) {
417 service_textfield_ = new views::Textfield(views::Textfield::STYLE_DEFAULT); 415 service_textfield_ = new views::Textfield(views::Textfield::STYLE_DEFAULT);
418 service_textfield_->SetController(this); 416 service_textfield_->SetController(this);
419 layout->AddView(service_textfield_); 417 layout->AddView(service_textfield_);
420 service_text_ = NULL; 418 service_text_ = NULL;
421 } else { 419 } else {
422 service_text_ = new views::Label(ASCIIToUTF16(vpn->name())); 420 service_text_ = new views::Label(ASCIIToWide(vpn->name()));
423 service_text_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); 421 service_text_->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
424 layout->AddView(service_text_); 422 layout->AddView(service_text_);
425 service_textfield_ = NULL; 423 service_textfield_ = NULL;
426 } 424 }
427 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); 425 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing);
428 426
429 // Provider type label and select. 427 // Provider type label and select.
430 layout->StartRow(0, column_view_set_id); 428 layout->StartRow(0, column_view_set_id);
431 layout->AddView(new views::Label(l10n_util::GetStringUTF16( 429 layout->AddView(new views::Label(UTF16ToWide(l10n_util::GetStringUTF16(
432 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_VPN_PROVIDER_TYPE))); 430 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_VPN_PROVIDER_TYPE))));
433 if (!vpn) { 431 if (!vpn) {
434 provider_type_combobox_ = 432 provider_type_combobox_ =
435 new views::Combobox(new ProviderTypeComboboxModel()); 433 new views::Combobox(new ProviderTypeComboboxModel());
436 provider_type_combobox_->set_listener(this); 434 provider_type_combobox_->set_listener(this);
437 layout->AddView(provider_type_combobox_); 435 layout->AddView(provider_type_combobox_);
438 provider_type_text_label_ = NULL; 436 provider_type_text_label_ = NULL;
439 } else { 437 } else {
440 provider_type_text_label_ = 438 provider_type_text_label_ =
441 new views::Label(ProviderTypeToString(provider_type_)); 439 new views::Label(UTF16ToWide(ProviderTypeToString(provider_type_)));
442 provider_type_text_label_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); 440 provider_type_text_label_->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
443 layout->AddView(provider_type_text_label_); 441 layout->AddView(provider_type_text_label_);
444 provider_type_combobox_ = NULL; 442 provider_type_combobox_ = NULL;
445 } 443 }
446 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); 444 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing);
447 445
448 // PSK passphrase label, input and visible button. 446 // PSK passphrase label, input and visible button.
449 layout->StartRow(0, column_view_set_id); 447 layout->StartRow(0, column_view_set_id);
450 psk_passphrase_label_ = new views::Label(l10n_util::GetStringUTF16( 448 psk_passphrase_label_ = new views::Label(UTF16ToWide(
451 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_VPN_PSK_PASSPHRASE)); 449 l10n_util::GetStringUTF16(
450 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_VPN_PSK_PASSPHRASE)));
452 layout->AddView(psk_passphrase_label_); 451 layout->AddView(psk_passphrase_label_);
453 psk_passphrase_textfield_ = new views::Textfield( 452 psk_passphrase_textfield_ = new views::Textfield(
454 views::Textfield::STYLE_PASSWORD); 453 views::Textfield::STYLE_PASSWORD);
455 psk_passphrase_textfield_->SetController(this); 454 psk_passphrase_textfield_->SetController(this);
456 if (vpn && !vpn->psk_passphrase().empty()) 455 if (vpn && !vpn->psk_passphrase().empty())
457 psk_passphrase_textfield_->SetText(UTF8ToUTF16(vpn->psk_passphrase())); 456 psk_passphrase_textfield_->SetText(UTF8ToUTF16(vpn->psk_passphrase()));
458 layout->AddView(psk_passphrase_textfield_); 457 layout->AddView(psk_passphrase_textfield_);
459 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); 458 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing);
460 459
461 // Server CA certificate 460 // Server CA certificate
462 layout->StartRow(0, column_view_set_id); 461 layout->StartRow(0, column_view_set_id);
463 server_ca_cert_label_ = 462 server_ca_cert_label_ =
464 new views::Label(l10n_util::GetStringUTF16( 463 new views::Label(UTF16ToWide(l10n_util::GetStringUTF16(
465 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CERT_SERVER_CA)); 464 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CERT_SERVER_CA)));
466 layout->AddView(server_ca_cert_label_); 465 layout->AddView(server_ca_cert_label_);
467 ServerCACertComboboxModel* server_ca_cert_model = 466 ServerCACertComboboxModel* server_ca_cert_model =
468 new ServerCACertComboboxModel(cert_library_); 467 new ServerCACertComboboxModel(cert_library_);
469 server_ca_cert_combobox_ = new views::Combobox(server_ca_cert_model); 468 server_ca_cert_combobox_ = new views::Combobox(server_ca_cert_model);
470 layout->AddView(server_ca_cert_combobox_); 469 layout->AddView(server_ca_cert_combobox_);
471 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); 470 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing);
472 471
473 // User certificate label and input. 472 // User certificate label and input.
474 layout->StartRow(0, column_view_set_id); 473 layout->StartRow(0, column_view_set_id);
475 user_cert_label_ = new views::Label(l10n_util::GetStringUTF16( 474 user_cert_label_ = new views::Label(UTF16ToWide(l10n_util::GetStringUTF16(
476 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_VPN_USER_CERT)); 475 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_VPN_USER_CERT)));
477 layout->AddView(user_cert_label_); 476 layout->AddView(user_cert_label_);
478 UserCertComboboxModel* user_cert_model = 477 UserCertComboboxModel* user_cert_model =
479 new UserCertComboboxModel(cert_library_); 478 new UserCertComboboxModel(cert_library_);
480 user_cert_combobox_ = new views::Combobox(user_cert_model); 479 user_cert_combobox_ = new views::Combobox(user_cert_model);
481 user_cert_combobox_->set_listener(this); 480 user_cert_combobox_->set_listener(this);
482 layout->AddView(user_cert_combobox_); 481 layout->AddView(user_cert_combobox_);
483 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); 482 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing);
484 483
485 // Username label and input. 484 // Username label and input.
486 layout->StartRow(0, column_view_set_id); 485 layout->StartRow(0, column_view_set_id);
487 layout->AddView(new views::Label(l10n_util::GetStringUTF16( 486 layout->AddView(new views::Label(UTF16ToWide(l10n_util::GetStringUTF16(
488 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_VPN_USERNAME))); 487 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_VPN_USERNAME))));
489 username_textfield_ = new views::Textfield(views::Textfield::STYLE_DEFAULT); 488 username_textfield_ = new views::Textfield(views::Textfield::STYLE_DEFAULT);
490 username_textfield_->SetController(this); 489 username_textfield_->SetController(this);
491 if (vpn && !vpn->username().empty()) 490 if (vpn && !vpn->username().empty())
492 username_textfield_->SetText(UTF8ToUTF16(vpn->username())); 491 username_textfield_->SetText(UTF8ToUTF16(vpn->username()));
493 layout->AddView(username_textfield_); 492 layout->AddView(username_textfield_);
494 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); 493 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing);
495 494
496 // User passphrase label, input and visble button. 495 // User passphrase label, input and visble button.
497 layout->StartRow(0, column_view_set_id); 496 layout->StartRow(0, column_view_set_id);
498 layout->AddView(new views::Label(l10n_util::GetStringUTF16( 497 layout->AddView(new views::Label(UTF16ToWide(
499 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_VPN_USER_PASSPHRASE))); 498 l10n_util::GetStringUTF16(
499 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_VPN_USER_PASSPHRASE))));
500 user_passphrase_textfield_ = new views::Textfield( 500 user_passphrase_textfield_ = new views::Textfield(
501 views::Textfield::STYLE_PASSWORD); 501 views::Textfield::STYLE_PASSWORD);
502 user_passphrase_textfield_->SetController(this); 502 user_passphrase_textfield_->SetController(this);
503 if (vpn && !vpn->user_passphrase().empty()) 503 if (vpn && !vpn->user_passphrase().empty())
504 user_passphrase_textfield_->SetText(UTF8ToUTF16(vpn->user_passphrase())); 504 user_passphrase_textfield_->SetText(UTF8ToUTF16(vpn->user_passphrase()));
505 layout->AddView(user_passphrase_textfield_); 505 layout->AddView(user_passphrase_textfield_);
506 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); 506 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing);
507 507
508 // OTP label and input. 508 // OTP label and input.
509 layout->StartRow(0, column_view_set_id); 509 layout->StartRow(0, column_view_set_id);
510 otp_label_ = new views::Label(l10n_util::GetStringUTF16( 510 otp_label_ = new views::Label(UTF16ToWide(l10n_util::GetStringUTF16(
511 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_VPN_OTP)); 511 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_VPN_OTP)));
512 layout->AddView(otp_label_); 512 layout->AddView(otp_label_);
513 otp_textfield_ = new views::Textfield(views::Textfield::STYLE_DEFAULT); 513 otp_textfield_ = new views::Textfield(views::Textfield::STYLE_DEFAULT);
514 otp_textfield_->SetController(this); 514 otp_textfield_->SetController(this);
515 layout->AddView(otp_textfield_); 515 layout->AddView(otp_textfield_);
516 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); 516 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing);
517 517
518 // This is not currently implemented with no immediate plans to do so. 518 // This is not currently implemented with no immediate plans to do so.
519 // TODO(stevenjb,kmixter): Set true if we implement this. 519 // TODO(stevenjb,kmixter): Set true if we implement this.
520 // See http://crosbug.com/19252. 520 // See http://crosbug.com/19252.
521 const bool show_group_name = false; 521 const bool show_group_name = false;
522 522
523 // Group Name label and input. 523 // Group Name label and input.
524 if (show_group_name) { 524 if (show_group_name) {
525 layout->StartRow(0, column_view_set_id); 525 layout->StartRow(0, column_view_set_id);
526 group_name_label_ = new views::Label(l10n_util::GetStringUTF16( 526 group_name_label_ = new views::Label(UTF16ToWide(l10n_util::GetStringUTF16(
527 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_VPN_GROUP_NAME)); 527 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_VPN_GROUP_NAME)));
528 layout->AddView(group_name_label_); 528 layout->AddView(group_name_label_);
529 group_name_textfield_ = 529 group_name_textfield_ =
530 new views::Textfield(views::Textfield::STYLE_DEFAULT); 530 new views::Textfield(views::Textfield::STYLE_DEFAULT);
531 group_name_textfield_->SetController(this); 531 group_name_textfield_->SetController(this);
532 if (vpn && !vpn->group_name().empty()) 532 if (vpn && !vpn->group_name().empty())
533 group_name_textfield_->SetText(UTF8ToUTF16(vpn->group_name())); 533 group_name_textfield_->SetText(UTF8ToUTF16(vpn->group_name()));
534 layout->AddView(group_name_textfield_); 534 layout->AddView(group_name_textfield_);
535 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); 535 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing);
536 } else { 536 } else {
537 group_name_label_ = NULL; 537 group_name_label_ = NULL;
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
632 632
633 if (otp_label_) 633 if (otp_label_)
634 otp_label_->SetEnabled(enable_otp); 634 otp_label_->SetEnabled(enable_otp);
635 if (otp_textfield_) 635 if (otp_textfield_)
636 otp_textfield_->SetEnabled(enable_otp); 636 otp_textfield_->SetEnabled(enable_otp);
637 637
638 if (group_name_label_) 638 if (group_name_label_)
639 group_name_label_->SetEnabled(enable_group_name); 639 group_name_label_->SetEnabled(enable_group_name);
640 if (group_name_textfield_) 640 if (group_name_textfield_)
641 group_name_textfield_->SetEnabled(enable_group_name); 641 group_name_textfield_->SetEnabled(enable_group_name);
642
642 } 643 }
643 644
644 void VPNConfigView::UpdateErrorLabel() { 645 void VPNConfigView::UpdateErrorLabel() {
645 NetworkLibrary* cros = CrosLibrary::Get()->GetNetworkLibrary(); 646 NetworkLibrary* cros = CrosLibrary::Get()->GetNetworkLibrary();
646 647
647 // Error message. 648 // Error message.
648 std::string error_msg; 649 std::string error_msg;
649 if (UserCertRequired() && cert_library_->CertificatesLoaded()) { 650 if (UserCertRequired() && cert_library_->CertificatesLoaded()) {
650 if (!HaveUserCerts()) { 651 if (!HaveUserCerts()) {
651 error_msg = l10n_util::GetStringUTF8( 652 error_msg = l10n_util::GetStringUTF8(
652 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_PLEASE_INSTALL_USER_CERT); 653 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_PLEASE_INSTALL_USER_CERT);
653 } else if (!IsUserCertValid()) { 654 } else if (!IsUserCertValid()) {
654 error_msg = l10n_util::GetStringUTF8( 655 error_msg = l10n_util::GetStringUTF8(
655 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_REQUIRE_HARDWARE_BACKED); 656 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_REQUIRE_HARDWARE_BACKED);
656 } 657 }
657 } 658 }
658 if (error_msg.empty() && !service_path_.empty()) { 659 if (error_msg.empty() && !service_path_.empty()) {
659 // TODO(kuan): differentiate between bad psk and user passphrases. 660 // TODO(kuan): differentiate between bad psk and user passphrases.
660 VirtualNetwork* vpn = cros->FindVirtualNetworkByPath(service_path_); 661 VirtualNetwork* vpn = cros->FindVirtualNetworkByPath(service_path_);
661 if (vpn && vpn->failed()) { 662 if (vpn && vpn->failed()) {
662 if (vpn->error() == ERROR_BAD_PASSPHRASE) { 663 if (vpn->error() == ERROR_BAD_PASSPHRASE) {
663 error_msg = l10n_util::GetStringUTF8( 664 error_msg = l10n_util::GetStringUTF8(
664 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_BAD_PASSPHRASE); 665 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_BAD_PASSPHRASE);
665 } else { 666 } else {
666 error_msg = vpn->GetErrorString(); 667 error_msg = vpn->GetErrorString();
667 } 668 }
668 } 669 }
669 } 670 }
670 if (!error_msg.empty()) { 671 if (!error_msg.empty()) {
671 error_label_->SetText(UTF8ToUTF16(error_msg)); 672 error_label_->SetText(UTF8ToWide(error_msg));
672 error_label_->SetVisible(true); 673 error_label_->SetVisible(true);
673 } else { 674 } else {
674 error_label_->SetVisible(false); 675 error_label_->SetVisible(false);
675 } 676 }
676 } 677 }
677 678
678 void VPNConfigView::UpdateCanLogin() { 679 void VPNConfigView::UpdateCanLogin() {
679 parent_->GetDialogClientView()->UpdateDialogButtons(); 680 parent_->GetDialogClientView()->UpdateDialogButtons();
680 } 681 }
681 682
(...skipping 25 matching lines...) Expand all
707 return std::string(); 708 return std::string();
708 std::string untrimmed = UTF16ToUTF8(textfield->text()); 709 std::string untrimmed = UTF16ToUTF8(textfield->text());
709 if (!trim_whitespace) 710 if (!trim_whitespace)
710 return untrimmed; 711 return untrimmed;
711 std::string result; 712 std::string result;
712 TrimWhitespaceASCII(untrimmed, TRIM_ALL, &result); 713 TrimWhitespaceASCII(untrimmed, TRIM_ALL, &result);
713 return result; 714 return result;
714 } 715 }
715 716
716 } // namespace chromeos 717 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/web_page_view.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