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 (info->app_mode_id == app_mode::kAppListModeId) { |
610 command_line.AppendSwitch(switches::kShowAppList); | |
Nico
2014/01/14 02:06:34
I didn't get why this is needed.
tapted
2014/01/14 04:02:28
Added a comment. This is the "Chrome not running"
| |
611 } else { | |
612 command_line.AppendSwitchPath(switches::kProfileDirectory, | |
613 info->profile_dir); | |
614 } | |
615 | |
610 bool success = | 616 bool success = |
611 base::mac::OpenApplicationWithPath(base::mac::OuterBundlePath(), | 617 base::mac::OpenApplicationWithPath(base::mac::OuterBundlePath(), |
612 command_line, | 618 command_line, |
613 kLSLaunchDefaults, | 619 kLSLaunchDefaults, |
614 &psn); | 620 &psn); |
615 if (!success) | 621 if (!success) |
616 return 1; | 622 return 1; |
617 | 623 |
618 base::Callback<void(bool)> on_ping_chrome_reply = | 624 base::Callback<void(bool)> on_ping_chrome_reply = |
619 base::Bind(&AppShimController::OnPingChromeReply, | 625 base::Bind(&AppShimController::OnPingChromeReply, |
(...skipping 17 matching lines...) Expand all Loading... | |
637 // minute. | 643 // minute. |
638 main_message_loop.PostTask( | 644 main_message_loop.PostTask( |
639 FROM_HERE, | 645 FROM_HERE, |
640 base::Bind(&AppShimController::Init, | 646 base::Bind(&AppShimController::Init, |
641 base::Unretained(&controller))); | 647 base::Unretained(&controller))); |
642 } | 648 } |
643 | 649 |
644 main_message_loop.Run(); | 650 main_message_loop.Run(); |
645 return 0; | 651 return 0; |
646 } | 652 } |
OLD | NEW |