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

Side by Side Diff: content/renderer/idle_user_detector.cc

Issue 2813683002: Allow MainThreadEventQueue to call the RenderWidget directly. (Closed)
Patch Set: Fix style nits Created 3 years, 8 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
« no previous file with comments | « content/renderer/idle_user_detector.h ('k') | content/renderer/input/input_event_filter.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/idle_user_detector.h" 5 #include "content/renderer/idle_user_detector.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "content/common/input_messages.h" 8 #include "content/common/input_messages.h"
9 #include "content/public/renderer/content_renderer_client.h" 9 #include "content/public/renderer/content_renderer_client.h"
10 #include "content/renderer/render_thread_impl.h" 10 #include "content/renderer/render_thread_impl.h"
11 11
12 namespace content { 12 namespace content {
13 13
14 IdleUserDetector::IdleUserDetector(RenderView* render_view) 14 IdleUserDetector::IdleUserDetector(RenderView* render_view)
15 : RenderViewObserver(render_view){ 15 : RenderViewObserver(render_view) {}
16 }
17 16
18 IdleUserDetector::~IdleUserDetector() { 17 IdleUserDetector::~IdleUserDetector() {}
19 }
20 18
21 bool IdleUserDetector::OnMessageReceived(const IPC::Message& message) { 19 bool IdleUserDetector::OnMessageReceived(const IPC::Message& message) {
22 IPC_BEGIN_MESSAGE_MAP(IdleUserDetector, message) 20 IPC_BEGIN_MESSAGE_MAP(IdleUserDetector, message)
23 IPC_MESSAGE_HANDLER(InputMsg_HandleInputEvent, OnHandleInputEvent) 21 IPC_MESSAGE_HANDLER(InputMsg_HandleInputEvent, OnHandleInputEvent)
24 IPC_END_MESSAGE_MAP() 22 IPC_END_MESSAGE_MAP()
25 return false; 23 return false;
26 } 24 }
27 25
28 void IdleUserDetector::OnHandleInputEvent( 26 void IdleUserDetector::ActivityDetected() {
29 const blink::WebInputEvent* event,
30 const std::vector<const blink::WebInputEvent*>& coalesced_events,
31 const ui::LatencyInfo& latency_info,
32 InputEventDispatchType dispatch_type) {
33 if (GetContentClient()->renderer()->RunIdleHandlerWhenWidgetsHidden()) { 27 if (GetContentClient()->renderer()->RunIdleHandlerWhenWidgetsHidden()) {
34 RenderThreadImpl* render_thread = RenderThreadImpl::current(); 28 RenderThreadImpl* render_thread = RenderThreadImpl::current();
35 if (render_thread != NULL) { 29 if (render_thread != NULL) {
36 render_thread->PostponeIdleNotification(); 30 render_thread->PostponeIdleNotification();
37 } 31 }
38 } 32 }
39 } 33 }
40 34
41 void IdleUserDetector::OnDestruct() { 35 void IdleUserDetector::OnHandleInputEvent(
42 delete this; 36 const blink::WebInputEvent* event,
37 const std::vector<const blink::WebInputEvent*>& coalesced_events,
38 const ui::LatencyInfo& latency_info,
39 InputEventDispatchType dispatch_type) {
40 ActivityDetected();
43 } 41 }
44 42
43 void IdleUserDetector::OnDestruct() {}
44
45 } // namespace content 45 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/idle_user_detector.h ('k') | content/renderer/input/input_event_filter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698