Revert of Add button to add new FSP services to Files app. (patchset #8 id:140001...
[chromium-blink-merge.git] / chrome / browser / chromeos / policy / server_backed_device_state.cc
blobd64a9bad183f905c71f0820cca9a593f2b2ecf0c
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "chrome/browser/chromeos/policy/server_backed_device_state.h"
7 #include <string>
9 #include "base/logging.h"
10 #include "base/prefs/pref_service.h"
11 #include "base/values.h"
12 #include "chrome/browser/browser_process.h"
13 #include "chrome/browser/browser_process_platform_part.h"
14 #include "chrome/common/pref_names.h"
16 namespace policy {
18 const char kDeviceStateManagementDomain[] = "management_domain";
19 const char kDeviceStateRestoreMode[] = "device_mode";
20 const char kDeviceStateDisabledMessage[] = "disabled_message";
22 const char kDeviceStateRestoreModeReEnrollmentRequested[] =
23 "re-enrollment-requested";
24 const char kDeviceStateRestoreModeReEnrollmentEnforced[] =
25 "re-enrollment-enforced";
26 const char kDeviceStateRestoreModeDisabled[] = "disabled";
28 RestoreMode GetRestoreMode() {
29 std::string restore_mode;
30 g_browser_process->local_state()->GetDictionary(
31 prefs::kServerBackedDeviceState)->GetString(kDeviceStateRestoreMode,
32 &restore_mode);
33 if (restore_mode.empty())
34 return RESTORE_MODE_NONE;
35 if (restore_mode == kDeviceStateRestoreModeReEnrollmentRequested)
36 return RESTORE_MODE_REENROLLMENT_REQUESTED;
37 if (restore_mode == kDeviceStateRestoreModeReEnrollmentEnforced)
38 return RESTORE_MODE_REENROLLMENT_ENFORCED;
39 if (restore_mode == kDeviceStateRestoreModeDisabled)
40 return RESTORE_MODE_DISABLED;
42 NOTREACHED();
43 return RESTORE_MODE_NONE;
46 } // namespace policy