OLD | NEW |
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/power_policy_controller.h" | 5 #include "chromeos/dbus/power_policy_controller.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/format_macros.h" | 9 #include "base/format_macros.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 if (policy.has_wait_for_initial_user_activity()) { | 145 if (policy.has_wait_for_initial_user_activity()) { |
146 str += base::StringPrintf("wait_for_initial_user_activity=%d ", | 146 str += base::StringPrintf("wait_for_initial_user_activity=%d ", |
147 policy.wait_for_initial_user_activity()); | 147 policy.wait_for_initial_user_activity()); |
148 } | 148 } |
149 if (policy.has_force_nonzero_brightness_for_user_activity()) { | 149 if (policy.has_force_nonzero_brightness_for_user_activity()) { |
150 str += base::StringPrintf("force_nonzero_brightness_for_user_activity=%d ", | 150 str += base::StringPrintf("force_nonzero_brightness_for_user_activity=%d ", |
151 policy.force_nonzero_brightness_for_user_activity()); | 151 policy.force_nonzero_brightness_for_user_activity()); |
152 } | 152 } |
153 if (policy.has_reason()) | 153 if (policy.has_reason()) |
154 str += base::StringPrintf("reason=\"%s\" ", policy.reason().c_str()); | 154 str += base::StringPrintf("reason=\"%s\" ", policy.reason().c_str()); |
155 base::TrimWhitespace(str, base::TRIM_TRAILING, &str); | 155 base::TrimWhitespaceASCII(str, base::TRIM_TRAILING, &str); |
156 return str; | 156 return str; |
157 } | 157 } |
158 | 158 |
159 // static | 159 // static |
160 void PowerPolicyController::Initialize(PowerManagerClient* client) { | 160 void PowerPolicyController::Initialize(PowerManagerClient* client) { |
161 DCHECK(!IsInitialized()); | 161 DCHECK(!IsInitialized()); |
162 g_power_policy_controller = new PowerPolicyController(client); | 162 g_power_policy_controller = new PowerPolicyController(client); |
163 } | 163 } |
164 | 164 |
165 // static | 165 // static |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
356 power_manager::PowerManagementPolicy_Action_DO_NOTHING); | 356 power_manager::PowerManagementPolicy_Action_DO_NOTHING); |
357 } | 357 } |
358 } | 358 } |
359 | 359 |
360 if (!causes.empty()) | 360 if (!causes.empty()) |
361 policy.set_reason(causes); | 361 policy.set_reason(causes); |
362 client_->SetPolicy(policy); | 362 client_->SetPolicy(policy); |
363 } | 363 } |
364 | 364 |
365 } // namespace chromeos | 365 } // namespace chromeos |
OLD | NEW |