| 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 "base/format_macros.h" | 7 #include "base/format_macros.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
| 10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 if (policy.has_user_activity_screen_dim_delay_factor()) { | 122 if (policy.has_user_activity_screen_dim_delay_factor()) { |
| 123 str += base::StringPrintf("user_activity_screen_dim_delay_factor=%f ", | 123 str += base::StringPrintf("user_activity_screen_dim_delay_factor=%f ", |
| 124 policy.user_activity_screen_dim_delay_factor()); | 124 policy.user_activity_screen_dim_delay_factor()); |
| 125 } | 125 } |
| 126 if (policy.has_wait_for_initial_user_activity()) { | 126 if (policy.has_wait_for_initial_user_activity()) { |
| 127 str += base::StringPrintf("wait_for_initial_user_activity=%d ", | 127 str += base::StringPrintf("wait_for_initial_user_activity=%d ", |
| 128 policy.wait_for_initial_user_activity()); | 128 policy.wait_for_initial_user_activity()); |
| 129 } | 129 } |
| 130 if (policy.has_reason()) | 130 if (policy.has_reason()) |
| 131 str += base::StringPrintf("reason=\"%s\" ", policy.reason().c_str()); | 131 str += base::StringPrintf("reason=\"%s\" ", policy.reason().c_str()); |
| 132 TrimWhitespace(str, TRIM_TRAILING, &str); | 132 base::TrimWhitespace(str, base::TRIM_TRAILING, &str); |
| 133 return str; | 133 return str; |
| 134 } | 134 } |
| 135 | 135 |
| 136 PowerPolicyController::PowerPolicyController() | 136 PowerPolicyController::PowerPolicyController() |
| 137 : client_(NULL), | 137 : client_(NULL), |
| 138 prefs_were_set_(false), | 138 prefs_were_set_(false), |
| 139 honor_screen_wake_locks_(true), | 139 honor_screen_wake_locks_(true), |
| 140 next_wake_lock_id_(1) { | 140 next_wake_lock_id_(1) { |
| 141 } | 141 } |
| 142 | 142 |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 it != system_wake_locks_.end(); ++it) { | 273 it != system_wake_locks_.end(); ++it) { |
| 274 reason += (reason.empty() ? "" : ", ") + it->second; | 274 reason += (reason.empty() ? "" : ", ") + it->second; |
| 275 } | 275 } |
| 276 | 276 |
| 277 if (!reason.empty()) | 277 if (!reason.empty()) |
| 278 policy.set_reason(reason); | 278 policy.set_reason(reason); |
| 279 client_->SetPolicy(policy); | 279 client_->SetPolicy(policy); |
| 280 } | 280 } |
| 281 | 281 |
| 282 } // namespace chromeos | 282 } // namespace chromeos |
| OLD | NEW |