| 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 if (!found_bundle) { | 56 if (!found_bundle) { |
| 57 // If no such bundle path exists, try to search by bundle ID. | 57 // If no such bundle path exists, try to search by bundle ID. |
| 58 if (!app_mode::FindBundleById(cr_bundle_id, &cr_bundle_path)) { | 58 if (!app_mode::FindBundleById(cr_bundle_id, &cr_bundle_path)) { |
| 59 // TODO(jeremy): Display UI to allow user to manually locate the Chrome | 59 // TODO(jeremy): Display UI to allow user to manually locate the Chrome |
| 60 // bundle. | 60 // bundle. |
| 61 LOG(FATAL) << "Failed to locate bundle by identifier"; | 61 LOG(FATAL) << "Failed to locate bundle by identifier"; |
| 62 } | 62 } |
| 63 } | 63 } |
| 64 | 64 |
| 65 // ** 2: Read information from the Chrome bundle. | 65 // ** 2: Read information from the Chrome bundle. |
| 66 string16 raw_version_str; | 66 base::string16 raw_version_str; |
| 67 base::FilePath version_path; | 67 base::FilePath version_path; |
| 68 base::FilePath framework_shlib_path; | 68 base::FilePath framework_shlib_path; |
| 69 if (!app_mode::GetChromeBundleInfo(cr_bundle_path, &raw_version_str, | 69 if (!app_mode::GetChromeBundleInfo(cr_bundle_path, &raw_version_str, |
| 70 &version_path, &framework_shlib_path)) { | 70 &version_path, &framework_shlib_path)) { |
| 71 LOG(FATAL) << "Couldn't ready Chrome bundle info"; | 71 LOG(FATAL) << "Couldn't ready Chrome bundle info"; |
| 72 } | 72 } |
| 73 | 73 |
| 74 // ** 3: Fill in ChromeAppModeInfo. | 74 // ** 3: Fill in ChromeAppModeInfo. |
| 75 info->chrome_outer_bundle_path = cr_bundle_path; | 75 info->chrome_outer_bundle_path = cr_bundle_path; |
| 76 info->chrome_versioned_path = version_path; | 76 info->chrome_versioned_path = version_path; |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 | 121 |
| 122 typedef int (*StartFun)(const app_mode::ChromeAppModeInfo*); | 122 typedef int (*StartFun)(const app_mode::ChromeAppModeInfo*); |
| 123 StartFun ChromeAppModeStart = (StartFun)dlsym(cr_dylib, "ChromeAppModeStart"); | 123 StartFun ChromeAppModeStart = (StartFun)dlsym(cr_dylib, "ChromeAppModeStart"); |
| 124 CHECK(ChromeAppModeStart) << "couldn't get entry point"; | 124 CHECK(ChromeAppModeStart) << "couldn't get entry point"; |
| 125 | 125 |
| 126 // 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 |
| 127 // backtraces under tail call optimization. | 127 // backtraces under tail call optimization. |
| 128 int rv = ChromeAppModeStart(&info); | 128 int rv = ChromeAppModeStart(&info); |
| 129 exit(rv); | 129 exit(rv); |
| 130 } | 130 } |
| OLD | NEW |