Index: chrome/browser/extensions/api/webstore_private/webstore_private_api.cc |
diff --git a/chrome/browser/extensions/api/webstore_private/webstore_private_api.cc b/chrome/browser/extensions/api/webstore_private/webstore_private_api.cc |
index 2433afe2aaee4209572fff66122239a3dc76f626..0323bffc676f316792c6220cc8f04e9465ff9f71 100644 |
--- a/chrome/browser/extensions/api/webstore_private/webstore_private_api.cc |
+++ b/chrome/browser/extensions/api/webstore_private/webstore_private_api.cc |
@@ -21,6 +21,7 @@ |
#include "chrome/browser/extensions/crx_installer.h" |
#include "chrome/browser/extensions/extension_install_ui_util.h" |
#include "chrome/browser/extensions/extension_service.h" |
+#include "chrome/browser/extensions/extension_util.h" |
#include "chrome/browser/extensions/install_tracker.h" |
#include "chrome/browser/gpu/gpu_feature_checker.h" |
#include "chrome/browser/profiles/profile.h" |
@@ -52,6 +53,8 @@ namespace GetEphemeralAppsEnabled = |
namespace GetIsLauncherEnabled = api::webstore_private::GetIsLauncherEnabled; |
namespace GetStoreLogin = api::webstore_private::GetStoreLogin; |
namespace GetWebGLStatus = api::webstore_private::GetWebGLStatus; |
+namespace IsExtensionPendingCustodianApproval = |
+ api::webstore_private::IsExtensionPendingCustodianApproval; |
namespace IsInIncognitoMode = api::webstore_private::IsInIncognitoMode; |
namespace LaunchEphemeralApp = api::webstore_private::LaunchEphemeralApp; |
namespace SetStoreLogin = api::webstore_private::SetStoreLogin; |
@@ -603,4 +606,49 @@ WebstorePrivateGetEphemeralAppsEnabledFunction::Run() { |
false))); |
} |
+WebstorePrivateIsExtensionPendingCustodianApprovalFunction:: |
+ WebstorePrivateIsExtensionPendingCustodianApprovalFunction() |
+ : chrome_details_(this) {} |
+ |
+WebstorePrivateIsExtensionPendingCustodianApprovalFunction:: |
+ ~WebstorePrivateIsExtensionPendingCustodianApprovalFunction() {} |
+ |
+ExtensionFunction::ResponseAction |
+WebstorePrivateIsExtensionPendingCustodianApprovalFunction::Run() { |
+ std::unique_ptr<IsExtensionPendingCustodianApproval::Params> params( |
+ IsExtensionPendingCustodianApproval::Params::Create(*args_)); |
+ |
+ Profile* profile = chrome_details_.GetProfile(); |
+ |
+ if (!profile->IsSupervised()) { |
+ return RespondNow(ArgumentList( |
+ IsExtensionPendingCustodianApproval::Results::Create(false))); |
+ } |
+ |
+ EXTENSION_FUNCTION_VALIDATE(params); |
Marc Treib
2016/05/09 11:50:19
I'd validate the args before checking IsSupervised
mamir
2016/05/09 13:33:48
Done.
|
+ ExtensionRegistry* registry = ExtensionRegistry::Get(browser_context()); |
+ |
+ const Extension* extension = |
+ registry->GetExtensionById(params->id, ExtensionRegistry::EVERYTHING); |
+ if (!extension) { |
+ return RespondNow(ArgumentList( |
+ IsExtensionPendingCustodianApproval::Results::Create(false))); |
+ } |
+ |
+ ExtensionPrefs* extensionsPrefs = ExtensionPrefs::Get(browser_context()); |
Marc Treib
2016/05/09 11:50:19
extension_prefs
mamir
2016/05/09 13:33:48
Sorry!
Done!
|
+ |
+ if (extensions::util::NeedCustodianApprovalForPermissionIncrease(profile) && |
+ extensionsPrefs->HasDisableReason( |
+ params->id, extensions::Extension::DISABLE_PERMISSIONS_INCREASE)) { |
+ return RespondNow(ArgumentList( |
+ IsExtensionPendingCustodianApproval::Results::Create(true))); |
+ } |
+ |
+ return RespondNow( |
+ ArgumentList(IsExtensionPendingCustodianApproval::Results::Create( |
+ extensionsPrefs->HasDisableReason( |
+ params->id, |
+ extensions::Extension::DISABLE_CUSTODIAN_APPROVAL_REQUIRED)))); |
Marc Treib
2016/05/09 11:50:19
extensions:: isn't required, we're already in that
mamir
2016/05/09 13:33:48
Done.
|
+} |
+ |
} // namespace extensions |