2013-03-13 15:12:05 -04:00
|
|
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
|
|
|
// Copyright (c) 2013 Adam Roben <adam@roben.org>. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
// found in the LICENSE-CHROMIUM file.
|
|
|
|
|
|
|
|
#import "main_delegate.h"
|
|
|
|
|
2013-04-08 12:41:30 -04:00
|
|
|
#include "common/application_info.h"
|
2013-03-28 17:16:35 -04:00
|
|
|
#include "common/mac/foundation_util.h"
|
2013-03-14 13:05:01 -04:00
|
|
|
#include "common/mac/main_application_bundle.h"
|
2013-03-14 09:03:50 -04:00
|
|
|
|
2013-07-17 11:04:45 -04:00
|
|
|
#include "base/command_line.h"
|
2013-03-13 15:12:05 -04:00
|
|
|
#include "base/mac/bundle_locations.h"
|
|
|
|
#include "base/path_service.h"
|
2013-10-07 15:16:49 -04:00
|
|
|
#include "base/strings/stringprintf.h"
|
2013-07-17 11:04:45 -04:00
|
|
|
#include "base/strings/sys_string_conversions.h"
|
2013-03-13 15:12:05 -04:00
|
|
|
#include "content/public/common/content_paths.h"
|
2013-07-17 11:04:45 -04:00
|
|
|
#include "content/public/common/content_switches.h"
|
2013-03-13 15:12:05 -04:00
|
|
|
|
|
|
|
namespace brightray {
|
|
|
|
|
|
|
|
namespace {
|
|
|
|
|
|
|
|
base::FilePath GetFrameworksPath() {
|
2013-03-14 13:05:01 -04:00
|
|
|
return MainApplicationBundlePath().Append("Contents").Append("Frameworks");
|
2013-03-13 15:12:05 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2013-05-22 11:40:43 -04:00
|
|
|
base::FilePath MainDelegate::GetResourcesPakFilePath() {
|
2013-03-14 09:03:50 -04:00
|
|
|
auto path = [base::mac::FrameworkBundle() pathForResource:@"content_shell" ofType:@"pak"];
|
2013-05-22 11:40:43 -04:00
|
|
|
return base::mac::NSStringToFilePath(path);
|
2013-03-14 09:03:50 -04:00
|
|
|
}
|
|
|
|
|
2013-03-13 15:12:05 -04:00
|
|
|
void MainDelegate::OverrideFrameworkBundlePath() {
|
2014-12-07 21:24:23 -08:00
|
|
|
base::FilePath helper_path = GetFrameworksPath().Append(GetApplicationName() + " Framework.framework");
|
2013-03-13 15:12:05 -04:00
|
|
|
|
|
|
|
base::mac::SetOverrideFrameworkBundlePath(helper_path);
|
|
|
|
}
|
|
|
|
|
|
|
|
void MainDelegate::OverrideChildProcessPath() {
|
2013-03-13 16:45:00 -04:00
|
|
|
base::FilePath helper_path = GetFrameworksPath().Append(GetApplicationName() + " Helper.app")
|
2013-03-13 15:12:05 -04:00
|
|
|
.Append("Contents")
|
|
|
|
.Append("MacOS")
|
2013-03-13 16:45:00 -04:00
|
|
|
.Append(GetApplicationName() + " Helper");
|
2013-03-13 15:12:05 -04:00
|
|
|
|
|
|
|
PathService::Override(content::CHILD_PROCESS_EXE, helper_path);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|