Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(358)

Unified Diff: ui/message_center/views/custom_notification_view.cc

Issue 2670213002: Pass BS/Return Key Events to EditBox in Custom Notification (Closed)
Patch Set: Added tests Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ui/message_center/views/custom_notification_view.cc
diff --git a/ui/message_center/views/custom_notification_view.cc b/ui/message_center/views/custom_notification_view.cc
index 91b894673e90f13db892db6b1a47cf40f8714a49..780c2b50c98ce5c5ed85e4d4d508c51927856240 100644
--- a/ui/message_center/views/custom_notification_view.cc
+++ b/ui/message_center/views/custom_notification_view.cc
@@ -6,6 +6,9 @@
#include <algorithm>
+#include "ui/base/ime/input_method.h"
+#include "ui/base/ime/text_input_client.h"
+#include "ui/base/ime/text_input_type.h"
#include "ui/gfx/geometry/size.h"
#include "ui/message_center/message_center_style.h"
#include "ui/views/background.h"
@@ -122,4 +125,23 @@ void CustomNotificationView::OnPaint(gfx::Canvas* canvas) {
focus_painter_.get());
}
+bool CustomNotificationView::OnKeyPressed(const ui::KeyEvent& event) {
+ if (contents_view_) {
+ ui::InputMethod* input_method = contents_view_->GetInputMethod();
+ if (input_method) {
+ ui::TextInputClient* text_input_client =
+ input_method->GetTextInputClient();
+ if (text_input_client &&
+ text_input_client->GetTextInputType() != ui::TEXT_INPUT_TYPE_NONE) {
+ // If the focus is in an edit box, we skip the special key handling for
+ // back space and return keys. So that these key events are sent to the
+ // arc container correctly without being handled by the message center.
+ return false;
+ }
+ }
+ }
+
+ return MessageView::OnKeyPressed(event);
+}
+
} // namespace message_center
« no previous file with comments | « ui/message_center/views/custom_notification_view.h ('k') | ui/message_center/views/custom_notification_view_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698