summaryrefslogtreecommitdiffstats
path: root/chrome/browser/views/options
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-21 03:43:45 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-21 03:43:45 +0000
commiteea372e5ae883c1a9853086e54b43896aa72df36 (patch)
treef8345aa56206a072496d69554f805fe189483011 /chrome/browser/views/options
parentb343f1c73ce201d34fe41037734f57f68dffe2f6 (diff)
downloadchromium_src-eea372e5ae883c1a9853086e54b43896aa72df36.zip
chromium_src-eea372e5ae883c1a9853086e54b43896aa72df36.tar.gz
chromium_src-eea372e5ae883c1a9853086e54b43896aa72df36.tar.bz2
Try to make TextField::Controller implementors cross-platform by abstracting
away the keystroke message that is passed. It turns out implementoars only ever check for enter and escape messages, so I wrote two functions in TextField that will decode the new Keyboard event. This design is not optimal. Ideally we would have something more like the WebInputEvent so that callers can check for anything in a cross-platform way. This was branched off from the original review: http://codereview.chromium.org/113639 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16577 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views/options')
-rw-r--r--chrome/browser/views/options/cookies_view.cc17
-rw-r--r--chrome/browser/views/options/cookies_view.h3
-rw-r--r--chrome/browser/views/options/general_page_view.cc3
-rw-r--r--chrome/browser/views/options/general_page_view.h5
4 files changed, 11 insertions, 17 deletions
diff --git a/chrome/browser/views/options/cookies_view.cc b/chrome/browser/views/options/cookies_view.cc
index f937c6d..ac5e495 100644
--- a/chrome/browser/views/options/cookies_view.cc
+++ b/chrome/browser/views/options/cookies_view.cc
@@ -620,16 +620,13 @@ void CookiesView::ContentsChanged(views::TextField* sender,
&CookiesView::UpdateSearchResults), kSearchFilterDelayMs);
}
-bool CookiesView::HandleKeystroke(views::TextField* sender, UINT message,
- TCHAR key, UINT repeat_count, UINT flags) {
- switch (key) {
- case VK_ESCAPE:
- ResetSearchQuery();
- break;
- case VK_RETURN:
- search_update_factory_.RevokeAll();
- UpdateSearchResults();
- break;
+bool CookiesView::HandleKeystroke(views::TextField* sender,
+ const views::TextField::Keystroke& key) {
+ if (views::TextField::IsKeystrokeEscape(key)) {
+ ResetSearchQuery();
+ } else if (views::TextField::IsKeystrokeEnter(key)) {
+ search_update_factory_.RevokeAll();
+ UpdateSearchResults();
}
return false;
}
diff --git a/chrome/browser/views/options/cookies_view.h b/chrome/browser/views/options/cookies_view.h
index f2bc98a..7de565d 100644
--- a/chrome/browser/views/options/cookies_view.h
+++ b/chrome/browser/views/options/cookies_view.h
@@ -51,8 +51,7 @@ class CookiesView : public views::View,
virtual void ContentsChanged(views::TextField* sender,
const std::wstring& new_contents);
virtual bool HandleKeystroke(views::TextField* sender,
- UINT message, TCHAR key, UINT repeat_count,
- UINT flags);
+ const views::TextField::Keystroke& key);
// views::WindowDelegate implementation:
virtual int GetDialogButtons() const {
diff --git a/chrome/browser/views/options/general_page_view.cc b/chrome/browser/views/options/general_page_view.cc
index 7c54d5c..35af571 100644
--- a/chrome/browser/views/options/general_page_view.cc
+++ b/chrome/browser/views/options/general_page_view.cc
@@ -619,8 +619,7 @@ void GeneralPageView::ContentsChanged(views::TextField* sender,
}
bool GeneralPageView::HandleKeystroke(views::TextField* sender,
- UINT message, TCHAR key,
- UINT repeat_count, UINT flags) {
+ const views::TextField::Keystroke&) {
return false;
}
diff --git a/chrome/browser/views/options/general_page_view.h b/chrome/browser/views/options/general_page_view.h
index 800cd04..1e2d72f 100644
--- a/chrome/browser/views/options/general_page_view.h
+++ b/chrome/browser/views/options/general_page_view.h
@@ -50,10 +50,9 @@ class GeneralPageView : public OptionsPageView,
// views::TextField::Controller implementation:
virtual void ContentsChanged(views::TextField* sender,
- const std::wstring& new_contents);
+ const std::wstring& new_contents);
virtual bool HandleKeystroke(views::TextField* sender,
- UINT message, TCHAR key, UINT repeat_count,
- UINT flags);
+ const views::TextField::Keystroke& key);
// OptionsPageView implementation:
virtual void InitControlLayout();