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

Side by Side Diff: chrome/browser/extensions/unpacked_installer.cc

Issue 510943003: Register granting of previously withheld permissions as a permissions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Resolve threading issues, add crx installer browser test 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/extensions/unpacked_installer.h" 5 #include "chrome/browser/extensions/unpacked_installer.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/files/file_util.h" 9 #include "base/files/file_util.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 144
145 if (!IsLoadingUnpackedAllowed()) { 145 if (!IsLoadingUnpackedAllowed()) {
146 ReportExtensionLoadError(kUnpackedExtensionsBlacklistedError); 146 ReportExtensionLoadError(kUnpackedExtensionsBlacklistedError);
147 return false; 147 return false;
148 } 148 }
149 149
150 std::string error; 150 std::string error;
151 install_checker_.set_extension( 151 install_checker_.set_extension(
152 file_util::LoadExtension( 152 file_util::LoadExtension(
153 extension_path_, Manifest::COMMAND_LINE, GetFlags(), &error).get()); 153 extension_path_, Manifest::COMMAND_LINE, GetFlags(), &error).get());
154 PermissionsUpdater(service_weak_->profile())
155 .InitializePermissions(extension());
154 156
155 if (!extension() || 157 if (!extension() ||
156 !extension_l10n_util::ValidateExtensionLocales( 158 !extension_l10n_util::ValidateExtensionLocales(
157 extension_path_, extension()->manifest()->value(), &error)) { 159 extension_path_, extension()->manifest()->value(), &error)) {
158 ReportExtensionLoadError(error); 160 ReportExtensionLoadError(error);
159 return false; 161 return false;
160 } 162 }
161 163
162 ShowInstallPrompt(); 164 ShowInstallPrompt();
163 165
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 error, 305 error,
304 service_weak_->profile(), 306 service_weak_->profile(),
305 be_noisy_on_failure_); 307 be_noisy_on_failure_);
306 } 308 }
307 } 309 }
308 310
309 void UnpackedInstaller::InstallExtension() { 311 void UnpackedInstaller::InstallExtension() {
310 DCHECK_CURRENTLY_ON(BrowserThread::UI); 312 DCHECK_CURRENTLY_ON(BrowserThread::UI);
311 313
312 PermissionsUpdater perms_updater(service_weak_->profile()); 314 PermissionsUpdater perms_updater(service_weak_->profile());
315 perms_updater.InitializePermissions(extension());
313 perms_updater.GrantActivePermissions(extension()); 316 perms_updater.GrantActivePermissions(extension());
314 317
315 service_weak_->OnExtensionInstalled( 318 service_weak_->OnExtensionInstalled(
316 extension(), syncer::StringOrdinal(), kInstallFlagInstallImmediately); 319 extension(), syncer::StringOrdinal(), kInstallFlagInstallImmediately);
317 } 320 }
318 321
319 } // namespace extensions 322 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698