| 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 629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 640 } else { | 640 } else { |
| 641 NSString* chrome_bundle_id = [base::mac::OuterBundle() bundleIdentifier]; | 641 NSString* chrome_bundle_id = [base::mac::OuterBundle() bundleIdentifier]; |
| 642 NSArray* existing_chrome = [NSRunningApplication | 642 NSArray* existing_chrome = [NSRunningApplication |
| 643 runningApplicationsWithBundleIdentifier:chrome_bundle_id]; | 643 runningApplicationsWithBundleIdentifier:chrome_bundle_id]; |
| 644 if ([existing_chrome count] > 0) | 644 if ([existing_chrome count] > 0) |
| 645 pid = [[existing_chrome objectAtIndex:0] processIdentifier]; | 645 pid = [[existing_chrome objectAtIndex:0] processIdentifier]; |
| 646 } | 646 } |
| 647 | 647 |
| 648 AppShimController controller; | 648 AppShimController controller; |
| 649 base::MessageLoopForUI main_message_loop; | 649 base::MessageLoopForUI main_message_loop; |
| 650 main_message_loop.set_thread_name("MainThread"); | |
| 651 base::PlatformThread::SetName("CrAppShimMain"); | 650 base::PlatformThread::SetName("CrAppShimMain"); |
| 652 | 651 |
| 653 // In tests, launching Chrome does nothing, and we won't get a ping response, | 652 // In tests, launching Chrome does nothing, and we won't get a ping response, |
| 654 // so just assume the socket exists. | 653 // so just assume the socket exists. |
| 655 if (pid == -1 && | 654 if (pid == -1 && |
| 656 !base::CommandLine::ForCurrentProcess()->HasSwitch( | 655 !base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 657 app_mode::kLaunchedForTest)) { | 656 app_mode::kLaunchedForTest)) { |
| 658 // Launch Chrome if it isn't already running. | 657 // Launch Chrome if it isn't already running. |
| 659 ProcessSerialNumber psn; | 658 ProcessSerialNumber psn; |
| 660 base::CommandLine command_line(base::CommandLine::NO_PROGRAM); | 659 base::CommandLine command_line(base::CommandLine::NO_PROGRAM); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 699 // minute. | 698 // minute. |
| 700 main_message_loop.PostTask( | 699 main_message_loop.PostTask( |
| 701 FROM_HERE, | 700 FROM_HERE, |
| 702 base::Bind(&AppShimController::Init, | 701 base::Bind(&AppShimController::Init, |
| 703 base::Unretained(&controller))); | 702 base::Unretained(&controller))); |
| 704 } | 703 } |
| 705 | 704 |
| 706 main_message_loop.Run(); | 705 main_message_loop.Run(); |
| 707 return 0; | 706 return 0; |
| 708 } | 707 } |
| OLD | NEW |