Chromium Code Reviews| 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..2527574d062fedaa8d7e75d62be3b330916962b2 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" |
| @@ -41,18 +42,24 @@ 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) { |
| + base::DictionaryValue* manifest, |
| + Profile* profile) { |
|
Devlin
2014/09/02 21:07:51
s/Profile/BrowserContext
gpdavis
2014/09/04 19:40:04
Done.
|
| // 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(profile).InitializePermissions( |
| + extension.get(), PermissionsUpdater::INIT_FLAG_TRANSIENT); |
| + return extension; |
| } |
| bool IsAppPredicate(scoped_refptr<const Extension> extension) { |
| @@ -295,7 +302,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(); |