| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <set> | 10 #include <set> |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 int creation_flags, | 221 int creation_flags, |
| 222 const base::FilePath& extensions_dir, | 222 const base::FilePath& extensions_dir, |
| 223 const scoped_refptr<base::SequencedTaskRunner>& unpacker_io_task_runner, | 223 const scoped_refptr<base::SequencedTaskRunner>& unpacker_io_task_runner, |
| 224 SandboxedUnpackerClient* client) | 224 SandboxedUnpackerClient* client) |
| 225 : client_(client), | 225 : client_(client), |
| 226 extensions_dir_(extensions_dir), | 226 extensions_dir_(extensions_dir), |
| 227 got_response_(false), | 227 got_response_(false), |
| 228 location_(location), | 228 location_(location), |
| 229 creation_flags_(creation_flags), | 229 creation_flags_(creation_flags), |
| 230 unpacker_io_task_runner_(unpacker_io_task_runner), | 230 unpacker_io_task_runner_(unpacker_io_task_runner), |
| 231 utility_wrapper_(new UtilityHostWrapper) {} | 231 utility_wrapper_(new UtilityHostWrapper) { |
| 232 // Tracking for crbug.com/692069. The location must be valid. If it's invalid, |
| 233 // the utility process kills itself for a bad IPC. |
| 234 CHECK_GT(location, Manifest::INVALID_LOCATION); |
| 235 CHECK_LT(location, Manifest::NUM_LOCATIONS); |
| 236 } |
| 232 | 237 |
| 233 bool SandboxedUnpacker::CreateTempDirectory() { | 238 bool SandboxedUnpacker::CreateTempDirectory() { |
| 234 CHECK(unpacker_io_task_runner_->RunsTasksOnCurrentThread()); | 239 CHECK(unpacker_io_task_runner_->RunsTasksOnCurrentThread()); |
| 235 | 240 |
| 236 base::FilePath temp_dir; | 241 base::FilePath temp_dir; |
| 237 if (!FindWritableTempLocation(extensions_dir_, &temp_dir)) { | 242 if (!FindWritableTempLocation(extensions_dir_, &temp_dir)) { |
| 238 ReportFailure(COULD_NOT_GET_TEMP_DIRECTORY, | 243 ReportFailure(COULD_NOT_GET_TEMP_DIRECTORY, |
| 239 l10n_util::GetStringFUTF16( | 244 l10n_util::GetStringFUTF16( |
| 240 IDS_EXTENSION_PACKAGE_INSTALL_ERROR, | 245 IDS_EXTENSION_PACKAGE_INSTALL_ERROR, |
| 241 ASCIIToUTF16("COULD_NOT_GET_TEMP_DIRECTORY"))); | 246 ASCIIToUTF16("COULD_NOT_GET_TEMP_DIRECTORY"))); |
| (...skipping 683 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 925 | 930 |
| 926 SandboxedUnpacker::UtilityHostWrapper::~UtilityHostWrapper() { | 931 SandboxedUnpacker::UtilityHostWrapper::~UtilityHostWrapper() { |
| 927 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 932 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 928 if (utility_host_) { | 933 if (utility_host_) { |
| 929 utility_host_->EndBatchMode(); | 934 utility_host_->EndBatchMode(); |
| 930 utility_host_.reset(); | 935 utility_host_.reset(); |
| 931 } | 936 } |
| 932 } | 937 } |
| 933 | 938 |
| 934 } // namespace extensions | 939 } // namespace extensions |
| OLD | NEW |