cast_main_delegate.cc revision 6e8cce623b6e4fe0c9e4af605d675dd9d0338c38
1// Copyright 2014 The Chromium Authors. All rights reserved. 2// Use of this source code is governed by a BSD-style license that can be 3// found in the LICENSE file. 4 5#include "chromecast/shell/app/cast_main_delegate.h" 6 7#include "base/base_paths.h" 8#include "base/logging.h" 9#include "base/path_service.h" 10#include "chromecast/common/cast_paths.h" 11#include "chromecast/common/cast_resource_delegate.h" 12#include "chromecast/shell/browser/cast_content_browser_client.h" 13#include "chromecast/shell/renderer/cast_content_renderer_client.h" 14#include "content/public/common/content_switches.h" 15#include "ui/base/resource/resource_bundle.h" 16 17namespace chromecast { 18namespace shell { 19 20CastMainDelegate::CastMainDelegate() { 21} 22 23CastMainDelegate::~CastMainDelegate() { 24} 25 26bool CastMainDelegate::BasicStartupComplete(int* exit_code) { 27 logging::LoggingSettings settings; 28 settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; 29 logging::InitLogging(settings); 30 // Time, process, and thread ID are available through logcat. 31 logging::SetLogItems(true, true, false, false); 32 33 RegisterPathProvider(); 34 35 content::SetContentClient(&content_client_); 36 return false; 37} 38 39void CastMainDelegate::PreSandboxStartup() { 40 InitializeResourceBundle(); 41} 42 43void CastMainDelegate::ZygoteForked() { 44} 45 46void CastMainDelegate::InitializeResourceBundle() { 47 resource_delegate_.reset(new CastResourceDelegate()); 48 // TODO(gunsch): Use LOAD_COMMON_RESOURCES once ResourceBundle no longer 49 // hardcodes resource file names. 50 ui::ResourceBundle::InitSharedInstanceWithLocale( 51 "en-US", 52 resource_delegate_.get(), 53 ui::ResourceBundle::DO_NOT_LOAD_COMMON_RESOURCES); 54 55 base::FilePath pak_dir; 56 PathService::Get(base::DIR_MODULE, &pak_dir); 57 ui::ResourceBundle::GetSharedInstance().AddDataPackFromPath( 58 pak_dir.Append(FILE_PATH_LITERAL("cast_shell.pak")), 59 ui::SCALE_FACTOR_NONE); 60} 61 62content::ContentBrowserClient* CastMainDelegate::CreateContentBrowserClient() { 63 browser_client_.reset(new CastContentBrowserClient); 64 return browser_client_.get(); 65} 66 67content::ContentRendererClient* 68CastMainDelegate::CreateContentRendererClient() { 69 renderer_client_.reset(new CastContentRendererClient); 70 return renderer_client_.get(); 71} 72 73} // namespace shell 74} // namespace chromecast 75