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

Unified Diff: chrome/app/chrome_dll_app_mode_mac.mm

Issue 2066004: Mac: app mode loader (shim). (Closed)
Patch Set: more changes per mark + merged ToT Created 10 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/app/app_mode_loader_mac.mm ('k') | chrome/app/framework.order » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/app/chrome_dll_app_mode_mac.mm
diff --git a/chrome/app/chrome_dll_app_mode_mac.mm b/chrome/app/chrome_dll_app_mode_mac.mm
new file mode 100644
index 0000000000000000000000000000000000000000..678547da5dadf64729a6dea4c6331f1a9aee7077
--- /dev/null
+++ b/chrome/app/chrome_dll_app_mode_mac.mm
@@ -0,0 +1,56 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// On Mac, one can't make shortcuts with command-line arguments. Instead, we
+// produce small app bundles which locate the Chromium framework and load it,
+// passing the appropriate data. This is the entry point into the framework for
+// those app bundles.
+
+#include <string> // TODO(viettrungluu): only needed for temporary hack
+
+#include "base/basictypes.h"
+#include "base/file_path.h"
+#include "base/logging.h"
+#include "chrome/common/app_mode_common_mac.h"
+#include "chrome/common/chrome_paths_internal.h"
+
+extern "C" {
+
+// |ChromeAppModeStart()| is the point of entry into the framework from the app
+// mode loader.
+__attribute__((visibility("default")))
+int ChromeAppModeStart(const app_mode::ChromeAppModeInfo* info);
+
+// TODO(viettrungluu): put this in a header file somewhere.
+int ChromeMain(int argc, char** argv);
+
+} // extern "C"
+
+int ChromeAppModeStart(const app_mode::ChromeAppModeInfo* info) {
+ if (info->major_version < app_mode::kCurrentChromeAppModeInfoMajorVersion) {
+ RAW_LOG(ERROR, "App Mode Loader too old.");
+ return 1;
+ }
+ if (info->major_version > app_mode::kCurrentChromeAppModeInfoMajorVersion) {
+ RAW_LOG(ERROR, "Browser Framework too old to load App Shortcut.");
+ return 1;
+ }
+
+ RAW_CHECK(info->chrome_versioned_path);
+ FilePath* chrome_versioned_path = new FilePath(info->chrome_versioned_path);
+ RAW_CHECK(!chrome_versioned_path->empty());
+ chrome::SetOverrideVersionedDirectory(chrome_versioned_path);
+
+ // TODO(viettrungluu): do something intelligent with data
+// return ChromeMain(info->argc, info->argv);
+ // For now, a cheesy hack instead.
+ RAW_CHECK(info->app_mode_url);
+ std::string argv1(std::string("--app=") + info->app_mode_url);
+ RAW_CHECK(info->app_mode_id);
+ std::string argv2(std::string("--user-data-dir=/tmp/") + info->app_mode_id);
+ char* argv[] = { info->argv[0],
+ const_cast<char*>(argv1.c_str()),
+ const_cast<char*>(argv2.c_str()) };
+ return ChromeMain(static_cast<int>(arraysize(argv)), argv);
+}
« no previous file with comments | « chrome/app/app_mode_loader_mac.mm ('k') | chrome/app/framework.order » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698