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
3 // found in the LICENSE file.
5 #include "content/renderer/idle_user_detector.h"
7 #include "base/logging.h"
8 #include "content/common/input_messages.h"
9 #include "content/public/renderer/content_renderer_client.h"
10 #include "content/renderer/render_thread_impl.h"
14 IdleUserDetector::IdleUserDetector(RenderView
* render_view
)
15 : RenderViewObserver(render_view
){
18 IdleUserDetector::~IdleUserDetector() {
21 bool IdleUserDetector::OnMessageReceived(const IPC::Message
& message
) {
22 IPC_BEGIN_MESSAGE_MAP(IdleUserDetector
, message
)
23 IPC_MESSAGE_HANDLER(InputMsg_HandleInputEvent
, OnHandleInputEvent
)
28 void IdleUserDetector::OnHandleInputEvent(const blink::WebInputEvent
* event
,
29 const ui::LatencyInfo
& latency_info
,
30 bool is_keyboard_shortcut
) {
31 if (GetContentClient()->renderer()->RunIdleHandlerWhenWidgetsHidden()) {
32 RenderThreadImpl
* render_thread
= RenderThreadImpl::current();
33 if (render_thread
!= NULL
) {
34 render_thread
->PostponeIdleNotification();
39 } // namespace content