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

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

Issue 2591963004: Transform RefCountedDeleteOnMessageLoop to RefCountedDeleteOnSequence. (Closed)
Patch Set: similarity Created 3 years, 12 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 EXTENSIONS_BROWSER_SANDBOXED_UNPACKER_H_ 5 #ifndef EXTENSIONS_BROWSER_SANDBOXED_UNPACKER_H_
6 #define EXTENSIONS_BROWSER_SANDBOXED_UNPACKER_H_ 6 #define EXTENSIONS_BROWSER_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/macros.h" 12 #include "base/macros.h"
13 #include "base/memory/ref_counted_delete_on_message_loop.h" 13 #include "base/memory/ref_counted_delete_on_sequence.h"
14 #include "base/memory/weak_ptr.h" 14 #include "base/memory/weak_ptr.h"
15 #include "base/time/time.h" 15 #include "base/time/time.h"
16 #include "content/public/browser/browser_thread.h" 16 #include "content/public/browser/browser_thread.h"
17 #include "content/public/browser/utility_process_host_client.h" 17 #include "content/public/browser/utility_process_host_client.h"
18 #include "extensions/browser/crx_file_info.h" 18 #include "extensions/browser/crx_file_info.h"
19 #include "extensions/browser/install/crx_install_error.h" 19 #include "extensions/browser/install/crx_install_error.h"
20 #include "extensions/common/manifest.h" 20 #include "extensions/common/manifest.h"
21 21
22 class SkBitmap; 22 class SkBitmap;
23 23
24 namespace base { 24 namespace base {
25 class DictionaryValue; 25 class DictionaryValue;
26 class SequencedTaskRunner; 26 class SequencedTaskRunner;
27 } 27 }
28 28
29 namespace content { 29 namespace content {
30 class UtilityProcessHost; 30 class UtilityProcessHost;
31 } 31 }
32 32
33 namespace extensions { 33 namespace extensions {
34 class Extension; 34 class Extension;
35 35
36 class SandboxedUnpackerClient 36 class SandboxedUnpackerClient
37 : public base::RefCountedDeleteOnMessageLoop<SandboxedUnpackerClient> { 37 : public base::RefCountedDeleteOnSequence<SandboxedUnpackerClient> {
38 public: 38 public:
39 // Initialize the ref-counted base to always delete on the UI thread. Note 39 // Initialize the ref-counted base to always delete on the UI thread. Note
40 // the constructor call must also happen on the UI thread. 40 // the constructor call must also happen on the UI thread.
41 SandboxedUnpackerClient(); 41 SandboxedUnpackerClient();
42 42
43 // temp_dir - A temporary directory containing the results of the extension 43 // temp_dir - A temporary directory containing the results of the extension
44 // unpacking. The client is responsible for deleting this directory. 44 // unpacking. The client is responsible for deleting this directory.
45 // 45 //
46 // extension_root - The path to the extension root inside of temp_dir. 46 // extension_root - The path to the extension root inside of temp_dir.
47 // 47 //
48 // original_manifest - The parsed but unmodified version of the manifest, 48 // original_manifest - The parsed but unmodified version of the manifest,
49 // with no modifications such as localization, etc. 49 // with no modifications such as localization, etc.
50 // 50 //
51 // extension - The extension that was unpacked. The client is responsible 51 // extension - The extension that was unpacked. The client is responsible
52 // for deleting this memory. 52 // for deleting this memory.
53 // 53 //
54 // install_icon - The icon we will display in the installation UI, if any. 54 // install_icon - The icon we will display in the installation UI, if any.
55 virtual void OnUnpackSuccess(const base::FilePath& temp_dir, 55 virtual void OnUnpackSuccess(const base::FilePath& temp_dir,
56 const base::FilePath& extension_root, 56 const base::FilePath& extension_root,
57 const base::DictionaryValue* original_manifest, 57 const base::DictionaryValue* original_manifest,
58 const Extension* extension, 58 const Extension* extension,
59 const SkBitmap& install_icon) = 0; 59 const SkBitmap& install_icon) = 0;
60 virtual void OnUnpackFailure(const CrxInstallError& error) = 0; 60 virtual void OnUnpackFailure(const CrxInstallError& error) = 0;
61 61
62 protected: 62 protected:
63 friend class base::RefCountedDeleteOnMessageLoop<SandboxedUnpackerClient>; 63 friend class base::RefCountedDeleteOnSequence<SandboxedUnpackerClient>;
64 friend class base::DeleteHelper<SandboxedUnpackerClient>; 64 friend class base::DeleteHelper<SandboxedUnpackerClient>;
65 65
66 virtual ~SandboxedUnpackerClient() {} 66 virtual ~SandboxedUnpackerClient() {}
67 }; 67 };
68 68
69 // SandboxedUnpacker does work to optionally unpack and then validate/sanitize 69 // SandboxedUnpacker does work to optionally unpack and then validate/sanitize
70 // an extension, either starting from a crx file or an already unzipped 70 // an extension, either starting from a crx file or an already unzipped
71 // directory (eg from differential update). This is done in a sandboxed 71 // directory (eg from differential update). This is done in a sandboxed
72 // subprocess to protect the browser process from parsing complex formats like 72 // subprocess to protect the browser process from parsing complex formats like
73 // JPEG or JSON from untrusted sources. 73 // JPEG or JSON from untrusted sources.
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 304
305 // Used for sending tasks to the utility process. 305 // Used for sending tasks to the utility process.
306 scoped_refptr<UtilityHostWrapper> utility_wrapper_; 306 scoped_refptr<UtilityHostWrapper> utility_wrapper_;
307 307
308 DISALLOW_COPY_AND_ASSIGN(SandboxedUnpacker); 308 DISALLOW_COPY_AND_ASSIGN(SandboxedUnpacker);
309 }; 309 };
310 310
311 } // namespace extensions 311 } // namespace extensions
312 312
313 #endif // EXTENSIONS_BROWSER_SANDBOXED_UNPACKER_H_ 313 #endif // EXTENSIONS_BROWSER_SANDBOXED_UNPACKER_H_
OLDNEW
« no previous file with comments | « content/browser/devtools/protocol/io_handler.cc ('k') | extensions/browser/sandboxed_unpacker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698