| 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 "extensions/browser/sandboxed_unpacker.h" | 5 #include "extensions/browser/sandboxed_unpacker.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 | 8 |
| 9 #include "base/base64.h" | 9 #include "base/base64.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 341 IDS_EXTENSION_PACKAGE_INSTALL_ERROR, | 341 IDS_EXTENSION_PACKAGE_INSTALL_ERROR, |
| 342 ASCIIToUTF16("UTILITY_PROCESS_CRASHED_WHILE_TRYING_TO_INSTALL")) + | 342 ASCIIToUTF16("UTILITY_PROCESS_CRASHED_WHILE_TRYING_TO_INSTALL")) + |
| 343 ASCIIToUTF16(". ") + | 343 ASCIIToUTF16(". ") + |
| 344 l10n_util::GetStringUTF16(IDS_EXTENSION_INSTALL_PROCESS_CRASHED)); | 344 l10n_util::GetStringUTF16(IDS_EXTENSION_INSTALL_PROCESS_CRASHED)); |
| 345 } | 345 } |
| 346 | 346 |
| 347 void SandboxedUnpacker::StartProcessOnIOThread( | 347 void SandboxedUnpacker::StartProcessOnIOThread( |
| 348 const base::FilePath& temp_crx_path) { | 348 const base::FilePath& temp_crx_path) { |
| 349 UtilityProcessHost* host = | 349 UtilityProcessHost* host = |
| 350 UtilityProcessHost::Create(this, unpacker_io_task_runner_.get()); | 350 UtilityProcessHost::Create(this, unpacker_io_task_runner_.get()); |
| 351 host->SetName( |
| 352 l10n_util::GetStringUTF16(IDS_UTILITY_PROCESS_EXTENSION_UNPACKER_NAME)); |
| 351 // Grant the subprocess access to the entire subdir the extension file is | 353 // Grant the subprocess access to the entire subdir the extension file is |
| 352 // in, so that it can unpack to that dir. | 354 // in, so that it can unpack to that dir. |
| 353 host->SetExposedDir(temp_crx_path.DirName()); | 355 host->SetExposedDir(temp_crx_path.DirName()); |
| 354 host->Send(new ChromeUtilityMsg_UnpackExtension(temp_crx_path, extension_id_, | 356 host->Send(new ChromeUtilityMsg_UnpackExtension(temp_crx_path, extension_id_, |
| 355 location_, creation_flags_)); | 357 location_, creation_flags_)); |
| 356 } | 358 } |
| 357 | 359 |
| 358 void SandboxedUnpacker::OnUnpackExtensionSucceeded( | 360 void SandboxedUnpacker::OnUnpackExtensionSucceeded( |
| 359 const base::DictionaryValue& manifest) { | 361 const base::DictionaryValue& manifest) { |
| 360 CHECK(unpacker_io_task_runner_->RunsTasksOnCurrentThread()); | 362 CHECK(unpacker_io_task_runner_->RunsTasksOnCurrentThread()); |
| (...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 841 | 843 |
| 842 void SandboxedUnpacker::Cleanup() { | 844 void SandboxedUnpacker::Cleanup() { |
| 843 DCHECK(unpacker_io_task_runner_->RunsTasksOnCurrentThread()); | 845 DCHECK(unpacker_io_task_runner_->RunsTasksOnCurrentThread()); |
| 844 if (!temp_dir_.Delete()) { | 846 if (!temp_dir_.Delete()) { |
| 845 LOG(WARNING) << "Can not delete temp directory at " | 847 LOG(WARNING) << "Can not delete temp directory at " |
| 846 << temp_dir_.path().value(); | 848 << temp_dir_.path().value(); |
| 847 } | 849 } |
| 848 } | 850 } |
| 849 | 851 |
| 850 } // namespace extensions | 852 } // namespace extensions |
| OLD | NEW |