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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 if (approval->minimum_version.get()) { | 156 if (approval->minimum_version.get()) { |
157 expected_version_.reset(new Version(*approval->minimum_version)); | 157 expected_version_.reset(new Version(*approval->minimum_version)); |
158 expected_version_strict_checking_ = false; | 158 expected_version_strict_checking_ = false; |
159 } | 159 } |
160 | 160 |
161 show_dialog_callback_ = approval->show_dialog_callback; | 161 show_dialog_callback_ = approval->show_dialog_callback; |
162 set_is_ephemeral(approval->is_ephemeral); | 162 set_is_ephemeral(approval->is_ephemeral); |
163 } | 163 } |
164 | 164 |
165 CrxInstaller::~CrxInstaller() { | 165 CrxInstaller::~CrxInstaller() { |
166 // Make sure the UI is deleted on the ui thread. | 166 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
167 if (client_) { | 167 // Ensure |client_| and |install_checker_| data members are destroyed on the |
168 BrowserThread::DeleteSoon(BrowserThread::UI, FROM_HERE, client_); | 168 // UI thread. The |client_| dialog has a weak reference as |this| is its |
169 client_ = NULL; | 169 // delegate, and |install_checker_| owns WeakPtrs, so must be destroyed on the |
170 } | 170 // same thread that created it. |
171 } | 171 } |
172 | 172 |
173 void CrxInstaller::InstallCrx(const base::FilePath& source_file) { | 173 void CrxInstaller::InstallCrx(const base::FilePath& source_file) { |
174 InstallCrxFile(CRXFileInfo(source_file)); | 174 InstallCrxFile(CRXFileInfo(source_file)); |
175 } | 175 } |
176 | 176 |
177 void CrxInstaller::InstallCrxFile(const CRXFileInfo& source_file) { | 177 void CrxInstaller::InstallCrxFile(const CRXFileInfo& source_file) { |
178 ExtensionService* service = service_weak_.get(); | 178 ExtensionService* service = service_weak_.get(); |
179 if (!service || service->browser_terminating()) | 179 if (!service || service->browser_terminating()) |
180 return; | 180 return; |
(...skipping 727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
908 if (!prefs->DidExtensionEscalatePermissions(extension()->id())) | 908 if (!prefs->DidExtensionEscalatePermissions(extension()->id())) |
909 return; | 909 return; |
910 | 910 |
911 if (client_) { | 911 if (client_) { |
912 AddRef(); // Balanced in InstallUIProceed() and InstallUIAbort(). | 912 AddRef(); // Balanced in InstallUIProceed() and InstallUIAbort(). |
913 client_->ConfirmReEnable(this, extension()); | 913 client_->ConfirmReEnable(this, extension()); |
914 } | 914 } |
915 } | 915 } |
916 | 916 |
917 } // namespace extensions | 917 } // namespace extensions |
OLD | NEW |