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