Chromium Code Reviews| Index: content/browser/renderer_host/input/browser_input_event.h |
| diff --git a/content/browser/renderer_host/input/browser_input_event.h b/content/browser/renderer_host/input/browser_input_event.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..7a2332eb2741d6e4e2b0f0f99ed748ecaf33b687 |
| --- /dev/null |
| +++ b/content/browser/renderer_host/input/browser_input_event.h |
| @@ -0,0 +1,70 @@ |
| +// Copyright (c) 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_BROWSER_RENDERER_HOST_INPUT_BROWSER_INPUT_EVENT_H_ |
| +#define CONTENT_BROWSER_RENDERER_HOST_INPUT_BROWSER_INPUT_EVENT_H_ |
| + |
| +#include <vector> |
| + |
| +#include "base/basictypes.h" |
| +#include "base/memory/scoped_vector.h" |
| +#include "content/common/input/input_event.h" |
| +#include "content/common/input/input_event_disposition.h" |
| + |
| +namespace content { |
| + |
| +class BrowserInputEvent; |
| + |
| +// Provides customized dispatch response for BrowserInputEvents. |
| +class BrowserInputEventClient { |
| + public: |
| + virtual ~BrowserInputEventClient() {} |
| + |
| + virtual void OnDispatched(const BrowserInputEvent& event, |
| + InputEventDisposition disposition) {} |
| + |
| + // Called if the event went unconsumed and can create followup events. Any |
| + // events added to |followup| by the client will be inserted into the |
| + // current input event stream. |followup| will never be NULL. |
| + virtual void OnDispatched(const BrowserInputEvent& event, |
| + InputEventDisposition disposition, |
| + ScopedVector<BrowserInputEvent>* followup) {} |
| +}; |
| + |
| +// Augmented InputEvent allowing customized dispatch response in the browser. |
| +class BrowserInputEvent : public InputEvent { |
| + public: |
| + // |client| may be NULL. |
|
aelias_OOO_until_Jul13
2013/09/09 22:31:14
I don't think we should allow NULL clients. Pleas
jdduke (slow)
2013/09/10 19:41:16
Done.
|
| + static scoped_ptr<BrowserInputEvent> Create( |
| + int64 id, |
| + scoped_ptr<InputEvent::Payload> payload, |
| + BrowserInputEventClient* client); |
| + |
| + template <typename PayloadType> |
| + static scoped_ptr<BrowserInputEvent> Create( |
| + int64 id, |
| + scoped_ptr<PayloadType> payload, |
| + BrowserInputEventClient* client) { |
| + return Create(id, payload.template PassAs<InputEvent::Payload>(), client); |
| + } |
| + |
| + virtual ~BrowserInputEvent(); |
| + |
| + // |followup_events| must not be NULL, and will only be modified if the |
| + // event went unconsumed and can create followup events. |
| + void OnDispatched(InputEventDisposition disposition, |
| + ScopedVector<BrowserInputEvent>* followup_events); |
| + |
| + protected: |
| + BrowserInputEvent(BrowserInputEventClient* client); |
| + |
| + bool CanCreateFollowupEvents() const; |
| + |
| + private: |
| + BrowserInputEventClient* client_; |
| +}; |
| + |
| +} // namespace content |
| + |
| +#endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_BROWSER_INPUT_EVENT_H_ |