Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_view.h" | 5 #include "ui/message_center/views/message_view.h" |
| 6 | 6 |
| 7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "ui/accessibility/ax_node_data.h" | 8 #include "ui/accessibility/ax_node_data.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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 145 // Space key handling is triggerred at key-release timing. See | 145 // Space key handling is triggerred at key-release timing. See |
| 146 // ui/views/controls/buttons/custom_button.cc for why. | 146 // ui/views/controls/buttons/custom_button.cc for why. |
| 147 if (event.flags() != ui::EF_NONE || event.key_code() != ui::VKEY_SPACE) | 147 if (event.flags() != ui::EF_NONE || event.key_code() != ui::VKEY_SPACE) |
| 148 return false; | 148 return false; |
| 149 | 149 |
| 150 controller_->ClickOnNotification(notification_id_); | 150 controller_->ClickOnNotification(notification_id_); |
| 151 return true; | 151 return true; |
| 152 } | 152 } |
| 153 | 153 |
| 154 void MessageView::OnPaint(gfx::Canvas* canvas) { | 154 void MessageView::OnPaint(gfx::Canvas* canvas) { |
| 155 views::View::OnPaint(canvas); | |
|
yoshiki
2017/05/08 11:22:17
OnPaint draws a border so it's necessary to fix cr
| |
| 155 views::Painter::PaintFocusPainter(this, canvas, focus_painter_.get()); | 156 views::Painter::PaintFocusPainter(this, canvas, focus_painter_.get()); |
| 156 } | 157 } |
| 157 | 158 |
| 158 void MessageView::OnFocus() { | 159 void MessageView::OnFocus() { |
| 160 views::View::OnFocus(); | |
|
yoshiki
2017/05/08 11:22:17
OnFocus fires an a11y event so I think it's needed
| |
| 159 // We paint a focus indicator. | 161 // We paint a focus indicator. |
| 160 SchedulePaint(); | 162 SchedulePaint(); |
| 161 } | 163 } |
| 162 | 164 |
| 163 void MessageView::OnBlur() { | 165 void MessageView::OnBlur() { |
| 166 views::View::OnBlur(); | |
|
yoshiki
2017/05/08 11:22:17
Actually View::OnBlur() is empty but I added this
| |
| 164 // We paint a focus indicator. | 167 // We paint a focus indicator. |
| 165 SchedulePaint(); | 168 SchedulePaint(); |
| 166 } | 169 } |
| 167 | 170 |
| 168 void MessageView::Layout() { | 171 void MessageView::Layout() { |
| 169 gfx::Rect content_bounds = GetContentsBounds(); | 172 gfx::Rect content_bounds = GetContentsBounds(); |
| 170 | 173 |
| 171 // Background. | 174 // Background. |
| 172 background_view_->SetBoundsRect(content_bounds); | 175 background_view_->SetBoundsRect(content_bounds); |
| 173 #if defined(OS_CHROMEOS) | 176 #if defined(OS_CHROMEOS) |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 224 } | 227 } |
| 225 | 228 |
| 226 void MessageView::SetDrawBackgroundAsActive(bool active) { | 229 void MessageView::SetDrawBackgroundAsActive(bool active) { |
| 227 background_view_->background()-> | 230 background_view_->background()-> |
| 228 SetNativeControlColor(active ? kHoveredButtonBackgroundColor : | 231 SetNativeControlColor(active ? kHoveredButtonBackgroundColor : |
| 229 kNotificationBackgroundColor); | 232 kNotificationBackgroundColor); |
| 230 SchedulePaint(); | 233 SchedulePaint(); |
| 231 } | 234 } |
| 232 | 235 |
| 233 } // namespace message_center | 236 } // namespace message_center |
| OLD | NEW |