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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 message_center::kNotificationButtonIconSize)); | 47 message_center::kNotificationButtonIconSize)); |
48 icon_->SetImage(image); | 48 icon_->SetImage(image); |
49 icon_->SetHorizontalAlignment(views::ImageView::LEADING); | 49 icon_->SetHorizontalAlignment(views::ImageView::LEADING); |
50 icon_->SetVerticalAlignment(views::ImageView::LEADING); | 50 icon_->SetVerticalAlignment(views::ImageView::LEADING); |
51 icon_->set_border(views::Border::CreateEmptyBorder( | 51 icon_->set_border(views::Border::CreateEmptyBorder( |
52 message_center::kButtonIconTopPadding, 0, 0, 0)); | 52 message_center::kButtonIconTopPadding, 0, 0, 0)); |
53 AddChildViewAt(icon_, 0); | 53 AddChildViewAt(icon_, 0); |
54 } | 54 } |
55 } | 55 } |
56 | 56 |
57 void NotificationButton::SetTitle(const string16& title) { | 57 void NotificationButton::SetTitle(const base::string16& title) { |
58 if (title_ != NULL) | 58 if (title_ != NULL) |
59 delete title_; // This removes the title from this view's children. | 59 delete title_; // This removes the title from this view's children. |
60 if (title.empty()) { | 60 if (title.empty()) { |
61 title_ = NULL; | 61 title_ = NULL; |
62 } else { | 62 } else { |
63 title_ = new views::Label(title); | 63 title_ = new views::Label(title); |
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_->set_border(views::Border::CreateEmptyBorder( | 67 title_->set_border(views::Border::CreateEmptyBorder( |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after 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 |