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

Unified Diff: services/ui/view_manager/view_tree_state.cc

Issue 1774393002: Mozart: Add ViewInspector contracts for hit testing. (Closed) Base URL: git@github.com:domokit/mojo.git@moz-5
Patch Set: Created 4 years, 9 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 | « services/ui/view_manager/view_tree_state.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/ui/view_manager/view_tree_state.cc
diff --git a/services/ui/view_manager/view_tree_state.cc b/services/ui/view_manager/view_tree_state.cc
index 842cbea4077fdf72b8d9d2294ed69e07088f2c40..2013b4e9bd9d4d8cefc50a64f8a5f293a2d99040 100644
--- a/services/ui/view_manager/view_tree_state.cc
+++ b/services/ui/view_manager/view_tree_state.cc
@@ -37,7 +37,30 @@ ViewTreeState::ViewTreeState(
base::Unretained(this), "ViewTreeListener connection closed"));
}
-ViewTreeState::~ViewTreeState() {}
+ViewTreeState::~ViewTreeState() {
+ ClearHitTesterCallbacks(false /*renderer_changed*/);
+}
+
+void ViewTreeState::SetRenderer(mojo::gfx::composition::RendererPtr renderer) {
+ renderer_ = renderer.Pass();
+ ClearHitTesterCallbacks(true /*renderer_changed*/);
+}
+
+void ViewTreeState::RequestHitTester(
+ mojo::InterfaceRequest<mojo::gfx::composition::HitTester>
+ hit_tester_request,
+ const mojo::ui::ViewInspector::GetHitTesterCallback& callback) {
+ DCHECK(hit_tester_request.is_pending());
+ if (renderer_)
+ renderer_->GetHitTester(hit_tester_request.Pass());
+ pending_hit_tester_callbacks_.push_back(callback);
+}
+
+void ViewTreeState::ClearHitTesterCallbacks(bool renderer_changed) {
+ for (const auto& callback : pending_hit_tester_callbacks_)
+ callback.Run(renderer_changed);
+ pending_hit_tester_callbacks_.clear();
+}
void ViewTreeState::LinkRoot(uint32_t key, std::unique_ptr<ViewStub> root) {
DCHECK(!root_);
« no previous file with comments | « services/ui/view_manager/view_tree_state.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698