OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 // On Mac, one can't make shortcuts with command-line arguments. Instead, we | 5 // On Mac, one can't make shortcuts with command-line arguments. Instead, we |
6 // produce small app bundles which locate the Chromium framework and load it, | 6 // produce small app bundles which locate the Chromium framework and load it, |
7 // passing the appropriate data. This is the entry point into the framework for | 7 // passing the appropriate data. This is the entry point into the framework for |
8 // those app bundles. | 8 // those app bundles. |
9 | 9 |
10 #import <Cocoa/Cocoa.h> | 10 #import <Cocoa/Cocoa.h> |
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
382 return 1; | 382 return 1; |
383 | 383 |
384 } else { | 384 } else { |
385 CommandLine command_line(CommandLine::NO_PROGRAM); | 385 CommandLine command_line(CommandLine::NO_PROGRAM); |
386 command_line.AppendSwitch(switches::kSilentLaunch); | 386 command_line.AppendSwitch(switches::kSilentLaunch); |
387 command_line.AppendSwitchPath(switches::kProfileDirectory, | 387 command_line.AppendSwitchPath(switches::kProfileDirectory, |
388 info->profile_dir); | 388 info->profile_dir); |
389 bool success = | 389 bool success = |
390 base::mac::OpenApplicationWithPath(info->chrome_outer_bundle_path, | 390 base::mac::OpenApplicationWithPath(info->chrome_outer_bundle_path, |
391 command_line, | 391 command_line, |
| 392 kLSLaunchDefaults, |
392 &psn); | 393 &psn); |
393 if (!success) | 394 if (!success) |
394 return 1; | 395 return 1; |
395 } | 396 } |
396 | 397 |
397 // This code abuses the fact that Apple Events sent before the process is | 398 // This code abuses the fact that Apple Events sent before the process is |
398 // fully initialized don't receive a reply until its run loop starts. Once | 399 // fully initialized don't receive a reply until its run loop starts. Once |
399 // the reply is received, Chrome will have opened its IPC port, guaranteed. | 400 // the reply is received, Chrome will have opened its IPC port, guaranteed. |
400 [ReplyEventHandler pingProcess:psn andCall:base::Bind(&OnPingChromeReply)]; | 401 [ReplyEventHandler pingProcess:psn andCall:base::Bind(&OnPingChromeReply)]; |
401 | 402 |
402 base::MessageLoopForUI main_message_loop; | 403 base::MessageLoopForUI main_message_loop; |
403 main_message_loop.set_thread_name("MainThread"); | 404 main_message_loop.set_thread_name("MainThread"); |
404 base::PlatformThread::SetName("CrAppShimMain"); | 405 base::PlatformThread::SetName("CrAppShimMain"); |
405 main_message_loop.Run(); | 406 main_message_loop.Run(); |
406 return 0; | 407 return 0; |
407 } | 408 } |
OLD | NEW |