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

Unified Diff: chromeos/dbus/power_policy_controller.cc

Issue 49773003: ChromeOS: Remove MockDBusThreadManager. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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: chromeos/dbus/power_policy_controller.cc
diff --git a/chromeos/dbus/power_policy_controller.cc b/chromeos/dbus/power_policy_controller.cc
index 6eed9656f7b17c616128083156a5d4a5b310714a..64cc66557bf61c0566d9b39caab9b6e6dc7d7e5d 100644
--- a/chromeos/dbus/power_policy_controller.cc
+++ b/chromeos/dbus/power_policy_controller.cc
@@ -123,19 +123,16 @@ std::string PowerPolicyController::GetPolicyDebugString(
return str;
}
-PowerPolicyController::PowerPolicyController(DBusThreadManager* manager,
- PowerManagerClient* client)
- : manager_(manager),
- client_(client),
+PowerPolicyController::PowerPolicyController()
+ : manager_(NULL),
+ client_(NULL),
prefs_were_set_(false),
honor_screen_wake_locks_(true),
next_wake_lock_id_(1) {
- manager_->AddObserver(this);
- client_->AddObserver(this);
- SendCurrentPolicy();
}
PowerPolicyController::~PowerPolicyController() {
+ DCHECK(manager_);
// The power manager's policy is reset before this point, in
// OnDBusThreadManagerDestroying(). At the time that
// PowerPolicyController is destroyed, PowerManagerClient's D-Bus proxy
@@ -146,6 +143,14 @@ PowerPolicyController::~PowerPolicyController() {
manager_ = NULL;
}
+void PowerPolicyController::Init(DBusThreadManager* manager) {
+ manager_ = manager;
+ manager_->AddObserver(this);
+ client_ = manager_->GetPowerManagerClient();
+ client_->AddObserver(this);
+ SendCurrentPolicy();
+}
+
void PowerPolicyController::ApplyPrefs(const PrefValues& values) {
prefs_policy_.Clear();

Powered by Google App Engine
This is Rietveld 408576698