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

Side by Side Diff: content/browser/renderer_host/input/browser_input_event.cc

Issue 20356003: Provided batched input delivery with a BufferedInputRouter (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Refactoring Created 7 years, 3 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright (c) 2013 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 #include "content/browser/renderer_host/input/browser_input_event.h"
6
7 #include "content/common/input/web_input_event_payload.h"
8
9 namespace content {
10
11 BrowserInputEvent::BrowserInputEvent(BrowserInputEventClient* client)
12 : client_(client) {}
13
14 BrowserInputEvent::~BrowserInputEvent() {}
15
16 scoped_ptr<BrowserInputEvent> BrowserInputEvent::Create(
17 int64 id,
18 scoped_ptr<InputEvent::Payload> payload,
19 BrowserInputEventClient* client) {
20 scoped_ptr<BrowserInputEvent> event(new BrowserInputEvent(client));
21 event->Initialize(id, payload.Pass());
22 return event.Pass();
23 }
24
25 void BrowserInputEvent::OnDispatched(
26 InputEventDisposition disposition,
27 ScopedVector<BrowserInputEvent>* followup_events) {
28 DCHECK(followup_events != NULL);
29 if (!client_)
30 return;
31
32 bool event_consumed =
33 disposition == INPUT_EVENT_MAIN_THREAD_CONSUMED ||
34 disposition == INPUT_EVENT_IMPL_THREAD_CONSUMED ||
35 disposition == INPUT_EVENT_MAIN_THREAD_PREVENT_DEFAULTED;
36
37 if (!event_consumed && CanCreateFollowupEvents())
38 client_->OnDispatched(*this, disposition, followup_events);
39 else
40 client_->OnDispatched(*this, disposition);
41 }
42
43 bool BrowserInputEvent::CanCreateFollowupEvents() const {
44 return payload()->GetType() == InputEvent::Payload::WEB_INPUT_EVENT &&
45 WebInputEventPayload::Cast(payload())->CanCreateFollowupEvents();
46 }
47
48 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698