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/view_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(ViewMsg_HandleInputEvent
, OnHandleInputEvent
)
28 void IdleUserDetector::OnHandleInputEvent(const WebKit::WebInputEvent
* event
,
29 bool is_keyboard_shortcut
) {
30 if (GetContentClient()->renderer()->RunIdleHandlerWhenWidgetsHidden()) {
31 RenderThreadImpl
* render_thread
= RenderThreadImpl::current();
32 if (render_thread
!= NULL
) {
33 render_thread
->PostponeIdleNotification();
38 } // namespace content