Chromium Code Reviews| 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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 133 if (CommandLine::ForCurrentProcess()->HasSwitch( | 133 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 134 app_mode::kLaunchedByChromeProcessId) || | 134 app_mode::kLaunchedByChromeProcessId) || |
| 135 info->app_mode_id == app_mode::kAppListModeId) { | 135 info->app_mode_id == app_mode::kAppListModeId) { |
| 136 // Pass --app-shim-error to have Chrome rebuild this shim. | 136 // Pass --app-shim-error to have Chrome rebuild this shim. |
| 137 // If Chrome has rebuilt this shim once already, then rebuilding doesn't fix | 137 // If Chrome has rebuilt this shim once already, then rebuilding doesn't fix |
| 138 // the problem, so don't try again. | 138 // the problem, so don't try again. |
| 139 if (!CommandLine::ForCurrentProcess()->HasSwitch( | 139 if (!CommandLine::ForCurrentProcess()->HasSwitch( |
| 140 app_mode::kLaunchedAfterRebuild)) { | 140 app_mode::kLaunchedAfterRebuild)) { |
| 141 command_line.AppendSwitchPath(app_mode::kAppShimError, | 141 command_line.AppendSwitchPath(app_mode::kAppShimError, |
| 142 app_mode_bundle_path); | 142 app_mode_bundle_path); |
| 143 #if defined(ARCH_CPU_32_BITS) | |
|
tapted
2014/06/26 06:47:05
I have a hunch this will never be false again on m
jackhou1
2014/06/27 04:55:56
I don't think it hurts to differentiate this. If i
| |
| 144 command_line.AppendSwitchASCII(app_mode::kAppShimErrorDetail, | |
| 145 app_mode::kAppShimErrorDetail32Bit); | |
| 146 #elif defined(ARCH_CPU_64_BITS) | |
| 147 command_line.AppendSwitchASCII(app_mode::kAppShimErrorDetail, | |
| 148 app_mode::kAppShimErrorDetail64Bit); | |
| 149 #endif | |
| 143 } | 150 } |
| 144 } else { | 151 } else { |
| 145 // If the shim was launched directly (instead of by Chrome), first ask | 152 // If the shim was launched directly (instead of by Chrome), first ask |
| 146 // Chrome to launch the app. Chrome will launch the shim again, the same | 153 // Chrome to launch the app. Chrome will launch the shim again, the same |
| 147 // error will occur and be handled above. This approach allows the app to be | 154 // error will occur and be handled above. This approach allows the app to be |
| 148 // started without blocking on fixing the shim and guarantees that the | 155 // started without blocking on fixing the shim and guarantees that the |
| 149 // profile is loaded when Chrome receives --app-shim-error. | 156 // profile is loaded when Chrome receives --app-shim-error. |
| 150 command_line.AppendSwitchPath(switches::kProfileDirectory, | 157 command_line.AppendSwitchPath(switches::kProfileDirectory, |
| 151 info->profile_dir); | 158 info->profile_dir); |
| 152 command_line.AppendSwitchASCII(switches::kAppId, info->app_mode_id); | 159 command_line.AppendSwitchASCII(switches::kAppId, info->app_mode_id); |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 173 // Hard coded info parameters. | 180 // Hard coded info parameters. |
| 174 info.major_version = app_mode::kCurrentChromeAppModeInfoMajorVersion; | 181 info.major_version = app_mode::kCurrentChromeAppModeInfoMajorVersion; |
| 175 info.minor_version = app_mode::kCurrentChromeAppModeInfoMinorVersion; | 182 info.minor_version = app_mode::kCurrentChromeAppModeInfoMinorVersion; |
| 176 info.argc = argc; | 183 info.argc = argc; |
| 177 info.argv = argv; | 184 info.argv = argv; |
| 178 | 185 |
| 179 // Exit instead of returning to avoid the the removal of |main()| from stack | 186 // Exit instead of returning to avoid the the removal of |main()| from stack |
| 180 // backtraces under tail call optimization. | 187 // backtraces under tail call optimization. |
| 181 exit(LoadFrameworkAndStart(&info)); | 188 exit(LoadFrameworkAndStart(&info)); |
| 182 } | 189 } |
| OLD | NEW |