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

Unified Diff: chrome/browser/extensions/unpacked_installer.cc

Issue 9222013: Prevent unnecessary prompts when unpacked extensions use chrome.permissions.request. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 11 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/extensions/unpacked_installer.cc
diff --git a/chrome/browser/extensions/unpacked_installer.cc b/chrome/browser/extensions/unpacked_installer.cc
index eabbfe6a34e0a409d0608725f79d37d9f2882ff1..c64ac970a50320f62a80d2f9e3f2fa3274188a1b 100644
--- a/chrome/browser/extensions/unpacked_installer.cc
+++ b/chrome/browser/extensions/unpacked_installer.cc
@@ -10,6 +10,7 @@
#include "chrome/browser/extensions/extension_install_ui.h"
#include "chrome/browser/extensions/extension_prefs.h"
#include "chrome/browser/extensions/extension_service.h"
+#include "chrome/browser/extensions/permissions_updater.h"
#include "chrome/common/extensions/extension.h"
#include "chrome/common/extensions/extension_file_util.h"
#include "chrome/common/string_ordinal.h"
@@ -55,9 +56,12 @@ void SimpleExtensionLoadPrompt::ShowPrompt() {
}
void SimpleExtensionLoadPrompt::InstallUIProceed() {
- if (service_weak_.get())
+ if (service_weak_.get()) {
+ extensions::PermissionsUpdater perms_updater(service_weak_->profile());
+ perms_updater.GrantActivePermissions(extension_);
service_weak_->OnExtensionInstalled(
extension_, false, StringOrdinal()); // Not from web store.
+ }
delete this;
}
@@ -199,7 +203,7 @@ void UnpackedInstaller::OnLoaded(
service_weak_->disabled_extensions();
if (service_weak_->show_extensions_prompts() &&
prompt_for_plugins_ &&
- !extension->plugins().empty() &&
+ !extension->CanSilentlyIncreasePermissionsDuringInstall() &&
disabled_extensions->Contains(extension->id())) {
SimpleExtensionLoadPrompt* prompt = new SimpleExtensionLoadPrompt(
service_weak_->profile(),
@@ -208,6 +212,9 @@ void UnpackedInstaller::OnLoaded(
prompt->ShowPrompt();
return; // continues in SimpleExtensionLoadPrompt::InstallUI*
}
+
+ PermissionsUpdater perms_updater(service_weak_->profile());
+ perms_updater.GrantActivePermissions(extension);
service_weak_->OnExtensionInstalled(extension,
false, // Not from web store.
StringOrdinal());

Powered by Google App Engine
This is Rietveld 408576698