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

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

Issue 315573003: Remove PermissionsData::ForExtension() completely (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/crx_installer.h" 5 #include "chrome/browser/extensions/crx_installer.h"
6 6
7 #include <map> 7 #include <map>
8 #include <set> 8 #include <set>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 } 290 }
291 291
292 // Make sure the manifests match if we want to bypass the prompt. 292 // Make sure the manifests match if we want to bypass the prompt.
293 if (approved_) { 293 if (approved_) {
294 bool valid = false; 294 bool valid = false;
295 if (expected_manifest_check_level_ == 295 if (expected_manifest_check_level_ ==
296 WebstoreInstaller::MANIFEST_CHECK_LEVEL_NONE) { 296 WebstoreInstaller::MANIFEST_CHECK_LEVEL_NONE) {
297 // To skip manifest checking, the extension must be a shared module 297 // To skip manifest checking, the extension must be a shared module
298 // and not request any permissions. 298 // and not request any permissions.
299 if (SharedModuleInfo::IsSharedModule(extension) && 299 if (SharedModuleInfo::IsSharedModule(extension) &&
300 PermissionsData::ForExtension(extension) 300 extension->permissions_data()->active_permissions()->IsEmpty()) {
301 ->active_permissions()
302 ->IsEmpty()) {
303 valid = true; 301 valid = true;
304 } 302 }
305 } else { 303 } else {
306 valid = expected_manifest_->Equals(original_manifest_.get()); 304 valid = expected_manifest_->Equals(original_manifest_.get());
307 if (!valid && expected_manifest_check_level_ == 305 if (!valid && expected_manifest_check_level_ ==
308 WebstoreInstaller::MANIFEST_CHECK_LEVEL_LOOSE) { 306 WebstoreInstaller::MANIFEST_CHECK_LEVEL_LOOSE) {
309 std::string error; 307 std::string error;
310 scoped_refptr<Extension> dummy_extension = 308 scoped_refptr<Extension> dummy_extension =
311 Extension::Create(base::FilePath(), 309 Extension::Create(base::FilePath(),
312 install_source_, 310 install_source_,
313 *expected_manifest_->value(), 311 *expected_manifest_->value(),
314 creation_flags_, 312 creation_flags_,
315 &error); 313 &error);
316 if (error.empty()) { 314 if (error.empty()) {
317 scoped_refptr<const PermissionSet> expected_permissions = 315 scoped_refptr<const PermissionSet> expected_permissions =
318 PermissionsData::ForExtension(dummy_extension) 316 dummy_extension->permissions_data()->active_permissions();
319 ->active_permissions();
320 valid = !(PermissionMessageProvider::Get()->IsPrivilegeIncrease( 317 valid = !(PermissionMessageProvider::Get()->IsPrivilegeIncrease(
321 expected_permissions, 318 expected_permissions,
322 PermissionsData::ForExtension(extension)->active_permissions(), 319 extension->permissions_data()->active_permissions(),
323 extension->GetType())); 320 extension->GetType()));
324 } 321 }
325 } 322 }
326 } 323 }
327 324
328 if (!valid) 325 if (!valid)
329 return CrxInstallerError( 326 return CrxInstallerError(
330 l10n_util::GetStringUTF16(IDS_EXTENSION_MANIFEST_INVALID)); 327 l10n_util::GetStringUTF16(IDS_EXTENSION_MANIFEST_INVALID));
331 } 328 }
332 329
(...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after
910 if (!prefs->DidExtensionEscalatePermissions(extension()->id())) 907 if (!prefs->DidExtensionEscalatePermissions(extension()->id()))
911 return; 908 return;
912 909
913 if (client_) { 910 if (client_) {
914 AddRef(); // Balanced in InstallUIProceed() and InstallUIAbort(). 911 AddRef(); // Balanced in InstallUIProceed() and InstallUIAbort().
915 client_->ConfirmReEnable(this, extension()); 912 client_->ConfirmReEnable(this, extension());
916 } 913 }
917 } 914 }
918 915
919 } // namespace extensions 916 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/bundle_installer.cc ('k') | chrome/browser/extensions/extension_gcm_app_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698