Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chrome/browser/chromeos/policy/consumer_management_service.h" | 5 #include "chrome/browser/chromeos/policy/consumer_management_service.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/prefs/pref_registry_simple.h" | 10 #include "base/prefs/pref_registry_simple.h" |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 88 if (stage.IsEnrolling()) | 88 if (stage.IsEnrolling()) |
| 89 return STATUS_ENROLLING; | 89 return STATUS_ENROLLING; |
| 90 | 90 |
| 91 return STATUS_UNENROLLED; | 91 return STATUS_UNENROLLED; |
| 92 } | 92 } |
| 93 | 93 |
| 94 std::string ConsumerManagementService::GetStatusString() const { | 94 std::string ConsumerManagementService::GetStatusString() const { |
| 95 return kStatusString[GetStatus()]; | 95 return kStatusString[GetStatus()]; |
| 96 } | 96 } |
| 97 | 97 |
| 98 bool ConsumerManagementService::IsManaged() const { | |
| 99 Status status = GetStatus(); | |
|
bartfab (slow)
2014/11/28 13:25:17
Nit: Const.
davidyu
2014/12/01 17:05:21
Done.
| |
| 100 return status == STATUS_ENROLLED || status == STATUS_UNENROLLING; | |
| 101 } | |
| 102 | |
| 98 ConsumerManagementStage ConsumerManagementService::GetStage() const { | 103 ConsumerManagementStage ConsumerManagementService::GetStage() const { |
| 99 const PrefService* prefs = g_browser_process->local_state(); | 104 const PrefService* prefs = g_browser_process->local_state(); |
| 100 const int stage = prefs->GetInteger(prefs::kConsumerManagementStage); | 105 const int stage = prefs->GetInteger(prefs::kConsumerManagementStage); |
| 101 return ConsumerManagementStage::FromInt(stage); | 106 return ConsumerManagementStage::FromInt(stage); |
| 102 } | 107 } |
| 103 | 108 |
| 104 void ConsumerManagementService::SetStage(ConsumerManagementStage stage) { | 109 void ConsumerManagementService::SetStage(ConsumerManagementStage stage) { |
| 105 PrefService* prefs = g_browser_process->local_state(); | 110 PrefService* prefs = g_browser_process->local_state(); |
| 106 prefs->SetInteger(prefs::kConsumerManagementStage, stage.value()); | 111 prefs->SetInteger(prefs::kConsumerManagementStage, stage.value()); |
| 107 | 112 |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 187 if (!dbus_success || reply.error() != 0) { | 192 if (!dbus_success || reply.error() != 0) { |
| 188 LOG(ERROR) << "Failed to flush and sign boot lockbox."; | 193 LOG(ERROR) << "Failed to flush and sign boot lockbox."; |
| 189 callback.Run(false); | 194 callback.Run(false); |
| 190 return; | 195 return; |
| 191 } | 196 } |
| 192 | 197 |
| 193 callback.Run(true); | 198 callback.Run(true); |
| 194 } | 199 } |
| 195 | 200 |
| 196 } // namespace policy | 201 } // namespace policy |
| OLD | NEW |