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

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

Issue 6805008: Remove RDH from UtilityProcessHost. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Oops, can only use g_browser_process on the UI thread. Created 9 years, 8 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 #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/base64.h" 9 #include "base/base64.h"
10 #include "base/crypto/signature_verifier.h" 10 #include "base/crypto/signature_verifier.h"
(...skipping 22 matching lines...) Expand all
33 #include "ui/gfx/codec/png_codec.h" 33 #include "ui/gfx/codec/png_codec.h"
34 34
35 const char SandboxedExtensionUnpacker::kExtensionHeaderMagic[] = "Cr24"; 35 const char SandboxedExtensionUnpacker::kExtensionHeaderMagic[] = "Cr24";
36 36
37 SandboxedExtensionUnpacker::SandboxedExtensionUnpacker( 37 SandboxedExtensionUnpacker::SandboxedExtensionUnpacker(
38 const FilePath& crx_path, 38 const FilePath& crx_path,
39 ResourceDispatcherHost* rdh, 39 ResourceDispatcherHost* rdh,
40 SandboxedExtensionUnpackerClient* client) 40 SandboxedExtensionUnpackerClient* client)
41 : crx_path_(crx_path), 41 : crx_path_(crx_path),
42 thread_identifier_(BrowserThread::ID_COUNT), 42 thread_identifier_(BrowserThread::ID_COUNT),
43 rdh_(rdh), client_(client), got_response_(false) { 43 rdh_(rdh), client_(client), got_response_(false) {
jam 2011/04/06 16:28:36 looks like this isn't needed anymore
willchan no longer on Chromium 2011/04/06 16:37:25 It's actually used to determine if we're in a unit
44 } 44 }
45 45
46 bool SandboxedExtensionUnpacker::CreateTempDirectory() { 46 bool SandboxedExtensionUnpacker::CreateTempDirectory() {
47 CHECK(BrowserThread::GetCurrentThreadIdentifier(&thread_identifier_)); 47 CHECK(BrowserThread::GetCurrentThreadIdentifier(&thread_identifier_));
48 48
49 FilePath user_data_temp_dir = extension_file_util::GetUserDataTempDir(); 49 FilePath user_data_temp_dir = extension_file_util::GetUserDataTempDir();
50 if (user_data_temp_dir.empty()) { 50 if (user_data_temp_dir.empty()) {
51 ReportFailure( 51 ReportFailure(
52 COULD_NOT_GET_TEMP_DIRECTORY, 52 COULD_NOT_GET_TEMP_DIRECTORY,
53 l10n_util::GetStringFUTF8( 53 l10n_util::GetStringFUTF8(
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 SandboxedExtensionUnpacker::~SandboxedExtensionUnpacker() { 139 SandboxedExtensionUnpacker::~SandboxedExtensionUnpacker() {
140 base::FileUtilProxy::Delete( 140 base::FileUtilProxy::Delete(
141 BrowserThread::GetMessageLoopProxyForThread(thread_identifier_), 141 BrowserThread::GetMessageLoopProxyForThread(thread_identifier_),
142 temp_dir_.Take(), 142 temp_dir_.Take(),
143 true, 143 true,
144 NULL); 144 NULL);
145 } 145 }
146 146
147 void SandboxedExtensionUnpacker::StartProcessOnIOThread( 147 void SandboxedExtensionUnpacker::StartProcessOnIOThread(
148 const FilePath& temp_crx_path) { 148 const FilePath& temp_crx_path) {
149 UtilityProcessHost* host = new UtilityProcessHost( 149 UtilityProcessHost* host = new UtilityProcessHost(this, thread_identifier_);
150 rdh_, this, thread_identifier_);
151 host->StartExtensionUnpacker(temp_crx_path); 150 host->StartExtensionUnpacker(temp_crx_path);
152 } 151 }
153 152
154 void SandboxedExtensionUnpacker::OnUnpackExtensionSucceeded( 153 void SandboxedExtensionUnpacker::OnUnpackExtensionSucceeded(
155 const DictionaryValue& manifest) { 154 const DictionaryValue& manifest) {
156 // Skip check for unittests. 155 // Skip check for unittests.
157 if (thread_identifier_ != BrowserThread::ID_COUNT) 156 if (thread_identifier_ != BrowserThread::ID_COUNT)
158 CHECK(BrowserThread::CurrentlyOn(thread_identifier_)); 157 CHECK(BrowserThread::CurrentlyOn(thread_identifier_));
159 got_response_ = true; 158 got_response_ = true;
160 159
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 ERROR_SAVING_CATALOG, 581 ERROR_SAVING_CATALOG,
583 l10n_util::GetStringFUTF8( 582 l10n_util::GetStringFUTF8(
584 IDS_EXTENSION_PACKAGE_INSTALL_ERROR, 583 IDS_EXTENSION_PACKAGE_INSTALL_ERROR,
585 ASCIIToUTF16("ERROR_SAVING_CATALOG"))); 584 ASCIIToUTF16("ERROR_SAVING_CATALOG")));
586 return false; 585 return false;
587 } 586 }
588 } 587 }
589 588
590 return true; 589 return true;
591 } 590 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698