Skip to content

Commit

Permalink
Revert 100093 - UI fix for idle API on ChromeOS.
Browse files Browse the repository at this point in the history
BUG=chromium-os:17167
TEST=None.


Review URL: http://codereview.chromium.org/7800018

TBR=sidor@chromium.org
Review URL: http://codereview.chromium.org/7847014

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@100104 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
dhollowa@chromium.org committed Sep 8, 2011
1 parent 4c78a3e commit 49a214a
Show file tree
Hide file tree
Showing 7 changed files with 3 additions and 72 deletions.
2 changes: 0 additions & 2 deletions chrome/browser/chromeos/cros/mock_power_library.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ class MockPowerLibrary : public PowerLibrary {
MOCK_CONST_METHOD0(battery_time_to_empty, base::TimeDelta(void));
MOCK_CONST_METHOD0(battery_time_to_full, base::TimeDelta(void));

MOCK_METHOD1(CalculateIdleTime, void(CalculateIdleTimeCallback*));

MOCK_METHOD1(EnableScreenLock, void(bool));
MOCK_METHOD0(RequestRestart, void(void));
MOCK_METHOD0(RequestShutdown, void(void));
Expand Down
24 changes: 0 additions & 24 deletions chrome/browser/chromeos/cros/power_library.cc
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,6 @@ class PowerLibraryImpl : public PowerLibrary {
return base::TimeDelta::FromSeconds(status_.battery_time_to_full);
}

virtual void CalculateIdleTime(CalculateIdleTimeCallback* callback) OVERRIDE {
// TODO(sidor): Examine if it's really a good idea to use void* as a second
// argument.
chromeos::GetIdleTime(&GetIdleTimeCallback, callback);
}

virtual void EnableScreenLock(bool enable) OVERRIDE {
if (!CrosLibrary::Get()->EnsureLoaded())
return;
Expand Down Expand Up @@ -112,21 +106,6 @@ class PowerLibraryImpl : public PowerLibrary {
// End PowerLibrary implementation.

private:
static void GetIdleTimeCallback(void* object,
int64_t time_idle_ms,
bool success) {
DCHECK(object);
CalculateIdleTimeCallback* notify =
static_cast<CalculateIdleTimeCallback*>(object);
if (success) {
notify->Run(time_idle_ms/1000);
} else {
LOG(ERROR) << "Power manager failed to calculate idle time.";
notify->Run(-1);
}
delete notify;
}

static void PowerStatusChangedHandler(void* object,
const chromeos::PowerStatus& status) {
PowerLibraryImpl* power = static_cast<PowerLibraryImpl*>(object);
Expand Down Expand Up @@ -241,9 +220,6 @@ class PowerLibraryStubImpl : public PowerLibrary {
return base::TimeDelta::FromHours(3) - battery_time_to_empty();
}

virtual void CalculateIdleTime(CalculateIdleTimeCallback* callback) OVERRIDE {
callback->Run(0);
}
virtual void EnableScreenLock(bool enable) OVERRIDE {}
virtual void RequestRestart() OVERRIDE {}
virtual void RequestShutdown() OVERRIDE {}
Expand Down
8 changes: 0 additions & 8 deletions chrome/browser/chromeos/cros/power_library.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,12 @@
#define CHROME_BROWSER_CHROMEOS_CROS_POWER_LIBRARY_H_
#pragma once

#include "base/callback.h"

namespace base {
class TimeDelta;
}

namespace chromeos {

typedef base::Callback<void(int64_t)> CalculateIdleTimeCallback;

// This interface defines interaction with the ChromeOS power library APIs.
// Classes can add themselves as observers. Users can get an instance of this
// library class like this: chromeos::CrosLibrary::Get()->GetPowerLibrary()
Expand Down Expand Up @@ -55,10 +51,6 @@ class PowerLibrary {
// The amount of time until battery is full.
virtual base::TimeDelta battery_time_to_full() const = 0;

// Calculates idle time asynchronously. If it encounters some error,
// it returns -1.
virtual void CalculateIdleTime(CalculateIdleTimeCallback* callback) = 0;

// Enable/disable screen lock for current session.
virtual void EnableScreenLock(bool enable) = 0;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

#include "base/message_loop.h"
#include "base/string_util.h"
#include "chrome/browser/chromeos/cros/cros_library.h"
#include "chrome/browser/chromeos/notifications/balloon_collection_impl.h"
#include "chrome/browser/notifications/balloon.h"
#include "chrome/browser/notifications/desktop_notification_service.h"
Expand Down Expand Up @@ -110,9 +109,6 @@ class DesktopNotificationsTest : public testing::Test {

// Contains the cumulative output of the unit test.
static std::string log_output_;

// Initializes / shuts down a stub CrosLibrary.
chromeos::ScopedStubCrosEnabler stub_cros_enabler_;
};

} // namespace chromeos
Expand Down
5 changes: 3 additions & 2 deletions chrome/browser/extensions/extension_idle_api.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Copyright (c) 2010 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.

Expand Down Expand Up @@ -169,7 +169,8 @@ bool ExtensionIdleQueryStateFunction::RunImpl() {
polling_data.state = IDLE_STATE_UNKNOWN;
CalculateIdleState(threshold,
base::Bind(&ExtensionIdleQueryStateFunction::IdleStateCallback,
this, threshold));
base::Unretained(this), threshold));

// Don't send the response, it'll be sent by our callback
return true;
}
Expand Down
30 changes: 0 additions & 30 deletions chrome/browser/idle_chromeos.cc

This file was deleted.

2 changes: 0 additions & 2 deletions chrome/chrome_browser.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -1311,7 +1311,6 @@
'browser/icon_manager_mac.mm',
'browser/icon_manager_win.cc',
'browser/idle.cc',
'browser/idle_chromeos.cc',
'browser/idle_linux.cc',
'browser/idle_mac.mm',
'browser/idle_query_linux.cc',
Expand Down Expand Up @@ -3907,7 +3906,6 @@
'browser/first_run/upgrade_util.cc',
'browser/first_run/upgrade_util.h',
'browser/first_run/upgrade_util_linux.cc',
'browser/idle_linux.cc',
'browser/password_manager/native_backend_gnome_x.cc',
'browser/password_manager/native_backend_gnome_x.h',
'browser/password_manager/native_backend_kwallet_x.cc',
Expand Down

0 comments on commit 49a214a

Please sign in to comment.