| 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 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 WebstoreInstaller::MANIFEST_CHECK_LEVEL_LOOSE) { | 290 WebstoreInstaller::MANIFEST_CHECK_LEVEL_LOOSE) { |
| 291 std::string error; | 291 std::string error; |
| 292 scoped_refptr<Extension> dummy_extension = | 292 scoped_refptr<Extension> dummy_extension = |
| 293 Extension::Create(base::FilePath(), | 293 Extension::Create(base::FilePath(), |
| 294 install_source_, | 294 install_source_, |
| 295 *expected_manifest_->value(), | 295 *expected_manifest_->value(), |
| 296 creation_flags_, | 296 creation_flags_, |
| 297 extension->id(), | 297 extension->id(), |
| 298 &error); | 298 &error); |
| 299 if (error.empty()) { | 299 if (error.empty()) { |
| 300 scoped_refptr<const PermissionSet> expected_permissions = | 300 const PermissionSet* expected_permissions = |
| 301 dummy_extension->permissions_data()->active_permissions(); | 301 dummy_extension->permissions_data()->active_permissions(); |
| 302 valid = !(PermissionMessageProvider::Get()->IsPrivilegeIncrease( | 302 valid = !(PermissionMessageProvider::Get()->IsPrivilegeIncrease( |
| 303 expected_permissions.get(), | 303 expected_permissions, |
| 304 extension->permissions_data()->active_permissions().get(), | 304 extension->permissions_data()->active_permissions(), |
| 305 extension->GetType())); | 305 extension->GetType())); |
| 306 } | 306 } |
| 307 } | 307 } |
| 308 } | 308 } |
| 309 | 309 |
| 310 if (!valid) | 310 if (!valid) |
| 311 return CrxInstallError( | 311 return CrxInstallError( |
| 312 l10n_util::GetStringUTF16(IDS_EXTENSION_MANIFEST_INVALID)); | 312 l10n_util::GetStringUTF16(IDS_EXTENSION_MANIFEST_INVALID)); |
| 313 } | 313 } |
| 314 | 314 |
| (...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 791 // Delete temporary files. | 791 // Delete temporary files. |
| 792 CleanupTempFiles(); | 792 CleanupTempFiles(); |
| 793 } | 793 } |
| 794 | 794 |
| 795 void CrxInstaller::ReportSuccessFromUIThread() { | 795 void CrxInstaller::ReportSuccessFromUIThread() { |
| 796 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 796 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 797 | 797 |
| 798 if (!service_weak_.get() || service_weak_->browser_terminating()) | 798 if (!service_weak_.get() || service_weak_->browser_terminating()) |
| 799 return; | 799 return; |
| 800 | 800 |
| 801 extension()->permissions_data()->LockToThread(); |
| 802 |
| 801 if (!update_from_settings_page_) { | 803 if (!update_from_settings_page_) { |
| 802 // If there is a client, tell the client about installation. | 804 // If there is a client, tell the client about installation. |
| 803 if (client_) | 805 if (client_) |
| 804 client_->OnInstallSuccess(extension(), install_icon_.get()); | 806 client_->OnInstallSuccess(extension(), install_icon_.get()); |
| 805 | 807 |
| 806 // We update the extension's granted permissions if the user already | 808 // We update the extension's granted permissions if the user already |
| 807 // approved the install (client_ is non NULL), or we are allowed to install | 809 // approved the install (client_ is non NULL), or we are allowed to install |
| 808 // this silently. | 810 // this silently. |
| 809 if ((client_ || allow_silent_install_) && | 811 if ((client_ || allow_silent_install_) && |
| 810 grant_permissions_ && | 812 grant_permissions_ && |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 901 if (!prefs->DidExtensionEscalatePermissions(extension()->id())) | 903 if (!prefs->DidExtensionEscalatePermissions(extension()->id())) |
| 902 return; | 904 return; |
| 903 | 905 |
| 904 if (client_) { | 906 if (client_) { |
| 905 AddRef(); // Balanced in InstallUIProceed() and InstallUIAbort(). | 907 AddRef(); // Balanced in InstallUIProceed() and InstallUIAbort(). |
| 906 client_->ConfirmReEnable(this, extension()); | 908 client_->ConfirmReEnable(this, extension()); |
| 907 } | 909 } |
| 908 } | 910 } |
| 909 | 911 |
| 910 } // namespace extensions | 912 } // namespace extensions |
| OLD | NEW |