Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(423)

Side by Side Diff: chrome/app/chrome_main_app_mode_mac.mm

Issue 9416012: Mac: Generate App Mode Loader bundle + cleanup (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased against trunk Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/app/app_mode_loader_mac.mm ('k') | chrome/browser/web_applications/web_app_mac.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/command_line.h" 13 #include "base/command_line.h"
14 #include "base/file_path.h" 14 #include "base/file_path.h"
15 #include "base/logging.h" 15 #include "base/logging.h"
16 #include "base/mac/bundle_locations.h"
17 #include "chrome/common/chrome_constants.h"
16 #include "chrome/common/chrome_paths_internal.h" 18 #include "chrome/common/chrome_paths_internal.h"
17 #include "chrome/common/chrome_switches.h" 19 #include "chrome/common/chrome_switches.h"
18 #include "chrome/common/mac/app_mode_common.h" 20 #include "chrome/common/mac/app_mode_common.h"
19 21
20 extern "C" { 22 extern "C" {
21 23
22 // |ChromeAppModeStart()| is the point of entry into the framework from the app 24 // |ChromeAppModeStart()| is the point of entry into the framework from the app
23 // mode loader. 25 // mode loader.
24 __attribute__((visibility("default"))) 26 __attribute__((visibility("default")))
25 int ChromeAppModeStart(const app_mode::ChromeAppModeInfo* info); 27 int ChromeAppModeStart(const app_mode::ChromeAppModeInfo* info);
(...skipping 10 matching lines...) Expand all
36 } 38 }
37 if (info->major_version > app_mode::kCurrentChromeAppModeInfoMajorVersion) { 39 if (info->major_version > app_mode::kCurrentChromeAppModeInfoMajorVersion) {
38 RAW_LOG(ERROR, "Browser Framework too old to load App Shortcut."); 40 RAW_LOG(ERROR, "Browser Framework too old to load App Shortcut.");
39 return 1; 41 return 1;
40 } 42 }
41 43
42 RAW_CHECK(!info->chrome_versioned_path.empty()); 44 RAW_CHECK(!info->chrome_versioned_path.empty());
43 FilePath* chrome_versioned_path = new FilePath(info->chrome_versioned_path); 45 FilePath* chrome_versioned_path = new FilePath(info->chrome_versioned_path);
44 RAW_CHECK(!chrome_versioned_path->empty()); 46 RAW_CHECK(!chrome_versioned_path->empty());
45 chrome::SetOverrideVersionedDirectory(chrome_versioned_path); 47 chrome::SetOverrideVersionedDirectory(chrome_versioned_path);
48 base::mac::SetOverrideOuterBundlePath(info->chrome_outer_bundle_path);
49 base::mac::SetOverrideFrameworkBundlePath(
50 chrome_versioned_path->Append(chrome::kFrameworkName));
46 51
47 CommandLine command_line(CommandLine::NO_PROGRAM); 52 CommandLine command_line(CommandLine::NO_PROGRAM);
48 command_line.AppendSwitch(info->argv[0]); 53 command_line.AppendSwitch(info->argv[0]);
54
49 RAW_CHECK(info->app_mode_id.size()); 55 RAW_CHECK(info->app_mode_id.size());
50 command_line.AppendSwitchASCII(switches::kAppId, info->app_mode_id); 56 command_line.AppendSwitchASCII(switches::kAppId, info->app_mode_id);
51 command_line.AppendSwitchPath(switches::kUserDataDir, info->user_data_dir); 57 command_line.AppendSwitchPath(switches::kUserDataDir, info->user_data_dir);
52 // 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
53 // extension. 59 // extension.
54 command_line.AppendSwitchPath(switches::kLoadExtension, info->extension_path); 60 command_line.AppendSwitchPath(switches::kLoadExtension, info->extension_path);
55 61
56 int argc = command_line.argv().size(); 62 int argc = command_line.argv().size();
57 char* argv[argc]; 63 char* argv[argc];
58 for (int i = 0; i < argc; ++i) 64 for (int i = 0; i < argc; ++i)
59 argv[i] = const_cast<char*>(command_line.argv()[i].c_str()); 65 argv[i] = const_cast<char*>(command_line.argv()[i].c_str());
60 66
61 return ChromeMain(argc, argv); 67 return ChromeMain(argc, argv);
62 } 68 }
OLDNEW
« no previous file with comments | « chrome/app/app_mode_loader_mac.mm ('k') | chrome/browser/web_applications/web_app_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698