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/message_center_button_bar.h" | 5 #include "ui/message_center/views/message_center_button_bar.h" |
6 | 6 |
7 #include "base/macros.h" | 7 #include "base/macros.h" |
8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
9 #include "ui/base/models/simple_menu_model.h" | 9 #include "ui/base/models/simple_menu_model.h" |
10 #include "ui/base/resource/resource_bundle.h" | 10 #include "ui/base/resource/resource_bundle.h" |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 }; | 61 }; |
62 | 62 |
63 NotificationCenterButton::NotificationCenterButton( | 63 NotificationCenterButton::NotificationCenterButton( |
64 views::ButtonListener* listener, | 64 views::ButtonListener* listener, |
65 int normal_id, | 65 int normal_id, |
66 int hover_id, | 66 int hover_id, |
67 int pressed_id, | 67 int pressed_id, |
68 int text_id) | 68 int text_id) |
69 : views::ToggleImageButton(listener), size_(kButtonSize, kButtonSize) { | 69 : views::ToggleImageButton(listener), size_(kButtonSize, kButtonSize) { |
70 ui::ResourceBundle& resource_bundle = ui::ResourceBundle::GetSharedInstance(); | 70 ui::ResourceBundle& resource_bundle = ui::ResourceBundle::GetSharedInstance(); |
71 SetImage(STATE_NORMAL, resource_bundle.GetImageSkiaNamed(normal_id)); | 71 SetImage(STATE_NORMAL, *resource_bundle.GetImageSkiaNamed(normal_id)); |
72 SetImage(STATE_HOVERED, resource_bundle.GetImageSkiaNamed(hover_id)); | 72 SetImage(STATE_HOVERED, *resource_bundle.GetImageSkiaNamed(hover_id)); |
73 SetImage(STATE_PRESSED, resource_bundle.GetImageSkiaNamed(pressed_id)); | 73 SetImage(STATE_PRESSED, *resource_bundle.GetImageSkiaNamed(pressed_id)); |
74 SetImageAlignment(views::ImageButton::ALIGN_CENTER, | 74 SetImageAlignment(views::ImageButton::ALIGN_CENTER, |
75 views::ImageButton::ALIGN_MIDDLE); | 75 views::ImageButton::ALIGN_MIDDLE); |
76 if (text_id) | 76 if (text_id) |
77 SetTooltipText(resource_bundle.GetLocalizedString(text_id)); | 77 SetTooltipText(resource_bundle.GetLocalizedString(text_id)); |
78 | 78 |
79 SetFocusForPlatform(); | 79 SetFocusForPlatform(); |
80 | 80 |
81 SetFocusPainter(views::Painter::CreateSolidFocusPainter( | 81 SetFocusPainter(views::Painter::CreateSolidFocusPainter( |
82 kFocusBorderColor, | 82 kFocusBorderColor, |
83 gfx::Insets(1, 2, 2, 2))); | 83 gfx::Insets(1, 2, 2, 2))); |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 button_container_->AddChildView(quiet_mode_button_); | 152 button_container_->AddChildView(quiet_mode_button_); |
153 | 153 |
154 close_all_button_ = | 154 close_all_button_ = |
155 new NotificationCenterButton(this, | 155 new NotificationCenterButton(this, |
156 IDR_NOTIFICATION_CLEAR_ALL, | 156 IDR_NOTIFICATION_CLEAR_ALL, |
157 IDR_NOTIFICATION_CLEAR_ALL_HOVER, | 157 IDR_NOTIFICATION_CLEAR_ALL_HOVER, |
158 IDR_NOTIFICATION_CLEAR_ALL_PRESSED, | 158 IDR_NOTIFICATION_CLEAR_ALL_PRESSED, |
159 IDS_MESSAGE_CENTER_CLEAR_ALL); | 159 IDS_MESSAGE_CENTER_CLEAR_ALL); |
160 close_all_button_->SetImage( | 160 close_all_button_->SetImage( |
161 views::Button::STATE_DISABLED, | 161 views::Button::STATE_DISABLED, |
162 resource_bundle.GetImageSkiaNamed(IDR_NOTIFICATION_CLEAR_ALL_DISABLED)); | 162 *resource_bundle.GetImageSkiaNamed(IDR_NOTIFICATION_CLEAR_ALL_DISABLED)); |
163 button_container_->AddChildView(close_all_button_); | 163 button_container_->AddChildView(close_all_button_); |
164 | 164 |
165 settings_button_ = | 165 settings_button_ = |
166 new NotificationCenterButton(this, | 166 new NotificationCenterButton(this, |
167 IDR_NOTIFICATION_SETTINGS, | 167 IDR_NOTIFICATION_SETTINGS, |
168 IDR_NOTIFICATION_SETTINGS_HOVER, | 168 IDR_NOTIFICATION_SETTINGS_HOVER, |
169 IDR_NOTIFICATION_SETTINGS_PRESSED, | 169 IDR_NOTIFICATION_SETTINGS_PRESSED, |
170 IDS_MESSAGE_CENTER_SETTINGS_BUTTON_LABEL); | 170 IDS_MESSAGE_CENTER_SETTINGS_BUTTON_LABEL); |
171 button_container_->AddChildView(settings_button_); | 171 button_container_->AddChildView(settings_button_); |
172 | 172 |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) | 300 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) |
301 } else if (sender == close_bubble_button_) { | 301 } else if (sender == close_bubble_button_) { |
302 message_center_view()->tray()->HideMessageCenterBubble(); | 302 message_center_view()->tray()->HideMessageCenterBubble(); |
303 #endif | 303 #endif |
304 } else { | 304 } else { |
305 NOTREACHED(); | 305 NOTREACHED(); |
306 } | 306 } |
307 } | 307 } |
308 | 308 |
309 } // namespace message_center | 309 } // namespace message_center |
OLD | NEW |