OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef MOJO_UI_ASSOCIATES_VIEW_INSPECTOR_CLIENT_H_ | |
6 #define MOJO_UI_ASSOCIATES_VIEW_INSPECTOR_CLIENT_H_ | |
7 | |
8 #include <queue> | |
9 #include <vector> | |
10 | |
11 #include "base/callback.h" | |
12 #include "base/macros.h" | |
13 #include "base/memory/ref_counted.h" | |
14 #include "mojo/services/ui/views/interfaces/view_associates.mojom.h" | |
15 #include "mojo/ui/associates/resolved_hits.h" | |
16 | |
17 namespace mojo { | |
18 namespace ui { | |
19 | |
20 // Provides facilities for using a |ViewInspector|, including caching. | |
21 class ViewInspectorClient : public base::RefCounted<ViewInspectorClient> { | |
22 public: | |
23 ViewInspectorClient(mojo::ui::ViewInspectorPtr view_inspector); | |
24 | |
25 mojo::ui::ViewInspector* view_inspector() { return view_inspector_.get(); } | |
26 | |
27 // Resolves all of the scene tokens referenced in the hit test result | |
28 // then invokes the callback. | |
29 // Note: May invoke the callback immediately if no remote calls were required. | |
30 void ResolveHits(mojo::gfx::composition::HitTestResultPtr hit_test_result, | |
31 const ResolvedHitsCallback& callback); | |
32 | |
33 private: | |
34 struct {}; | |
abarth
2016/03/09 04:06:36
?
jeffbrown
2016/03/09 19:43:43
!
| |
35 | |
36 friend class base::RefCounted<ViewInspectorClient>; | |
37 ~ViewInspectorClient(); | |
38 | |
39 void ResolveSceneHit( | |
40 const mojo::gfx::composition::SceneHit* scene_hit, | |
41 ResolvedHits* resolved_hits, | |
42 mojo::Array<mojo::gfx::composition::SceneTokenPtr>* missing_scene_tokens); | |
43 void OnScenesResolved(scoped_ptr<ResolvedHits> resolved_hits, | |
44 mojo::Array<uint32_t> missing_scene_token_values, | |
45 const ResolvedHitsCallback& callback, | |
46 mojo::Array<mojo::ui::ViewTokenPtr> view_tokens); | |
47 | |
48 mojo::ui::ViewInspectorPtr view_inspector_; | |
49 | |
50 // TODO(jeffbrown): Decide how this should be pruned. | |
51 SceneTokenValueToViewTokenMap resolved_scene_cache_; | |
52 | |
53 std::queue<ResolvedHitsCallback> resolutions_; | |
54 | |
55 DISALLOW_COPY_AND_ASSIGN(ViewInspectorClient); | |
56 }; | |
57 | |
58 } // namespace ui | |
59 } // namespace mojo | |
60 | |
61 #endif // MOJO_UI_ASSOCIATES_VIEW_INSPECTOR_CLIENT_H_ | |
OLD | NEW |