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

Unified Diff: chrome/browser/extensions/api/developer_private/developer_private_api.cc

Issue 2801583003: developerPrivate.repair: Skip not-corrupted and policy extensions (Closed)
Patch Set: Created 3 years, 8 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
« no previous file with comments | « no previous file | chrome/browser/extensions/api/developer_private/developer_private_api_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/api/developer_private/developer_private_api.cc
diff --git a/chrome/browser/extensions/api/developer_private/developer_private_api.cc b/chrome/browser/extensions/api/developer_private/developer_private_api.cc
index f2b455a41118817bc33a49a150372e93107a9182..c9c6996a3696864dac192eb0fad739e9c252ac08 100644
--- a/chrome/browser/extensions/api/developer_private/developer_private_api.cc
+++ b/chrome/browser/extensions/api/developer_private/developer_private_api.cc
@@ -75,6 +75,7 @@
#include "extensions/common/install_warning.h"
#include "extensions/common/manifest.h"
#include "extensions/common/manifest_handlers/options_page_info.h"
+#include "extensions/common/manifest_url_handlers.h"
#include "extensions/common/permissions/permissions_data.h"
#include "extensions/grit/extensions_browser_resources.h"
#include "storage/browser/fileapi/external_mount_points.h"
@@ -109,6 +110,8 @@ const char kCannotUpdateSupervisedProfileSettingsError[] =
"Cannot change settings for a supervised profile.";
const char kNoOptionsPageForExtensionError[] =
"Extension does not have an options page.";
+const char kCannotRepairNotCorruptedExtension[] =
+ "Cannot repair a not corrupted extension.";
const char kUnpackedAppsFolder[] = "apps_target";
const char kManifestFile[] = "manifest.json";
@@ -1461,6 +1464,18 @@ DeveloperPrivateRepairExtensionFunction::Run() {
if (!extension)
return RespondNow(Error(kNoSuchExtensionError));
+ ExtensionSystem* extension_system = ExtensionSystem::Get(browser_context());
+ if (extension_system->management_policy()->MustRemainEnabled(extension,
Devlin 2017/04/06 00:54:06 Should we also check MustRemainInstalled()?
lazyboy 2017/04/06 01:33:53 I'm not entirely sure, I copied the logic from ver
Devlin 2017/04/06 15:12:31 Yeah, the differences differences between all of t
lazyboy 2017/04/06 18:06:05 OK, done MustRemainEnabled || MustRemainInstalled
+ nullptr)) {
+ int disable_reason = ExtensionPrefs::Get(browser_context())
+ ->GetDisableReasons(extension->id());
+ // Do not let a policy extension that is not corrupted to be
+ // reinstalled/repaired. Currently this would uninstall the extension but
Devlin 2017/04/06 00:54:06 Should we even allow this in the case of corruptio
lazyboy 2017/04/06 01:33:53 "Currently" is misleading here, I meant to put tha
Devlin 2017/04/06 15:12:31 Yep, I figured. :) But my main question still sta
lazyboy 2017/04/06 18:06:05 Ah, that is correct. I've disallowed policy extens
+ // then we will fail to reinstall it for policy check.
+ if ((disable_reason & Extension::DISABLE_CORRUPTED) == 0)
Devlin 2017/04/06 00:55:24 And actually, we should probably have this check e
lazyboy 2017/04/06 01:33:53 Putting it in WebstoreReinstaller might other case
+ return RespondNow(Error(kCannotRepairNotCorruptedExtension));
+ }
+
content::WebContents* web_contents = GetSenderWebContents();
if (!web_contents)
return RespondNow(Error(kCouldNotFindWebContentsError));
« no previous file with comments | « no previous file | chrome/browser/extensions/api/developer_private/developer_private_api_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698