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

Side by Side Diff: chrome/browser/utility_process_host.cc

Issue 2001013: Use realpath() to find the path to the extension unpack dir on posix systems. (Closed)
Patch Set: 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
« base/file_util_posix.cc ('K') | « base/file_util_unittest.cc ('k') | no next file » | 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/utility_process_host.h" 5 #include "chrome/browser/utility_process_host.h"
6 6
7 #include "app/app_switches.h" 7 #include "app/app_switches.h"
8 #include "app/l10n_util.h" 8 #include "app/l10n_util.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
11 #include "base/message_loop.h" 11 #include "base/message_loop.h"
12 #include "chrome/browser/browser_process.h" 12 #include "chrome/browser/browser_process.h"
13 #include "chrome/common/chrome_switches.h" 13 #include "chrome/common/chrome_switches.h"
14 #include "chrome/common/utility_messages.h" 14 #include "chrome/common/utility_messages.h"
15 #include "ipc/ipc_switches.h" 15 #include "ipc/ipc_switches.h"
16 16
17 UtilityProcessHost::UtilityProcessHost(ResourceDispatcherHost* rdh, 17 UtilityProcessHost::UtilityProcessHost(ResourceDispatcherHost* rdh,
18 Client* client, 18 Client* client,
19 ChromeThread::ID client_thread_id) 19 ChromeThread::ID client_thread_id)
20 : ChildProcessHost(UTILITY_PROCESS, rdh), 20 : ChildProcessHost(UTILITY_PROCESS, rdh),
21 client_(client), 21 client_(client),
22 client_thread_id_(client_thread_id) { 22 client_thread_id_(client_thread_id) {
23 } 23 }
24 24
25 UtilityProcessHost::~UtilityProcessHost() { 25 UtilityProcessHost::~UtilityProcessHost() {
26 } 26 }
27 27
28 bool UtilityProcessHost::StartExtensionUnpacker(const FilePath& extension) { 28 bool UtilityProcessHost::StartExtensionUnpacker(const FilePath& extension) {
29 FilePath initial_path = extension.DirName();
30 FilePath real_path;
31
32 #if defined(OS_POSIX)
33 if (!file_util::RealPath(initial_path, &real_path)) {
34 real_path = initial_path;
35 }
36 #else
37 // TODO(skerner): For windows, we need to expand NTFS junctions.
38 // http://crbug.com/13044
39 real_path = initial_path;
40 #endif
41
42 // TODO(skerner): Remove this logging once we understand crbug.com/35198
43 LOG(INFO) << "initial_path: " << initial_path.value();
44 LOG(INFO) << "real_path: " << real_path.value();
45
29 // Grant the subprocess access to the entire subdir the extension file is 46 // Grant the subprocess access to the entire subdir the extension file is
30 // in, so that it can unpack to that dir. 47 // in, so that it can unpack to that dir.
31 if (!StartProcess(extension.DirName())) 48 if (!StartProcess(real_path))
32 return false; 49 return false;
33 50
34 Send(new UtilityMsg_UnpackExtension(extension)); 51 Send(new UtilityMsg_UnpackExtension(extension));
35 return true; 52 return true;
36 } 53 }
37 54
38 bool UtilityProcessHost::StartWebResourceUnpacker(const std::string& data) { 55 bool UtilityProcessHost::StartWebResourceUnpacker(const std::string& data) {
39 if (!StartProcess(FilePath())) 56 if (!StartProcess(FilePath()))
40 return false; 57 return false;
41 58
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 IPC_MESSAGE_HANDLER(UtilityHostMsg_ParseUpdateManifest_Succeeded, 171 IPC_MESSAGE_HANDLER(UtilityHostMsg_ParseUpdateManifest_Succeeded,
155 Client::OnParseUpdateManifestSucceeded) 172 Client::OnParseUpdateManifestSucceeded)
156 IPC_MESSAGE_HANDLER(UtilityHostMsg_ParseUpdateManifest_Failed, 173 IPC_MESSAGE_HANDLER(UtilityHostMsg_ParseUpdateManifest_Failed,
157 Client::OnParseUpdateManifestFailed) 174 Client::OnParseUpdateManifestFailed)
158 IPC_MESSAGE_HANDLER(UtilityHostMsg_DecodeImage_Succeeded, 175 IPC_MESSAGE_HANDLER(UtilityHostMsg_DecodeImage_Succeeded,
159 Client::OnDecodeImageSucceeded) 176 Client::OnDecodeImageSucceeded)
160 IPC_MESSAGE_HANDLER(UtilityHostMsg_DecodeImage_Failed, 177 IPC_MESSAGE_HANDLER(UtilityHostMsg_DecodeImage_Failed,
161 Client::OnDecodeImageFailed) 178 Client::OnDecodeImageFailed)
162 IPC_END_MESSAGE_MAP_EX() 179 IPC_END_MESSAGE_MAP_EX()
163 } 180 }
OLDNEW
« base/file_util_posix.cc ('K') | « base/file_util_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698