renderer_freezer.h revision 6e8cce623b6e4fe0c9e4af605d675dd9d0338c38
1// Copyright 2014 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#ifndef CHROME_BROWSER_CHROMEOS_POWER_RENDERER_FREEZER_H_ 6#define CHROME_BROWSER_CHROMEOS_POWER_RENDERER_FREEZER_H_ 7 8#include "base/files/file_path.h" 9#include "base/time/time.h" 10#include "chromeos/chromeos_export.h" 11#include "chromeos/dbus/power_manager_client.h" 12 13namespace chromeos { 14 15// Freezes the chrome renderers when the system is about to suspend and thaws 16// them after the system fully resumes. This class registers itself as a 17// PowerManagerClient::Observer on creation and unregisters itself on 18// destruction. 19class CHROMEOS_EXPORT RendererFreezer : public PowerManagerClient::Observer { 20 public: 21 RendererFreezer(); 22 virtual ~RendererFreezer(); 23 24 // PowerManagerClient::Observer implementation 25 virtual void SuspendImminent() OVERRIDE; 26 virtual void SuspendDone(const base::TimeDelta& sleep_duration) OVERRIDE; 27 28 private: 29 base::FilePath state_path_; 30 bool enabled_; 31 bool frozen_; 32 33 DISALLOW_COPY_AND_ASSIGN(RendererFreezer); 34}; 35 36} // namespace chromeos 37 38#endif // CHROME_BROWSER_CHROMEOS_POWER_RENDERER_FREEZER_H_ 39