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

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

Issue 6156001: Remove wstring from l10n_util. Part 8, the last part.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/wifi_config_view.h" 5 #include "chrome/browser/chromeos/options/wifi_config_view.h"
6 6
7 #include "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "app/resource_bundle.h" 8 #include "app/resource_bundle.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 id = IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_BAD_PASSPHRASE; 130 id = IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_BAD_PASSPHRASE;
131 else if (wifi_->error() == ERROR_BAD_WEPKEY) 131 else if (wifi_->error() == ERROR_BAD_WEPKEY)
132 id = IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_BAD_WEPKEY; 132 id = IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_BAD_WEPKEY;
133 } 133 }
134 if (id == kNoError && failed) { 134 if (id == kNoError && failed) {
135 // We don't know what the error was. For now assume bad identity or 135 // We don't know what the error was. For now assume bad identity or
136 // passphrase. See TODO comment in Login() and crosbug.com/9538. 136 // passphrase. See TODO comment in Login() and crosbug.com/9538.
137 id = IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_BAD_CREDENTIALS; 137 id = IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_BAD_CREDENTIALS;
138 } 138 }
139 if (id != kNoError) { 139 if (id != kNoError) {
140 error_label_->SetText(l10n_util::GetString(id)); 140 error_label_->SetText(UTF16ToWide(l10n_util::GetStringUTF16(id)));
141 error_label_->SetVisible(true); 141 error_label_->SetVisible(true);
142 } else { 142 } else {
143 error_label_->SetVisible(false); 143 error_label_->SetVisible(false);
144 } 144 }
145 } 145 }
146 146
147 void WifiConfigView::ContentsChanged(views::Textfield* sender, 147 void WifiConfigView::ContentsChanged(views::Textfield* sender,
148 const string16& new_contents) { 148 const string16& new_contents) {
149 UpdateCanLogin(); 149 UpdateCanLogin();
150 } 150 }
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 views::GridLayout::USE_PREF, 0, 0); 292 views::GridLayout::USE_PREF, 0, 0);
293 // Textfield 293 // Textfield
294 column_set->AddColumn(views::GridLayout::FILL, views::GridLayout::FILL, 1, 294 column_set->AddColumn(views::GridLayout::FILL, views::GridLayout::FILL, 1,
295 views::GridLayout::USE_PREF, 0, kPasswordWidth); 295 views::GridLayout::USE_PREF, 0, kPasswordWidth);
296 // Password visible button 296 // Password visible button
297 column_set->AddColumn(views::GridLayout::CENTER, views::GridLayout::FILL, 1, 297 column_set->AddColumn(views::GridLayout::CENTER, views::GridLayout::FILL, 1,
298 views::GridLayout::USE_PREF, 0, 0); 298 views::GridLayout::USE_PREF, 0, 0);
299 299
300 // SSID input 300 // SSID input
301 layout->StartRow(0, column_view_set_id); 301 layout->StartRow(0, column_view_set_id);
302 layout->AddView(new views::Label(l10n_util::GetString( 302 layout->AddView(new views::Label(UTF16ToWide(l10n_util::GetStringUTF16(
303 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_NETWORK_ID))); 303 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_NETWORK_ID))));
304 if (!wifi_.get()) { 304 if (!wifi_.get()) {
305 ssid_textfield_ = new views::Textfield(views::Textfield::STYLE_DEFAULT); 305 ssid_textfield_ = new views::Textfield(views::Textfield::STYLE_DEFAULT);
306 ssid_textfield_->SetController(this); 306 ssid_textfield_->SetController(this);
307 layout->AddView(ssid_textfield_); 307 layout->AddView(ssid_textfield_);
308 } else { 308 } else {
309 views::Label* label = new views::Label(ASCIIToWide(wifi_->name())); 309 views::Label* label = new views::Label(ASCIIToWide(wifi_->name()));
310 label->SetHorizontalAlignment(views::Label::ALIGN_LEFT); 310 label->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
311 layout->AddView(label); 311 layout->AddView(label);
312 } 312 }
313 layout->AddPaddingRow(0, kRelatedControlVerticalSpacing); 313 layout->AddPaddingRow(0, kRelatedControlVerticalSpacing);
314 314
315 // Certificate input 315 // Certificate input
316 // Loaded certificates (i.e. stored in a pkcs11 device) do not require 316 // Loaded certificates (i.e. stored in a pkcs11 device) do not require
317 // a passphrase. 317 // a passphrase.
318 bool certificate_loaded = false; 318 bool certificate_loaded = false;
319 319
320 // Add ID and cert password if we're using 802.1x 320 // Add ID and cert password if we're using 802.1x
321 // XXX we're cheating and assuming 802.1x means EAP-TLS - not true 321 // XXX we're cheating and assuming 802.1x means EAP-TLS - not true
322 // in general, but very common. WPA Supplicant doesn't report the 322 // in general, but very common. WPA Supplicant doesn't report the
323 // EAP type because it's unknown until the process begins, and we'd 323 // EAP type because it's unknown until the process begins, and we'd
324 // need some kind of callback. 324 // need some kind of callback.
325 if (wifi_.get() && wifi_->encrypted() && 325 if (wifi_.get() && wifi_->encrypted() &&
326 wifi_->encryption() == SECURITY_8021X) { 326 wifi_->encryption() == SECURITY_8021X) {
327 layout->StartRow(0, column_view_set_id); 327 layout->StartRow(0, column_view_set_id);
328 layout->AddView(new views::Label(l10n_util::GetString( 328 layout->AddView(new views::Label(UTF16ToWide(l10n_util::GetStringUTF16(
329 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CERT_IDENTITY))); 329 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CERT_IDENTITY))));
330 identity_textfield_ = new views::Textfield( 330 identity_textfield_ = new views::Textfield(
331 views::Textfield::STYLE_DEFAULT); 331 views::Textfield::STYLE_DEFAULT);
332 identity_textfield_->SetController(this); 332 identity_textfield_->SetController(this);
333 if (!wifi_->identity().empty()) 333 if (!wifi_->identity().empty())
334 identity_textfield_->SetText(UTF8ToUTF16(wifi_->identity())); 334 identity_textfield_->SetText(UTF8ToUTF16(wifi_->identity()));
335 layout->AddView(identity_textfield_); 335 layout->AddView(identity_textfield_);
336 layout->AddPaddingRow(0, kRelatedControlVerticalSpacing); 336 layout->AddPaddingRow(0, kRelatedControlVerticalSpacing);
337 layout->StartRow(0, column_view_set_id); 337 layout->StartRow(0, column_view_set_id);
338 layout->AddView(new views::Label(l10n_util::GetString( 338 layout->AddView(new views::Label(UTF16ToWide(l10n_util::GetStringUTF16(
339 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CERT))); 339 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CERT))));
340 if (!wifi_->cert_path().empty()) { 340 if (!wifi_->cert_path().empty()) {
341 certificate_path_ = wifi_->cert_path(); 341 certificate_path_ = wifi_->cert_path();
342 certificate_loaded = wifi_->IsCertificateLoaded(); 342 certificate_loaded = wifi_->IsCertificateLoaded();
343 } 343 }
344 if (certificate_loaded) { 344 if (certificate_loaded) {
345 std::wstring label = l10n_util::GetString( 345 std::wstring label = UTF16ToWide(l10n_util::GetStringUTF16(
346 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CERT_INSTALLED); 346 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CERT_INSTALLED));
347 views::Label* cert_text = new views::Label(label); 347 views::Label* cert_text = new views::Label(label);
348 cert_text->SetHorizontalAlignment(views::Label::ALIGN_LEFT); 348 cert_text->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
349 layout->AddView(cert_text); 349 layout->AddView(cert_text);
350 } else { 350 } else {
351 std::wstring label; 351 std::wstring label;
352 if (!certificate_path_.empty()) 352 if (!certificate_path_.empty())
353 label = UTF8ToWide(certificate_path_); 353 label = UTF8ToWide(certificate_path_);
354 else 354 else
355 label = l10n_util::GetString( 355 label = UTF16ToWide(l10n_util::GetStringUTF16(
356 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CERT_BUTTON); 356 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CERT_BUTTON));
357 certificate_browse_button_ = new views::NativeButton(this, label); 357 certificate_browse_button_ = new views::NativeButton(this, label);
358 layout->AddView(certificate_browse_button_); 358 layout->AddView(certificate_browse_button_);
359 } 359 }
360 layout->AddPaddingRow(0, kRelatedControlVerticalSpacing); 360 layout->AddPaddingRow(0, kRelatedControlVerticalSpacing);
361 } 361 }
362 362
363 // Security select 363 // Security select
364 if (!wifi_.get()) { 364 if (!wifi_.get()) {
365 layout->StartRow(0, column_view_set_id); 365 layout->StartRow(0, column_view_set_id);
366 layout->AddView(new views::Label(l10n_util::GetString( 366 layout->AddView(new views::Label(UTF16ToWide(l10n_util::GetStringUTF16(
367 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_SECURITY))); 367 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_SECURITY))));
368 security_combobox_ = new views::Combobox(new SecurityComboboxModel()); 368 security_combobox_ = new views::Combobox(new SecurityComboboxModel());
369 security_combobox_->set_listener(this); 369 security_combobox_->set_listener(this);
370 layout->AddView(security_combobox_); 370 layout->AddView(security_combobox_);
371 layout->AddPaddingRow(0, kRelatedControlVerticalSpacing); 371 layout->AddPaddingRow(0, kRelatedControlVerticalSpacing);
372 } 372 }
373 373
374 // Passphrase input 374 // Passphrase input
375 layout->StartRow(0, column_view_set_id); 375 layout->StartRow(0, column_view_set_id);
376 int label_text_id; 376 int label_text_id;
377 if (wifi_.get() && wifi_->encryption() == SECURITY_8021X) { 377 if (wifi_.get() && wifi_->encryption() == SECURITY_8021X) {
378 label_text_id = 378 label_text_id =
379 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_PRIVATE_KEY_PASSWORD; 379 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_PRIVATE_KEY_PASSWORD;
380 } else { 380 } else {
381 label_text_id = IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_PASSPHRASE; 381 label_text_id = IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_PASSPHRASE;
382 } 382 }
383 layout->AddView(new views::Label(l10n_util::GetString(label_text_id))); 383 layout->AddView(new views::Label(
384 UTF16ToWide(l10n_util::GetStringUTF16(label_text_id))));
384 passphrase_textfield_ = new views::Textfield( 385 passphrase_textfield_ = new views::Textfield(
385 views::Textfield::STYLE_PASSWORD); 386 views::Textfield::STYLE_PASSWORD);
386 passphrase_textfield_->SetController(this); 387 passphrase_textfield_->SetController(this);
387 if (wifi_.get() && !wifi_->passphrase().empty()) 388 if (wifi_.get() && !wifi_->passphrase().empty())
388 passphrase_textfield_->SetText(UTF8ToUTF16(wifi_->passphrase())); 389 passphrase_textfield_->SetText(UTF8ToUTF16(wifi_->passphrase()));
389 // Disable passphrase input initially for other network. 390 // Disable passphrase input initially for other network.
390 if (!wifi_.get()) 391 if (!wifi_.get())
391 passphrase_textfield_->SetEnabled(false); 392 passphrase_textfield_->SetEnabled(false);
392 layout->AddView(passphrase_textfield_); 393 layout->AddView(passphrase_textfield_);
393 // Password visible button. 394 // Password visible button.
(...skipping 13 matching lines...) Expand all
407 error_label_ = new views::Label(); 408 error_label_ = new views::Label();
408 error_label_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); 409 error_label_->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
409 error_label_->SetColor(SK_ColorRED); 410 error_label_->SetColor(SK_ColorRED);
410 layout->AddView(error_label_); 411 layout->AddView(error_label_);
411 layout->AddPaddingRow(0, kRelatedControlVerticalSpacing); 412 layout->AddPaddingRow(0, kRelatedControlVerticalSpacing);
412 // Set or hide the error text. 413 // Set or hide the error text.
413 UpdateErrorLabel(false); 414 UpdateErrorLabel(false);
414 } 415 }
415 416
416 } // namespace chromeos 417 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/options/system_page_view.cc ('k') | chrome/browser/chromeos/status/network_dropdown_button.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698