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

Side by Side Diff: ui/message_center/views/notification_button.cc

Issue 273173003: Notifications: Retain button hover state during content updates. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/message_center/views/notification_button.h" 5 #include "ui/message_center/views/notification_button.h"
6 6
7 #include "ui/gfx/canvas.h" 7 #include "ui/gfx/canvas.h"
8 #include "ui/message_center/message_center_style.h" 8 #include "ui/message_center/message_center_style.h"
9 #include "ui/message_center/views/constants.h" 9 #include "ui/message_center/views/constants.h"
10 #include "ui/views/background.h" 10 #include "ui/views/background.h"
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 // We render differently when focused. 91 // We render differently when focused.
92 SchedulePaint(); 92 SchedulePaint();
93 } 93 }
94 94
95 void NotificationButton::OnBlur() { 95 void NotificationButton::OnBlur() {
96 views::CustomButton::OnBlur(); 96 views::CustomButton::OnBlur();
97 // We render differently when focused. 97 // We render differently when focused.
98 SchedulePaint(); 98 SchedulePaint();
99 } 99 }
100 100
101 void NotificationButton::ViewHierarchyChanged(
102 const ViewHierarchyChangedDetails& details) {
103 // We disable view hierarchy change detection in the parent
104 // because it resets the hoverstate, which we do not want
105 // when we update the view to contain a new label or image.
106 views::View::ViewHierarchyChanged(details);
107 }
108
101 void NotificationButton::StateChanged() { 109 void NotificationButton::StateChanged() {
102 if (state() == STATE_HOVERED || state() == STATE_PRESSED) { 110 if (state() == STATE_HOVERED || state() == STATE_PRESSED) {
103 set_background(views::Background::CreateSolidBackground( 111 set_background(views::Background::CreateSolidBackground(
104 message_center::kHoveredButtonBackgroundColor)); 112 message_center::kHoveredButtonBackgroundColor));
105 } else { 113 } else {
106 set_background(NULL); 114 set_background(NULL);
107 } 115 }
108 } 116 }
109 117
110 } // namespace message_center 118 } // namespace message_center
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698