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

Unified Diff: extensions/shell/app/paths_mac.mm

Issue 745093002: AppShell support for Mac. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: minors Created 6 years 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 | « extensions/shell/app/paths_mac.h ('k') | extensions/shell/app/shell_main.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/shell/app/paths_mac.mm
diff --git a/extensions/shell/app/paths_mac.mm b/extensions/shell/app/paths_mac.mm
new file mode 100644
index 0000000000000000000000000000000000000000..d10c3c87532905b371d83226988e2d22691b135a
--- /dev/null
+++ b/extensions/shell/app/paths_mac.mm
@@ -0,0 +1,52 @@
+// Copyright 2014 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.
+
+#include "extensions/shell/app/paths_mac.h"
+
+#include "base/files/file_path.h"
+#include "base/logging.h"
+#include "base/path_service.h"
+#include "base/mac/bundle_locations.h"
+#include "base/mac/foundation_util.h"
+#include "content/public/common/content_paths.h"
+
+namespace extensions {
+
+namespace {
+
+base::FilePath GetFrameworksPath() {
+ base::FilePath path;
+ PathService::Get(base::FILE_EXE, &path);
+ // We now have a path .../App Shell.app/Contents/MacOS/App Shell, and want to
+ // transform it into
+ // .../App Shell.app/Contents/Frameworks/App Shell Framework.framework.
+ // But if it's App Shell Helper.app (inside Frameworks), we must go deeper.
+ if (base::mac::IsBackgroundOnlyProcess()) {
+ path = path.DirName().DirName().DirName().DirName().DirName();
+ } else {
+ path = path.DirName().DirName();
+ }
+ DCHECK_EQ("Contents", path.BaseName().value());
+ path = path.Append("Frameworks");
+ return path;
+}
+
+} // namespace
+
+void OverrideFrameworkBundlePath() {
+ base::FilePath path =
+ GetFrameworksPath().Append("App Shell Framework.framework");
+ base::mac::SetOverrideFrameworkBundlePath(path);
+}
+
+void OverrideChildProcessFilePath() {
+ base::FilePath path = GetFrameworksPath()
+ .Append("App Shell Helper.app")
+ .Append("Contents")
+ .Append("MacOS")
+ .Append("App Shell Helper");
+ PathService::Override(content::CHILD_PROCESS_EXE, path);
+}
+
+} // namespace extensions
« no previous file with comments | « extensions/shell/app/paths_mac.h ('k') | extensions/shell/app/shell_main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698