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 | 10 #include <string> // TODO(viettrungluu): only needed for temporary hack |
11 | 11 |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
13 #include "base/file_path.h" | 13 #include "base/file_path.h" |
14 #include "base/logging.h" | 14 #include "base/logging.h" |
15 #include "base/mac/bundle_locations.h" | 15 #include "base/mac/bundle_locations.h" |
16 #include "chrome/common/chrome_constants.h" | 16 #include "chrome/common/chrome_constants.h" |
17 #include "chrome/common/chrome_paths_internal.h" | 17 #include "chrome/common/chrome_paths_internal.h" |
18 #include "chrome/common/chrome_switches.h" | |
18 #include "chrome/common/mac/app_mode_common.h" | 19 #include "chrome/common/mac/app_mode_common.h" |
19 | 20 |
20 extern "C" { | 21 extern "C" { |
21 | 22 |
22 // |ChromeAppModeStart()| is the point of entry into the framework from the app | 23 // |ChromeAppModeStart()| is the point of entry into the framework from the app |
23 // mode loader. | 24 // mode loader. |
24 __attribute__((visibility("default"))) | 25 __attribute__((visibility("default"))) |
25 int ChromeAppModeStart(const app_mode::ChromeAppModeInfo* info); | 26 int ChromeAppModeStart(const app_mode::ChromeAppModeInfo* info); |
26 | 27 |
27 // TODO(viettrungluu): put this in a header file somewhere. | 28 // TODO(viettrungluu): put this in a header file somewhere. |
(...skipping 13 matching lines...) Expand all Loading... | |
41 | 42 |
42 RAW_CHECK(!info->chrome_versioned_path.empty()); | 43 RAW_CHECK(!info->chrome_versioned_path.empty()); |
43 FilePath* chrome_versioned_path = new FilePath(info->chrome_versioned_path); | 44 FilePath* chrome_versioned_path = new FilePath(info->chrome_versioned_path); |
44 RAW_CHECK(!chrome_versioned_path->empty()); | 45 RAW_CHECK(!chrome_versioned_path->empty()); |
45 chrome::SetOverrideVersionedDirectory(chrome_versioned_path); | 46 chrome::SetOverrideVersionedDirectory(chrome_versioned_path); |
46 | 47 |
47 base::mac::SetOverrideOuterBundlePath(info->chrome_outer_bundle_path); | 48 base::mac::SetOverrideOuterBundlePath(info->chrome_outer_bundle_path); |
48 base::mac::SetOverrideFrameworkBundlePath( | 49 base::mac::SetOverrideFrameworkBundlePath( |
49 chrome_versioned_path->Append(chrome::kFrameworkName)); | 50 chrome_versioned_path->Append(chrome::kFrameworkName)); |
50 | 51 |
51 // TODO(viettrungluu): do something intelligent with data | |
Mihai Parparita -not on Chrome
2012/02/21 20:41:02
So we're blessing this hack? It seems like we'd wa
sail
2012/02/22 23:35:33
Done.
| |
52 // return ChromeMain(info->argc, info->argv); | |
53 // For now, a cheesy hack instead. | |
54 RAW_CHECK(info->app_mode_id.size()); | 52 RAW_CHECK(info->app_mode_id.size()); |
55 std::string argv1(std::string("--app-id=") + info->app_mode_id); | 53 std::string argv1("--app-id=" + info->app_mode_id); |
56 std::string argv2( | 54 std::string argv2("--user-data-dir=" + info->user_data_dir.value()); |
57 std::string("--user-data-dir=") + info->user_data_dir.value()); | 55 std::string argv3("--load-extension=" + info->extension_path.value()); |
Mihai Parparita -not on Chrome
2012/02/21 20:41:02
Add a TODO about switching to a different flag tha
sail
2012/02/22 23:35:33
Done.
| |
58 char* argv[] = { info->argv[0], | 56 char* argv[] = { info->argv[0], |
59 const_cast<char*>(argv1.c_str()), | 57 const_cast<char*>(argv1.c_str()), |
60 const_cast<char*>(argv2.c_str()) }; | 58 const_cast<char*>(argv2.c_str()), |
59 const_cast<char*>(argv3.c_str()) }; | |
61 return ChromeMain(static_cast<int>(arraysize(argv)), argv); | 60 return ChromeMain(static_cast<int>(arraysize(argv)), argv); |
62 } | 61 } |
OLD | NEW |