| 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/chromeos/options/language_config_view.h" | 5 #include "chrome/browser/chromeos/options/language_config_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 remove_language_button_->SetEnabled(remove_button_enabled); | 229 remove_language_button_->SetEnabled(remove_button_enabled); |
| 230 | 230 |
| 231 // Add the per language config view to the right area. | 231 // Add the per language config view to the right area. |
| 232 right_container_->AddChildView(CreatePerLanguageConfigView(language_code)); | 232 right_container_->AddChildView(CreatePerLanguageConfigView(language_code)); |
| 233 MaybeDisableLastCheckbox(); | 233 MaybeDisableLastCheckbox(); |
| 234 // Layout the right container. This is needed for the contents on the | 234 // Layout the right container. This is needed for the contents on the |
| 235 // right to be displayed properly. | 235 // right to be displayed properly. |
| 236 right_container_->Layout(); | 236 right_container_->Layout(); |
| 237 } | 237 } |
| 238 | 238 |
| 239 std::wstring LanguageConfigView::GetText(int row, int column_id) { | 239 string16 LanguageConfigView::GetText(int row, int column_id) { |
| 240 if (row >= 0 && row < static_cast<int>( | 240 if (row >= 0 && row < static_cast<int>( |
| 241 model_.num_preferred_language_codes())) { | 241 model_.num_preferred_language_codes())) { |
| 242 return UTF16ToWide(input_method::GetLanguageDisplayNameFromCode( | 242 return input_method::GetLanguageDisplayNameFromCode( |
| 243 model_.preferred_language_code_at(row))); | 243 model_.preferred_language_code_at(row)); |
| 244 } | 244 } |
| 245 NOTREACHED(); | 245 NOTREACHED(); |
| 246 return L""; | 246 return string16(); |
| 247 } | 247 } |
| 248 | 248 |
| 249 void LanguageConfigView::SetObserver(TableModelObserver* observer) { | 249 void LanguageConfigView::SetObserver(TableModelObserver* observer) { |
| 250 // We don't need the observer for the table mode, since we implement the | 250 // We don't need the observer for the table mode, since we implement the |
| 251 // table model as part of the LanguageConfigView class. | 251 // table model as part of the LanguageConfigView class. |
| 252 // http://crbug.com/38266 | 252 // http://crbug.com/38266 |
| 253 } | 253 } |
| 254 | 254 |
| 255 int LanguageConfigView::RowCount() { | 255 int LanguageConfigView::RowCount() { |
| 256 // Returns the number of rows of the language table. | 256 // Returns the number of rows of the language table. |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 406 | 406 |
| 407 // Set up column sets for the grid layout. | 407 // Set up column sets for the grid layout. |
| 408 const int kTableColumnSetId = 0; | 408 const int kTableColumnSetId = 0; |
| 409 ColumnSet* column_set = layout->AddColumnSet(kTableColumnSetId); | 409 ColumnSet* column_set = layout->AddColumnSet(kTableColumnSetId); |
| 410 column_set->AddColumn(GridLayout::FILL, GridLayout::FILL, 1, | 410 column_set->AddColumn(GridLayout::FILL, GridLayout::FILL, 1, |
| 411 GridLayout::USE_PREF, 0, 0); | 411 GridLayout::USE_PREF, 0, 0); |
| 412 | 412 |
| 413 // Create the language table. | 413 // Create the language table. |
| 414 std::vector<TableColumn> columns; | 414 std::vector<TableColumn> columns; |
| 415 TableColumn column(0, | 415 TableColumn column(0, |
| 416 l10n_util::GetString( | 416 l10n_util::GetStringUTF16( |
| 417 IDS_OPTIONS_SETTINGS_LANGUAGES_LANGUAGES), | 417 IDS_OPTIONS_SETTINGS_LANGUAGES_LANGUAGES), |
| 418 TableColumn::LEFT, -1, 0); | 418 TableColumn::LEFT, -1, 0); |
| 419 columns.push_back(column); | 419 columns.push_back(column); |
| 420 // We don't show horizontal and vertical lines. | 420 // We don't show horizontal and vertical lines. |
| 421 const int options = (views::TableView2::SINGLE_SELECTION | | 421 const int options = (views::TableView2::SINGLE_SELECTION | |
| 422 views::TableView2::RESIZABLE_COLUMNS | | 422 views::TableView2::RESIZABLE_COLUMNS | |
| 423 views::TableView2::AUTOSIZE_COLUMNS); | 423 views::TableView2::AUTOSIZE_COLUMNS); |
| 424 preferred_language_table_ = | 424 preferred_language_table_ = |
| 425 new views::TableView2(this, columns, views::TEXT_ONLY, options); | 425 new views::TableView2(this, columns, views::TEXT_ONLY, options); |
| 426 // Set the observer so OnSelectionChanged() will be invoked when a | 426 // Set the observer so OnSelectionChanged() will be invoked when a |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 621 | 621 |
| 622 void LanguageConfigView::EnableAllCheckboxes() { | 622 void LanguageConfigView::EnableAllCheckboxes() { |
| 623 for (std::set<InputMethodCheckbox*>::iterator checkbox = | 623 for (std::set<InputMethodCheckbox*>::iterator checkbox = |
| 624 input_method_checkboxes_.begin(); | 624 input_method_checkboxes_.begin(); |
| 625 checkbox != input_method_checkboxes_.end(); ++checkbox) { | 625 checkbox != input_method_checkboxes_.end(); ++checkbox) { |
| 626 (*checkbox)->SetEnabled(true); | 626 (*checkbox)->SetEnabled(true); |
| 627 } | 627 } |
| 628 } | 628 } |
| 629 | 629 |
| 630 } // namespace chromeos | 630 } // namespace chromeos |
| OLD | NEW |