summaryrefslogtreecommitdiffstats
path: root/chrome/common
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/common')
-rw-r--r--chrome/common/app_mode_common_mac.h41
-rw-r--r--chrome/common/app_mode_common_mac.mm4
-rw-r--r--chrome/common/chrome_paths_internal.h7
-rw-r--r--chrome/common/chrome_paths_mac.mm14
4 files changed, 64 insertions, 2 deletions
diff --git a/chrome/common/app_mode_common_mac.h b/chrome/common/app_mode_common_mac.h
index 0929be5..48d72fe 100644
--- a/chrome/common/app_mode_common_mac.h
+++ b/chrome/common/app_mode_common_mac.h
@@ -20,6 +20,47 @@ extern const CFStringRef kAppPrefsID;
// bundle; this key is recorded under the ID given by |kAppPrefsID|.
extern const CFStringRef kLastRunAppBundlePathPrefsKey;
+// Current major/minor version numbers of |ChromeAppModeInfo| (defined below).
+const unsigned kCurrentChromeAppModeInfoMajorVersion = 0;
+const unsigned kCurrentChromeAppModeInfoMinorVersion = 1;
+
+// The structure used to pass information from the app mode loader to the
+// (browser) framework. This is versioned using major and minor version numbers,
+// written below as v<major>.<minor>. Version-number checking is done by the
+// framework, and the framework must accept all structures with the same major
+// version number. It may refuse to load if the major version of the structure
+// is different from the one it accepts.
+struct ChromeAppModeInfo {
+ // Major and minor version number of this structure.
+ unsigned major_version; // Required: all versions
+ unsigned minor_version; // Required: all versions
+
+ // Original |argc| and |argv|.
+ int argc; // Required: v0.1
+ char** argv; // Required: v0.1
+
+ // Versioned path to the browser which is being loaded.
+ char* chrome_versioned_path; // Required: v0.1
+
+ // Information about the App Mode shortcut:
+
+ // Path to the App Mode Loader application bundle originally run.
+ char* app_mode_bundle_path; // Optional: v0.1
+
+ // Short ID string, preferably derived from |app_mode_short_name|. Should be
+ // safe for the file system.
+ char* app_mode_id; // Required: v0.1
+
+ // Short (e.g., one-word) UTF8-encoded name for the shortcut.
+ char* app_mode_short_name; // Optional: v0.1
+
+ // Unrestricted (e.g., several-word) UTF8-encoded name for the shortcut.
+ char* app_mode_name; // Optional: v0.1
+
+ // URL for the shortcut. Must be a valid URL.
+ char* app_mode_url; // Required: v0.1
+};
+
} // namespace app_mode
#endif // CHROME_COMMON_APP_MODE_COMMON_MAC_H_
diff --git a/chrome/common/app_mode_common_mac.mm b/chrome/common/app_mode_common_mac.mm
index aa35af7..3705c34 100644
--- a/chrome/common/app_mode_common_mac.mm
+++ b/chrome/common/app_mode_common_mac.mm
@@ -7,9 +7,9 @@
namespace app_mode {
#if defined(GOOGLE_CHROME_BUILD)
-extern const CFStringRef kAppPrefsID = CFSTR("com.google.Chrome");
+const CFStringRef kAppPrefsID = CFSTR("com.google.Chrome");
#else
-extern const CFStringRef kAppPrefsID = CFSTR("org.chromium.Chromium");
+const CFStringRef kAppPrefsID = CFSTR("org.chromium.Chromium");
#endif
const CFStringRef kLastRunAppBundlePathPrefsKey = CFSTR("LastRunAppBundlePath");
diff --git a/chrome/common/chrome_paths_internal.h b/chrome/common/chrome_paths_internal.h
index 5254f51..7d731e1 100644
--- a/chrome/common/chrome_paths_internal.h
+++ b/chrome/common/chrome_paths_internal.h
@@ -40,6 +40,13 @@ bool GetUserDesktop(FilePath* result);
// in the .app at Contents/Versions/w.x.y.z.
FilePath GetVersionedDirectory();
+// This overrides the directory returned by |GetVersionedDirectory()|, to be
+// used when |GetVersionedDirectory()| can't automatically determine the proper
+// location. This is the case when the browser didn't load itself but by, e.g.,
+// the app mode loader. This should be called before |ChromeMain()|. This takes
+// ownership of the object |path| and the caller must not delete it.
+void SetOverrideVersionedDirectory(const FilePath* path);
+
// Most of the application is further contained within the framework. The
// framework bundle is located within the versioned directory at a specific
// path. The only components in the versioned directory not included in the
diff --git a/chrome/common/chrome_paths_mac.mm b/chrome/common/chrome_paths_mac.mm
index 21868cd..c7db483 100644
--- a/chrome/common/chrome_paths_mac.mm
+++ b/chrome/common/chrome_paths_mac.mm
@@ -12,6 +12,10 @@
#include "base/path_service.h"
#include "chrome/common/chrome_constants.h"
+namespace {
+const FilePath* g_override_versioned_directory = NULL;
+} // namespace
+
namespace chrome {
bool GetDefaultUserDataDirectory(FilePath* result) {
@@ -53,6 +57,9 @@ bool GetUserDesktop(FilePath* result) {
}
FilePath GetVersionedDirectory() {
+ if (g_override_versioned_directory)
+ return *g_override_versioned_directory;
+
// Start out with the path to the running executable.
FilePath path;
PathService::Get(base::FILE_EXE, &path);
@@ -75,6 +82,13 @@ FilePath GetVersionedDirectory() {
return path;
}
+void SetOverrideVersionedDirectory(const FilePath* path) {
+ if (path != g_override_versioned_directory) {
+ delete g_override_versioned_directory;
+ g_override_versioned_directory = path;
+ }
+}
+
FilePath GetFrameworkBundlePath() {
// It's tempting to use +[NSBundle bundleWithIdentifier:], but it's really
// slow (about 30ms on 10.5 and 10.6), despite Apple's documentation stating