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

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

Issue 6995095: Move UtilityProcessHost to content and move the message sending/dispatching to the clients. This... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 6 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
11 #include "base/file_path.h" 11 #include "base/file_path.h"
12 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "base/scoped_temp_dir.h" 13 #include "base/scoped_temp_dir.h"
14 #include "chrome/browser/utility_process_host.h" 14 #include "content/browser/utility_process_host.h"
15 15
16 class DictionaryValue; 16 class DictionaryValue;
17 class Extension; 17 class Extension;
18 class ResourceDispatcherHost; 18 class ResourceDispatcherHost;
19 19
20 class SandboxedExtensionUnpackerClient 20 class SandboxedExtensionUnpackerClient
21 : public base::RefCountedThreadSafe<SandboxedExtensionUnpackerClient> { 21 : public base::RefCountedThreadSafe<SandboxedExtensionUnpackerClient> {
22 public: 22 public:
23 // temp_dir - A temporary directory containing the results of the extension 23 // temp_dir - A temporary directory containing the results of the extension
24 // unpacking. The client is responsible for deleting this directory. 24 // unpacking. The client is responsible for deleting this directory.
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 // in ExtensionUnpacker as it is not specific to sandboxed unpacking. It was 180 // in ExtensionUnpacker as it is not specific to sandboxed unpacking. It was
181 // put here because we cannot run windows crypto code in the sandbox. But we 181 // put here because we cannot run windows crypto code in the sandbox. But we
182 // could still have this method statically on ExtensionUnpacker so that code 182 // could still have this method statically on ExtensionUnpacker so that code
183 // just for unpacking is there and code just for sandboxing of unpacking is 183 // just for unpacking is there and code just for sandboxing of unpacking is
184 // here. 184 // here.
185 bool ValidateSignature(); 185 bool ValidateSignature();
186 186
187 // Starts the utility process that unpacks our extension. 187 // Starts the utility process that unpacks our extension.
188 void StartProcessOnIOThread(const FilePath& temp_crx_path); 188 void StartProcessOnIOThread(const FilePath& temp_crx_path);
189 189
190 // SandboxedExtensionUnpacker 190 // UtilityProcessHost::Client
191 virtual void OnUnpackExtensionSucceeded(const DictionaryValue& manifest); 191 virtual bool OnMessageReceived(const IPC::Message& message);
192 virtual void OnUnpackExtensionFailed(const std::string& error_message);
193 virtual void OnProcessCrashed(int exit_code); 192 virtual void OnProcessCrashed(int exit_code);
194 193
194 // IPC message handlers.
195 void OnUnpackExtensionSucceeded(const DictionaryValue& manifest);
196 void OnUnpackExtensionFailed(const std::string& error_message);
197
195 void ReportFailure(FailureReason reason, const std::string& message); 198 void ReportFailure(FailureReason reason, const std::string& message);
196 void ReportSuccess(const DictionaryValue& original_manifest); 199 void ReportSuccess(const DictionaryValue& original_manifest);
197 200
198 // Overwrites original manifest with safe result from utility process. 201 // Overwrites original manifest with safe result from utility process.
199 // Returns NULL on error. Caller owns the returned object. 202 // Returns NULL on error. Caller owns the returned object.
200 DictionaryValue* RewriteManifestFile(const DictionaryValue& manifest); 203 DictionaryValue* RewriteManifestFile(const DictionaryValue& manifest);
201 204
202 // Overwrites original files with safe results from utility process. 205 // Overwrites original files with safe results from utility process.
203 // Reports error and returns false if it fails. 206 // Reports error and returns false if it fails.
204 bool RewriteImageFiles(); 207 bool RewriteImageFiles();
(...skipping 24 matching lines...) Expand all
229 bool got_response_; 232 bool got_response_;
230 233
231 // The public key that was extracted from the CRX header. 234 // The public key that was extracted from the CRX header.
232 std::string public_key_; 235 std::string public_key_;
233 236
234 // Time at which unpacking started. Used to compute the time unpacking takes. 237 // Time at which unpacking started. Used to compute the time unpacking takes.
235 base::TimeTicks unpack_start_time_; 238 base::TimeTicks unpack_start_time_;
236 }; 239 };
237 240
238 #endif // CHROME_BROWSER_EXTENSIONS_SANDBOXED_EXTENSION_UNPACKER_H_ 241 #endif // CHROME_BROWSER_EXTENSIONS_SANDBOXED_EXTENSION_UNPACKER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698