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 587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
598 AppShimController controller; | 598 AppShimController controller; |
599 base::MessageLoopForUI main_message_loop; | 599 base::MessageLoopForUI main_message_loop; |
600 main_message_loop.set_thread_name("MainThread"); | 600 main_message_loop.set_thread_name("MainThread"); |
601 base::PlatformThread::SetName("CrAppShimMain"); | 601 base::PlatformThread::SetName("CrAppShimMain"); |
602 | 602 |
603 if (pid == -1) { | 603 if (pid == -1) { |
604 // Launch Chrome if it isn't already running. | 604 // Launch Chrome if it isn't already running. |
605 ProcessSerialNumber psn; | 605 ProcessSerialNumber psn; |
606 CommandLine command_line(CommandLine::NO_PROGRAM); | 606 CommandLine command_line(CommandLine::NO_PROGRAM); |
607 command_line.AppendSwitch(switches::kSilentLaunch); | 607 command_line.AppendSwitch(switches::kSilentLaunch); |
608 command_line.AppendSwitchPath(switches::kProfileDirectory, | 608 |
609 info->profile_dir); | 609 // If the shim is the app launcher, pass --show-app-list when starting a new |
| 610 // Chrome process to inform startup codepaths and load the correct profile. |
| 611 if (info->app_mode_id == app_mode::kAppListModeId) { |
| 612 command_line.AppendSwitch(switches::kShowAppList); |
| 613 } else { |
| 614 command_line.AppendSwitchPath(switches::kProfileDirectory, |
| 615 info->profile_dir); |
| 616 } |
| 617 |
610 bool success = | 618 bool success = |
611 base::mac::OpenApplicationWithPath(base::mac::OuterBundlePath(), | 619 base::mac::OpenApplicationWithPath(base::mac::OuterBundlePath(), |
612 command_line, | 620 command_line, |
613 kLSLaunchDefaults, | 621 kLSLaunchDefaults, |
614 &psn); | 622 &psn); |
615 if (!success) | 623 if (!success) |
616 return 1; | 624 return 1; |
617 | 625 |
618 base::Callback<void(bool)> on_ping_chrome_reply = | 626 base::Callback<void(bool)> on_ping_chrome_reply = |
619 base::Bind(&AppShimController::OnPingChromeReply, | 627 base::Bind(&AppShimController::OnPingChromeReply, |
(...skipping 17 matching lines...) Expand all Loading... |
637 // minute. | 645 // minute. |
638 main_message_loop.PostTask( | 646 main_message_loop.PostTask( |
639 FROM_HERE, | 647 FROM_HERE, |
640 base::Bind(&AppShimController::Init, | 648 base::Bind(&AppShimController::Init, |
641 base::Unretained(&controller))); | 649 base::Unretained(&controller))); |
642 } | 650 } |
643 | 651 |
644 main_message_loop.Run(); | 652 main_message_loop.Run(); |
645 return 0; | 653 return 0; |
646 } | 654 } |
OLD | NEW |