| 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 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 expected_version_strict_checking_ = false; | 160 expected_version_strict_checking_ = false; |
| 161 } | 161 } |
| 162 | 162 |
| 163 show_dialog_callback_ = approval->show_dialog_callback; | 163 show_dialog_callback_ = approval->show_dialog_callback; |
| 164 | 164 |
| 165 if (approval->is_ephemeral) | 165 if (approval->is_ephemeral) |
| 166 creation_flags_ |= Extension::IS_EPHEMERAL; | 166 creation_flags_ |= Extension::IS_EPHEMERAL; |
| 167 } | 167 } |
| 168 | 168 |
| 169 CrxInstaller::~CrxInstaller() { | 169 CrxInstaller::~CrxInstaller() { |
| 170 LOG(WARNING) << "Destroying"; |
| 170 // Make sure the UI is deleted on the ui thread. | 171 // Make sure the UI is deleted on the ui thread. |
| 171 if (client_) { | 172 if (client_) { |
| 172 BrowserThread::DeleteSoon(BrowserThread::UI, FROM_HERE, client_); | 173 BrowserThread::DeleteSoon(BrowserThread::UI, FROM_HERE, client_); |
| 173 client_ = NULL; | 174 client_ = NULL; |
| 174 } | 175 } |
| 175 } | 176 } |
| 176 | 177 |
| 177 void CrxInstaller::InstallCrx(const base::FilePath& source_file) { | 178 void CrxInstaller::InstallCrx(const base::FilePath& source_file) { |
| 178 ExtensionService* service = service_weak_.get(); | 179 ExtensionService* service = service_weak_.get(); |
| 179 if (!service || service->browser_terminating()) | 180 if (!service || service->browser_terminating()) |
| (...skipping 649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 829 | 830 |
| 830 InstallTrackerFactory::GetForProfile(profile()) | 831 InstallTrackerFactory::GetForProfile(profile()) |
| 831 ->OnFinishCrxInstall(success ? extension()->id() : expected_id_, success); | 832 ->OnFinishCrxInstall(success ? extension()->id() : expected_id_, success); |
| 832 | 833 |
| 833 if (success) | 834 if (success) |
| 834 ConfirmReEnable(); | 835 ConfirmReEnable(); |
| 835 } | 836 } |
| 836 | 837 |
| 837 void CrxInstaller::CleanupTempFiles() { | 838 void CrxInstaller::CleanupTempFiles() { |
| 838 if (!installer_task_runner_->RunsTasksOnCurrentThread()) { | 839 if (!installer_task_runner_->RunsTasksOnCurrentThread()) { |
| 840 LOG(WARNING) << "Post CleanupTempFiles"; |
| 839 if (!installer_task_runner_->PostTask( | 841 if (!installer_task_runner_->PostTask( |
| 840 FROM_HERE, | 842 FROM_HERE, |
| 841 base::Bind(&CrxInstaller::CleanupTempFiles, this))) { | 843 base::Bind(&CrxInstaller::CleanupTempFiles, this))) { |
| 842 NOTREACHED(); | 844 NOTREACHED(); |
| 843 } | 845 } |
| 844 return; | 846 return; |
| 845 } | 847 } |
| 846 | 848 |
| 849 LOG(WARNING) << "CleanupTempFiles"; |
| 847 // Delete the temp directory and crx file as necessary. | 850 // Delete the temp directory and crx file as necessary. |
| 848 if (!temp_dir_.value().empty()) { | 851 if (!temp_dir_.value().empty()) { |
| 849 file_util::DeleteFile(temp_dir_, true); | 852 file_util::DeleteFile(temp_dir_, true); |
| 850 temp_dir_ = base::FilePath(); | 853 temp_dir_ = base::FilePath(); |
| 851 } | 854 } |
| 852 | 855 |
| 853 if (delete_source_ && !source_file_.value().empty()) { | 856 if (delete_source_ && !source_file_.value().empty()) { |
| 854 file_util::DeleteFile(source_file_, false); | 857 file_util::DeleteFile(source_file_, false); |
| 855 source_file_ = base::FilePath(); | 858 source_file_ = base::FilePath(); |
| 856 } | 859 } |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 891 if (!prefs->DidExtensionEscalatePermissions(extension()->id())) | 894 if (!prefs->DidExtensionEscalatePermissions(extension()->id())) |
| 892 return; | 895 return; |
| 893 | 896 |
| 894 if (client_) { | 897 if (client_) { |
| 895 AddRef(); // Balanced in InstallUIProceed() and InstallUIAbort(). | 898 AddRef(); // Balanced in InstallUIProceed() and InstallUIAbort(). |
| 896 client_->ConfirmReEnable(this, extension()); | 899 client_->ConfirmReEnable(this, extension()); |
| 897 } | 900 } |
| 898 } | 901 } |
| 899 | 902 |
| 900 } // namespace extensions | 903 } // namespace extensions |
| OLD | NEW |