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(); |