2013-03-13 19:12:05 +00: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 16:41:30 +00:00
|
|
|
#include "common/application_info.h"
|
2013-03-28 21:16:35 +00:00
|
|
|
#include "common/mac/foundation_util.h"
|
2013-03-14 17:05:01 +00:00
|
|
|
#include "common/mac/main_application_bundle.h"
|
2013-03-14 13:03:50 +00:00
|
|
|
|
2013-03-13 19:12:05 +00:00
|
|
|
#include "base/mac/bundle_locations.h"
|
|
|
|
#include "base/path_service.h"
|
|
|
|
#include "content/public/common/content_paths.h"
|
2013-03-14 13:03:50 +00:00
|
|
|
#include "ui/base/resource/resource_bundle.h"
|
2013-03-13 19:12:05 +00:00
|
|
|
|
|
|
|
namespace brightray {
|
|
|
|
|
|
|
|
namespace {
|
|
|
|
|
|
|
|
base::FilePath GetFrameworksPath() {
|
2013-03-14 17:05:01 +00:00
|
|
|
return MainApplicationBundlePath().Append("Contents").Append("Frameworks");
|
2013-03-13 19:12:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2013-03-14 13:03:50 +00:00
|
|
|
void MainDelegate::InitializeResourceBundle() {
|
|
|
|
auto path = [base::mac::FrameworkBundle() pathForResource:@"content_shell" ofType:@"pak"];
|
|
|
|
|
|
|
|
ui::ResourceBundle::InitSharedInstanceWithPakPath(base::mac::NSStringToFilePath(path));
|
2013-04-26 15:04:51 +00:00
|
|
|
|
|
|
|
std::vector<base::FilePath> pak_paths;
|
|
|
|
AddPakPaths(&pak_paths);
|
|
|
|
for (const auto& path : pak_paths)
|
|
|
|
ui::ResourceBundle::GetSharedInstance().AddDataPackFromPath(path, ui::SCALE_FACTOR_NONE);
|
2013-03-14 13:03:50 +00:00
|
|
|
}
|
|
|
|
|
2013-03-13 19:12:05 +00:00
|
|
|
void MainDelegate::OverrideFrameworkBundlePath() {
|
2013-03-13 20:45:00 +00:00
|
|
|
base::FilePath helper_path = GetFrameworksPath().Append(GetApplicationName() + ".framework");
|
2013-03-13 19:12:05 +00:00
|
|
|
|
|
|
|
base::mac::SetOverrideFrameworkBundlePath(helper_path);
|
|
|
|
}
|
|
|
|
|
|
|
|
void MainDelegate::OverrideChildProcessPath() {
|
2013-03-13 20:45:00 +00:00
|
|
|
base::FilePath helper_path = GetFrameworksPath().Append(GetApplicationName() + " Helper.app")
|
2013-03-13 19:12:05 +00:00
|
|
|
.Append("Contents")
|
|
|
|
.Append("MacOS")
|
2013-03-13 20:45:00 +00:00
|
|
|
.Append(GetApplicationName() + " Helper");
|
2013-03-13 19:12:05 +00:00
|
|
|
|
|
|
|
PathService::Override(content::CHILD_PROCESS_EXE, helper_path);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|