| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "apps/shell/shell_main_delegate.h" | 5 #include "apps/shell/shell_main_delegate.h" |
| 6 | 6 |
| 7 #include "apps/shell/shell_content_browser_client.h" | 7 #include "apps/shell/shell_content_browser_client.h" |
| 8 #include "apps/shell/shell_content_client.h" | 8 #include "apps/shell/shell_content_client.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/path_service.h" | 12 #include "base/path_service.h" |
| 13 #include "content/public/browser/browser_main_runner.h" | 13 #include "content/public/browser/browser_main_runner.h" |
| 14 #include "ui/base/resource/resource_bundle.h" | 14 #include "ui/base/resource/resource_bundle.h" |
| 15 | 15 |
| 16 namespace { |
| 17 |
| 18 void InitLogging() { |
| 19 base::FilePath log_filename; |
| 20 PathService::Get(base::DIR_EXE, &log_filename); |
| 21 log_filename = log_filename.AppendASCII("app_shell.log"); |
| 22 logging::LoggingSettings settings; |
| 23 settings.logging_dest = logging::LOG_TO_ALL; |
| 24 settings.log_file = log_filename.value().c_str(); |
| 25 settings.delete_old = logging::DELETE_OLD_LOG_FILE; |
| 26 logging::InitLogging(settings); |
| 27 logging::SetLogItems(true, true, true, true); |
| 28 } |
| 29 |
| 30 } // namespace |
| 31 |
| 16 namespace apps { | 32 namespace apps { |
| 17 | 33 |
| 18 ShellMainDelegate::ShellMainDelegate() { | 34 ShellMainDelegate::ShellMainDelegate() { |
| 19 } | 35 } |
| 20 | 36 |
| 21 ShellMainDelegate::~ShellMainDelegate() { | 37 ShellMainDelegate::~ShellMainDelegate() { |
| 22 } | 38 } |
| 23 | 39 |
| 24 bool ShellMainDelegate::BasicStartupComplete(int* exit_code) { | 40 bool ShellMainDelegate::BasicStartupComplete(int* exit_code) { |
| 25 // TODO(jamescook): Initialize logging here. | 41 InitLogging(); |
| 26 content_client_.reset(new ShellContentClient); | 42 content_client_.reset(new ShellContentClient); |
| 27 SetContentClient(content_client_.get()); | 43 SetContentClient(content_client_.get()); |
| 28 return false; | 44 return false; |
| 29 } | 45 } |
| 30 | 46 |
| 31 void ShellMainDelegate::PreSandboxStartup() { | 47 void ShellMainDelegate::PreSandboxStartup() { |
| 32 InitializeResourceBundle(); | 48 InitializeResourceBundle(); |
| 33 } | 49 } |
| 34 | 50 |
| 35 content::ContentBrowserClient* ShellMainDelegate::CreateContentBrowserClient() { | 51 content::ContentBrowserClient* ShellMainDelegate::CreateContentBrowserClient() { |
| 36 browser_client_.reset(new apps::ShellContentBrowserClient); | 52 browser_client_.reset(new apps::ShellContentBrowserClient); |
| 37 return browser_client_.get(); | 53 return browser_client_.get(); |
| 38 } | 54 } |
| 39 | 55 |
| 40 content::ContentRendererClient* | 56 content::ContentRendererClient* |
| 41 ShellMainDelegate::CreateContentRendererClient() { | 57 ShellMainDelegate::CreateContentRendererClient() { |
| 42 // TODO(jamescook): Create a ShellContentRendererClient with the extensions | 58 // TODO(jamescook): Create a ShellContentRendererClient with the extensions |
| 43 // initialization pieces of ChromeContentRendererClient. | 59 // initialization pieces of ChromeContentRendererClient. |
| 44 return content::ContentMainDelegate::CreateContentRendererClient(); | 60 return content::ContentMainDelegate::CreateContentRendererClient(); |
| 45 } | 61 } |
| 46 | 62 |
| 47 void ShellMainDelegate::InitializeResourceBundle() { | 63 void ShellMainDelegate::InitializeResourceBundle() { |
| 48 ui::ResourceBundle::InitSharedInstanceWithLocale("en-US", NULL); | 64 ui::ResourceBundle::InitSharedInstanceWithLocale("en-US", NULL); |
| 49 } | 65 } |
| 50 | 66 |
| 51 } // namespace apps | 67 } // namespace apps |
| OLD | NEW |