OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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, shortcuts can't have command-line arguments. Instead, produce small | 5 // On Mac, shortcuts can't have command-line arguments. Instead, produce small |
6 // app bundles which locate the Chromium framework and load it, passing the | 6 // app bundles which locate the Chromium framework and load it, passing the |
7 // appropriate data. This is the code for such an app bundle. It should be kept | 7 // appropriate data. This is the code for such an app bundle. It should be kept |
8 // minimal and do as little work as possible (with as much work done on | 8 // minimal and do as little work as possible (with as much work done on |
9 // framework side as possible). | 9 // framework side as possible). |
10 | 10 |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
85 info->app_mode_id = SysNSStringToUTF8( | 85 info->app_mode_id = SysNSStringToUTF8( |
86 [info_plist objectForKey:app_mode::kCrAppModeShortcutIDKey]); | 86 [info_plist objectForKey:app_mode::kCrAppModeShortcutIDKey]); |
87 CHECK(info->app_mode_id.size()) << "couldn't get app shortcut ID"; | 87 CHECK(info->app_mode_id.size()) << "couldn't get app shortcut ID"; |
88 | 88 |
89 info->app_mode_name = SysNSStringToUTF16( | 89 info->app_mode_name = SysNSStringToUTF16( |
90 [info_plist objectForKey:app_mode::kCrAppModeShortcutNameKey]); | 90 [info_plist objectForKey:app_mode::kCrAppModeShortcutNameKey]); |
91 | 91 |
92 info->app_mode_url = SysNSStringToUTF8( | 92 info->app_mode_url = SysNSStringToUTF8( |
93 [info_plist objectForKey:app_mode::kCrAppModeShortcutURLKey]); | 93 [info_plist objectForKey:app_mode::kCrAppModeShortcutURLKey]); |
94 | 94 |
95 info->user_data_dir = base::mac::NSStringToFilePath( | |
jeremy
2012/02/23 13:30:54
What makes this a "user data dir" rather than just
sail
2012/02/23 18:31:17
Done.
user_data_dir is the correct name. I change
| |
96 [info_plist objectForKey:app_mode::kCrAppModeUserDataDirKey]); | |
97 | |
95 // Open the framework. | 98 // Open the framework. |
96 *cr_dylib = dlopen(framework_shlib_path.value().c_str(), RTLD_LAZY); | 99 *cr_dylib = dlopen(framework_shlib_path.value().c_str(), RTLD_LAZY); |
97 CHECK(cr_dylib) << "couldn't load framework: " << dlerror(); | 100 CHECK(cr_dylib) << "couldn't load framework: " << dlerror(); |
98 } | 101 } |
99 | 102 |
100 } // namespace | 103 } // namespace |
101 | 104 |
102 __attribute__((visibility("default"))) | 105 __attribute__((visibility("default"))) |
103 int main(int argc, char** argv) { | 106 int main(int argc, char** argv) { |
104 app_mode::ChromeAppModeInfo info; | 107 app_mode::ChromeAppModeInfo info; |
(...skipping 10 matching lines...) Expand all Loading... | |
115 | 118 |
116 typedef int (*StartFun)(const app_mode::ChromeAppModeInfo*); | 119 typedef int (*StartFun)(const app_mode::ChromeAppModeInfo*); |
117 StartFun ChromeAppModeStart = (StartFun)dlsym(cr_dylib, "ChromeAppModeStart"); | 120 StartFun ChromeAppModeStart = (StartFun)dlsym(cr_dylib, "ChromeAppModeStart"); |
118 CHECK(ChromeAppModeStart) << "couldn't get entry point"; | 121 CHECK(ChromeAppModeStart) << "couldn't get entry point"; |
119 | 122 |
120 // Exit instead of returning to avoid the the removal of |main()| from stack | 123 // Exit instead of returning to avoid the the removal of |main()| from stack |
121 // backtraces under tail call optimization. | 124 // backtraces under tail call optimization. |
122 int rv = ChromeAppModeStart(&info); | 125 int rv = ChromeAppModeStart(&info); |
123 exit(rv); | 126 exit(rv); |
124 } | 127 } |
OLD | NEW |