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

Side by Side Diff: mojo/ui/associates/view_tree_hit_tester_client.cc

Issue 1782733002: Mozart: The great RectF-ication. (Closed) Base URL: git@github.com:domokit/mojo.git@moz-9
Patch Set: rebase 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 unified diff | Download patch
OLDNEW
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 "mojo/ui/associates/view_tree_hit_tester_client.h" 5 #include "mojo/ui/associates/view_tree_hit_tester_client.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 9
10 namespace mojo { 10 namespace mojo {
11 namespace ui { 11 namespace ui {
12 12
13 ViewTreeHitTesterClient::ViewTreeHitTesterClient( 13 ViewTreeHitTesterClient::ViewTreeHitTesterClient(
14 const scoped_refptr<ViewInspectorClient>& view_inspector_client, 14 const scoped_refptr<ViewInspectorClient>& view_inspector_client,
15 mojo::ui::ViewTreeTokenPtr view_tree_token) 15 mojo::ui::ViewTreeTokenPtr view_tree_token)
16 : view_inspector_client_(view_inspector_client), 16 : view_inspector_client_(view_inspector_client),
17 view_tree_token_(view_tree_token.Pass()), 17 view_tree_token_(view_tree_token.Pass()),
18 weak_factory_(this) { 18 weak_factory_(this) {
19 DCHECK(view_inspector_client_); 19 DCHECK(view_inspector_client_);
20 DCHECK(view_tree_token_); 20 DCHECK(view_tree_token_);
21 21
22 UpdateHitTester(); 22 UpdateHitTester();
23 } 23 }
24 24
25 ViewTreeHitTesterClient::~ViewTreeHitTesterClient() {} 25 ViewTreeHitTesterClient::~ViewTreeHitTesterClient() {}
26 26
27 void ViewTreeHitTesterClient::HitTest(mojo::PointPtr point, 27 void ViewTreeHitTesterClient::HitTest(mojo::PointFPtr point,
28 const ResolvedHitsCallback& callback) { 28 const ResolvedHitsCallback& callback) {
29 if (!hit_tester_) { 29 if (!hit_tester_) {
30 callback.Run(nullptr); 30 callback.Run(nullptr);
31 return; 31 return;
32 } 32 }
33 33
34 // TODO(jeffbrown): Here we are assuming that the hit test callbacks will be 34 // TODO(jeffbrown): Here we are assuming that the hit test callbacks will be
35 // invoked in FIFO order. It might be a good idea to eliminate that 35 // invoked in FIFO order. It might be a good idea to eliminate that
36 // assumption. 36 // assumption.
37 pending_callbacks_.push(callback); 37 pending_callbacks_.push(callback);
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 83
84 void ViewTreeHitTesterClient::OnHitTesterDied() { 84 void ViewTreeHitTesterClient::OnHitTesterDied() {
85 ReleaseHitTester(); 85 ReleaseHitTester();
86 86
87 if (!hit_tester_changed_callback_.is_null()) 87 if (!hit_tester_changed_callback_.is_null())
88 hit_tester_changed_callback_.Run(); 88 hit_tester_changed_callback_.Run();
89 } 89 }
90 90
91 } // namespace ui 91 } // namespace ui
92 } // namespace mojo 92 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/ui/associates/view_tree_hit_tester_client.h ('k') | mojo/ui/associates/view_tree_hit_tester_client_apptest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698