2013-04-12 01:46:58 +00:00
|
|
|
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
|
|
|
#include "app/atom_main_delegate.h"
|
|
|
|
|
2013-04-20 03:19:25 +00:00
|
|
|
#include "base/command_line.h"
|
2013-07-08 03:09:53 +00:00
|
|
|
#include "base/logging.h"
|
2013-04-12 01:46:58 +00:00
|
|
|
#include "browser/atom_browser_client.h"
|
2013-04-20 03:19:25 +00:00
|
|
|
#include "content/public/common/content_switches.h"
|
2013-04-12 01:46:58 +00:00
|
|
|
#include "renderer/atom_renderer_client.h"
|
|
|
|
|
|
|
|
namespace atom {
|
|
|
|
|
|
|
|
AtomMainDelegate::AtomMainDelegate() {
|
|
|
|
}
|
|
|
|
|
|
|
|
AtomMainDelegate::~AtomMainDelegate() {
|
|
|
|
}
|
|
|
|
|
2013-07-08 03:09:53 +00:00
|
|
|
bool AtomMainDelegate::BasicStartupComplete(int* exit_code) {
|
|
|
|
// Disable logging out to debug.log on Windows
|
|
|
|
#if defined(OS_WIN)
|
|
|
|
logging::InitLogging(
|
|
|
|
L"debug.log",
|
2013-07-23 08:37:00 +00:00
|
|
|
#if defined(DEBUG)
|
|
|
|
logging::LOG_TO_BOTH_FILE_AND_SYSTEM_DEBUG_LOG ,
|
|
|
|
#else
|
2013-07-08 03:09:53 +00:00
|
|
|
logging::LOG_ONLY_TO_SYSTEM_DEBUG_LOG,
|
2013-07-23 08:37:00 +00:00
|
|
|
#endif // defined(NDEBUG)
|
2013-07-08 03:09:53 +00:00
|
|
|
logging::LOCK_LOG_FILE,
|
|
|
|
logging::DELETE_OLD_LOG_FILE,
|
|
|
|
logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS);
|
|
|
|
logging::SetLogItems(true, false, true, false);
|
2013-07-23 08:37:00 +00:00
|
|
|
#endif // defined(OS_WIN)
|
2013-07-08 03:09:53 +00:00
|
|
|
|
|
|
|
return brightray::MainDelegate::BasicStartupComplete(exit_code);
|
|
|
|
}
|
|
|
|
|
2013-04-20 03:19:25 +00:00
|
|
|
void AtomMainDelegate::PreSandboxStartup() {
|
|
|
|
brightray::MainDelegate::PreSandboxStartup();
|
|
|
|
|
|
|
|
// Disable renderer sandbox for most of node's functions.
|
|
|
|
CommandLine* command_line = CommandLine::ForCurrentProcess();
|
|
|
|
command_line->AppendSwitch(switches::kNoSandbox);
|
|
|
|
}
|
|
|
|
|
2013-04-12 01:46:58 +00:00
|
|
|
content::ContentBrowserClient* AtomMainDelegate::CreateContentBrowserClient() {
|
|
|
|
browser_client_.reset(new AtomBrowserClient);
|
|
|
|
return browser_client_.get();
|
|
|
|
}
|
|
|
|
|
|
|
|
content::ContentRendererClient*
|
|
|
|
AtomMainDelegate::CreateContentRendererClient() {
|
|
|
|
renderer_client_.reset(new AtomRendererClient);
|
|
|
|
return renderer_client_.get();
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace atom
|