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

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

Issue 501273002: Update extension install prompt to reflect withheld permissions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Permissions helper method, init flag changes in updater Created 6 years, 3 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/bundle_installer.cc
diff --git a/chrome/browser/extensions/bundle_installer.cc b/chrome/browser/extensions/bundle_installer.cc
index 66ffe0c22408d28fd704a308badab3928151e08a..7e1da33828fe711e3b58f3ed32ce176e12fa9c75 100644
--- a/chrome/browser/extensions/bundle_installer.cc
+++ b/chrome/browser/extensions/bundle_installer.cc
@@ -13,6 +13,7 @@
#include "base/strings/utf_string_conversions.h"
#include "base/values.h"
#include "chrome/browser/extensions/crx_installer.h"
+#include "chrome/browser/extensions/permissions_updater.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_finder.h"
@@ -40,19 +41,26 @@ AutoApproveForTest g_auto_approve_for_test = DO_NOT_SKIP;
// Creates a dummy extension and sets the manifest's name to the item's
// localized name.
-scoped_refptr<Extension> CreateDummyExtension(const BundleInstaller::Item& item,
- base::DictionaryValue* manifest) {
+scoped_refptr<Extension> CreateDummyExtension(
+ const BundleInstaller::Item& item,
+ base::DictionaryValue* manifest,
+ content::BrowserContext* browser_context) {
// We require localized names so we can have nice error messages when we can't
// parse an extension manifest.
CHECK(!item.localized_name.empty());
std::string error;
- return Extension::Create(base::FilePath(),
- Manifest::INTERNAL,
- *manifest,
- Extension::NO_FLAGS,
- item.id,
- &error);
+ scoped_refptr<Extension> extension = Extension::Create(base::FilePath(),
+ Manifest::INTERNAL,
+ *manifest,
+ Extension::NO_FLAGS,
+ item.id,
+ &error);
+ // Initialize permissions so that withheld permissions don't end up in the
+ // install prompt.
+ PermissionsUpdater(browser_context).InitializePermissions(
+ extension.get(), PermissionsUpdater::INIT_FLAG_TRANSIENT);
+ return extension;
}
bool IsAppPredicate(scoped_refptr<const Extension> extension) {
@@ -295,7 +303,8 @@ void BundleInstaller::OnWebstoreParseSuccess(
const std::string& id,
const SkBitmap& icon,
base::DictionaryValue* manifest) {
- dummy_extensions_.push_back(CreateDummyExtension(items_[id], manifest));
+ dummy_extensions_.push_back(
+ CreateDummyExtension(items_[id], manifest, profile_));
parsed_manifests_[id] = linked_ptr<base::DictionaryValue>(manifest);
ShowPromptIfDoneParsing();

Powered by Google App Engine
This is Rietveld 408576698