| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "base/gfx/png_decoder.h" | 9 #include "base/gfx/png_decoder.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 460 TableColumn(IDS_SEARCH_ENGINES_EDITOR_DESCRIPTION_COLUMN, | 460 TableColumn(IDS_SEARCH_ENGINES_EDITOR_DESCRIPTION_COLUMN, |
| 461 TableColumn::LEFT, -1, .75)); | 461 TableColumn::LEFT, -1, .75)); |
| 462 columns.back().sortable = true; | 462 columns.back().sortable = true; |
| 463 columns.push_back( | 463 columns.push_back( |
| 464 TableColumn(IDS_SEARCH_ENGINES_EDITOR_KEYWORD_COLUMN, | 464 TableColumn(IDS_SEARCH_ENGINES_EDITOR_KEYWORD_COLUMN, |
| 465 TableColumn::LEFT, -1, .25)); | 465 TableColumn::LEFT, -1, .25)); |
| 466 columns.back().sortable = true; | 466 columns.back().sortable = true; |
| 467 table_view_ = new views::TableView(table_model_.get(), columns, | 467 table_view_ = new views::TableView(table_model_.get(), columns, |
| 468 views::ICON_AND_TEXT, false, true, true); | 468 views::ICON_AND_TEXT, false, true, true); |
| 469 table_view_->SetObserver(this); | 469 table_view_->SetObserver(this); |
| 470 // Make the table initially sorted by name. | |
| 471 views::TableView::SortDescriptors sort; | |
| 472 sort.push_back(views::TableView::SortDescriptor( | |
| 473 IDS_SEARCH_ENGINES_EDITOR_DESCRIPTION_COLUMN, true)); | |
| 474 table_view_->SetSortDescriptors(sort); | |
| 475 | 470 |
| 476 add_button_ = new views::NativeButton( | 471 add_button_ = new views::NativeButton( |
| 477 l10n_util::GetString(IDS_SEARCH_ENGINES_EDITOR_NEW_BUTTON)); | 472 l10n_util::GetString(IDS_SEARCH_ENGINES_EDITOR_NEW_BUTTON)); |
| 478 add_button_->SetEnabled(url_model_->loaded()); | 473 add_button_->SetEnabled(url_model_->loaded()); |
| 479 add_button_->SetListener(this); | 474 add_button_->SetListener(this); |
| 480 | 475 |
| 481 edit_button_ = new views::NativeButton( | 476 edit_button_ = new views::NativeButton( |
| 482 l10n_util::GetString(IDS_SEARCH_ENGINES_EDITOR_EDIT_BUTTON)); | 477 l10n_util::GetString(IDS_SEARCH_ENGINES_EDITOR_EDIT_BUTTON)); |
| 483 edit_button_->SetEnabled(false); | 478 edit_button_->SetEnabled(false); |
| 484 edit_button_->SetListener(this); | 479 edit_button_->SetListener(this); |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 628 } | 623 } |
| 629 const int new_index = table_model_->IndexOfTemplateURL(keyword); | 624 const int new_index = table_model_->IndexOfTemplateURL(keyword); |
| 630 table_model_->NotifyChanged(new_index); | 625 table_model_->NotifyChanged(new_index); |
| 631 | 626 |
| 632 // Make sure the new default is in the main group. | 627 // Make sure the new default is in the main group. |
| 633 table_model_->MoveToMainGroup(index); | 628 table_model_->MoveToMainGroup(index); |
| 634 | 629 |
| 635 // And select it. | 630 // And select it. |
| 636 table_view_->Select(table_model_->IndexOfTemplateURL(keyword)); | 631 table_view_->Select(table_model_->IndexOfTemplateURL(keyword)); |
| 637 } | 632 } |
| OLD | NEW |