| Index: chrome/browser/ui/views/edit_search_engine_dialog.cc
|
| diff --git a/chrome/browser/ui/views/edit_search_engine_dialog.cc b/chrome/browser/ui/views/edit_search_engine_dialog.cc
|
| index 711422266c1827483262057fb947c0a77f29e6d1..50a49aea318f19e40795e86650d5480bac918c96 100644
|
| --- a/chrome/browser/ui/views/edit_search_engine_dialog.cc
|
| +++ b/chrome/browser/ui/views/edit_search_engine_dialog.cc
|
| @@ -4,6 +4,7 @@
|
|
|
| #include "chrome/browser/ui/views/edit_search_engine_dialog.h"
|
|
|
| +#include "base/i18n/case_conversion.h"
|
| #include "base/i18n/rtl.h"
|
| #include "base/strings/string_util.h"
|
| #include "base/strings/utf_string_conversions.h"
|
| @@ -102,6 +103,14 @@ bool EditSearchEngineDialog::Accept() {
|
| void EditSearchEngineDialog::ContentsChanged(
|
| Textfield* sender,
|
| const base::string16& new_contents) {
|
| + // Force the keyword text to be lowercase, keep the caret or selection.
|
| + if (sender == keyword_tf_ && !sender->HasCompositionText()) {
|
| + // TODO(msw): Prevent textfield scrolling with selection model changes here.
|
| + const gfx::SelectionModel selection_model = sender->GetSelectionModel();
|
| + sender->SetText(base::i18n::ToLower(new_contents));
|
| + sender->SelectSelectionModel(selection_model);
|
| + }
|
| +
|
| GetDialogClientView()->UpdateDialogButtons();
|
| UpdateImageViews();
|
| }
|
| @@ -115,18 +124,17 @@ bool EditSearchEngineDialog::HandleKeyEvent(
|
| void EditSearchEngineDialog::Init() {
|
| // Create the views we'll need.
|
| if (controller_->template_url()) {
|
| - title_tf_ = CreateTextfield(controller_->template_url()->short_name(),
|
| - false);
|
| - keyword_tf_ = CreateTextfield(controller_->template_url()->keyword(), true);
|
| + title_tf_ = CreateTextfield(controller_->template_url()->short_name());
|
| + keyword_tf_ = CreateTextfield(controller_->template_url()->keyword());
|
| url_tf_ = CreateTextfield(
|
| - controller_->template_url()->url_ref().DisplayURL(), false);
|
| + controller_->template_url()->url_ref().DisplayURL());
|
| // We don't allow users to edit prepopulate URLs. This is done as
|
| // occasionally we need to update the URL of prepopulated TemplateURLs.
|
| url_tf_->SetReadOnly(controller_->template_url()->prepopulate_id() != 0);
|
| } else {
|
| - title_tf_ = CreateTextfield(base::string16(), false);
|
| - keyword_tf_ = CreateTextfield(base::string16(), true);
|
| - url_tf_ = CreateTextfield(base::string16(), false);
|
| + title_tf_ = CreateTextfield(base::string16());
|
| + keyword_tf_ = CreateTextfield(base::string16());
|
| + url_tf_ = CreateTextfield(base::string16());
|
| }
|
| title_iv_ = new views::ImageView();
|
| keyword_iv_ = new views::ImageView();
|
| @@ -223,12 +231,10 @@ views::Label* EditSearchEngineDialog::CreateLabel(int message_id) {
|
| return label;
|
| }
|
|
|
| -Textfield* EditSearchEngineDialog::CreateTextfield(const base::string16& text,
|
| - bool lowercase) {
|
| - Textfield* text_field = new Textfield(
|
| - lowercase ? Textfield::STYLE_LOWERCASE : Textfield::STYLE_DEFAULT);
|
| +Textfield* EditSearchEngineDialog::CreateTextfield(const base::string16& text) {
|
| + Textfield* text_field = new Textfield();
|
| text_field->SetText(text);
|
| - text_field->SetController(this);
|
| + text_field->set_controller(this);
|
| return text_field;
|
| }
|
|
|
|
|