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

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

Issue 1080453002: Always destroy CrxInstaller on the UI Thread (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix CrOZ Created 5 years, 8 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
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/files/file_path.h" 10 #include "base/files/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_delete_on_message_loop.h"
13 #include "base/time/time.h" 13 #include "base/time/time.h"
14 #include "content/public/browser/utility_process_host_client.h" 14 #include "content/public/browser/utility_process_host_client.h"
15 #include "extensions/browser/crx_file_info.h" 15 #include "extensions/browser/crx_file_info.h"
16 #include "extensions/browser/install/crx_install_error.h" 16 #include "extensions/browser/install/crx_install_error.h"
17 #include "extensions/common/manifest.h" 17 #include "extensions/common/manifest.h"
18 18
19 class SkBitmap; 19 class SkBitmap;
20 20
21 namespace base { 21 namespace base {
22 class DictionaryValue; 22 class DictionaryValue;
23 class SequencedTaskRunner; 23 class SequencedTaskRunner;
24 } 24 }
25 25
26 namespace crypto { 26 namespace crypto {
27 class SecureHash; 27 class SecureHash;
28 } 28 }
29 29
30 namespace extensions { 30 namespace extensions {
31 class Extension; 31 class Extension;
32 32
33 class SandboxedUnpackerClient 33 class SandboxedUnpackerClient
34 : public base::RefCountedThreadSafe<SandboxedUnpackerClient> { 34 : public base::RefCountedDeleteOnMessageLoop<SandboxedUnpackerClient> {
35 public: 35 public:
36 SandboxedUnpackerClient(const scoped_refptr<base::MessageLoopProxy>& loop);
37
36 // temp_dir - A temporary directory containing the results of the extension 38 // temp_dir - A temporary directory containing the results of the extension
37 // unpacking. The client is responsible for deleting this directory. 39 // unpacking. The client is responsible for deleting this directory.
38 // 40 //
39 // extension_root - The path to the extension root inside of temp_dir. 41 // extension_root - The path to the extension root inside of temp_dir.
40 // 42 //
41 // original_manifest - The parsed but unmodified version of the manifest, 43 // original_manifest - The parsed but unmodified version of the manifest,
42 // with no modifications such as localization, etc. 44 // with no modifications such as localization, etc.
43 // 45 //
44 // extension - The extension that was unpacked. The client is responsible 46 // extension - The extension that was unpacked. The client is responsible
45 // for deleting this memory. 47 // for deleting this memory.
46 // 48 //
47 // install_icon - The icon we will display in the installation UI, if any. 49 // install_icon - The icon we will display in the installation UI, if any.
48 virtual void OnUnpackSuccess(const base::FilePath& temp_dir, 50 virtual void OnUnpackSuccess(const base::FilePath& temp_dir,
49 const base::FilePath& extension_root, 51 const base::FilePath& extension_root,
50 const base::DictionaryValue* original_manifest, 52 const base::DictionaryValue* original_manifest,
51 const Extension* extension, 53 const Extension* extension,
52 const SkBitmap& install_icon) = 0; 54 const SkBitmap& install_icon) = 0;
53 virtual void OnUnpackFailure(const CrxInstallError& error) = 0; 55 virtual void OnUnpackFailure(const CrxInstallError& error) = 0;
54 56
55 protected: 57 protected:
56 friend class base::RefCountedThreadSafe<SandboxedUnpackerClient>; 58 friend class base::RefCountedDeleteOnMessageLoop<SandboxedUnpackerClient>;
59 friend class base::DeleteHelper<SandboxedUnpackerClient>;
57 60
58 virtual ~SandboxedUnpackerClient() {} 61 virtual ~SandboxedUnpackerClient() {}
59 }; 62 };
60 63
61 // SandboxedUnpacker unpacks extensions from the CRX format into a 64 // SandboxedUnpacker unpacks extensions from the CRX format into a
62 // directory. This is done in a sandboxed subprocess to protect the browser 65 // directory. This is done in a sandboxed subprocess to protect the browser
63 // process from parsing complex formats like JPEG or JSON from untrusted 66 // process from parsing complex formats like JPEG or JSON from untrusted
64 // sources. 67 // sources.
65 // 68 //
66 // Unpacking an extension using this class makes minor changes to its source, 69 // Unpacking an extension using this class makes minor changes to its source,
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 // when calling Extenion::Create() by the crx installer. 260 // when calling Extenion::Create() by the crx installer.
258 int creation_flags_; 261 int creation_flags_;
259 262
260 // Sequenced task runner where file I/O operations will be performed at. 263 // Sequenced task runner where file I/O operations will be performed at.
261 scoped_refptr<base::SequencedTaskRunner> unpacker_io_task_runner_; 264 scoped_refptr<base::SequencedTaskRunner> unpacker_io_task_runner_;
262 }; 265 };
263 266
264 } // namespace extensions 267 } // namespace extensions
265 268
266 #endif // CHROME_BROWSER_EXTENSIONS_SANDBOXED_UNPACKER_H_ 269 #endif // CHROME_BROWSER_EXTENSIONS_SANDBOXED_UNPACKER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698