2013-03-13 19:12:05 +00:00
|
|
|
// Copyright (c) 2012 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-CHROMIUM file.
|
|
|
|
|
2013-03-14 13:03:50 +00:00
|
|
|
#include "common/main_delegate.h"
|
|
|
|
|
|
|
|
#include "browser/browser_client.h"
|
|
|
|
#include "common/content_client.h"
|
2013-03-13 19:12:05 +00:00
|
|
|
|
|
|
|
#include "base/command_line.h"
|
2013-05-22 15:40:43 +00:00
|
|
|
#include "base/path_service.h"
|
2013-03-13 19:12:05 +00:00
|
|
|
#include "content/public/common/content_switches.h"
|
2013-05-22 15:40:43 +00:00
|
|
|
#include "ui/base/resource/resource_bundle.h"
|
2013-03-13 19:12:05 +00:00
|
|
|
|
|
|
|
namespace brightray {
|
|
|
|
|
2013-04-24 22:30:47 +00:00
|
|
|
MainDelegate::MainDelegate() {
|
2013-03-13 19:12:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
MainDelegate::~MainDelegate() {
|
|
|
|
}
|
|
|
|
|
2013-04-24 22:30:47 +00:00
|
|
|
scoped_ptr<ContentClient> MainDelegate::CreateContentClient() {
|
|
|
|
return make_scoped_ptr(new ContentClient).Pass();
|
|
|
|
}
|
|
|
|
|
2013-03-14 13:03:50 +00:00
|
|
|
bool MainDelegate::BasicStartupComplete(int* exit_code) {
|
2013-04-24 22:30:47 +00:00
|
|
|
content_client_ = CreateContentClient().Pass();
|
2013-03-14 13:03:50 +00:00
|
|
|
SetContentClient(content_client_.get());
|
2013-03-13 19:12:05 +00:00
|
|
|
#if defined(OS_MACOSX)
|
|
|
|
OverrideChildProcessPath();
|
|
|
|
OverrideFrameworkBundlePath();
|
2013-05-22 15:40:43 +00:00
|
|
|
#endif
|
2014-06-26 20:35:27 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
void MainDelegate::PreSandboxStartup() {
|
2013-03-14 13:03:50 +00:00
|
|
|
InitializeResourceBundle();
|
2013-05-22 15:40:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void MainDelegate::InitializeResourceBundle() {
|
|
|
|
base::FilePath path;
|
|
|
|
#if defined(OS_MACOSX)
|
|
|
|
path = GetResourcesPakFilePath();
|
|
|
|
#else
|
|
|
|
base::FilePath pak_dir;
|
|
|
|
PathService::Get(base::DIR_MODULE, &pak_dir);
|
|
|
|
path = pak_dir.Append(FILE_PATH_LITERAL("content_shell.pak"));
|
2013-05-21 15:39:25 +00:00
|
|
|
#endif
|
2013-05-22 15:40:43 +00:00
|
|
|
|
2015-12-30 05:19:45 +00:00
|
|
|
ui::ResourceBundle::InitSharedInstanceWithLocale("", NULL,
|
|
|
|
ui::ResourceBundle::DO_NOT_LOAD_COMMON_RESOURCES);
|
|
|
|
ui::ResourceBundle::GetSharedInstance().AddDataPackFromPath(path, ui::SCALE_FACTOR_100P);
|
2014-07-12 13:16:13 +00:00
|
|
|
AddDataPackFromPath(&ui::ResourceBundle::GetSharedInstance(), path.DirName());
|
2013-03-13 19:12:05 +00:00
|
|
|
}
|
|
|
|
|
2013-12-03 22:12:21 +00:00
|
|
|
content::ContentBrowserClient* MainDelegate::CreateContentBrowserClient() {
|
|
|
|
browser_client_ = CreateBrowserClient().Pass();
|
|
|
|
return browser_client_.get();
|
|
|
|
}
|
|
|
|
|
|
|
|
scoped_ptr<BrowserClient> MainDelegate::CreateBrowserClient() {
|
|
|
|
return make_scoped_ptr(new BrowserClient).Pass();
|
|
|
|
}
|
|
|
|
|
2013-11-17 23:20:17 +00:00
|
|
|
} // namespace brightray
|