| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <set> | 7 #include <set> |
| 8 | 8 |
| 9 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
| 10 #include "app/resource_bundle.h" | 10 #include "app/resource_bundle.h" |
| 11 #include "base/file_util.h" | 11 #include "base/file_util.h" |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 } | 110 } |
| 111 | 111 |
| 112 // Make sure the UI is deleted on the ui thread. | 112 // Make sure the UI is deleted on the ui thread. |
| 113 BrowserThread::DeleteSoon(BrowserThread::UI, FROM_HERE, client_); | 113 BrowserThread::DeleteSoon(BrowserThread::UI, FROM_HERE, client_); |
| 114 client_ = NULL; | 114 client_ = NULL; |
| 115 } | 115 } |
| 116 | 116 |
| 117 void CrxInstaller::InstallCrx(const FilePath& source_file) { | 117 void CrxInstaller::InstallCrx(const FilePath& source_file) { |
| 118 source_file_ = source_file; | 118 source_file_ = source_file; |
| 119 | 119 |
| 120 FilePath user_data_temp_dir; | |
| 121 { | |
| 122 // We shouldn't be doing disk IO on the UI thread. | |
| 123 // http://code.google.com/p/chromium/issues/detail?id=60634 | |
| 124 base::ThreadRestrictions::ScopedAllowIO allow_io; | |
| 125 CHECK(PathService::Get(chrome::DIR_USER_DATA_TEMP, &user_data_temp_dir)); | |
| 126 } | |
| 127 | |
| 128 scoped_refptr<SandboxedExtensionUnpacker> unpacker( | 120 scoped_refptr<SandboxedExtensionUnpacker> unpacker( |
| 129 new SandboxedExtensionUnpacker( | 121 new SandboxedExtensionUnpacker( |
| 130 source_file, | 122 source_file, |
| 131 user_data_temp_dir, | |
| 132 g_browser_process->resource_dispatcher_host(), | 123 g_browser_process->resource_dispatcher_host(), |
| 133 this)); | 124 this)); |
| 134 | 125 |
| 135 BrowserThread::PostTask( | 126 BrowserThread::PostTask( |
| 136 BrowserThread::FILE, FROM_HERE, | 127 BrowserThread::FILE, FROM_HERE, |
| 137 NewRunnableMethod( | 128 NewRunnableMethod( |
| 138 unpacker.get(), &SandboxedExtensionUnpacker::Start)); | 129 unpacker.get(), &SandboxedExtensionUnpacker::Start)); |
| 139 } | 130 } |
| 140 | 131 |
| 141 void CrxInstaller::InstallUserScript(const FilePath& source_file, | 132 void CrxInstaller::InstallUserScript(const FilePath& source_file, |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 433 client_->OnInstallSuccess(extension_.get(), install_icon_.get()); | 424 client_->OnInstallSuccess(extension_.get(), install_icon_.get()); |
| 434 | 425 |
| 435 // Tell the frontend about the installation and hand off ownership of | 426 // Tell the frontend about the installation and hand off ownership of |
| 436 // extension_ to it. | 427 // extension_ to it. |
| 437 frontend_->OnExtensionInstalled(extension_); | 428 frontend_->OnExtensionInstalled(extension_); |
| 438 extension_ = NULL; | 429 extension_ = NULL; |
| 439 | 430 |
| 440 // We're done. We don't post any more tasks to ourselves so we are deleted | 431 // We're done. We don't post any more tasks to ourselves so we are deleted |
| 441 // soon. | 432 // soon. |
| 442 } | 433 } |
| OLD | NEW |