OLD | NEW |
---|---|
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 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
289 } | 289 } |
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) && |
not at google - send to devlin
2014/06/02 23:20:06
here
Devlin
2014/06/03 15:28:21
Not done. No speed advantage and given that we ref
| |
300 PermissionsData::GetActivePermissions(extension)->IsEmpty()) { | 300 PermissionsData::ForExtension(extension) |
301 ->active_permissions() | |
302 ->IsEmpty()) { | |
301 valid = true; | 303 valid = true; |
302 } | 304 } |
303 } else { | 305 } else { |
304 valid = expected_manifest_->Equals(original_manifest_.get()); | 306 valid = expected_manifest_->Equals(original_manifest_.get()); |
305 if (!valid && expected_manifest_check_level_ == | 307 if (!valid && expected_manifest_check_level_ == |
306 WebstoreInstaller::MANIFEST_CHECK_LEVEL_LOOSE) { | 308 WebstoreInstaller::MANIFEST_CHECK_LEVEL_LOOSE) { |
307 std::string error; | 309 std::string error; |
308 scoped_refptr<Extension> dummy_extension = | 310 scoped_refptr<Extension> dummy_extension = |
309 Extension::Create(base::FilePath(), | 311 Extension::Create(base::FilePath(), |
310 install_source_, | 312 install_source_, |
311 *expected_manifest_->value(), | 313 *expected_manifest_->value(), |
312 creation_flags_, | 314 creation_flags_, |
313 &error); | 315 &error); |
314 if (error.empty()) { | 316 if (error.empty()) { |
315 scoped_refptr<const PermissionSet> expected_permissions = | 317 scoped_refptr<const PermissionSet> expected_permissions = |
316 PermissionsData::GetActivePermissions(dummy_extension.get()); | 318 PermissionsData::ForExtension(dummy_extension) |
319 ->active_permissions(); | |
317 valid = !(PermissionMessageProvider::Get()->IsPrivilegeIncrease( | 320 valid = !(PermissionMessageProvider::Get()->IsPrivilegeIncrease( |
318 expected_permissions, | 321 expected_permissions, |
319 PermissionsData::GetActivePermissions(extension), | 322 PermissionsData::ForExtension(extension)->active_permissions(), |
320 extension->GetType())); | 323 extension->GetType())); |
321 } | 324 } |
322 } | 325 } |
323 } | 326 } |
324 | 327 |
325 if (!valid) | 328 if (!valid) |
326 return CrxInstallerError( | 329 return CrxInstallerError( |
327 l10n_util::GetStringUTF16(IDS_EXTENSION_MANIFEST_INVALID)); | 330 l10n_util::GetStringUTF16(IDS_EXTENSION_MANIFEST_INVALID)); |
328 } | 331 } |
329 | 332 |
330 // The checks below are skipped for themes and external installs. | 333 // The checks below are skipped for themes and external installs. |
(...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
907 if (!prefs->DidExtensionEscalatePermissions(extension()->id())) | 910 if (!prefs->DidExtensionEscalatePermissions(extension()->id())) |
908 return; | 911 return; |
909 | 912 |
910 if (client_) { | 913 if (client_) { |
911 AddRef(); // Balanced in InstallUIProceed() and InstallUIAbort(). | 914 AddRef(); // Balanced in InstallUIProceed() and InstallUIAbort(). |
912 client_->ConfirmReEnable(this, extension()); | 915 client_->ConfirmReEnable(this, extension()); |
913 } | 916 } |
914 } | 917 } |
915 | 918 |
916 } // namespace extensions | 919 } // namespace extensions |
OLD | NEW |