| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2017 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 CONTENT_RENDERER_INPUT_TARGET_FRAME_FOR_INPUT_IMPL_H_ |
| 6 #define CONTENT_RENDERER_INPUT_TARGET_FRAME_FOR_INPUT_IMPL_H_ |
| 7 |
| 8 #include "base/memory/ref_counted.h" |
| 9 #include "content/renderer/render_frame_impl.h" |
| 10 #include "mojo/public/cpp/bindings/binding.h" |
| 11 #include "services/viz/public/interfaces/hit_test/target_frame_for_input_delegat
e.mojom.h" |
| 12 |
| 13 namespace content { |
| 14 class MainThreadEventQueue; |
| 15 |
| 16 // This class provides an implementation of FrameInputHitTest mojo interface. |
| 17 class TargetFrameForInputImpl : public viz::mojom::TargetFrameForInputDelegate { |
| 18 public: |
| 19 static void CreateMojoService( |
| 20 base::WeakPtr<RenderFrameImpl> render_frame, |
| 21 viz::mojom::TargetFrameForInputDelegateRequest request); |
| 22 |
| 23 void HitTestFrameAt(const gfx::Point& point, |
| 24 HitTestFrameAtCallback callback) override; |
| 25 |
| 26 private: |
| 27 ~TargetFrameForInputImpl() override; |
| 28 |
| 29 TargetFrameForInputImpl( |
| 30 base::WeakPtr<RenderFrameImpl> render_frame, |
| 31 viz::mojom::TargetFrameForInputDelegateRequest request); |
| 32 |
| 33 void RunOnMainThread(base::OnceClosure closure); |
| 34 void HitTestOnMainThread(const gfx::Point&, HitTestFrameAtCallback); |
| 35 |
| 36 void BindNow(viz::mojom::TargetFrameForInputDelegateRequest request); |
| 37 void Release(); |
| 38 |
| 39 mojo::Binding<viz::mojom::TargetFrameForInputDelegate> binding_; |
| 40 |
| 41 // |render_frame_| should only be accessed on the main thread. Use |
| 42 // GetRenderFrame so that it will DCHECK this for you. |
| 43 base::WeakPtr<RenderFrameImpl> render_frame_; |
| 44 |
| 45 scoped_refptr<MainThreadEventQueue> input_event_queue_; |
| 46 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_; |
| 47 |
| 48 base::WeakPtr<TargetFrameForInputImpl> weak_this_; |
| 49 base::WeakPtrFactory<TargetFrameForInputImpl> weak_ptr_factory_; |
| 50 |
| 51 DISALLOW_COPY_AND_ASSIGN(TargetFrameForInputImpl); |
| 52 }; |
| 53 |
| 54 } // namespace content |
| 55 |
| 56 #endif // CONTENT_RENDERER_INPUT_TARGET_FRAME_FOR_INPUT_IMPL_H_ |
| OLD | NEW |