Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(65)

Side by Side Diff: chrome/browser/extensions/sandboxed_unpacker.h

Issue 12093036: Move Extension Location and Type enums to Manifest, and move InstallWarning to its own file. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/file_path.h" 10 #include "base/file_path.h"
11 #include "base/files/scoped_temp_dir.h" 11 #include "base/files/scoped_temp_dir.h"
12 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "chrome/common/extensions/extension.h" 13 #include "base/time.h"
14 #include "chrome/common/extensions/manifest.h"
14 #include "content/public/browser/utility_process_host_client.h" 15 #include "content/public/browser/utility_process_host_client.h"
15 16
16 namespace base { 17 namespace base {
17 class DictionaryValue; 18 class DictionaryValue;
18 class SequencedTaskRunner; 19 class SequencedTaskRunner;
19 } 20 }
20 21
21 namespace extensions { 22 namespace extensions {
23 class Extension;
22 24
23 class SandboxedUnpackerClient 25 class SandboxedUnpackerClient
24 : public base::RefCountedThreadSafe<SandboxedUnpackerClient> { 26 : public base::RefCountedThreadSafe<SandboxedUnpackerClient> {
25 public: 27 public:
26 // temp_dir - A temporary directory containing the results of the extension 28 // temp_dir - A temporary directory containing the results of the extension
27 // unpacking. The client is responsible for deleting this directory. 29 // unpacking. The client is responsible for deleting this directory.
28 // 30 //
29 // extension_root - The path to the extension root inside of temp_dir. 31 // extension_root - The path to the extension root inside of temp_dir.
30 // 32 //
31 // original_manifest - The parsed but unmodified version of the manifest, 33 // original_manifest - The parsed but unmodified version of the manifest,
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 // 68 //
67 // 69 //
68 // NOTE: This class should only be used on the file thread. 70 // NOTE: This class should only be used on the file thread.
69 class SandboxedUnpacker : public content::UtilityProcessHostClient { 71 class SandboxedUnpacker : public content::UtilityProcessHostClient {
70 public: 72 public:
71 // Unpacks the extension in |crx_path| into a temporary directory and calls 73 // Unpacks the extension in |crx_path| into a temporary directory and calls
72 // |client| with the result. If |run_out_of_process| is provided, unpacking 74 // |client| with the result. If |run_out_of_process| is provided, unpacking
73 // is done in a sandboxed subprocess. Otherwise, it is done in-process. 75 // is done in a sandboxed subprocess. Otherwise, it is done in-process.
74 SandboxedUnpacker(const FilePath& crx_path, 76 SandboxedUnpacker(const FilePath& crx_path,
75 bool run_out_of_process, 77 bool run_out_of_process,
76 Extension::Location location, 78 Manifest::Location location,
77 int creation_flags, 79 int creation_flags,
78 const FilePath& extensions_dir, 80 const FilePath& extensions_dir,
79 base::SequencedTaskRunner* unpacker_io_task_runner, 81 base::SequencedTaskRunner* unpacker_io_task_runner,
80 SandboxedUnpackerClient* client); 82 SandboxedUnpackerClient* client);
81 83
82 // Start unpacking the extension. The client is called with the results. 84 // Start unpacking the extension. The client is called with the results.
83 void Start(); 85 void Start();
84 86
85 private: 87 private:
86 class ProcessHostClient; 88 class ProcessHostClient;
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 std::string public_key_; 220 std::string public_key_;
219 221
220 // The extension's ID. This will be calculated from the public key in the crx 222 // The extension's ID. This will be calculated from the public key in the crx
221 // header. 223 // header.
222 std::string extension_id_; 224 std::string extension_id_;
223 225
224 // Time at which unpacking started. Used to compute the time unpacking takes. 226 // Time at which unpacking started. Used to compute the time unpacking takes.
225 base::TimeTicks unpack_start_time_; 227 base::TimeTicks unpack_start_time_;
226 228
227 // Location to use for the unpacked extension. 229 // Location to use for the unpacked extension.
228 Extension::Location location_; 230 Manifest::Location location_;
229 231
230 // Creation flags to use for the extension. These flags will be used 232 // Creation flags to use for the extension. These flags will be used
231 // when calling Extenion::Create() by the crx installer. 233 // when calling Extenion::Create() by the crx installer.
232 int creation_flags_; 234 int creation_flags_;
233 235
234 // Sequenced task runner where file I/O operations will be performed at. 236 // Sequenced task runner where file I/O operations will be performed at.
235 scoped_refptr<base::SequencedTaskRunner> unpacker_io_task_runner_; 237 scoped_refptr<base::SequencedTaskRunner> unpacker_io_task_runner_;
236 }; 238 };
237 239
238 } // namespace extensions 240 } // namespace extensions
239 241
240 #endif // CHROME_BROWSER_EXTENSIONS_SANDBOXED_UNPACKER_H_ 242 #endif // CHROME_BROWSER_EXTENSIONS_SANDBOXED_UNPACKER_H_
OLDNEW
« no previous file with comments | « chrome/browser/extensions/requirements_checker_browsertest.cc ('k') | chrome/browser/extensions/sandboxed_unpacker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698