| 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" |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 title_->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 64 title_->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
| 65 title_->SetEnabledColor(message_center::kRegularTextColor); | 65 title_->SetEnabledColor(message_center::kRegularTextColor); |
| 66 title_->SetBackgroundColor(kRegularTextBackgroundColor); | 66 title_->SetBackgroundColor(kRegularTextBackgroundColor); |
| 67 title_->SetBorder( | 67 title_->SetBorder( |
| 68 views::Border::CreateEmptyBorder(kButtonTitleTopPadding, 0, 0, 0)); | 68 views::Border::CreateEmptyBorder(kButtonTitleTopPadding, 0, 0, 0)); |
| 69 AddChildView(title_); | 69 AddChildView(title_); |
| 70 } | 70 } |
| 71 SetAccessibleName(title); | 71 SetAccessibleName(title); |
| 72 } | 72 } |
| 73 | 73 |
| 74 gfx::Size NotificationButton::GetPreferredSize() { | 74 gfx::Size NotificationButton::GetPreferredSize() const { |
| 75 return gfx::Size(message_center::kNotificationWidth, | 75 return gfx::Size(message_center::kNotificationWidth, |
| 76 message_center::kButtonHeight); | 76 message_center::kButtonHeight); |
| 77 } | 77 } |
| 78 | 78 |
| 79 int NotificationButton::GetHeightForWidth(int width) { | 79 int NotificationButton::GetHeightForWidth(int width) const { |
| 80 return message_center::kButtonHeight; | 80 return message_center::kButtonHeight; |
| 81 } | 81 } |
| 82 | 82 |
| 83 void NotificationButton::OnPaint(gfx::Canvas* canvas) { | 83 void NotificationButton::OnPaint(gfx::Canvas* canvas) { |
| 84 CustomButton::OnPaint(canvas); | 84 CustomButton::OnPaint(canvas); |
| 85 views::Painter::PaintFocusPainter(this, canvas, focus_painter_.get()); | 85 views::Painter::PaintFocusPainter(this, canvas, focus_painter_.get()); |
| 86 } | 86 } |
| 87 | 87 |
| 88 void NotificationButton::OnFocus() { | 88 void NotificationButton::OnFocus() { |
| 89 views::CustomButton::OnFocus(); | 89 views::CustomButton::OnFocus(); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 101 void NotificationButton::StateChanged() { | 101 void NotificationButton::StateChanged() { |
| 102 if (state() == STATE_HOVERED || state() == STATE_PRESSED) { | 102 if (state() == STATE_HOVERED || state() == STATE_PRESSED) { |
| 103 set_background(views::Background::CreateSolidBackground( | 103 set_background(views::Background::CreateSolidBackground( |
| 104 message_center::kHoveredButtonBackgroundColor)); | 104 message_center::kHoveredButtonBackgroundColor)); |
| 105 } else { | 105 } else { |
| 106 set_background(NULL); | 106 set_background(NULL); |
| 107 } | 107 } |
| 108 } | 108 } |
| 109 | 109 |
| 110 } // namespace message_center | 110 } // namespace message_center |
| OLD | NEW |