OLD | NEW |
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" |
11 #include "ui/views/border.h" | 11 #include "ui/views/border.h" |
12 #include "ui/views/controls/image_view.h" | 12 #include "ui/views/controls/image_view.h" |
13 #include "ui/views/controls/label.h" | 13 #include "ui/views/controls/label.h" |
14 #include "ui/views/layout/box_layout.h" | 14 #include "ui/views/layout/box_layout.h" |
15 #include "ui/views/painter.h" | 15 #include "ui/views/painter.h" |
16 | 16 |
17 namespace message_center { | 17 namespace message_center { |
18 | 18 |
19 NotificationButton::NotificationButton(views::ButtonListener* listener) | 19 NotificationButton::NotificationButton(views::ButtonListener* listener) |
20 : views::CustomButton(listener), | 20 : views::CustomButton(listener), |
21 icon_(NULL), | 21 icon_(NULL), |
22 title_(NULL), | 22 title_(NULL), |
23 focus_painter_(views::Painter::CreateSolidFocusPainter( | 23 focus_painter_(views::Painter::CreateSolidFocusPainter( |
24 message_center::kFocusBorderColor, | 24 message_center::kFocusBorderColor, |
25 gfx::Insets(1, 2, 2, 2))) { | 25 gfx::Insets(1, 2, 2, 2))) { |
26 SetFocusBehavior(FocusBehavior::ALWAYS); | 26 Button::ConfigureDefaultFocus(this); |
27 // Create a background so that it does not change when the MessageView | 27 // Create a background so that it does not change when the MessageView |
28 // background changes to show touch feedback | 28 // background changes to show touch feedback |
29 set_background(views::Background::CreateSolidBackground( | 29 set_background(views::Background::CreateSolidBackground( |
30 kNotificationBackgroundColor)); | 30 kNotificationBackgroundColor)); |
31 set_request_focus_on_press(false); | 31 set_request_focus_on_press(false); |
32 set_notify_enter_exit_on_child(true); | 32 set_notify_enter_exit_on_child(true); |
33 SetLayoutManager( | 33 SetLayoutManager( |
34 new views::BoxLayout(views::BoxLayout::kHorizontal, | 34 new views::BoxLayout(views::BoxLayout::kHorizontal, |
35 message_center::kButtonHorizontalPadding, | 35 message_center::kButtonHorizontalPadding, |
36 kButtonVecticalPadding, | 36 kButtonVecticalPadding, |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 if (state() == STATE_HOVERED || state() == STATE_PRESSED) { | 114 if (state() == STATE_HOVERED || state() == STATE_PRESSED) { |
115 set_background(views::Background::CreateSolidBackground( | 115 set_background(views::Background::CreateSolidBackground( |
116 message_center::kHoveredButtonBackgroundColor)); | 116 message_center::kHoveredButtonBackgroundColor)); |
117 } else { | 117 } else { |
118 set_background(views::Background::CreateSolidBackground( | 118 set_background(views::Background::CreateSolidBackground( |
119 kNotificationBackgroundColor)); | 119 kNotificationBackgroundColor)); |
120 } | 120 } |
121 } | 121 } |
122 | 122 |
123 } // namespace message_center | 123 } // namespace message_center |
OLD | NEW |