| 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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 | 163 |
| 164 CrxInstaller::~CrxInstaller() { | 164 CrxInstaller::~CrxInstaller() { |
| 165 // Make sure the UI is deleted on the ui thread. | 165 // Make sure the UI is deleted on the ui thread. |
| 166 if (client_) { | 166 if (client_) { |
| 167 BrowserThread::DeleteSoon(BrowserThread::UI, FROM_HERE, client_); | 167 BrowserThread::DeleteSoon(BrowserThread::UI, FROM_HERE, client_); |
| 168 client_ = NULL; | 168 client_ = NULL; |
| 169 } | 169 } |
| 170 } | 170 } |
| 171 | 171 |
| 172 void CrxInstaller::InstallCrx(const base::FilePath& source_file) { | 172 void CrxInstaller::InstallCrx(const base::FilePath& source_file) { |
| 173 CheckAndInstallCrx(source_file, std::string()); |
| 174 } |
| 175 |
| 176 void CrxInstaller::CheckAndInstallCrx(const base::FilePath& source_file, |
| 177 const std::string& package_hash) { |
| 173 ExtensionService* service = service_weak_.get(); | 178 ExtensionService* service = service_weak_.get(); |
| 174 if (!service || service->browser_terminating()) | 179 if (!service || service->browser_terminating()) |
| 175 return; | 180 return; |
| 176 | 181 |
| 177 NotifyCrxInstallBegin(); | 182 NotifyCrxInstallBegin(); |
| 178 | 183 |
| 179 source_file_ = source_file; | 184 source_file_ = source_file; |
| 180 | 185 |
| 181 scoped_refptr<SandboxedUnpacker> unpacker( | 186 scoped_refptr<SandboxedUnpacker> unpacker(new SandboxedUnpacker( |
| 182 new SandboxedUnpacker(source_file, | 187 source_file, package_hash, install_source_, creation_flags_, |
| 183 install_source_, | 188 install_directory_, installer_task_runner_.get(), this)); |
| 184 creation_flags_, | |
| 185 install_directory_, | |
| 186 installer_task_runner_.get(), | |
| 187 this)); | |
| 188 | 189 |
| 189 if (!installer_task_runner_->PostTask( | 190 if (!installer_task_runner_->PostTask( |
| 190 FROM_HERE, | 191 FROM_HERE, |
| 191 base::Bind(&SandboxedUnpacker::Start, unpacker.get()))) | 192 base::Bind(&SandboxedUnpacker::Start, unpacker.get()))) |
| 192 NOTREACHED(); | 193 NOTREACHED(); |
| 193 } | 194 } |
| 194 | 195 |
| 195 void CrxInstaller::InstallUserScript(const base::FilePath& source_file, | 196 void CrxInstaller::InstallUserScript(const base::FilePath& source_file, |
| 196 const GURL& download_url) { | 197 const GURL& download_url) { |
| 197 DCHECK(!download_url.is_empty()); | 198 DCHECK(!download_url.is_empty()); |
| (...skipping 704 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 902 if (!prefs->DidExtensionEscalatePermissions(extension()->id())) | 903 if (!prefs->DidExtensionEscalatePermissions(extension()->id())) |
| 903 return; | 904 return; |
| 904 | 905 |
| 905 if (client_) { | 906 if (client_) { |
| 906 AddRef(); // Balanced in InstallUIProceed() and InstallUIAbort(). | 907 AddRef(); // Balanced in InstallUIProceed() and InstallUIAbort(). |
| 907 client_->ConfirmReEnable(this, extension()); | 908 client_->ConfirmReEnable(this, extension()); |
| 908 } | 909 } |
| 909 } | 910 } |
| 910 | 911 |
| 911 } // namespace extensions | 912 } // namespace extensions |
| OLD | NEW |