diff options
author | sky@google.com <sky@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-26 00:26:26 +0000 |
---|---|---|
committer | sky@google.com <sky@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-26 00:26:26 +0000 |
commit | 802cbf0fc2d88085b7ef5c5fa01d32b261287d6f (patch) | |
tree | 7b78d590d1aba7623ac8c82cbca9de766fc216a3 /chrome/browser | |
parent | f42d28c678cd72979d64eebed9ea879c59e2576a (diff) | |
download | chromium_src-802cbf0fc2d88085b7ef5c5fa01d32b261287d6f.zip chromium_src-802cbf0fc2d88085b7ef5c5fa01d32b261287d6f.tar.gz chromium_src-802cbf0fc2d88085b7ef5c5fa01d32b261287d6f.tar.bz2 |
Changes keyword editor to map all input in the keyword field to lower
case.
BUG=4520
TEST=bring up the keyword editor, type some text and make sure it gets
mapped to lower case.
Review URL: http://codereview.chromium.org/12452
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@6018 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r-- | chrome/browser/views/edit_keyword_controller.cc | 18 | ||||
-rw-r--r-- | chrome/browser/views/edit_keyword_controller.h | 13 |
2 files changed, 17 insertions, 14 deletions
diff --git a/chrome/browser/views/edit_keyword_controller.cc b/chrome/browser/views/edit_keyword_controller.cc index 0ae528b..efbb43e 100644 --- a/chrome/browser/views/edit_keyword_controller.cc +++ b/chrome/browser/views/edit_keyword_controller.cc @@ -173,16 +173,16 @@ void EditKeywordController::Init() { // Create the views we'll need. view_ = new views::View(); if (template_url_) { - title_tf_ = CreateTextField(template_url_->short_name()); - keyword_tf_ = CreateTextField(template_url_->keyword()); - url_tf_ = CreateTextField(GetDisplayURL(*template_url_)); + title_tf_ = CreateTextField(template_url_->short_name(), false); + keyword_tf_ = CreateTextField(template_url_->keyword(), true); + url_tf_ = CreateTextField(GetDisplayURL(*template_url_), false); // 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(template_url_->prepopulate_id() != 0); } else { - title_tf_ = CreateTextField(std::wstring()); - keyword_tf_ = CreateTextField(std::wstring()); - url_tf_ = CreateTextField(std::wstring()); + title_tf_ = CreateTextField(std::wstring(), false); + keyword_tf_ = CreateTextField(std::wstring(), true); + url_tf_ = CreateTextField(std::wstring(), false); } title_iv_ = new ImageView(); keyword_iv_ = new ImageView(); @@ -277,8 +277,10 @@ views::Label* EditKeywordController::CreateLabel(int message_id) { return label; } -TextField* EditKeywordController::CreateTextField(const std::wstring& text) { - TextField* text_field = new TextField(); +TextField* EditKeywordController::CreateTextField(const std::wstring& text, + bool lowercase) { + TextField* text_field = new TextField( + lowercase ? TextField::STYLE_LOWERCASE : TextField::STYLE_DEFAULT); text_field->SetText(text); text_field->SetController(this); return text_field; diff --git a/chrome/browser/views/edit_keyword_controller.h b/chrome/browser/views/edit_keyword_controller.h index fa01a4f..7268e89 100644 --- a/chrome/browser/views/edit_keyword_controller.h +++ b/chrome/browser/views/edit_keyword_controller.h @@ -7,8 +7,8 @@ // dialog, and also on its own to confirm the addition of a keyword added by // the ExternalJSObject via the RenderView. -#ifndef CHROME_BROWSER_VIEWS_EDIT_KEYWORD_CONTROLLER_H__ -#define CHROME_BROWSER_VIEWS_EDIT_KEYWORD_CONTROLLER_H__ +#ifndef CHROME_BROWSER_VIEWS_EDIT_KEYWORD_CONTROLLER_H_ +#define CHROME_BROWSER_VIEWS_EDIT_KEYWORD_CONTROLLER_H_ #include <Windows.h> @@ -68,8 +68,9 @@ class EditKeywordController : public views::TextField::Controller, // Create a Label containing the text with the specified message id. views::Label* CreateLabel(int message_id); - // Creates a text field with the specified text. - views::TextField* CreateTextField(const std::wstring& text); + // Creates a text field with the specified text. If |lowercase| is true, the + // textfield is configured to map all input to lower case. + views::TextField* CreateTextField(const std::wstring& text, bool lowercase); // Returns true if the currently input URL is valid. The URL is valid if it // contains no search terms and is a valid url, or if it contains a search @@ -128,7 +129,7 @@ class EditKeywordController : public views::TextField::Controller, views::ImageView* keyword_iv_; views::ImageView* url_iv_; - DISALLOW_EVIL_CONSTRUCTORS(EditKeywordController); + DISALLOW_COPY_AND_ASSIGN(EditKeywordController); }; -#endif // CHROME_BROWSER_VIEWS_EDIT_KEYWORD_CONTROLLER_H__ +#endif // CHROME_BROWSER_VIEWS_EDIT_KEYWORD_CONTROLLER_H_ |