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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 info->app_mode_short_name = SysNSStringToUTF16( | 88 info->app_mode_short_name = SysNSStringToUTF16( |
89 [info_plist objectForKey:app_mode::kCrAppModeShortcutShortNameKey]); | 89 [info_plist objectForKey:app_mode::kCrAppModeShortcutShortNameKey]); |
90 | 90 |
91 info->app_mode_name = SysNSStringToUTF16( | 91 info->app_mode_name = SysNSStringToUTF16( |
92 [info_plist objectForKey:app_mode::kCrAppModeShortcutNameKey]); | 92 [info_plist objectForKey:app_mode::kCrAppModeShortcutNameKey]); |
93 | 93 |
94 info->app_mode_url = SysNSStringToUTF8( | 94 info->app_mode_url = SysNSStringToUTF8( |
95 [info_plist objectForKey:app_mode::kCrAppModeShortcutURLKey]); | 95 [info_plist objectForKey:app_mode::kCrAppModeShortcutURLKey]); |
96 CHECK(info->app_mode_url.size()) << "couldn't get app shortcut URL"; | 96 CHECK(info->app_mode_url.size()) << "couldn't get app shortcut URL"; |
97 | 97 |
| 98 info->user_data_dir = base::mac::NSStringToFilePath( |
| 99 [info_plist objectForKey:app_mode::kCrAppModeUserDataDirKey]); |
| 100 |
98 // Open the framework. | 101 // Open the framework. |
99 *cr_dylib = dlopen(framework_shlib_path.value().c_str(), RTLD_LAZY); | 102 *cr_dylib = dlopen(framework_shlib_path.value().c_str(), RTLD_LAZY); |
100 CHECK(cr_dylib) << "couldn't load framework: " << dlerror(); | 103 CHECK(cr_dylib) << "couldn't load framework: " << dlerror(); |
101 } | 104 } |
102 | 105 |
103 } // namespace | 106 } // namespace |
104 | 107 |
105 __attribute__((visibility("default"))) | 108 __attribute__((visibility("default"))) |
106 int main(int argc, char** argv) { | 109 int main(int argc, char** argv) { |
107 app_mode::ChromeAppModeInfo info; | 110 app_mode::ChromeAppModeInfo info; |
(...skipping 10 matching lines...) Expand all Loading... |
118 | 121 |
119 typedef int (*StartFun)(const app_mode::ChromeAppModeInfo*); | 122 typedef int (*StartFun)(const app_mode::ChromeAppModeInfo*); |
120 StartFun ChromeAppModeStart = (StartFun)dlsym(cr_dylib, "ChromeAppModeStart"); | 123 StartFun ChromeAppModeStart = (StartFun)dlsym(cr_dylib, "ChromeAppModeStart"); |
121 CHECK(ChromeAppModeStart) << "couldn't get entry point"; | 124 CHECK(ChromeAppModeStart) << "couldn't get entry point"; |
122 | 125 |
123 // Exit instead of returning to avoid the the removal of |main()| from stack | 126 // Exit instead of returning to avoid the the removal of |main()| from stack |
124 // backtraces under tail call optimization. | 127 // backtraces under tail call optimization. |
125 int rv = ChromeAppModeStart(&info); | 128 int rv = ChromeAppModeStart(&info); |
126 exit(rv); | 129 exit(rv); |
127 } | 130 } |
OLD | NEW |