summaryrefslogtreecommitdiffstats
path: root/content/renderer/gpu/input_handler_manager_client.h
blob: c147a8a6be05901ad0756f829e10216d3f0e899e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
// Copyright 2013 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_GPU_INPUT_HANDLER_MANAGER_CLIENT_H_
#define CONTENT_RENDERER_GPU_INPUT_HANDLER_MANAGER_CLIENT_H_

#include "base/basictypes.h"
#include "base/callback.h"
#include "base/callback_forward.h"
#include "content/common/content_export.h"
#include "ui/gfx/vector2d_f.h"

namespace ui {
struct LatencyInfo;
}

namespace cc {
class InputHandler;
struct DidOverscrollParams;
}

namespace WebKit {
class WebInputEvent;
}

namespace content {

class CONTENT_EXPORT InputHandlerManagerClient {
 public:
  virtual ~InputHandlerManagerClient() {}

  // The Manager will supply a |handler| when bound to the client. This is valid
  // until the manager shuts down, at which point it supplies a null |handler|.
  // The client should only makes calls to |handler| on the compositor thread.
  typedef base::Callback<
      InputEventAckState(int /*routing_id*/,
                         const WebKit::WebInputEvent*,
                         const ui::LatencyInfo& latency_info)> Handler;

  // Called from the main thread.
  virtual void SetBoundHandler(const Handler& handler) = 0;

  // Called from the compositor thread.
  virtual void DidAddInputHandler(int routing_id,
                                  cc::InputHandler* input_handler) = 0;
  virtual void DidRemoveInputHandler(int routing_id) = 0;
  virtual void DidOverscroll(int routing_id,
                             const cc::DidOverscrollParams& params) = 0;

 protected:
  InputHandlerManagerClient() {}

 private:
  DISALLOW_COPY_AND_ASSIGN(InputHandlerManagerClient);
};

}  // namespace content

#endif  // CONTENT_COMMON_GPU_INPUT_HANDLER_MANAGER_CLIENT_H_