Chromium Code Reviews| Index: mojo/ui/associates/view_inspector_client.h |
| diff --git a/mojo/ui/associates/view_inspector_client.h b/mojo/ui/associates/view_inspector_client.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..273798102d50e1e9a6f7db0c8a6fb3f3aae03669 |
| --- /dev/null |
| +++ b/mojo/ui/associates/view_inspector_client.h |
| @@ -0,0 +1,61 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef MOJO_UI_ASSOCIATES_VIEW_INSPECTOR_CLIENT_H_ |
| +#define MOJO_UI_ASSOCIATES_VIEW_INSPECTOR_CLIENT_H_ |
| + |
| +#include <queue> |
| +#include <vector> |
| + |
| +#include "base/callback.h" |
| +#include "base/macros.h" |
| +#include "base/memory/ref_counted.h" |
| +#include "mojo/services/ui/views/interfaces/view_associates.mojom.h" |
| +#include "mojo/ui/associates/resolved_hits.h" |
| + |
| +namespace mojo { |
| +namespace ui { |
| + |
| +// Provides facilities for using a |ViewInspector|, including caching. |
| +class ViewInspectorClient : public base::RefCounted<ViewInspectorClient> { |
| + public: |
| + ViewInspectorClient(mojo::ui::ViewInspectorPtr view_inspector); |
| + |
| + mojo::ui::ViewInspector* view_inspector() { return view_inspector_.get(); } |
| + |
| + // Resolves all of the scene tokens referenced in the hit test result |
| + // then invokes the callback. |
| + // Note: May invoke the callback immediately if no remote calls were required. |
| + void ResolveHits(mojo::gfx::composition::HitTestResultPtr hit_test_result, |
| + const ResolvedHitsCallback& callback); |
| + |
| + private: |
| + struct {}; |
|
abarth
2016/03/09 04:06:36
?
jeffbrown
2016/03/09 19:43:43
!
|
| + |
| + friend class base::RefCounted<ViewInspectorClient>; |
| + ~ViewInspectorClient(); |
| + |
| + void ResolveSceneHit( |
| + const mojo::gfx::composition::SceneHit* scene_hit, |
| + ResolvedHits* resolved_hits, |
| + mojo::Array<mojo::gfx::composition::SceneTokenPtr>* missing_scene_tokens); |
| + void OnScenesResolved(scoped_ptr<ResolvedHits> resolved_hits, |
| + mojo::Array<uint32_t> missing_scene_token_values, |
| + const ResolvedHitsCallback& callback, |
| + mojo::Array<mojo::ui::ViewTokenPtr> view_tokens); |
| + |
| + mojo::ui::ViewInspectorPtr view_inspector_; |
| + |
| + // TODO(jeffbrown): Decide how this should be pruned. |
| + SceneTokenValueToViewTokenMap resolved_scene_cache_; |
| + |
| + std::queue<ResolvedHitsCallback> resolutions_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(ViewInspectorClient); |
| +}; |
| + |
| +} // namespace ui |
| +} // namespace mojo |
| + |
| +#endif // MOJO_UI_ASSOCIATES_VIEW_INSPECTOR_CLIENT_H_ |