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, 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 #include <string> // TODO(viettrungluu): only needed for temporary hack | |
11 | |
12 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
13 #include "base/command_line.h" | 11 #include "base/command_line.h" |
14 #include "base/file_path.h" | 12 #include "base/file_path.h" |
15 #include "base/logging.h" | 13 #include "base/logging.h" |
16 #include "base/mac/bundle_locations.h" | 14 #include "base/mac/bundle_locations.h" |
17 #include "chrome/common/chrome_constants.h" | 15 #include "chrome/common/chrome_constants.h" |
18 #include "chrome/common/chrome_paths_internal.h" | 16 #include "chrome/common/chrome_paths_internal.h" |
19 #include "chrome/common/chrome_switches.h" | 17 #include "chrome/common/chrome_switches.h" |
20 #include "chrome/common/mac/app_mode_common.h" | 18 #include "chrome/common/mac/app_mode_common.h" |
21 | 19 |
(...skipping 20 matching lines...) Expand all Loading... |
42 } | 40 } |
43 | 41 |
44 RAW_CHECK(!info->chrome_versioned_path.empty()); | 42 RAW_CHECK(!info->chrome_versioned_path.empty()); |
45 FilePath* chrome_versioned_path = new FilePath(info->chrome_versioned_path); | 43 FilePath* chrome_versioned_path = new FilePath(info->chrome_versioned_path); |
46 RAW_CHECK(!chrome_versioned_path->empty()); | 44 RAW_CHECK(!chrome_versioned_path->empty()); |
47 chrome::SetOverrideVersionedDirectory(chrome_versioned_path); | 45 chrome::SetOverrideVersionedDirectory(chrome_versioned_path); |
48 base::mac::SetOverrideOuterBundlePath(info->chrome_outer_bundle_path); | 46 base::mac::SetOverrideOuterBundlePath(info->chrome_outer_bundle_path); |
49 base::mac::SetOverrideFrameworkBundlePath( | 47 base::mac::SetOverrideFrameworkBundlePath( |
50 chrome_versioned_path->Append(chrome::kFrameworkName)); | 48 chrome_versioned_path->Append(chrome::kFrameworkName)); |
51 | 49 |
| 50 app_mode::SetAppModeInfo(info); |
| 51 |
52 CommandLine command_line(CommandLine::NO_PROGRAM); | 52 CommandLine command_line(CommandLine::NO_PROGRAM); |
53 command_line.AppendSwitch(info->argv[0]); | 53 command_line.AppendSwitch(info->argv[0]); |
54 | 54 |
55 RAW_CHECK(info->app_mode_id.size()); | 55 RAW_CHECK(info->app_mode_id.size()); |
56 command_line.AppendSwitchASCII(switches::kAppId, info->app_mode_id); | 56 command_line.AppendSwitchASCII(switches::kAppId, info->app_mode_id); |
57 command_line.AppendSwitchPath(switches::kUserDataDir, info->user_data_dir); | 57 command_line.AppendSwitchPath(switches::kUserDataDir, info->user_data_dir); |
58 // TODO(sail): Use a different flag that doesn't imply Location::LOAD for the | 58 // TODO(sail): Use a different flag that doesn't imply Location::LOAD for the |
59 // extension. | 59 // extension. |
60 command_line.AppendSwitchPath(switches::kLoadExtension, info->extension_path); | 60 command_line.AppendSwitchPath(switches::kLoadExtension, info->extension_path); |
61 | 61 |
62 int argc = command_line.argv().size(); | 62 int argc = command_line.argv().size(); |
63 char* argv[argc]; | 63 char* argv[argc]; |
64 for (int i = 0; i < argc; ++i) | 64 for (int i = 0; i < argc; ++i) |
65 argv[i] = const_cast<char*>(command_line.argv()[i].c_str()); | 65 argv[i] = const_cast<char*>(command_line.argv()[i].c_str()); |
66 | 66 |
67 return ChromeMain(argc, argv); | 67 return ChromeMain(argc, argv); |
68 } | 68 } |
OLD | NEW |