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

Unified Diff: content/renderer/input/frame_input_hit_test_impl.h

Issue 2951053005: Add Mojo API for Blink hit testing (Closed)
Patch Set: Make the hit test API accesible by viz component Created 3 years, 4 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
Index: content/renderer/input/frame_input_hit_test_impl.h
diff --git a/content/renderer/input/frame_input_hit_test_impl.h b/content/renderer/input/frame_input_hit_test_impl.h
new file mode 100644
index 0000000000000000000000000000000000000000..b60c992028e9170d647e120a95e4d98f4c34f62d
--- /dev/null
+++ b/content/renderer/input/frame_input_hit_test_impl.h
@@ -0,0 +1,54 @@
+// Copyright 2017 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 CONTENT_RENDERER_INPUT_FRAME_INPUT_HIT_TEST_IMPL_H_
+#define CONTENT_RENDERER_INPUT_FRAME_INPUT_HIT_TEST_IMPL_H_
+
+#include "base/memory/ref_counted.h"
+#include "content/renderer/render_frame_impl.h"
+#include "mojo/public/cpp/bindings/binding.h"
+#include "services/viz/public/interfaces/hit_test/input_hit_test.mojom.h"
+
+namespace content {
+class MainThreadEventQueue;
+
+// This class provides an implementation of FrameInputHitTest mojo interface.
+class FrameInputHitTestImpl : public viz::mojom::FrameInputHitTest {
+ public:
+ static void CreateMojoService(base::WeakPtr<RenderFrameImpl> render_frame,
+ viz::mojom::FrameInputHitTestRequest request);
+
+ void HitTestFrameAt(const gfx::Point& point,
+ HitTestFrameAtCallback callback) override;
+
+ private:
+ ~FrameInputHitTestImpl() override;
+
+ FrameInputHitTestImpl(base::WeakPtr<RenderFrameImpl> render_frame,
+ viz::mojom::FrameInputHitTestRequest request);
+
+ void RunOnMainThread(base::OnceClosure closure);
+ void HitTestOnMainThread(const gfx::Point&, HitTestFrameAtCallback);
+
+ void BindNow(viz::mojom::FrameInputHitTestRequest request);
+ void Release();
+
+ mojo::Binding<viz::mojom::FrameInputHitTest> binding_;
+
+ // |render_frame_| should only be accessed on the main thread. Use
+ // GetRenderFrame so that it will DCHECK this for you.
+ base::WeakPtr<RenderFrameImpl> render_frame_;
+
+ scoped_refptr<MainThreadEventQueue> input_event_queue_;
+ scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_;
+
+ base::WeakPtr<FrameInputHitTestImpl> weak_this_;
+ base::WeakPtrFactory<FrameInputHitTestImpl> weak_ptr_factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(FrameInputHitTestImpl);
+};
+
+} // namespace content
+
+#endif // CONTENT_RENDERER_INPUT_FRAME_INPUT_HIT_TEST_IMPL_H_

Powered by Google App Engine
This is Rietveld 408576698