| 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 "grit/ui_resources.h" | 7 #include "grit/ui_resources.h" |
| 8 #include "grit/ui_strings.h" | 8 #include "grit/ui_strings.h" |
| 9 #include "ui/base/l10n/l10n_util.h" | 9 #include "ui/base/l10n/l10n_util.h" |
| 10 #include "ui/base/models/simple_menu_model.h" | 10 #include "ui/base/models/simple_menu_model.h" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 : views::ToggleImageButton(listener), size_(kButtonSize, kButtonSize) { | 67 : views::ToggleImageButton(listener), size_(kButtonSize, kButtonSize) { |
| 68 ui::ResourceBundle& resource_bundle = ui::ResourceBundle::GetSharedInstance(); | 68 ui::ResourceBundle& resource_bundle = ui::ResourceBundle::GetSharedInstance(); |
| 69 SetImage(STATE_NORMAL, resource_bundle.GetImageSkiaNamed(normal_id)); | 69 SetImage(STATE_NORMAL, resource_bundle.GetImageSkiaNamed(normal_id)); |
| 70 SetImage(STATE_HOVERED, resource_bundle.GetImageSkiaNamed(hover_id)); | 70 SetImage(STATE_HOVERED, resource_bundle.GetImageSkiaNamed(hover_id)); |
| 71 SetImage(STATE_PRESSED, resource_bundle.GetImageSkiaNamed(pressed_id)); | 71 SetImage(STATE_PRESSED, resource_bundle.GetImageSkiaNamed(pressed_id)); |
| 72 SetImageAlignment(views::ImageButton::ALIGN_CENTER, | 72 SetImageAlignment(views::ImageButton::ALIGN_CENTER, |
| 73 views::ImageButton::ALIGN_MIDDLE); | 73 views::ImageButton::ALIGN_MIDDLE); |
| 74 if (text_id) | 74 if (text_id) |
| 75 SetTooltipText(resource_bundle.GetLocalizedString(text_id)); | 75 SetTooltipText(resource_bundle.GetLocalizedString(text_id)); |
| 76 | 76 |
| 77 set_focusable(true); | 77 SetFocusable(true); |
| 78 set_request_focus_on_press(false); | 78 set_request_focus_on_press(false); |
| 79 | 79 |
| 80 SetFocusPainter(views::Painter::CreateSolidFocusPainter( | 80 SetFocusPainter(views::Painter::CreateSolidFocusPainter( |
| 81 kFocusBorderColor, | 81 kFocusBorderColor, |
| 82 gfx::Insets(1, 2, 2, 2))); | 82 gfx::Insets(1, 2, 2, 2))); |
| 83 } | 83 } |
| 84 | 84 |
| 85 gfx::Size NotificationCenterButton::GetPreferredSize() { return size_; } | 85 gfx::Size NotificationCenterButton::GetPreferredSize() { return size_; } |
| 86 | 86 |
| 87 // MessageCenterButtonBar ///////////////////////////////////////////////////// | 87 // MessageCenterButtonBar ///////////////////////////////////////////////////// |
| (...skipping 19 matching lines...) Expand all Loading... |
| 107 ui::ResourceBundle& resource_bundle = ui::ResourceBundle::GetSharedInstance(); | 107 ui::ResourceBundle& resource_bundle = ui::ResourceBundle::GetSharedInstance(); |
| 108 | 108 |
| 109 title_arrow_ = new NotificationCenterButton(this, | 109 title_arrow_ = new NotificationCenterButton(this, |
| 110 IDR_NOTIFICATION_ARROW, | 110 IDR_NOTIFICATION_ARROW, |
| 111 IDR_NOTIFICATION_ARROW_HOVER, | 111 IDR_NOTIFICATION_ARROW_HOVER, |
| 112 IDR_NOTIFICATION_ARROW_PRESSED, | 112 IDR_NOTIFICATION_ARROW_PRESSED, |
| 113 0); | 113 0); |
| 114 title_arrow_->set_size(gfx::Size(kChevronWidth, kButtonSize)); | 114 title_arrow_->set_size(gfx::Size(kChevronWidth, kButtonSize)); |
| 115 | 115 |
| 116 // Keyboardists can use the gear button to switch modes. | 116 // Keyboardists can use the gear button to switch modes. |
| 117 title_arrow_->set_focusable(false); | 117 title_arrow_->SetFocusable(false); |
| 118 AddChildView(title_arrow_); | 118 AddChildView(title_arrow_); |
| 119 | 119 |
| 120 gfx::Font notification_label_font = | 120 gfx::Font notification_label_font = |
| 121 ResourceBundle::GetSharedInstance().GetFont(ResourceBundle::BaseFont); | 121 ResourceBundle::GetSharedInstance().GetFont(ResourceBundle::BaseFont); |
| 122 notification_label_ = new views::Label( | 122 notification_label_ = new views::Label( |
| 123 l10n_util::GetStringUTF16(IDS_MESSAGE_CENTER_FOOTER_TITLE), | 123 l10n_util::GetStringUTF16(IDS_MESSAGE_CENTER_FOOTER_TITLE), |
| 124 notification_label_font); | 124 notification_label_font); |
| 125 notification_label_->SetAutoColorReadabilityEnabled(false); | 125 notification_label_->SetAutoColorReadabilityEnabled(false); |
| 126 notification_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 126 notification_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
| 127 notification_label_->SetEnabledColor(kRegularTextColor); | 127 notification_label_->SetEnabledColor(kRegularTextColor); |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 message_center()->SetQuietMode(false); | 262 message_center()->SetQuietMode(false); |
| 263 else | 263 else |
| 264 message_center()->EnterQuietModeWithExpire(base::TimeDelta::FromDays(1)); | 264 message_center()->EnterQuietModeWithExpire(base::TimeDelta::FromDays(1)); |
| 265 quiet_mode_button_->SetToggled(message_center()->IsQuietMode()); | 265 quiet_mode_button_->SetToggled(message_center()->IsQuietMode()); |
| 266 } else { | 266 } else { |
| 267 NOTREACHED(); | 267 NOTREACHED(); |
| 268 } | 268 } |
| 269 } | 269 } |
| 270 | 270 |
| 271 } // namespace message_center | 271 } // namespace message_center |
| OLD | NEW |