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

Unified Diff: blimp/client/core/render_widget/blimp_document.h

Issue 2400923002: Move BlimpInputManager to BlimpDocument from BlimpCompositor. (Closed)
Patch Set: Removed unnecessary DCHECK. Created 4 years, 2 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
« no previous file with comments | « blimp/client/core/render_widget/BUILD.gn ('k') | blimp/client/core/render_widget/blimp_document.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: blimp/client/core/render_widget/blimp_document.h
diff --git a/blimp/client/core/render_widget/blimp_document.h b/blimp/client/core/render_widget/blimp_document.h
index d03b7d172f465306efc419cea45658890903ab8b..57f46ce81d1de4ac234ae1fabd71a7cf8d4cbfc2 100644
--- a/blimp/client/core/render_widget/blimp_document.h
+++ b/blimp/client/core/render_widget/blimp_document.h
@@ -10,6 +10,7 @@
#include "base/macros.h"
#include "base/memory/ptr_util.h"
#include "blimp/client/core/compositor/blimp_compositor.h"
+#include "blimp/client/core/input/blimp_input_manager.h"
namespace blimp {
namespace client {
@@ -20,7 +21,9 @@ class BlimpDocumentManager;
// BlimpDocument maps to an engine side render widget.
// 1. Is created on receiving an RenderWidgetMessage from the engine.
// 2. Owns the BlimpCompositor instance.
-class BlimpDocument : public BlimpCompositorClient {
+// 3. Handles touch events and forward them to the engine.
+class BlimpDocument : public BlimpCompositorClient,
+ public BlimpInputManagerClient {
public:
BlimpDocument(int document_id,
BlimpCompositorDependencies* compositor_dependencies,
@@ -32,16 +35,26 @@ class BlimpDocument : public BlimpCompositorClient {
// Returns the compositor instance.
BlimpCompositor* GetCompositor();
+ // Forwards the touch event to the |input_manager_|.
+ // virtual for testing.
+ virtual bool OnTouchEvent(const ui::MotionEvent& motion_event);
+
protected:
- void SetCompositorForTest(std::unique_ptr<BlimpCompositor> compositor);
+ // Constructor that may take a mock compositor as input for testing.
+ BlimpDocument(int document_id,
+ std::unique_ptr<BlimpCompositor> compositor,
+ BlimpCompositorDependencies* compositor_dependencies,
+ BlimpDocumentManager* document_manager);
private:
// BlimpCompositorClient implementation.
- void SendWebGestureEvent(
- const blink::WebGestureEvent& gesture_event) override;
void SendCompositorMessage(
const cc::proto::CompositorMessage& message) override;
+ // BlimpInputManagerClient implementation.
+ void SendWebGestureEvent(
+ const blink::WebGestureEvent& gesture_event) override;
+
// The unique identifier for this document instance.
const int document_id_;
@@ -51,6 +64,14 @@ class BlimpDocument : public BlimpCompositorClient {
// Used to send messages to the corresponding render widget on the engine.
BlimpDocumentManager* manager_;
+ // Handles input events for the current document. The lifetime of the
+ // input manager is tied to the lifetime of the layer tree host of its
+ // compositor which owns the cc::InputHandler.
+ // The input events are forwarded to this input handler by
+ // the manager to be handled by the client compositor for the current
+ // document.
+ std::unique_ptr<BlimpInputManager> input_manager_;
+
DISALLOW_COPY_AND_ASSIGN(BlimpDocument);
};
« no previous file with comments | « blimp/client/core/render_widget/BUILD.gn ('k') | blimp/client/core/render_widget/blimp_document.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698