| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/extensions/users_private/users_private_api.h" | 5 #include "chrome/browser/chromeos/extensions/users_private/users_private_api.h" |
| 6 | 6 |
| 7 #include "base/values.h" | 7 #include "base/values.h" |
| 8 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
| 9 #include "chrome/browser/chromeos/extensions/users_private/users_private_delegat
e.h" | 9 #include "chrome/browser/chromeos/extensions/users_private/users_private_delegat
e.h" |
| 10 #include "chrome/browser/chromeos/extensions/users_private/users_private_delegat
e_factory.h" | 10 #include "chrome/browser/chromeos/extensions/users_private/users_private_delegat
e_factory.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 | 47 |
| 48 // Create one list to set. This is needed because user white list update is | 48 // Create one list to set. This is needed because user white list update is |
| 49 // asynchronous and sequential. Before previous write comes back, cached list | 49 // asynchronous and sequential. Before previous write comes back, cached list |
| 50 // is stale and should not be used for appending. See http://crbug.com/127215 | 50 // is stale and should not be used for appending. See http://crbug.com/127215 |
| 51 scoped_ptr<base::ListValue> email_list; | 51 scoped_ptr<base::ListValue> email_list; |
| 52 | 52 |
| 53 UsersPrivateDelegate* delegate = | 53 UsersPrivateDelegate* delegate = |
| 54 UsersPrivateDelegateFactory::GetForBrowserContext(browser_context()); | 54 UsersPrivateDelegateFactory::GetForBrowserContext(browser_context()); |
| 55 PrefsUtil* prefs_util = delegate->GetPrefsUtil(); | 55 PrefsUtil* prefs_util = delegate->GetPrefsUtil(); |
| 56 | 56 |
| 57 scoped_ptr<api::settings_private::PrefObject> users_pref_object = | 57 scoped_ptr<api::settings_private::PrefData> users_pref_data = |
| 58 prefs_util->GetPref(chromeos::kAccountsPrefUsers); | 58 prefs_util->GetPref(chromeos::kAccountsPrefUsers); |
| 59 if (users_pref_object->value) { | 59 if (users_pref_data->value) { |
| 60 const base::ListValue* existing = nullptr; | 60 const base::ListValue* existing = nullptr; |
| 61 users_pref_object->value->GetAsList(&existing); | 61 users_pref_data->value->GetAsList(&existing); |
| 62 email_list.reset(existing->DeepCopy()); | 62 email_list.reset(existing->DeepCopy()); |
| 63 } else { | 63 } else { |
| 64 email_list.reset(new base::ListValue()); | 64 email_list.reset(new base::ListValue()); |
| 65 } | 65 } |
| 66 | 66 |
| 67 // Remove all supervised users. On the next step only supervised users present | 67 // Remove all supervised users. On the next step only supervised users present |
| 68 // on the device will be added back. Thus not present SU are removed. | 68 // on the device will be added back. Thus not present SU are removed. |
| 69 // No need to remove usual users as they can simply login back. | 69 // No need to remove usual users as they can simply login back. |
| 70 for (size_t i = 0; i < email_list->GetSize(); ++i) { | 70 for (size_t i = 0; i < email_list->GetSize(); ++i) { |
| 71 std::string whitelisted_user; | 71 std::string whitelisted_user; |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 | 205 |
| 206 ExtensionFunction::ResponseAction | 206 ExtensionFunction::ResponseAction |
| 207 UsersPrivateIsWhitelistManagedFunction::Run() { | 207 UsersPrivateIsWhitelistManagedFunction::Run() { |
| 208 bool is_managed = g_browser_process->platform_part() | 208 bool is_managed = g_browser_process->platform_part() |
| 209 ->browser_policy_connector_chromeos() | 209 ->browser_policy_connector_chromeos() |
| 210 ->IsEnterpriseManaged(); | 210 ->IsEnterpriseManaged(); |
| 211 return RespondNow(OneArgument(new base::FundamentalValue(is_managed))); | 211 return RespondNow(OneArgument(new base::FundamentalValue(is_managed))); |
| 212 } | 212 } |
| 213 | 213 |
| 214 } // namespace extensions | 214 } // namespace extensions |
| OLD | NEW |