| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/custom_notification_view.h" | 5 #include "ui/message_center/views/custom_notification_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "ui/base/ime/input_method.h" |
| 10 #include "ui/base/ime/text_input_client.h" |
| 11 #include "ui/base/ime/text_input_type.h" |
| 9 #include "ui/gfx/geometry/size.h" | 12 #include "ui/gfx/geometry/size.h" |
| 10 #include "ui/message_center/message_center_style.h" | 13 #include "ui/message_center/message_center_style.h" |
| 11 #include "ui/views/background.h" | 14 #include "ui/views/background.h" |
| 12 #include "ui/views/controls/button/image_button.h" | 15 #include "ui/views/controls/button/image_button.h" |
| 13 #include "ui/views/controls/image_view.h" | 16 #include "ui/views/controls/image_view.h" |
| 14 #include "ui/views/painter.h" | 17 #include "ui/views/painter.h" |
| 15 | 18 |
| 16 namespace message_center { | 19 namespace message_center { |
| 17 | 20 |
| 18 CustomNotificationView::CustomNotificationView( | 21 CustomNotificationView::CustomNotificationView( |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 MessageView::RequestFocus(); | 118 MessageView::RequestFocus(); |
| 116 } | 119 } |
| 117 | 120 |
| 118 void CustomNotificationView::OnPaint(gfx::Canvas* canvas) { | 121 void CustomNotificationView::OnPaint(gfx::Canvas* canvas) { |
| 119 MessageView::OnPaint(canvas); | 122 MessageView::OnPaint(canvas); |
| 120 if (contents_view_ && contents_view_->IsFocusable()) | 123 if (contents_view_ && contents_view_->IsFocusable()) |
| 121 views::Painter::PaintFocusPainter(contents_view_, canvas, | 124 views::Painter::PaintFocusPainter(contents_view_, canvas, |
| 122 focus_painter_.get()); | 125 focus_painter_.get()); |
| 123 } | 126 } |
| 124 | 127 |
| 128 bool CustomNotificationView::OnKeyPressed(const ui::KeyEvent& event) { |
| 129 if (contents_view_) { |
| 130 ui::InputMethod* input_method = contents_view_->GetInputMethod(); |
| 131 if (input_method) { |
| 132 ui::TextInputClient* text_input_client = |
| 133 input_method->GetTextInputClient(); |
| 134 if (text_input_client && |
| 135 text_input_client->GetTextInputType() != ui::TEXT_INPUT_TYPE_NONE) { |
| 136 // If the focus is in an edit box, we skip the special key handling for |
| 137 // back space and return keys. So that these key events are sent to the |
| 138 // arc container correctly without being handled by the message center. |
| 139 return false; |
| 140 } |
| 141 } |
| 142 } |
| 143 |
| 144 return MessageView::OnKeyPressed(event); |
| 145 } |
| 146 |
| 125 } // namespace message_center | 147 } // namespace message_center |
| OLD | NEW |