Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(15)

Unified Diff: ui/message_center/views/notification_view.cc

Issue 14198004: Scrolls to the notification when focus moves to its buttons. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/message_center/views/notification_view.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/message_center/views/notification_view.cc
diff --git a/ui/message_center/views/notification_view.cc b/ui/message_center/views/notification_view.cc
index f4a0572414d4d1e489d8cd67def9d2b967e62122..9736e668272af02a0d54151cbecd6fe45f9b3f32 100644
--- a/ui/message_center/views/notification_view.cc
+++ b/ui/message_center/views/notification_view.cc
@@ -224,6 +224,7 @@ class NotificationButton : public views::CustomButton {
// Overridden from views::View:
virtual gfx::Size GetPreferredSize() OVERRIDE;
virtual int GetHeightForWidth(int width) OVERRIDE;
+ virtual void OnFocus() OVERRIDE;
// Overridden from views::CustomButton:
virtual void StateChanged() OVERRIDE;
@@ -288,6 +289,10 @@ int NotificationButton::GetHeightForWidth(int width) {
return kButtonHeight;
}
+void NotificationButton::OnFocus() {
+ ScrollRectToVisible(GetLocalBounds());
+}
+
void NotificationButton::StateChanged() {
if (state() == STATE_HOVERED || state() == STATE_PRESSED)
set_background(MakeBackground(kHoveredButtonBackgroundColor));
@@ -498,6 +503,12 @@ void NotificationView::Layout() {
}
}
+void NotificationView::ScrollRectToVisible(const gfx::Rect& rect) {
+ // Notification want to show the whole notification when a part of it (like
+ // a button) gets focused.
+ views::View::ScrollRectToVisible(GetLocalBounds());
+}
+
void NotificationView::ButtonPressed(views::Button* sender,
const ui::Event& event) {
// See if the button pressed was an action button.
« no previous file with comments | « ui/message_center/views/notification_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698