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

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

Issue 160311: Pull CrxInstaller out of ExtensionsService. (Closed)
Patch Set: Fix leak of SandboxedExtensionUnpacker Created 11 years, 4 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
« no previous file with comments | « chrome/browser/extensions/sandboxed_extension_unpacker.h ('k') | chrome/chrome.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "chrome/browser/extensions/sandboxed_extension_unpacker.h" 5 #include "chrome/browser/extensions/sandboxed_extension_unpacker.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/crypto/signature_verifier.h" 9 #include "base/crypto/signature_verifier.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 12 matching lines...) Expand all
23 23
24 #include "third_party\skia\include\core\SkBitmap.h" 24 #include "third_party\skia\include\core\SkBitmap.h"
25 25
26 const char SandboxedExtensionUnpacker::kExtensionHeaderMagic[] = "Cr24"; 26 const char SandboxedExtensionUnpacker::kExtensionHeaderMagic[] = "Cr24";
27 27
28 SandboxedExtensionUnpacker::SandboxedExtensionUnpacker( 28 SandboxedExtensionUnpacker::SandboxedExtensionUnpacker(
29 const FilePath& crx_path, ResourceDispatcherHost* rdh, 29 const FilePath& crx_path, ResourceDispatcherHost* rdh,
30 SandboxedExtensionUnpackerClient* client) 30 SandboxedExtensionUnpackerClient* client)
31 : crx_path_(crx_path), client_loop_(MessageLoop::current()), rdh_(rdh), 31 : crx_path_(crx_path), client_loop_(MessageLoop::current()), rdh_(rdh),
32 client_(client), got_response_(false) { 32 client_(client), got_response_(false) {
33
34 AddRef();
35 } 33 }
36 34
37 void SandboxedExtensionUnpacker::Start() { 35 void SandboxedExtensionUnpacker::Start() {
38 // Create a temporary directory to work in. 36 // Create a temporary directory to work in.
39 if (!temp_dir_.CreateUniqueTempDir()) { 37 if (!temp_dir_.CreateUniqueTempDir()) {
40 ReportFailure("Could not create temporary directory."); 38 ReportFailure("Could not create temporary directory.");
41 return; 39 return;
42 } 40 }
43 41
44 // Initialize the path that will eventually contain the unpacked extension. 42 // Initialize the path that will eventually contain the unpacked extension.
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 return false; 260 return false;
263 } 261 }
264 262
265 net::Base64Encode(std::string(reinterpret_cast<char*>(&key.front()), 263 net::Base64Encode(std::string(reinterpret_cast<char*>(&key.front()),
266 key.size()), &public_key_); 264 key.size()), &public_key_);
267 return true; 265 return true;
268 } 266 }
269 267
270 void SandboxedExtensionUnpacker::ReportFailure(const std::string& error) { 268 void SandboxedExtensionUnpacker::ReportFailure(const std::string& error) {
271 client_->OnUnpackFailure(error); 269 client_->OnUnpackFailure(error);
272 Release();
273 } 270 }
274 271
275 void SandboxedExtensionUnpacker::ReportSuccess() { 272 void SandboxedExtensionUnpacker::ReportSuccess() {
276 // Client takes ownership of temporary directory and extension. 273 // Client takes ownership of temporary directory and extension.
277 client_->OnUnpackSuccess(temp_dir_.Take(), extension_root_, 274 client_->OnUnpackSuccess(temp_dir_.Take(), extension_root_,
278 extension_.release()); 275 extension_.release());
279 Release();
280 } 276 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/sandboxed_extension_unpacker.h ('k') | chrome/chrome.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698