OLD | NEW |
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/mac/relauncher.h" | 5 #include "chrome/browser/mac/relauncher.h" |
6 | 6 |
7 #include <ApplicationServices/ApplicationServices.h> | 7 #include <ApplicationServices/ApplicationServices.h> |
8 #include <AvailabilityMacros.h> | 8 #include <AvailabilityMacros.h> |
9 #include <dlfcn.h> | 9 #include <dlfcn.h> |
10 #include <string.h> | 10 #include <string.h> |
(...skipping 10 matching lines...) Expand all Loading... |
21 #include "base/file_util.h" | 21 #include "base/file_util.h" |
22 #include "base/logging.h" | 22 #include "base/logging.h" |
23 #include "base/mac/mac_util.h" | 23 #include "base/mac/mac_util.h" |
24 #include "base/mac/scoped_cftyperef.h" | 24 #include "base/mac/scoped_cftyperef.h" |
25 #include "base/path_service.h" | 25 #include "base/path_service.h" |
26 #include "base/process_util.h" | 26 #include "base/process_util.h" |
27 #include "base/stringprintf.h" | 27 #include "base/stringprintf.h" |
28 #include "base/sys_string_conversions.h" | 28 #include "base/sys_string_conversions.h" |
29 #include "chrome/browser/mac/install_from_dmg.h" | 29 #include "chrome/browser/mac/install_from_dmg.h" |
30 #include "chrome/common/chrome_switches.h" | 30 #include "chrome/common/chrome_switches.h" |
31 #include "content/common/main_function_params.h" | |
32 #include "content/public/common/content_paths.h" | 31 #include "content/public/common/content_paths.h" |
33 #include "content/public/common/content_switches.h" | 32 #include "content/public/common/content_switches.h" |
| 33 #include "content/public/common/main_function_params.h" |
34 | 34 |
35 // RTLD_MAIN_ONLY is supported as of Mac OS X 10.5, but <dlfcn.h> does not | 35 // RTLD_MAIN_ONLY is supported as of Mac OS X 10.5, but <dlfcn.h> does not |
36 // define it in the 10.5 SDK. It is present in the 10.6 SDK and is documented | 36 // define it in the 10.5 SDK. It is present in the 10.6 SDK and is documented |
37 // as working on 10.5 and later. The source code for the version of dyld that | 37 // as working on 10.5 and later. The source code for the version of dyld that |
38 // shipped in 10.5, dyld-95.3/src/dyldAPIs.cpp, confirms that this feature is | 38 // shipped in 10.5, dyld-95.3/src/dyldAPIs.cpp, confirms that this feature is |
39 // supported. Provide a fallback definition here. | 39 // supported. Provide a fallback definition here. |
40 #if MAC_OS_X_VERSION_MAX_ALLOWED == MAC_OS_X_VERSION_10_5 // 10.5 SDK | 40 #if MAC_OS_X_VERSION_MAX_ALLOWED == MAC_OS_X_VERSION_10_5 // 10.5 SDK |
41 #define RTLD_MAIN_ONLY ((void*)-5) // Search main executable only. | 41 #define RTLD_MAIN_ONLY ((void*)-5) // Search main executable only. |
42 #endif | 42 #endif |
43 | 43 |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 LOG(ERROR) << "kevent (monitor): unexpected event, filter " << event.filter | 248 LOG(ERROR) << "kevent (monitor): unexpected event, filter " << event.filter |
249 << ", fflags " << event.fflags << ", ident " << event.ident; | 249 << ", fflags " << event.fflags << ", ident " << event.ident; |
250 return; | 250 return; |
251 } | 251 } |
252 } | 252 } |
253 | 253 |
254 } // namespace | 254 } // namespace |
255 | 255 |
256 namespace internal { | 256 namespace internal { |
257 | 257 |
258 int RelauncherMain(const MainFunctionParams& main_parameters) { | 258 int RelauncherMain(const content::MainFunctionParams& main_parameters) { |
259 // CommandLine rearranges the order of the arguments returned by | 259 // CommandLine rearranges the order of the arguments returned by |
260 // main_parameters.argv(), rendering it impossible to determine which | 260 // main_parameters.argv(), rendering it impossible to determine which |
261 // arguments originally came before kRelauncherArgSeparator and which came | 261 // arguments originally came before kRelauncherArgSeparator and which came |
262 // after. It's crucial to distinguish between these because only those | 262 // after. It's crucial to distinguish between these because only those |
263 // after the separator should be given to the relaunched process; it's also | 263 // after the separator should be given to the relaunched process; it's also |
264 // important to not treat the path to the relaunched process as a "loose" | 264 // important to not treat the path to the relaunched process as a "loose" |
265 // argument. NXArgc and NXArgv are pointers to the original argc and argv as | 265 // argument. NXArgc and NXArgv are pointers to the original argc and argv as |
266 // passed to main(), so use those. The typical mechanism to do this is to | 266 // passed to main(), so use those. The typical mechanism to do this is to |
267 // provide "extern" declarations to access these, but they're only present | 267 // provide "extern" declarations to access these, but they're only present |
268 // in the crt1.o start file. This function will be linked into the framework | 268 // in the crt1.o start file. This function will be linked into the framework |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
381 if (!dmg_bsd_device_name.empty()) { | 381 if (!dmg_bsd_device_name.empty()) { |
382 EjectAndTrashDiskImage(dmg_bsd_device_name); | 382 EjectAndTrashDiskImage(dmg_bsd_device_name); |
383 } | 383 } |
384 | 384 |
385 return 0; | 385 return 0; |
386 } | 386 } |
387 | 387 |
388 } // namespace internal | 388 } // namespace internal |
389 | 389 |
390 } // namespace mac_relauncher | 390 } // namespace mac_relauncher |
OLD | NEW |