Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(924)

Unified Diff: chrome/browser/chromeos/extensions/users_private/users_private_api.cc

Issue 2902253004: Settings: Users: Make isCurrentUserOwner async (Closed)
Patch Set: Fix test Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..e5541c249b945fbb21ac9450f3102902bda66532 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"
@@ -211,9 +212,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));
+ return RespondLater();
+}
+
+void UsersPrivateIsCurrentUserOwnerFunction::IsOwnerCallback(bool is_owner) {
+ Respond(OneArgument(base::MakeUnique<base::Value>(is_owner)));
}
////////////////////////////////////////////////////////////////////////////////

Powered by Google App Engine
This is Rietveld 408576698