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

Unified Diff: chrome/browser/chromeos/power/light_bar.cc

Issue 823703004: Tracking push events for lucid sleep (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Kill renderer if it sends a bad message id Created 5 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/power/light_bar.cc
diff --git a/chrome/browser/chromeos/power/light_bar.cc b/chrome/browser/chromeos/power/light_bar.cc
deleted file mode 100644
index 92c2033994547c714642c362bbe41c8980ff0ef9..0000000000000000000000000000000000000000
--- a/chrome/browser/chromeos/power/light_bar.cc
+++ /dev/null
@@ -1,60 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/chromeos/power/light_bar.h"
-
-#include <cstring> // needed for strlen()
-
-#include "base/command_line.h"
-#include "base/files/file_util.h"
-#include "base/logging.h"
-#include "base/message_loop/message_loop.h"
-#include "chromeos/chromeos_switches.h"
-#include "chromeos/dbus/dbus_thread_manager.h"
-
-namespace chromeos {
-
-namespace {
-const int kDarkSuspendDelaySeconds = 4;
-const char kLightBarControlPath[] =
- "/sys/devices/platform/cros_ec_lpc.0/cros-ec-dev.0/chromeos/cros_ec/"
- "lightbar/sequence";
-const char kKonamiCommand[] = "KONAMI";
-
-} // namespace
-
-LightBar::LightBar()
- : control_path_(base::FilePath(kLightBarControlPath)),
- has_light_bar_(base::PathIsWritable(control_path_)) {
- DBusThreadManager::Get()->GetPowerManagerClient()->AddObserver(this);
-}
-
-LightBar::~LightBar() {
- DBusThreadManager::Get()->GetPowerManagerClient()->RemoveObserver(this);
-}
-
-void LightBar::DarkSuspendImminent() {
- // The plan is to track the progress of push events and then re-suspend as
- // soon as we know they have been processed. In the meanwhile, we can hack
- // around this by just having the light bar delay for a long time so that
- // people can at least start playing around with this feature for their apps.
- //
- // TODO(chirantan): Remove this once we can accurately track the progress of
- // push events.
- base::MessageLoop::current()->PostDelayedTask(
- FROM_HERE,
- DBusThreadManager::Get()
- ->GetPowerManagerClient()
- ->GetSuspendReadinessCallback(),
- base::TimeDelta::FromSeconds(kDarkSuspendDelaySeconds));
-
- if (!has_light_bar_)
- return;
-
- if (base::WriteFile(control_path_, kKonamiCommand, strlen(kKonamiCommand)) !=
- static_cast<int>(strlen(kKonamiCommand)))
- PLOG(WARNING) << "Unable to flash light bar during dark resume.";
-}
-
-} // namespace chromeos

Powered by Google App Engine
This is Rietveld 408576698