1868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)// Copyright 2013 The Chromium Authors. All rights reserved.
2868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
3868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)// found in the LICENSE file.
4868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
55d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#ifndef CONTENT_RENDERER_INPUT_INPUT_HANDLER_MANAGER_CLIENT_H_
65d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#define CONTENT_RENDERER_INPUT_INPUT_HANDLER_MANAGER_CLIENT_H_
7868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
8868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#include "base/basictypes.h"
97dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch#include "base/callback.h"
10868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#include "base/callback_forward.h"
11868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#include "content/common/content_export.h"
12eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch#include "ui/gfx/vector2d_f.h"
13868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
14868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)namespace ui {
15868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)struct LatencyInfo;
16868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)}
17868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
187d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)namespace cc {
197d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)class InputHandler;
207d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)}
217d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)
22f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)namespace blink {
23868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)class WebInputEvent;
24868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)}
25868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
26868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)namespace content {
27e5d81f57cb97b3b6b7fccc9c5610d21eb81db09dBen Murdochstruct DidOverscrollParams;
28868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
29868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)class CONTENT_EXPORT InputHandlerManagerClient {
30868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) public:
31868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  virtual ~InputHandlerManagerClient() {}
32868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
33868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  // The Manager will supply a |handler| when bound to the client. This is valid
34868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  // until the manager shuts down, at which point it supplies a null |handler|.
35868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  // The client should only makes calls to |handler| on the compositor thread.
36868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  typedef base::Callback<
37868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)      InputEventAckState(int /*routing_id*/,
38f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)                         const blink::WebInputEvent*,
39a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)                         ui::LatencyInfo* latency_info)> Handler;
40868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
41868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  // Called from the main thread.
42868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  virtual void SetBoundHandler(const Handler& handler) = 0;
43868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
44868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  // Called from the compositor thread.
457d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)  virtual void DidAddInputHandler(int routing_id,
467d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)                                  cc::InputHandler* input_handler) = 0;
47868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  virtual void DidRemoveInputHandler(int routing_id) = 0;
487d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)  virtual void DidOverscroll(int routing_id,
49e5d81f57cb97b3b6b7fccc9c5610d21eb81db09dBen Murdoch                             const DidOverscrollParams& params) = 0;
505d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  virtual void DidStopFlinging(int routing_id) = 0;
51868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
52868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) protected:
53868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  InputHandlerManagerClient() {}
54868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
55868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) private:
56868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  DISALLOW_COPY_AND_ASSIGN(InputHandlerManagerClient);
57868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)};
58868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
59868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)}  // namespace content
60868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
61868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#endif  // CONTENT_COMMON_GPU_INPUT_HANDLER_MANAGER_CLIENT_H_
62