Chromium Code Reviews| Index: chrome/browser/chromeos/extensions/users_private/users_private_api.cc |
| diff --git a/chrome/browser/chromeos/extensions/users_private/users_private_api.cc b/chrome/browser/chromeos/extensions/users_private/users_private_api.cc |
| index 0ca0a1bde918c3cbf7309ae52446f9f726765c3d..4c7267cf2a4ae43b5dc12ed326f396dbab6cc4cd 100644 |
| --- a/chrome/browser/chromeos/extensions/users_private/users_private_api.cc |
| +++ b/chrome/browser/chromeos/extensions/users_private/users_private_api.cc |
| @@ -8,6 +8,7 @@ |
| #include <utility> |
| +#include "base/bind.h" |
| #include "base/memory/ptr_util.h" |
| #include "base/strings/utf_string_conversions.h" |
| #include "base/values.h" |
| @@ -23,6 +24,7 @@ |
| #include "chrome/browser/profiles/profile.h" |
| #include "chrome/common/extensions/api/users_private.h" |
| #include "chromeos/settings/cros_settings_names.h" |
| +#include "components/ownership/owner_settings_service.h" |
|
xiyuan
2017/05/26 16:21:37
nit: Do we need this since we have the owner_setti
stevenjb
2017/05/26 19:44:47
Done.
|
| #include "components/user_manager/user_manager.h" |
| #include "components/user_manager/user_names.h" |
| #include "extensions/browser/extension_function_registry.h" |
| @@ -211,9 +213,15 @@ UsersPrivateIsCurrentUserOwnerFunction:: |
| ExtensionFunction::ResponseAction |
| UsersPrivateIsCurrentUserOwnerFunction::Run() { |
| - bool is_owner = |
| - chromeos::ProfileHelper::IsOwnerProfile(chrome_details_.GetProfile()); |
| - return RespondNow(OneArgument(base::MakeUnique<base::Value>(is_owner))); |
| + chromeos::OwnerSettingsServiceChromeOSFactory::GetForBrowserContext( |
| + browser_context()) |
| + ->IsOwnerAsync(base::Bind( |
| + &UsersPrivateIsCurrentUserOwnerFunction::IsOwnerCallback, this)); |
|
stevenjb
2017/05/25 23:57:32
Unfortunately this never responds in the apitest (
xiyuan
2017/05/26 16:21:37
Think the easiest way is to mock an owner key pair
stevenjb
2017/05/26 19:44:47
Thanks a ton, that would have been a lot harder fo
|
| + return RespondLater(); |
| +} |
| + |
| +void UsersPrivateIsCurrentUserOwnerFunction::IsOwnerCallback(bool is_owner) { |
| + Respond(OneArgument(base::MakeUnique<base::Value>(is_owner))); |
| } |
| //////////////////////////////////////////////////////////////////////////////// |