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

Side by Side Diff: chromeos/dbus/fake_power_manager_client.cc

Issue 2296003002: ABANDONED: chromeos: Resume displays when suspend is cancelled. (Closed)
Patch Set: fix comment Created 4 years, 3 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 unified diff | Download patch
« no previous file with comments | « chromeos/dbus/fake_power_manager_client.h ('k') | ui/display/chromeos/display_configurator.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chromeos/dbus/fake_power_manager_client.h" 5 #include "chromeos/dbus/fake_power_manager_client.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/location.h" 9 #include "base/location.h"
10 #include "base/threading/thread_task_runner_handle.h" 10 #include "base/threading/thread_task_runner_handle.h"
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 : power_manager::PowerSupplyProperties_ExternalPower_AC); 129 : power_manager::PowerSupplyProperties_ExternalPower_AC);
130 break; 130 break;
131 } 131 }
132 } 132 }
133 133
134 NotifyObservers(); 134 NotifyObservers();
135 } 135 }
136 136
137 base::Closure FakePowerManagerClient::GetSuspendReadinessCallback() { 137 base::Closure FakePowerManagerClient::GetSuspendReadinessCallback() {
138 ++num_pending_suspend_readiness_callbacks_; 138 ++num_pending_suspend_readiness_callbacks_;
139
140 return base::Bind(&FakePowerManagerClient::HandleSuspendReadiness, 139 return base::Bind(&FakePowerManagerClient::HandleSuspendReadiness,
141 base::Unretained(this)); 140 base::Unretained(this));
142 } 141 }
143 142
144 int FakePowerManagerClient::GetNumPendingSuspendReadinessCallbacks() { 143 int FakePowerManagerClient::GetNumPendingSuspendReadinessCallbacks() {
145 return num_pending_suspend_readiness_callbacks_; 144 return num_pending_suspend_readiness_callbacks_;
146 } 145 }
147 146
147 void FakePowerManagerClient::Reset() {
148 observers_.Clear();
149 policy_ = power_manager::PowerManagementPolicy();
150 props_ = power_manager::PowerSupplyProperties();
151 num_request_restart_calls_ = 0;
152 num_request_shutdown_calls_ = 0;
153 num_set_policy_calls_ = 0;
154 num_set_is_projecting_calls_ = 0;
155 num_pending_suspend_readiness_callbacks_ = 0;
156 is_projecting_ = false;
157 video_activity_reports_.clear();
158 }
159
148 bool FakePowerManagerClient::PopVideoActivityReport() { 160 bool FakePowerManagerClient::PopVideoActivityReport() {
149 CHECK(!video_activity_reports_.empty()); 161 CHECK(!video_activity_reports_.empty());
150 bool fullscreen = video_activity_reports_.front(); 162 bool fullscreen = video_activity_reports_.front();
151 video_activity_reports_.pop_front(); 163 video_activity_reports_.pop_front();
152 return fullscreen; 164 return fullscreen;
153 } 165 }
154 166
155 void FakePowerManagerClient::SendSuspendImminent() { 167 void FakePowerManagerClient::SendSuspendImminent() {
156 FOR_EACH_OBSERVER(Observer, observers_, SuspendImminent()); 168 FOR_EACH_OBSERVER(Observer, observers_, SuspendImminent());
157 if (render_process_manager_delegate_) 169 if (render_process_manager_delegate_)
(...skipping 28 matching lines...) Expand all
186 FOR_EACH_OBSERVER(Observer, observers_, PowerChanged(props_)); 198 FOR_EACH_OBSERVER(Observer, observers_, PowerChanged(props_));
187 } 199 }
188 200
189 void FakePowerManagerClient::HandleSuspendReadiness() { 201 void FakePowerManagerClient::HandleSuspendReadiness() {
190 CHECK(num_pending_suspend_readiness_callbacks_ > 0); 202 CHECK(num_pending_suspend_readiness_callbacks_ > 0);
191 203
192 --num_pending_suspend_readiness_callbacks_; 204 --num_pending_suspend_readiness_callbacks_;
193 } 205 }
194 206
195 } // namespace chromeos 207 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/dbus/fake_power_manager_client.h ('k') | ui/display/chromeos/display_configurator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698