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

Unified Diff: components/mus/public/cpp/lib/window_tree_client.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/mus/public/cpp/lib/window.cc ('k') | components/mus/public/cpp/window.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/mus/public/cpp/lib/window_tree_client.cc
diff --git a/components/mus/public/cpp/lib/window_tree_client.cc b/components/mus/public/cpp/lib/window_tree_client.cc
index 7a43101ff6a809ad755b710c8bb4739fd90096c1..362595876fcf31d1089f7e8ba1a071655923e8b4 100644
--- a/components/mus/public/cpp/lib/window_tree_client.cc
+++ b/components/mus/public/cpp/lib/window_tree_client.cc
@@ -30,6 +30,8 @@
namespace mus {
+namespace {
+
void DeleteWindowTreeClient(WindowTreeClient* client) { delete client; }
Id MakeTransportId(ClientSpecificId client_id, ClientSpecificId local_id) {
@@ -61,6 +63,8 @@ Window* AddWindowToClient(WindowTreeClient* client,
return window;
}
+} // namespace
+
Window* BuildWindowTree(WindowTreeClient* client,
const mojo::Array<mojom::WindowDataPtr>& windows,
Window* initial_parent) {
@@ -100,6 +104,7 @@ WindowTreeClient::WindowTreeClient(
tree_(nullptr),
delete_on_no_roots_(!window_manager_delegate),
in_destructor_(false),
+ event_handler_binding_(this),
weak_factory_(this) {
// Allow for a null request in tests.
if (request.is_pending())
@@ -1003,6 +1008,17 @@ void WindowTreeClient::OnWindowPredefinedCursorChanged(
WindowPrivate(window).LocalSetPredefinedCursor(cursor);
}
+void X() {
+ LOG(ERROR) << "FFFFFFFFFFFFFFFFUCK";
+}
+
+void WindowTreeClient::RequestInputEventHandler(
+ mojom::InputEventHandlerRequest request) {
+ LOG(ERROR) << "Yes";
+ event_handler_binding_.Bind(std::move(request));
+ event_handler_binding_.set_connection_error_handler(base::Bind(&X));
+}
+
void WindowTreeClient::OnChangeCompleted(uint32_t change_id, bool success) {
std::unique_ptr<InFlightChange> change(std::move(in_flight_map_[change_id]));
in_flight_map_.erase(change_id);
@@ -1178,4 +1194,18 @@ void WindowTreeClient::SetUnderlaySurfaceOffsetAndExtendedHitArea(
}
}
+void WindowTreeClient::OnInputEvent(uint32_t window_id,
+ std::unique_ptr<ui::Event> event,
+ const OnInputEventCallback& callback) {
+ Window* window = GetWindowByServerId(window_id); // May be null.
+ LOG(ERROR) << "X: " << event->name() << " " << window << " " << window_id
+ << " " << windows_.size();
+ if (!window && !windows_.empty())
+ window = windows_.begin()->second;
+ if (window && window->input_event_handler_) {
+ window->input_event_handler_->OnWindowInputEvent(window, *event, nullptr);
+ }
+ callback.Run(true);
+}
+
} // namespace mus
« no previous file with comments | « components/mus/public/cpp/lib/window.cc ('k') | components/mus/public/cpp/window.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698