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. 4 5 #include "content/renderer/idle_user_detector.h" 6 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" 11 12 namespace content { 13 IdleUserDetector(RenderView * render_view)14IdleUserDetector::IdleUserDetector(RenderView* render_view) 15 : RenderViewObserver(render_view){ 16 } 17 ~IdleUserDetector()18IdleUserDetector::~IdleUserDetector() { 19 } 20 OnMessageReceived(const IPC::Message & message)21bool IdleUserDetector::OnMessageReceived(const IPC::Message& message) { 22 IPC_BEGIN_MESSAGE_MAP(IdleUserDetector, message) 23 IPC_MESSAGE_HANDLER(InputMsg_HandleInputEvent, OnHandleInputEvent) 24 IPC_END_MESSAGE_MAP() 25 return false; 26 } 27 OnHandleInputEvent(const blink::WebInputEvent * event,const ui::LatencyInfo & latency_info,bool is_keyboard_shortcut)28void 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(); 35 } 36 } 37 } 38 39 } // namespace content 40