summaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authormukai@chromium.org <mukai@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-11 11:55:36 +0000
committermukai@chromium.org <mukai@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-11 11:55:36 +0000
commit9493259b660f9f1e43c6cc7ef777917fd16e1b46 (patch)
treeb36c8f9d6c18cbfa18d3aa6a6bf35b7928045350 /ui
parent90d4f1d9c1c2f286db8da233c81d16a1f19abd02 (diff)
downloadchromium_src-9493259b660f9f1e43c6cc7ef777917fd16e1b46.zip
chromium_src-9493259b660f9f1e43c6cc7ef777917fd16e1b46.tar.gz
chromium_src-9493259b660f9f1e43c6cc7ef777917fd16e1b46.tar.bz2
Fixes initial focus of settings view for scrolling.
The arrow keys should move the scrolls of notifier settings view, but it doesn't when it pops up, because the initially focused view is NULL at that point. To allow scrolling by arrow keys when nothing is focused, this CL does the following things: - the settings view is now focusable but no focus border when it pops up, so focus looks NULL but keyboard events come to the view - the keyboard event is forwarded to scroller, so it scrolls up/down - when the keyboard focus is moved to an entry, then this handling is no longer necessary. Thus it exits from the focus cycle by calling set_focusable(false) BUG=230021 Review URL: https://chromiumcodereview.appspot.com/13917005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@193619 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui')
-rw-r--r--ui/message_center/views/notifier_settings_view.cc14
-rw-r--r--ui/message_center/views/notifier_settings_view.h3
2 files changed, 17 insertions, 0 deletions
diff --git a/ui/message_center/views/notifier_settings_view.cc b/ui/message_center/views/notifier_settings_view.cc
index 36f6f45..867d9e7 100644
--- a/ui/message_center/views/notifier_settings_view.cc
+++ b/ui/message_center/views/notifier_settings_view.cc
@@ -244,6 +244,8 @@ NotifierSettingsView::NotifierSettingsView(
DCHECK(delegate_);
set_background(views::Background::CreateSolidBackground(SK_ColorWHITE));
+ set_focusable(true);
+ set_focus_border(NULL);
gfx::Font title_font =
ResourceBundle::GetSharedInstance().GetFont(ResourceBundle::MediumFont);
@@ -289,6 +291,10 @@ NotifierSettingsView::~NotifierSettingsView() {
settings_view_ = NULL;
}
+views::View* NotifierSettingsView::GetInitiallyFocusedView() {
+ return this;
+}
+
void NotifierSettingsView::WindowClosing() {
if (delegate_)
delegate_->OnNotifierSettingsClosing();
@@ -329,6 +335,14 @@ gfx::Size NotifierSettingsView::GetPreferredSize() {
return GetMinimumSize();
}
+void NotifierSettingsView::OnBlur() {
+ set_focusable(false);
+}
+
+bool NotifierSettingsView::OnKeyPressed(const ui::KeyEvent& event) {
+ return scroller_->OnKeyPressed(event);
+}
+
void NotifierSettingsView::ButtonPressed(views::Button* sender,
const ui::Event& event) {
std::set<NotifierButton*>::iterator iter = buttons_.find(
diff --git a/ui/message_center/views/notifier_settings_view.h b/ui/message_center/views/notifier_settings_view.h
index b6c3032..68db79b 100644
--- a/ui/message_center/views/notifier_settings_view.h
+++ b/ui/message_center/views/notifier_settings_view.h
@@ -52,6 +52,7 @@ class MESSAGE_CENTER_EXPORT NotifierSettingsView
virtual ~NotifierSettingsView();
// Overridden from views::WidgetDelegate:
+ virtual views::View* GetInitiallyFocusedView() OVERRIDE;
virtual void WindowClosing() OVERRIDE;
virtual views::View* GetContentsView() OVERRIDE;
virtual bool CanResize() const OVERRIDE;
@@ -60,6 +61,8 @@ class MESSAGE_CENTER_EXPORT NotifierSettingsView
virtual void Layout() OVERRIDE;
virtual gfx::Size GetMinimumSize() OVERRIDE;
virtual gfx::Size GetPreferredSize() OVERRIDE;
+ virtual void OnBlur() OVERRIDE;
+ virtual bool OnKeyPressed(const ui::KeyEvent& event) OVERRIDE;
// Overridden from views::ButtonListener:
virtual void ButtonPressed(views::Button* sender,