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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 // Mark the extension as approved, but save the expected manifest and ID | 146 // Mark the extension as approved, but save the expected manifest and ID |
147 // so we can check that they match the CRX's. | 147 // so we can check that they match the CRX's. |
148 approved_ = true; | 148 approved_ = true; |
149 expected_manifest_check_level_ = approval->manifest_check_level; | 149 expected_manifest_check_level_ = approval->manifest_check_level; |
150 if (expected_manifest_check_level_ != | 150 if (expected_manifest_check_level_ != |
151 WebstoreInstaller::MANIFEST_CHECK_LEVEL_NONE) | 151 WebstoreInstaller::MANIFEST_CHECK_LEVEL_NONE) |
152 expected_manifest_.reset(approval->manifest->DeepCopy()); | 152 expected_manifest_.reset(approval->manifest->DeepCopy()); |
153 expected_id_ = approval->extension_id; | 153 expected_id_ = approval->extension_id; |
154 } | 154 } |
155 if (approval->minimum_version.get()) { | 155 if (approval->minimum_version.get()) { |
156 expected_version_.reset(new Version(*approval->minimum_version)); | 156 expected_version_.reset(new base::Version(*approval->minimum_version)); |
157 expected_version_strict_checking_ = false; | 157 expected_version_strict_checking_ = false; |
158 } | 158 } |
159 | 159 |
160 show_dialog_callback_ = approval->show_dialog_callback; | 160 show_dialog_callback_ = approval->show_dialog_callback; |
161 | 161 |
162 if (approval->is_ephemeral) | 162 if (approval->is_ephemeral) |
163 creation_flags_ |= Extension::IS_EPHEMERAL; | 163 creation_flags_ |= Extension::IS_EPHEMERAL; |
164 } | 164 } |
165 | 165 |
166 CrxInstaller::~CrxInstaller() { | 166 CrxInstaller::~CrxInstaller() { |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
475 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 475 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
476 ExtensionService* service = service_weak_.get(); | 476 ExtensionService* service = service_weak_.get(); |
477 if (!service || service->browser_terminating()) | 477 if (!service || service->browser_terminating()) |
478 return; | 478 return; |
479 | 479 |
480 if (SharedModuleInfo::ImportsModules(extension())) { | 480 if (SharedModuleInfo::ImportsModules(extension())) { |
481 const std::vector<SharedModuleInfo::ImportInfo>& imports = | 481 const std::vector<SharedModuleInfo::ImportInfo>& imports = |
482 SharedModuleInfo::GetImports(extension()); | 482 SharedModuleInfo::GetImports(extension()); |
483 std::vector<SharedModuleInfo::ImportInfo>::const_iterator i; | 483 std::vector<SharedModuleInfo::ImportInfo>::const_iterator i; |
484 for (i = imports.begin(); i != imports.end(); ++i) { | 484 for (i = imports.begin(); i != imports.end(); ++i) { |
485 Version version_required(i->minimum_version); | 485 base::Version version_required(i->minimum_version); |
486 const Extension* imported_module = | 486 const Extension* imported_module = |
487 service->GetExtensionById(i->extension_id, true); | 487 service->GetExtensionById(i->extension_id, true); |
488 if (imported_module && | 488 if (imported_module && |
489 !SharedModuleInfo::IsSharedModule(imported_module)) { | 489 !SharedModuleInfo::IsSharedModule(imported_module)) { |
490 ReportFailureFromUIThread( | 490 ReportFailureFromUIThread( |
491 CrxInstallerError(l10n_util::GetStringFUTF16( | 491 CrxInstallerError(l10n_util::GetStringFUTF16( |
492 IDS_EXTENSION_INSTALL_DEPENDENCY_NOT_SHARED_MODULE, | 492 IDS_EXTENSION_INSTALL_DEPENDENCY_NOT_SHARED_MODULE, |
493 ASCIIToUTF16(i->extension_id)))); | 493 ASCIIToUTF16(i->extension_id)))); |
494 return; | 494 return; |
495 } | 495 } |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
653 Release(); // balanced in ConfirmInstall() or ConfirmReEnable(). | 653 Release(); // balanced in ConfirmInstall() or ConfirmReEnable(). |
654 | 654 |
655 // We're done. Since we don't post any more tasks to ourself, our ref count | 655 // We're done. Since we don't post any more tasks to ourself, our ref count |
656 // should go to zero and we die. The destructor will clean up the temp dir. | 656 // should go to zero and we die. The destructor will clean up the temp dir. |
657 } | 657 } |
658 | 658 |
659 void CrxInstaller::CompleteInstall() { | 659 void CrxInstaller::CompleteInstall() { |
660 DCHECK(installer_task_runner_->RunsTasksOnCurrentThread()); | 660 DCHECK(installer_task_runner_->RunsTasksOnCurrentThread()); |
661 | 661 |
662 if (!current_version_.empty()) { | 662 if (!current_version_.empty()) { |
663 Version current_version(current_version_); | 663 base::Version current_version(current_version_); |
664 if (current_version.CompareTo(*(extension()->version())) > 0) { | 664 if (current_version.CompareTo(*(extension()->version())) > 0) { |
665 ReportFailureFromFileThread( | 665 ReportFailureFromFileThread( |
666 CrxInstallerError( | 666 CrxInstallerError( |
667 l10n_util::GetStringUTF16(extension()->is_app() ? | 667 l10n_util::GetStringUTF16(extension()->is_app() ? |
668 IDS_APP_CANT_DOWNGRADE_VERSION : | 668 IDS_APP_CANT_DOWNGRADE_VERSION : |
669 IDS_EXTENSION_CANT_DOWNGRADE_VERSION))); | 669 IDS_EXTENSION_CANT_DOWNGRADE_VERSION))); |
670 return; | 670 return; |
671 } | 671 } |
672 } | 672 } |
673 | 673 |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
867 if (!prefs->DidExtensionEscalatePermissions(extension()->id())) | 867 if (!prefs->DidExtensionEscalatePermissions(extension()->id())) |
868 return; | 868 return; |
869 | 869 |
870 if (client_) { | 870 if (client_) { |
871 AddRef(); // Balanced in InstallUIProceed() and InstallUIAbort(). | 871 AddRef(); // Balanced in InstallUIProceed() and InstallUIAbort(). |
872 client_->ConfirmReEnable(this, extension()); | 872 client_->ConfirmReEnable(this, extension()); |
873 } | 873 } |
874 } | 874 } |
875 | 875 |
876 } // namespace extensions | 876 } // namespace extensions |
OLD | NEW |