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> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "apps/app_shim/app_shim_messages.h" | 13 #include "apps/app_shim/app_shim_messages.h" |
14 #include "base/at_exit.h" | 14 #include "base/at_exit.h" |
15 #include "base/command_line.h" | 15 #include "base/command_line.h" |
16 #include "base/files/file_path.h" | 16 #include "base/files/file_path.h" |
17 #include "base/file_util.h" | 17 #include "base/file_util.h" |
18 #include "base/logging.h" | 18 #include "base/logging.h" |
19 #include "base/mac/bundle_locations.h" | 19 #include "base/mac/bundle_locations.h" |
20 #include "base/mac/foundation_util.h" | 20 #include "base/mac/foundation_util.h" |
21 #include "base/mac/launch_services_util.h" | 21 #include "base/mac/launch_services_util.h" |
22 #include "base/mac/mac_logging.h" | 22 #include "base/mac/mac_logging.h" |
23 #include "base/mac/mac_util.h" | 23 #include "base/mac/mac_util.h" |
24 #include "base/mac/scoped_nsautorelease_pool.h" | 24 #include "base/mac/scoped_nsautorelease_pool.h" |
25 #include "base/mac/scoped_nsobject.h" | 25 #include "base/mac/scoped_nsobject.h" |
| 26 #include "base/mac/sdk_forward_declarations.h" |
26 #include "base/message_loop/message_loop.h" | 27 #include "base/message_loop/message_loop.h" |
27 #include "base/path_service.h" | 28 #include "base/path_service.h" |
28 #include "base/strings/string_number_conversions.h" | 29 #include "base/strings/string_number_conversions.h" |
29 #include "base/strings/sys_string_conversions.h" | 30 #include "base/strings/sys_string_conversions.h" |
30 #include "base/threading/thread.h" | 31 #include "base/threading/thread.h" |
31 #include "chrome/common/chrome_constants.h" | 32 #include "chrome/common/chrome_constants.h" |
32 #include "chrome/common/chrome_paths.h" | 33 #include "chrome/common/chrome_paths.h" |
33 #include "chrome/common/chrome_switches.h" | 34 #include "chrome/common/chrome_switches.h" |
34 #include "chrome/common/mac/app_mode_common.h" | 35 #include "chrome/common/mac/app_mode_common.h" |
35 #include "grit/generated_resources.h" | 36 #include "grit/generated_resources.h" |
36 #include "ipc/ipc_channel_proxy.h" | 37 #include "ipc/ipc_channel_proxy.h" |
37 #include "ipc/ipc_listener.h" | 38 #include "ipc/ipc_listener.h" |
38 #include "ipc/ipc_message.h" | 39 #include "ipc/ipc_message.h" |
39 #include "ui/base/resource/resource_bundle.h" | 40 #include "ui/base/resource/resource_bundle.h" |
40 #include "ui/base/l10n/l10n_util.h" | 41 #include "ui/base/l10n/l10n_util.h" |
41 | 42 |
42 // Replicate specific 10.7 SDK declarations for building with prior SDKs. | |
43 #if !defined(MAC_OS_X_VERSION_10_7) || \ | |
44 MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7 | |
45 | |
46 @interface NSApplication (LionSDKDeclarations) | |
47 - (void)disableRelaunchOnLogin; | |
48 @end | |
49 | |
50 #endif // MAC_OS_X_VERSION_10_7 | |
51 | |
52 namespace { | 43 namespace { |
53 | 44 |
54 // Timeout in seconds to wait for a reply for the initial Apple Event. Note that | 45 // Timeout in seconds to wait for a reply for the initial Apple Event. Note that |
55 // kAEDefaultTimeout on Mac is "about one minute" according to Apple's | 46 // kAEDefaultTimeout on Mac is "about one minute" according to Apple's |
56 // documentation, but is no longer supported for asynchronous Apple Events. | 47 // documentation, but is no longer supported for asynchronous Apple Events. |
57 const int kPingChromeTimeoutSeconds = 60; | 48 const int kPingChromeTimeoutSeconds = 60; |
58 | 49 |
59 const app_mode::ChromeAppModeInfo* g_info; | 50 const app_mode::ChromeAppModeInfo* g_info; |
60 base::Thread* g_io_thread = NULL; | 51 base::Thread* g_io_thread = NULL; |
61 | 52 |
(...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
665 // minute. | 656 // minute. |
666 main_message_loop.PostTask( | 657 main_message_loop.PostTask( |
667 FROM_HERE, | 658 FROM_HERE, |
668 base::Bind(&AppShimController::Init, | 659 base::Bind(&AppShimController::Init, |
669 base::Unretained(&controller))); | 660 base::Unretained(&controller))); |
670 } | 661 } |
671 | 662 |
672 main_message_loop.Run(); | 663 main_message_loop.Run(); |
673 return 0; | 664 return 0; |
674 } | 665 } |
OLD | NEW |