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

Side by Side Diff: content/renderer/mus/render_widget_mus_connection.cc

Issue 2089183003: mus: Introduce API for embedder to dispatch event to the embeded client. Base URL: https://chromium.googlesource.com/chromium/src.git@mus-parent-window-receives-child-event
Patch Set: Created 4 years, 6 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "content/renderer/mus/render_widget_mus_connection.h" 5 #include "content/renderer/mus/render_widget_mus_connection.h"
6 6
7 #include <map> 7 #include <map>
8 8
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 NOTIMPLEMENTED(); 105 NOTIMPLEMENTED();
106 } 106 }
107 107
108 void RenderWidgetMusConnection::OnDidOverscroll( 108 void RenderWidgetMusConnection::OnDidOverscroll(
109 const DidOverscrollParams& params) { 109 const DidOverscrollParams& params) {
110 NOTIMPLEMENTED(); 110 NOTIMPLEMENTED();
111 } 111 }
112 112
113 void RenderWidgetMusConnection::OnInputEventAck( 113 void RenderWidgetMusConnection::OnInputEventAck(
114 std::unique_ptr<InputEventAck> input_event_ack) { 114 std::unique_ptr<InputEventAck> input_event_ack) {
115 if (pending_ack_.is_null())
116 return;
115 DCHECK(!pending_ack_.is_null()); 117 DCHECK(!pending_ack_.is_null());
116 pending_ack_.Run(input_event_ack->state == 118 pending_ack_.Run(input_event_ack->state ==
117 InputEventAckState::INPUT_EVENT_ACK_STATE_CONSUMED 119 InputEventAckState::INPUT_EVENT_ACK_STATE_CONSUMED
118 ? mus::mojom::EventResult::HANDLED 120 ? mus::mojom::EventResult::HANDLED
119 : mus::mojom::EventResult::UNHANDLED); 121 : mus::mojom::EventResult::UNHANDLED);
120 pending_ack_.Reset(); 122 pending_ack_.Reset();
121 } 123 }
122 124
123 void RenderWidgetMusConnection::NotifyInputEventHandled( 125 void RenderWidgetMusConnection::NotifyInputEventHandled(
124 blink::WebInputEvent::Type handled_type) { 126 blink::WebInputEvent::Type handled_type) {
125 NOTIMPLEMENTED(); 127 NOTIMPLEMENTED();
126 } 128 }
127 129
128 void RenderWidgetMusConnection::SetInputHandler( 130 void RenderWidgetMusConnection::SetInputHandler(
129 RenderWidgetInputHandler* input_handler) { 131 RenderWidgetInputHandler* input_handler) {
130 DCHECK(!input_handler_); 132 DCHECK(!input_handler_ || !input_handler);
131 input_handler_ = input_handler; 133 input_handler_ = input_handler;
132 } 134 }
133 135
134 void RenderWidgetMusConnection::UpdateTextInputState( 136 void RenderWidgetMusConnection::UpdateTextInputState(
135 ShowIme show_ime, 137 ShowIme show_ime,
136 ChangeSource change_source) { 138 ChangeSource change_source) {
137 NOTIMPLEMENTED(); 139 NOTIMPLEMENTED();
138 } 140 }
139 141
140 bool RenderWidgetMusConnection::WillHandleGestureEvent( 142 bool RenderWidgetMusConnection::WillHandleGestureEvent(
(...skipping 12 matching lines...) Expand all
153 void RenderWidgetMusConnection::OnConnectionLost() { 155 void RenderWidgetMusConnection::OnConnectionLost() {
154 DCHECK(thread_checker_.CalledOnValidThread()); 156 DCHECK(thread_checker_.CalledOnValidThread());
155 g_connections.Get().erase(routing_id_); 157 g_connections.Get().erase(routing_id_);
156 delete this; 158 delete this;
157 } 159 }
158 160
159 void RenderWidgetMusConnection::OnWindowInputEvent( 161 void RenderWidgetMusConnection::OnWindowInputEvent(
160 std::unique_ptr<blink::WebInputEvent> input_event, 162 std::unique_ptr<blink::WebInputEvent> input_event,
161 const base::Callback<void(mus::mojom::EventResult)>& ack) { 163 const base::Callback<void(mus::mojom::EventResult)>& ack) {
162 DCHECK(thread_checker_.CalledOnValidThread()); 164 DCHECK(thread_checker_.CalledOnValidThread());
165 LOG(ERROR) << input_event->type;
163 // If we don't yet have a RenderWidgetInputHandler then we don't yet have 166 // If we don't yet have a RenderWidgetInputHandler then we don't yet have
164 // an initialized RenderWidget. 167 // an initialized RenderWidget.
165 if (!input_handler_) { 168 if (!input_handler_) {
166 ack.Run(mus::mojom::EventResult::UNHANDLED); 169 ack.Run(mus::mojom::EventResult::UNHANDLED);
167 return; 170 return;
168 } 171 }
169 // TODO(fsamuel): It would be nice to add this DCHECK but the reality is an 172 // TODO(fsamuel): It would be nice to add this DCHECK but the reality is an
170 // event could timeout and we could receive the next event before we ack the 173 // event could timeout and we could receive the next event before we ack the
171 // previous event. 174 // previous event.
172 // DCHECK(pending_ack_.is_null()); 175 // DCHECK(pending_ack_.is_null());
173 pending_ack_ = ack; 176 pending_ack_ = ack;
174 // TODO(fsamuel, sadrul): Track real latency info. 177 // TODO(fsamuel, sadrul): Track real latency info.
175 ui::LatencyInfo latency_info; 178 ui::LatencyInfo latency_info;
176 input_handler_->HandleInputEvent(*input_event, latency_info, 179 input_handler_->HandleInputEvent(*input_event, latency_info,
177 DISPATCH_TYPE_BLOCKING); 180 DISPATCH_TYPE_BLOCKING);
178 } 181 }
179 182
180 } // namespace content 183 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/mus/compositor_mus_connection.cc ('k') | mojo/public/cpp/bindings/lib/validation_errors.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698