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

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

Issue 9150016: Move creation and ownership of ResourceDispatcherHost and PluginService to content. This gives a ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 8 years, 11 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/bind.h" 10 #include "base/bind.h"
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 // Neither paths is link free chances are good installation will fail. 156 // Neither paths is link free chances are good installation will fail.
157 LOG(ERROR) << "Both the %TEMP% folder and the profile seem to be on " 157 LOG(ERROR) << "Both the %TEMP% folder and the profile seem to be on "
158 << "remote drives or read-only. Installation can not complete!"; 158 << "remote drives or read-only. Installation can not complete!";
159 return false; 159 return false;
160 } 160 }
161 161
162 } // namespace 162 } // namespace
163 163
164 SandboxedExtensionUnpacker::SandboxedExtensionUnpacker( 164 SandboxedExtensionUnpacker::SandboxedExtensionUnpacker(
165 const FilePath& crx_path, 165 const FilePath& crx_path,
166 ResourceDispatcherHost* rdh,
167 Extension::Location location, 166 Extension::Location location,
168 int creation_flags, 167 int creation_flags,
169 SandboxedExtensionUnpackerClient* client) 168 SandboxedExtensionUnpackerClient* client)
170 : crx_path_(crx_path), 169 : crx_path_(crx_path),
171 thread_identifier_(BrowserThread::ID_COUNT), 170 thread_identifier_(BrowserThread::ID_COUNT),
172 rdh_(rdh), client_(client), got_response_(false), 171 client_(client),
173 location_(location), creation_flags_(creation_flags) { 172 got_response_(false),
173 location_(location),
174 creation_flags_(creation_flags),
175 use_utility_process_(true) {
174 } 176 }
175 177
176 bool SandboxedExtensionUnpacker::CreateTempDirectory() { 178 bool SandboxedExtensionUnpacker::CreateTempDirectory() {
177 CHECK(BrowserThread::GetCurrentThreadIdentifier(&thread_identifier_)); 179 CHECK(BrowserThread::GetCurrentThreadIdentifier(&thread_identifier_));
178 180
179 FilePath temp_dir; 181 FilePath temp_dir;
180 if (!FindWritableTempLocation(&temp_dir)) { 182 if (!FindWritableTempLocation(&temp_dir)) {
181 ReportFailure( 183 ReportFailure(
182 COULD_NOT_GET_TEMP_DIRECTORY, 184 COULD_NOT_GET_TEMP_DIRECTORY,
183 l10n_util::GetStringFUTF16( 185 l10n_util::GetStringFUTF16(
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 l10n_util::GetStringFUTF16( 234 l10n_util::GetStringFUTF16(
233 IDS_EXTENSION_PACKAGE_INSTALL_ERROR, 235 IDS_EXTENSION_PACKAGE_INSTALL_ERROR,
234 ASCIIToUTF16("FAILED_TO_COPY_EXTENSION_FILE_TO_TEMP_DIRECTORY"))); 236 ASCIIToUTF16("FAILED_TO_COPY_EXTENSION_FILE_TO_TEMP_DIRECTORY")));
235 return; 237 return;
236 } 238 }
237 239
238 // If we are supposed to use a subprocess, kick off the subprocess. 240 // If we are supposed to use a subprocess, kick off the subprocess.
239 // 241 //
240 // TODO(asargent) we shouldn't need to do this branch here - instead 242 // TODO(asargent) we shouldn't need to do this branch here - instead
241 // UtilityProcessHost should handle it for us. (http://crbug.com/19192) 243 // UtilityProcessHost should handle it for us. (http://crbug.com/19192)
242 bool use_utility_process = rdh_ && 244 bool use_utility_process = use_utility_process_ &&
243 !CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess); 245 !CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess);
244 if (use_utility_process) { 246 if (use_utility_process) {
245 // The utility process will have access to the directory passed to 247 // The utility process will have access to the directory passed to
246 // SandboxedExtensionUnpacker. That directory should not contain a 248 // SandboxedExtensionUnpacker. That directory should not contain a
247 // symlink or NTFS reparse point. When the path is used, following 249 // symlink or NTFS reparse point. When the path is used, following
248 // the link/reparse point will cause file system access outside the 250 // the link/reparse point will cause file system access outside the
249 // sandbox path, and the sandbox will deny the operation. 251 // sandbox path, and the sandbox will deny the operation.
250 FilePath link_free_crx_path; 252 FilePath link_free_crx_path;
251 if (!file_util::NormalizeFilePath(temp_crx_path, &link_free_crx_path)) { 253 if (!file_util::NormalizeFilePath(temp_crx_path, &link_free_crx_path)) {
252 LOG(ERROR) << "Could not get the normalized path of " 254 LOG(ERROR) << "Could not get the normalized path of "
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after
768 ERROR_SAVING_CATALOG, 770 ERROR_SAVING_CATALOG,
769 l10n_util::GetStringFUTF16( 771 l10n_util::GetStringFUTF16(
770 IDS_EXTENSION_PACKAGE_INSTALL_ERROR, 772 IDS_EXTENSION_PACKAGE_INSTALL_ERROR,
771 ASCIIToUTF16("ERROR_SAVING_CATALOG"))); 773 ASCIIToUTF16("ERROR_SAVING_CATALOG")));
772 return false; 774 return false;
773 } 775 }
774 } 776 }
775 777
776 return true; 778 return true;
777 } 779 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698