summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions/sandboxed_extension_unpacker.h
diff options
context:
space:
mode:
authoraa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-30 06:21:58 +0000
committeraa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-30 06:21:58 +0000
commit7577a5c5f3fbddaf9506e00904c21b2a4525e30b (patch)
tree6ec32f8e1b2d835889e143a5c59f222191730f62 /chrome/browser/extensions/sandboxed_extension_unpacker.h
parent340e050c09a44bcd25a54f9003186b8a95ef565e (diff)
downloadchromium_src-7577a5c5f3fbddaf9506e00904c21b2a4525e30b.zip
chromium_src-7577a5c5f3fbddaf9506e00904c21b2a4525e30b.tar.gz
chromium_src-7577a5c5f3fbddaf9506e00904c21b2a4525e30b.tar.bz2
Pull CrxInstaller out of ExtensionsService.
CrxInstaller is a new stateful object that encapsulates a single installation from unpack through notification. It currently contains the UI bits, but I suspect in the next CL (where I will finally implement the install UI) these will come out and CrxInstaller will become SilentCrxInstaller, and only used for updates and external installs. Also in this change, I removed the concept of install callbacks that ExtensionUpdater was using. This was only used to delete the temp crx file as far as I can tell, and we can easily keep state about that in CrxInstaller. With this CL, ExtensionsServiceBackend is almost completely dead, with only a few zombie methods left like LoadAllExtensions(). These should all become little objects like CrxInstaller that hold a reference to ExtensionsService over their lifetime and then kill themselves. I'll get to that eventually. Review URL: http://codereview.chromium.org/160311 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@22043 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions/sandboxed_extension_unpacker.h')
-rw-r--r--chrome/browser/extensions/sandboxed_extension_unpacker.h20
1 files changed, 16 insertions, 4 deletions
diff --git a/chrome/browser/extensions/sandboxed_extension_unpacker.h b/chrome/browser/extensions/sandboxed_extension_unpacker.h
index 4023ea9..02b34fb 100644
--- a/chrome/browser/extensions/sandboxed_extension_unpacker.h
+++ b/chrome/browser/extensions/sandboxed_extension_unpacker.h
@@ -17,8 +17,12 @@ class Extension;
class MessageLoop;
class ResourceDispatcherHost;
-class SandboxedExtensionUnpackerClient {
+class SandboxedExtensionUnpackerClient
+ : public base::RefCountedThreadSafe<SandboxedExtensionUnpackerClient> {
public:
+ virtual ~SandboxedExtensionUnpackerClient(){
+ }
+
// temp_dir - A temporary directoy containing the results of the extension
// unpacking. The client is responsible for deleting this directory.
//
@@ -42,9 +46,17 @@ class SandboxedExtensionUnpackerClient {
// such, it should not be used when the output is not intended to be given back
// to the author.
//
+//
+// Lifetime management:
+//
+// This class is ref-counted by each call it makes to itself on another thread,
+// and by UtilityProcessHost.
+//
+// Additionally, we hold a reference to our own client so that it lives at least
+// long enough to receive the result of unpacking.
+//
+//
// NOTE: This class should only be used on the file thread.
-
-
class SandboxedExtensionUnpacker : public UtilityProcessHost::Client {
public:
// The size of the magic character sequence at the beginning of each crx
@@ -114,7 +126,7 @@ class SandboxedExtensionUnpacker : public UtilityProcessHost::Client {
FilePath crx_path_;
MessageLoop* client_loop_;
ResourceDispatcherHost* rdh_;
- SandboxedExtensionUnpackerClient* client_;
+ scoped_refptr<SandboxedExtensionUnpackerClient> client_;
ScopedTempDir temp_dir_;
FilePath extension_root_;
scoped_ptr<Extension> extension_;