| 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 668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 679 base::Callback<void(bool)> on_ping_chrome_reply = | 679 base::Callback<void(bool)> on_ping_chrome_reply = |
| 680 base::Bind(&AppShimController::OnPingChromeReply, | 680 base::Bind(&AppShimController::OnPingChromeReply, |
| 681 base::Unretained(&controller)); | 681 base::Unretained(&controller)); |
| 682 | 682 |
| 683 // This code abuses the fact that Apple Events sent before the process is | 683 // This code abuses the fact that Apple Events sent before the process is |
| 684 // fully initialized don't receive a reply until its run loop starts. Once | 684 // fully initialized don't receive a reply until its run loop starts. Once |
| 685 // the reply is received, Chrome will have opened its IPC port, guaranteed. | 685 // the reply is received, Chrome will have opened its IPC port, guaranteed. |
| 686 [ReplyEventHandler pingProcess:psn | 686 [ReplyEventHandler pingProcess:psn |
| 687 andCall:on_ping_chrome_reply]; | 687 andCall:on_ping_chrome_reply]; |
| 688 | 688 |
| 689 main_message_loop.PostDelayedTask( | 689 main_message_loop.task_runner()->PostDelayedTask( |
| 690 FROM_HERE, | 690 FROM_HERE, base::Bind(&AppShimController::OnPingChromeTimeout, |
| 691 base::Bind(&AppShimController::OnPingChromeTimeout, | 691 base::Unretained(&controller)), |
| 692 base::Unretained(&controller)), | |
| 693 base::TimeDelta::FromSeconds(kPingChromeTimeoutSeconds)); | 692 base::TimeDelta::FromSeconds(kPingChromeTimeoutSeconds)); |
| 694 } else { | 693 } else { |
| 695 // Chrome already running. Proceed to init. This could still fail if Chrome | 694 // Chrome already running. Proceed to init. This could still fail if Chrome |
| 696 // is still starting up or shutting down, but the process will exit quickly, | 695 // is still starting up or shutting down, but the process will exit quickly, |
| 697 // which is preferable to waiting for the Apple Event to timeout after one | 696 // which is preferable to waiting for the Apple Event to timeout after one |
| 698 // minute. | 697 // minute. |
| 699 main_message_loop.PostTask( | 698 main_message_loop.task_runner()->PostTask( |
| 700 FROM_HERE, | 699 FROM_HERE, |
| 701 base::Bind(&AppShimController::Init, | 700 base::Bind(&AppShimController::Init, base::Unretained(&controller))); |
| 702 base::Unretained(&controller))); | |
| 703 } | 701 } |
| 704 | 702 |
| 705 main_message_loop.Run(); | 703 main_message_loop.Run(); |
| 706 return 0; | 704 return 0; |
| 707 } | 705 } |
| OLD | NEW |