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

Side by Side Diff: chrome/browser/ui/views/url_picker.cc

Issue 6088008: Remove wstring from l10n_util. Part 7.... (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/views/url_picker.h" 5 #include "chrome/browser/views/url_picker.h"
6 6
7 #include "app/keyboard_codes.h" 7 #include "app/keyboard_codes.h"
8 #include "app/l10n_util.h" 8 #include "app/l10n_util.h"
9 #include "app/resource_bundle.h" 9 #include "app/resource_bundle.h"
10 #include "app/table_model.h" 10 #include "app/table_model.h"
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 column_set->AddColumn(GridLayout::FILL, GridLayout::CENTER, 1, 81 column_set->AddColumn(GridLayout::FILL, GridLayout::CENTER, 1,
82 GridLayout::USE_PREF, 0, 0); 82 GridLayout::USE_PREF, 0, 0);
83 83
84 column_set = layout->AddColumnSet(single_column_view_set_id); 84 column_set = layout->AddColumnSet(single_column_view_set_id);
85 column_set->AddColumn(GridLayout::FILL, GridLayout::FILL, 1, 85 column_set->AddColumn(GridLayout::FILL, GridLayout::FILL, 1,
86 GridLayout::FIXED, kTableWidth, 0); 86 GridLayout::FIXED, kTableWidth, 0);
87 87
88 layout->StartRow(0, labels_column_set_id); 88 layout->StartRow(0, labels_column_set_id);
89 views::Label* url_label = new views::Label(); 89 views::Label* url_label = new views::Label();
90 url_label->SetHorizontalAlignment(views::Label::ALIGN_LEFT); 90 url_label->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
91 url_label->SetText(l10n_util::GetString(IDS_ASI_URL)); 91 url_label->SetText(UTF16ToWide(l10n_util::GetStringUTF16(IDS_ASI_URL)));
92 layout->AddView(url_label); 92 layout->AddView(url_label);
93 93
94 url_field_ = new views::Textfield(); 94 url_field_ = new views::Textfield();
95 url_field_->SetController(this); 95 url_field_->SetController(this);
96 layout->AddView(url_field_); 96 layout->AddView(url_field_);
97 97
98 layout->AddPaddingRow(0, kUnrelatedControlVerticalSpacing); 98 layout->AddPaddingRow(0, kUnrelatedControlVerticalSpacing);
99 99
100 layout->StartRow(0, single_column_view_set_id); 100 layout->StartRow(0, single_column_view_set_id);
101 views::Label* description_label = new views::Label(); 101 views::Label* description_label = new views::Label();
102 description_label->SetHorizontalAlignment(views::Label::ALIGN_LEFT); 102 description_label->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
103 description_label->SetText(l10n_util::GetString(IDS_ASI_DESCRIPTION)); 103 description_label->SetText(
104 UTF16ToWide(l10n_util::GetStringUTF16(IDS_ASI_DESCRIPTION)));
104 description_label->SetFont( 105 description_label->SetFont(
105 description_label->font().DeriveFont(0, gfx::Font::BOLD)); 106 description_label->font().DeriveFont(0, gfx::Font::BOLD));
106 layout->AddView(description_label); 107 layout->AddView(description_label);
107 108
108 layout->AddPaddingRow(0, kRelatedControlVerticalSpacing); 109 layout->AddPaddingRow(0, kRelatedControlVerticalSpacing);
109 110
110 layout->StartRow(1, single_column_view_set_id); 111 layout->StartRow(1, single_column_view_set_id);
111 layout->AddView(url_table_); 112 layout->AddView(url_table_);
112 113
113 layout->AddPaddingRow(0, kRelatedControlVerticalSpacing); 114 layout->AddPaddingRow(0, kRelatedControlVerticalSpacing);
(...skipping 12 matching lines...) Expand all
126 url_field_->RequestFocus(); 127 url_field_->RequestFocus();
127 url_table_model_->Reload(profile_); 128 url_table_model_->Reload(profile_);
128 } 129 }
129 130
130 void UrlPicker::Close() { 131 void UrlPicker::Close() {
131 DCHECK(window()); 132 DCHECK(window());
132 window()->Close(); 133 window()->Close();
133 } 134 }
134 135
135 std::wstring UrlPicker::GetWindowTitle() const { 136 std::wstring UrlPicker::GetWindowTitle() const {
136 return l10n_util::GetString(IDS_ASI_ADD_TITLE); 137 return UTF16ToWide(l10n_util::GetStringUTF16(IDS_ASI_ADD_TITLE));
137 } 138 }
138 139
139 bool UrlPicker::IsModal() const { 140 bool UrlPicker::IsModal() const {
140 return true; 141 return true;
141 } 142 }
142 143
143 std::wstring UrlPicker::GetDialogButtonLabel( 144 std::wstring UrlPicker::GetDialogButtonLabel(
144 MessageBoxFlags::DialogButton button) const { 145 MessageBoxFlags::DialogButton button) const {
145 if (button == MessageBoxFlags::DIALOGBUTTON_OK) 146 if (button == MessageBoxFlags::DIALOGBUTTON_OK)
146 return l10n_util::GetString(IDS_ASI_ADD); 147 return UTF16ToWide(l10n_util::GetStringUTF16(IDS_ASI_ADD));
147 return std::wstring(); 148 return std::wstring();
148 } 149 }
149 150
150 void UrlPicker::ContentsChanged(views::Textfield* sender, 151 void UrlPicker::ContentsChanged(views::Textfield* sender,
151 const std::wstring& new_contents) { 152 const std::wstring& new_contents) {
152 GetDialogClientView()->UpdateDialogButtons(); 153 GetDialogClientView()->UpdateDialogButtons();
153 } 154 }
154 155
155 bool UrlPicker::Accept() { 156 bool UrlPicker::Accept() {
156 if (!IsDialogButtonEnabled(MessageBoxFlags::DIALOGBUTTON_OK)) { 157 if (!IsDialogButtonEnabled(MessageBoxFlags::DIALOGBUTTON_OK)) {
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 PerformModelChange(); 240 PerformModelChange();
240 if (window()) 241 if (window())
241 window()->Close(); 242 window()->Close();
242 } 243 }
243 } 244 }
244 245
245 GURL UrlPicker::GetInputURL() const { 246 GURL UrlPicker::GetInputURL() const {
246 return URLFixerUpper::FixupURL(UTF16ToUTF8(url_field_->text()), 247 return URLFixerUpper::FixupURL(UTF16ToUTF8(url_field_->text()),
247 std::string()); 248 std::string());
248 } 249 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698