| 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 #ifndef CHROME_BROWSER_EXTENSIONS_SANDBOXED_UNPACKER_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_SANDBOXED_UNPACKER_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_SANDBOXED_UNPACKER_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_SANDBOXED_UNPACKER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 // Additionally, we hold a reference to our own client so that it lives at least | 71 // Additionally, we hold a reference to our own client so that it lives at least |
| 72 // long enough to receive the result of unpacking. | 72 // long enough to receive the result of unpacking. |
| 73 // | 73 // |
| 74 // | 74 // |
| 75 // NOTE: This class should only be used on the file thread. | 75 // NOTE: This class should only be used on the file thread. |
| 76 class SandboxedUnpacker : public content::UtilityProcessHostClient { | 76 class SandboxedUnpacker : public content::UtilityProcessHostClient { |
| 77 public: | 77 public: |
| 78 // Unpacks the extension in |crx_path| into a temporary directory and calls | 78 // Unpacks the extension in |crx_path| into a temporary directory and calls |
| 79 // |client| with the result. If |run_out_of_process| is provided, unpacking | 79 // |client| with the result. If |run_out_of_process| is provided, unpacking |
| 80 // is done in a sandboxed subprocess. Otherwise, it is done in-process. | 80 // is done in a sandboxed subprocess. Otherwise, it is done in-process. |
| 81 SandboxedUnpacker(const base::FilePath& crx_path, | 81 SandboxedUnpacker( |
| 82 Manifest::Location location, | 82 const base::FilePath& crx_path, |
| 83 int creation_flags, | 83 Manifest::Location location, |
| 84 const base::FilePath& extensions_dir, | 84 int creation_flags, |
| 85 base::SequencedTaskRunner* unpacker_io_task_runner, | 85 const base::FilePath& extensions_dir, |
| 86 SandboxedUnpackerClient* client); | 86 const scoped_refptr<base::SequencedTaskRunner>& unpacker_io_task_runner, |
| 87 SandboxedUnpackerClient* client); |
| 87 | 88 |
| 88 // Start unpacking the extension. The client is called with the results. | 89 // Start unpacking the extension. The client is called with the results. |
| 89 void Start(); | 90 void Start(); |
| 90 | 91 |
| 91 private: | 92 private: |
| 92 class ProcessHostClient; | 93 class ProcessHostClient; |
| 93 | 94 |
| 94 // Enumerate all the ways unpacking can fail. Calls to ReportFailure() | 95 // Enumerate all the ways unpacking can fail. Calls to ReportFailure() |
| 95 // take a failure reason as an argument, and put it in histogram | 96 // take a failure reason as an argument, and put it in histogram |
| 96 // Extensions.SandboxUnpackFailureReason. | 97 // Extensions.SandboxUnpackFailureReason. |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 // when calling Extenion::Create() by the crx installer. | 237 // when calling Extenion::Create() by the crx installer. |
| 237 int creation_flags_; | 238 int creation_flags_; |
| 238 | 239 |
| 239 // Sequenced task runner where file I/O operations will be performed at. | 240 // Sequenced task runner where file I/O operations will be performed at. |
| 240 scoped_refptr<base::SequencedTaskRunner> unpacker_io_task_runner_; | 241 scoped_refptr<base::SequencedTaskRunner> unpacker_io_task_runner_; |
| 241 }; | 242 }; |
| 242 | 243 |
| 243 } // namespace extensions | 244 } // namespace extensions |
| 244 | 245 |
| 245 #endif // CHROME_BROWSER_EXTENSIONS_SANDBOXED_UNPACKER_H_ | 246 #endif // CHROME_BROWSER_EXTENSIONS_SANDBOXED_UNPACKER_H_ |
| OLD | NEW |