Chromium Code Reviews| 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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 101 scoped_refptr<CrxInstaller> CrxInstaller::Create( | 101 scoped_refptr<CrxInstaller> CrxInstaller::Create( |
| 102 ExtensionService* service, | 102 ExtensionService* service, |
| 103 scoped_ptr<ExtensionInstallPrompt> client, | 103 scoped_ptr<ExtensionInstallPrompt> client, |
| 104 const WebstoreInstaller::Approval* approval) { | 104 const WebstoreInstaller::Approval* approval) { |
| 105 return new CrxInstaller(service->AsWeakPtr(), client.Pass(), approval); | 105 return new CrxInstaller(service->AsWeakPtr(), client.Pass(), approval); |
| 106 } | 106 } |
| 107 | 107 |
| 108 CrxInstaller::CrxInstaller(base::WeakPtr<ExtensionService> service_weak, | 108 CrxInstaller::CrxInstaller(base::WeakPtr<ExtensionService> service_weak, |
| 109 scoped_ptr<ExtensionInstallPrompt> client, | 109 scoped_ptr<ExtensionInstallPrompt> client, |
| 110 const WebstoreInstaller::Approval* approval) | 110 const WebstoreInstaller::Approval* approval) |
| 111 : install_directory_(service_weak->install_directory()), | 111 : SandboxedUnpackerClient( |
| 112 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI)), | |
| 113 install_directory_(service_weak->install_directory()), | |
| 112 install_source_(Manifest::INTERNAL), | 114 install_source_(Manifest::INTERNAL), |
| 113 approved_(false), | 115 approved_(false), |
| 114 hash_check_failed_(false), | 116 hash_check_failed_(false), |
| 115 expected_manifest_check_level_( | 117 expected_manifest_check_level_( |
| 116 WebstoreInstaller::MANIFEST_CHECK_LEVEL_STRICT), | 118 WebstoreInstaller::MANIFEST_CHECK_LEVEL_STRICT), |
| 117 expected_version_strict_checking_(false), | 119 expected_version_strict_checking_(false), |
| 118 extensions_enabled_(service_weak->extensions_enabled()), | 120 extensions_enabled_(service_weak->extensions_enabled()), |
| 119 delete_source_(false), | 121 delete_source_(false), |
| 120 create_app_shortcut_(false), | 122 create_app_shortcut_(false), |
| 121 service_weak_(service_weak), | 123 service_weak_(service_weak), |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 156 if (approval->minimum_version.get()) { | 158 if (approval->minimum_version.get()) { |
| 157 expected_version_.reset(new Version(*approval->minimum_version)); | 159 expected_version_.reset(new Version(*approval->minimum_version)); |
| 158 expected_version_strict_checking_ = false; | 160 expected_version_strict_checking_ = false; |
| 159 } | 161 } |
| 160 | 162 |
| 161 show_dialog_callback_ = approval->show_dialog_callback; | 163 show_dialog_callback_ = approval->show_dialog_callback; |
| 162 set_is_ephemeral(approval->is_ephemeral); | 164 set_is_ephemeral(approval->is_ephemeral); |
| 163 } | 165 } |
| 164 | 166 |
| 165 CrxInstaller::~CrxInstaller() { | 167 CrxInstaller::~CrxInstaller() { |
| 166 // Make sure the UI is deleted on the ui thread. | 168 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 167 if (client_) { | 169 // The scoped_ptr |client_| data member must be destroyed on the UI thread. |
|
benwells
2015/04/14 22:14:19
Nit: the client_ member was destroyed on the ui th
tapted
2015/04/15 03:07:44
Done.
| |
| 168 BrowserThread::DeleteSoon(BrowserThread::UI, FROM_HERE, client_); | |
| 169 client_ = NULL; | |
| 170 } | |
| 171 } | 170 } |
| 172 | 171 |
| 173 void CrxInstaller::InstallCrx(const base::FilePath& source_file) { | 172 void CrxInstaller::InstallCrx(const base::FilePath& source_file) { |
| 174 InstallCrxFile(CRXFileInfo(source_file)); | 173 InstallCrxFile(CRXFileInfo(source_file)); |
| 175 } | 174 } |
| 176 | 175 |
| 177 void CrxInstaller::InstallCrxFile(const CRXFileInfo& source_file) { | 176 void CrxInstaller::InstallCrxFile(const CRXFileInfo& source_file) { |
| 178 ExtensionService* service = service_weak_.get(); | 177 ExtensionService* service = service_weak_.get(); |
| 179 if (!service || service->browser_terminating()) | 178 if (!service || service->browser_terminating()) |
| 180 return; | 179 return; |
| (...skipping 727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 908 if (!prefs->DidExtensionEscalatePermissions(extension()->id())) | 907 if (!prefs->DidExtensionEscalatePermissions(extension()->id())) |
| 909 return; | 908 return; |
| 910 | 909 |
| 911 if (client_) { | 910 if (client_) { |
| 912 AddRef(); // Balanced in InstallUIProceed() and InstallUIAbort(). | 911 AddRef(); // Balanced in InstallUIProceed() and InstallUIAbort(). |
| 913 client_->ConfirmReEnable(this, extension()); | 912 client_->ConfirmReEnable(this, extension()); |
| 914 } | 913 } |
| 915 } | 914 } |
| 916 | 915 |
| 917 } // namespace extensions | 916 } // namespace extensions |
| OLD | NEW |