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

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

Issue 2951053005: Add Mojo API for Blink hit testing (Closed)
Patch Set: Address Rob's comments 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/target_frame_for_input_impl.h
diff --git a/content/renderer/input/target_frame_for_input_impl.h b/content/renderer/input/target_frame_for_input_impl.h
new file mode 100644
index 0000000000000000000000000000000000000000..948982ed8f81b7dbc5c0c52026b82ece7b5614b2
--- /dev/null
+++ b/content/renderer/input/target_frame_for_input_impl.h
@@ -0,0 +1,56 @@
+// 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_TARGET_FRAME_FOR_INPUT_IMPL_H_
+#define CONTENT_RENDERER_INPUT_TARGET_FRAME_FOR_INPUT_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/target_frame_for_input_delegate.mojom.h"
+
+namespace content {
+class MainThreadEventQueue;
+
+// This class provides an implementation of FrameInputHitTest mojo interface.
+class TargetFrameForInputImpl : public viz::mojom::TargetFrameForInputDelegate {
+ public:
+ static void CreateMojoService(
+ base::WeakPtr<RenderFrameImpl> render_frame,
+ viz::mojom::TargetFrameForInputDelegateRequest request);
+
+ void HitTestFrameAt(const gfx::Point& point,
+ HitTestFrameAtCallback callback) override;
+
+ private:
+ ~TargetFrameForInputImpl() override;
+
+ TargetFrameForInputImpl(
+ base::WeakPtr<RenderFrameImpl> render_frame,
+ viz::mojom::TargetFrameForInputDelegateRequest request);
+
+ void RunOnMainThread(base::OnceClosure closure);
+ void HitTestOnMainThread(const gfx::Point&, HitTestFrameAtCallback);
+
+ void BindNow(viz::mojom::TargetFrameForInputDelegateRequest request);
+ void Release();
+
+ mojo::Binding<viz::mojom::TargetFrameForInputDelegate> 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<TargetFrameForInputImpl> weak_this_;
+ base::WeakPtrFactory<TargetFrameForInputImpl> weak_ptr_factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(TargetFrameForInputImpl);
+};
+
+} // namespace content
+
+#endif // CONTENT_RENDERER_INPUT_TARGET_FRAME_FOR_INPUT_IMPL_H_
« no previous file with comments | « content/renderer/input/render_widget_input_handler.cc ('k') | content/renderer/input/target_frame_for_input_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698