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

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

Issue 1582022: Unpack extensions inside chrome's directory. (Closed)
Patch Set: Final rebase. Created 10 years, 7 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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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_EXTENSION_UNPACKER_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_SANDBOXED_EXTENSION_UNPACKER_H_
6 #define CHROME_BROWSER_EXTENSIONS_SANDBOXED_EXTENSION_UNPACKER_H_ 6 #define CHROME_BROWSER_EXTENSIONS_SANDBOXED_EXTENSION_UNPACKER_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/file_path.h" 10 #include "base/file_path.h"
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 // The magic character sequence at the beginning of each crx file. 86 // The magic character sequence at the beginning of each crx file.
87 static const char kExtensionHeaderMagic[]; 87 static const char kExtensionHeaderMagic[];
88 88
89 // The current version of the crx format. 89 // The current version of the crx format.
90 static const uint32 kCurrentVersion = 2; 90 static const uint32 kCurrentVersion = 2;
91 91
92 // Unpacks the extension in |crx_path| into a temporary directory and calls 92 // Unpacks the extension in |crx_path| into a temporary directory and calls
93 // |client| with the result. If |rdh| is provided, unpacking is done in a 93 // |client| with the result. If |rdh| is provided, unpacking is done in a
94 // sandboxed subprocess. Otherwise, it is done in-process. 94 // sandboxed subprocess. Otherwise, it is done in-process.
95 SandboxedExtensionUnpacker(const FilePath& crx_path, 95 SandboxedExtensionUnpacker(const FilePath& crx_path,
96 const FilePath& temp_path,
96 ResourceDispatcherHost* rdh, 97 ResourceDispatcherHost* rdh,
97 SandboxedExtensionUnpackerClient* cilent); 98 SandboxedExtensionUnpackerClient* cilent);
98 99
99 const GURL& web_origin() const { return web_origin_; } 100 const GURL& web_origin() const { return web_origin_; }
100 void set_web_origin(const GURL& val) { 101 void set_web_origin(const GURL& val) {
101 web_origin_ = val; 102 web_origin_ = val;
102 } 103 }
103 104
104 // Start unpacking the extension. The client is called with the results. 105 // Start unpacking the extension. The client is called with the results.
105 void Start(); 106 void Start();
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 DictionaryValue* RewriteManifestFile(const DictionaryValue& manifest); 139 DictionaryValue* RewriteManifestFile(const DictionaryValue& manifest);
139 140
140 // Overwrites original files with safe results from utility process. 141 // Overwrites original files with safe results from utility process.
141 // Reports error and returns false if it fails. 142 // Reports error and returns false if it fails.
142 bool RewriteImageFiles(); 143 bool RewriteImageFiles();
143 bool RewriteCatalogFiles(); 144 bool RewriteCatalogFiles();
144 145
145 // The path to the CRX to unpack. 146 // The path to the CRX to unpack.
146 FilePath crx_path_; 147 FilePath crx_path_;
147 148
149 // A path to a temp dir to unpack in.
150 FilePath temp_path_;
151
148 // Our client's thread. This is the thread we respond on. 152 // Our client's thread. This is the thread we respond on.
149 ChromeThread::ID thread_identifier_; 153 ChromeThread::ID thread_identifier_;
150 154
151 // ResourceDispatcherHost to pass to the utility process. 155 // ResourceDispatcherHost to pass to the utility process.
152 ResourceDispatcherHost* rdh_; 156 ResourceDispatcherHost* rdh_;
153 157
154 // Our client. 158 // Our client.
155 scoped_refptr<SandboxedExtensionUnpackerClient> client_; 159 scoped_refptr<SandboxedExtensionUnpackerClient> client_;
156 160
157 // A temporary directory to use for unpacking. 161 // A temporary directory to use for unpacking.
(...skipping 11 matching lines...) Expand all
169 // The public key that was extracted from the CRX header. 173 // The public key that was extracted from the CRX header.
170 std::string public_key_; 174 std::string public_key_;
171 175
172 // If the unpacked extension uses web content, its origin will be set to this 176 // If the unpacked extension uses web content, its origin will be set to this
173 // value. This is used when an app is self-hosted. The only valid origin is 177 // value. This is used when an app is self-hosted. The only valid origin is
174 // the origin it is served from. 178 // the origin it is served from.
175 GURL web_origin_; 179 GURL web_origin_;
176 }; 180 };
177 181
178 #endif // CHROME_BROWSER_EXTENSIONS_SANDBOXED_EXTENSION_UNPACKER_H_ 182 #endif // CHROME_BROWSER_EXTENSIONS_SANDBOXED_EXTENSION_UNPACKER_H_
OLDNEW
« no previous file with comments | « chrome/browser/extensions/crx_installer.cc ('k') | chrome/browser/extensions/sandboxed_extension_unpacker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698