Chromium Code Reviews| Index: chrome/browser/extensions/api/autotest_private/autotest_private_api.cc |
| diff --git a/chrome/browser/extensions/api/autotest_private/autotest_private_api.cc b/chrome/browser/extensions/api/autotest_private/autotest_private_api.cc |
| index c11364a72883c62385869d3117dca10f06623232..6aa80d6a95fca84ff8bc09343f7a2e471b6f6b64 100644 |
| --- a/chrome/browser/extensions/api/autotest_private/autotest_private_api.cc |
| +++ b/chrome/browser/extensions/api/autotest_private/autotest_private_api.cc |
| @@ -27,8 +27,10 @@ |
| #include "extensions/common/permissions/permissions_data.h" |
| #if defined(OS_CHROMEOS) |
| +#include "chrome/browser/chromeos/arc/arc_util.h" |
| #include "chrome/browser/chromeos/login/lock/screen_locker.h" |
| #include "chrome/browser/chromeos/system/input_device_settings.h" |
| +#include "chrome/browser/profiles/profile_manager.h" |
| #include "chromeos/dbus/dbus_thread_manager.h" |
| #include "chromeos/dbus/session_manager_client.h" |
| #include "components/user_manager/user.h" |
| @@ -378,6 +380,44 @@ AutotestPrivateGetVisibleNotificationsFunction::Run() { |
| return RespondNow(OneArgument(std::move(values))); |
| } |
| +ExtensionFunction::ResponseAction |
| +AutotestPrivateIsPlayStoreEnabledFunction::Run() { |
| + DVLOG(1) << "AutotestPrivateIsPlayStoreEnabledFunction"; |
| + bool enabled = false; |
| +#if defined(OS_CHROMEOS) |
| + Profile* profile = ProfileManager::GetActiveUserProfile(); |
|
Luis Héctor Chávez
2017/04/07 01:57:50
qq: is Profile* guaranteed to be non-null at this
khmel
2017/04/07 15:52:45
I think no, but arc::IsArcAllowedForProfile(profil
|
| + enabled = arc::IsArcAllowedForProfile(profile) && |
|
Luis Héctor Chávez
2017/04/07 01:57:50
nit: This is redundant.
khmel
2017/04/07 15:52:45
Removed.
|
| + arc::IsArcPlayStoreEnabledForProfile(profile); |
| +#endif |
| + return RespondNow(OneArgument(base::MakeUnique<base::Value>(enabled))); |
| +} |
| + |
| +ExtensionFunction::ResponseAction |
| +AutotestPrivateIsPlayStoreManagedFunction::Run() { |
| + DVLOG(1) << "AutotestPrivateIsPlayStoreManagedFunction"; |
| + bool managed = false; |
| +#if defined(OS_CHROMEOS) |
| + Profile* profile = ProfileManager::GetActiveUserProfile(); |
| + managed = arc::IsArcAllowedForProfile(profile) && |
| + arc::IsArcPlayStoreEnabledPreferenceManagedForProfile(profile); |
| +#endif |
| + return RespondNow(OneArgument(base::MakeUnique<base::Value>(managed))); |
| +} |
| + |
| +ExtensionFunction::ResponseAction |
| +AutotestPrivateSetPlayStoreEnabledFunction::Run() { |
| + DVLOG(1) << "AutotestPrivateSetPlayStoreEnabledFunction"; |
| + std::unique_ptr<api::autotest_private::SetPlayStoreEnabled::Params> params( |
| + api::autotest_private::SetPlayStoreEnabled::Params::Create(*args_)); |
| + EXTENSION_FUNCTION_VALIDATE(params.get()); |
| +#if defined(OS_CHROMEOS) |
| + Profile* profile = ProfileManager::GetActiveUserProfile(); |
| + if (arc::IsArcAllowedForProfile(profile)) |
|
Luis Héctor Chávez
2017/04/07 02:01:53
Do you also want the semantics of this actually en
khmel
2017/04/07 15:52:45
This is good point. I will update arc::SetArcPlayS
|
| + arc::SetArcPlayStoreEnabledForProfile(profile, params->enabled); |
| +#endif |
| + return RespondNow(NoArguments()); |
|
Luis Héctor Chávez
2017/04/07 01:57:50
Don't you want to return success/failure? Otherwis
khmel
2017/04/07 15:52:45
Added returning the value
|
| +} |
| + |
| static base::LazyInstance<BrowserContextKeyedAPIFactory<AutotestPrivateAPI>>:: |
| DestructorAtExit g_factory = LAZY_INSTANCE_INITIALIZER; |