OLD | NEW |
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/keyword_editor_view.h" | 5 #include "chrome/browser/views/keyword_editor_view.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
10 #include "base/stl_util-inl.h" | 10 #include "base/stl_util-inl.h" |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 return gfx::Size(views::Window::GetLocalizedContentsSize( | 119 return gfx::Size(views::Window::GetLocalizedContentsSize( |
120 IDS_SEARCHENGINES_DIALOG_WIDTH_CHARS, | 120 IDS_SEARCHENGINES_DIALOG_WIDTH_CHARS, |
121 IDS_SEARCHENGINES_DIALOG_HEIGHT_LINES)); | 121 IDS_SEARCHENGINES_DIALOG_HEIGHT_LINES)); |
122 } | 122 } |
123 | 123 |
124 bool KeywordEditorView::CanResize() const { | 124 bool KeywordEditorView::CanResize() const { |
125 return true; | 125 return true; |
126 } | 126 } |
127 | 127 |
128 std::wstring KeywordEditorView::GetWindowTitle() const { | 128 std::wstring KeywordEditorView::GetWindowTitle() const { |
129 return l10n_util::GetString(IDS_SEARCH_ENGINES_EDITOR_WINDOW_TITLE); | 129 return UTF16ToWide( |
| 130 l10n_util::GetStringUTF16(IDS_SEARCH_ENGINES_EDITOR_WINDOW_TITLE)); |
130 } | 131 } |
131 | 132 |
132 std::wstring KeywordEditorView::GetWindowName() const { | 133 std::wstring KeywordEditorView::GetWindowName() const { |
133 return UTF8ToWide(prefs::kKeywordEditorWindowPlacement); | 134 return UTF8ToWide(prefs::kKeywordEditorWindowPlacement); |
134 } | 135 } |
135 | 136 |
136 int KeywordEditorView::GetDialogButtons() const { | 137 int KeywordEditorView::GetDialogButtons() const { |
137 return MessageBoxFlags::DIALOGBUTTON_CANCEL; | 138 return MessageBoxFlags::DIALOGBUTTON_CANCEL; |
138 } | 139 } |
139 | 140 |
(...skipping 18 matching lines...) Expand all Loading... |
158 TableColumn::LEFT, -1, .75)); | 159 TableColumn::LEFT, -1, .75)); |
159 columns.back().sortable = true; | 160 columns.back().sortable = true; |
160 columns.push_back( | 161 columns.push_back( |
161 TableColumn(IDS_SEARCH_ENGINES_EDITOR_KEYWORD_COLUMN, | 162 TableColumn(IDS_SEARCH_ENGINES_EDITOR_KEYWORD_COLUMN, |
162 TableColumn::LEFT, -1, .25)); | 163 TableColumn::LEFT, -1, .25)); |
163 columns.back().sortable = true; | 164 columns.back().sortable = true; |
164 table_view_ = new views::TableView(controller_->table_model(), columns, | 165 table_view_ = new views::TableView(controller_->table_model(), columns, |
165 views::ICON_AND_TEXT, false, true, true); | 166 views::ICON_AND_TEXT, false, true, true); |
166 table_view_->SetObserver(this); | 167 table_view_->SetObserver(this); |
167 | 168 |
168 add_button_ = new views::NativeButton( | 169 add_button_ = new views::NativeButton(this, UTF16ToWide( |
169 this, l10n_util::GetString(IDS_SEARCH_ENGINES_EDITOR_NEW_BUTTON)); | 170 l10n_util::GetStringUTF16(IDS_SEARCH_ENGINES_EDITOR_NEW_BUTTON))); |
170 add_button_->SetEnabled(controller_->loaded()); | 171 add_button_->SetEnabled(controller_->loaded()); |
171 add_button_->AddAccelerator( | 172 add_button_->AddAccelerator( |
172 views::Accelerator(app::VKEY_A, false, false, true)); | 173 views::Accelerator(app::VKEY_A, false, false, true)); |
173 add_button_->SetAccessibleKeyboardShortcut(L"A"); | 174 add_button_->SetAccessibleKeyboardShortcut(L"A"); |
174 | 175 |
175 edit_button_ = new views::NativeButton( | 176 edit_button_ = new views::NativeButton(this, UTF16ToWide( |
176 this, l10n_util::GetString(IDS_SEARCH_ENGINES_EDITOR_EDIT_BUTTON)); | 177 l10n_util::GetStringUTF16(IDS_SEARCH_ENGINES_EDITOR_EDIT_BUTTON))); |
177 edit_button_->SetEnabled(false); | 178 edit_button_->SetEnabled(false); |
178 | 179 |
179 remove_button_ = new views::NativeButton( | 180 remove_button_ = new views::NativeButton(this, UTF16ToWide( |
180 this, l10n_util::GetString(IDS_SEARCH_ENGINES_EDITOR_REMOVE_BUTTON)); | 181 l10n_util::GetStringUTF16(IDS_SEARCH_ENGINES_EDITOR_REMOVE_BUTTON))); |
181 remove_button_->SetEnabled(false); | 182 remove_button_->SetEnabled(false); |
182 remove_button_->AddAccelerator( | 183 remove_button_->AddAccelerator( |
183 views::Accelerator(app::VKEY_R, false, false, true)); | 184 views::Accelerator(app::VKEY_R, false, false, true)); |
184 remove_button_->SetAccessibleKeyboardShortcut(L"R"); | 185 remove_button_->SetAccessibleKeyboardShortcut(L"R"); |
185 | 186 |
186 make_default_button_ = new views::NativeButton( | 187 make_default_button_ = new views::NativeButton( |
187 this, | 188 this, |
188 l10n_util::GetString(IDS_SEARCH_ENGINES_EDITOR_MAKE_DEFAULT_BUTTON)); | 189 UTF16ToWide(l10n_util::GetStringUTF16( |
| 190 IDS_SEARCH_ENGINES_EDITOR_MAKE_DEFAULT_BUTTON))); |
189 make_default_button_->SetEnabled(false); | 191 make_default_button_->SetEnabled(false); |
190 | 192 |
191 InitLayoutManager(); | 193 InitLayoutManager(); |
192 } | 194 } |
193 | 195 |
194 void KeywordEditorView::InitLayoutManager() { | 196 void KeywordEditorView::InitLayoutManager() { |
195 const int related_x = kRelatedControlHorizontalSpacing; | 197 const int related_x = kRelatedControlHorizontalSpacing; |
196 const int related_y = kRelatedControlVerticalSpacing; | 198 const int related_y = kRelatedControlVerticalSpacing; |
197 const int unrelated_y = kUnrelatedControlVerticalSpacing; | 199 const int unrelated_y = kUnrelatedControlVerticalSpacing; |
198 | 200 |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 add_button_->SetEnabled(controller_->loaded()); | 299 add_button_->SetEnabled(controller_->loaded()); |
298 } | 300 } |
299 | 301 |
300 void KeywordEditorView::MakeDefaultTemplateURL() { | 302 void KeywordEditorView::MakeDefaultTemplateURL() { |
301 int new_index = | 303 int new_index = |
302 controller_->MakeDefaultTemplateURL(table_view_->FirstSelectedRow()); | 304 controller_->MakeDefaultTemplateURL(table_view_->FirstSelectedRow()); |
303 if (new_index >= 0) | 305 if (new_index >= 0) |
304 table_view_->Select(new_index); | 306 table_view_->Select(new_index); |
305 default_chosen_ = true; | 307 default_chosen_ = true; |
306 } | 308 } |
OLD | NEW |