Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/shell/shell_main_delegate.h" | 5 #include "content/shell/shell_main_delegate.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
| 9 #include "base/logging.h" | |
| 9 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| 10 #include "content/public/browser/browser_main_runner.h" | 11 #include "content/public/browser/browser_main_runner.h" |
| 11 #include "content/public/common/content_switches.h" | 12 #include "content/public/common/content_switches.h" |
| 12 #include "content/public/common/url_constants.h" | 13 #include "content/public/common/url_constants.h" |
| 13 #include "content/shell/shell_browser_main.h" | 14 #include "content/shell/shell_browser_main.h" |
| 14 #include "content/shell/shell_content_browser_client.h" | 15 #include "content/shell/shell_content_browser_client.h" |
| 15 #include "content/shell/shell_content_renderer_client.h" | 16 #include "content/shell/shell_content_renderer_client.h" |
| 17 #include "content/shell/shell_switches.h" | |
| 16 #include "ui/base/resource/resource_bundle.h" | 18 #include "ui/base/resource/resource_bundle.h" |
| 17 #include "ui/base/ui_base_paths.h" | 19 #include "ui/base/ui_base_paths.h" |
| 18 | 20 |
| 19 #if defined(OS_MACOSX) | 21 #if defined(OS_MACOSX) |
| 20 #include "content/shell/paths_mac.h" | 22 #include "content/shell/paths_mac.h" |
| 21 #endif // OS_MACOSX | 23 #endif // OS_MACOSX |
| 22 | 24 |
| 25 namespace { | |
| 26 | |
| 27 void InitLogging() { | |
| 28 FilePath log_filename; | |
| 29 PathService::Get(base::DIR_EXE, &log_filename); | |
| 30 log_filename = log_filename.AppendASCII("content_shell.log"); | |
| 31 logging::InitLogging( | |
| 32 log_filename.value().c_str(), | |
| 33 logging::LOG_ONLY_TO_FILE, | |
| 34 logging::LOCK_LOG_FILE, | |
| 35 logging::DELETE_OLD_LOG_FILE, | |
| 36 logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS); | |
| 37 const bool kProcessId = true; | |
|
jam
2012/06/26 15:30:00
nit: i find that naming booleans like this, instea
| |
| 38 const bool kThreadId = true; | |
| 39 const bool kTimestamp = true; | |
| 40 const bool kTickcount = true; | |
| 41 logging::SetLogItems(kProcessId, kThreadId, !kTimestamp, kTickcount); | |
| 42 } | |
| 43 | |
| 44 } // namespace | |
| 45 | |
| 23 ShellMainDelegate::ShellMainDelegate() { | 46 ShellMainDelegate::ShellMainDelegate() { |
| 24 } | 47 } |
| 25 | 48 |
| 26 ShellMainDelegate::~ShellMainDelegate() { | 49 ShellMainDelegate::~ShellMainDelegate() { |
| 27 #if defined(OS_ANDROID) | 50 #if defined(OS_ANDROID) |
| 28 NOTREACHED(); | 51 NOTREACHED(); |
| 29 #endif | 52 #endif |
| 30 } | 53 } |
| 31 | 54 |
| 32 bool ShellMainDelegate::BasicStartupComplete(int* exit_code) { | 55 bool ShellMainDelegate::BasicStartupComplete(int* exit_code) { |
| 56 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) | |
| 57 InitLogging(); | |
| 33 #if defined(OS_MACOSX) | 58 #if defined(OS_MACOSX) |
| 34 OverrideFrameworkBundlePath(); | 59 OverrideFrameworkBundlePath(); |
| 35 #endif | 60 #endif |
| 36 content::SetContentClient(&content_client_); | 61 content::SetContentClient(&content_client_); |
| 37 return false; | 62 return false; |
| 38 } | 63 } |
| 39 | 64 |
| 40 void ShellMainDelegate::PreSandboxStartup() { | 65 void ShellMainDelegate::PreSandboxStartup() { |
| 41 #if defined(OS_MACOSX) | 66 #if defined(OS_MACOSX) |
| 42 OverrideChildProcessPath(); | 67 OverrideChildProcessPath(); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 85 content::ContentBrowserClient* ShellMainDelegate::CreateContentBrowserClient() { | 110 content::ContentBrowserClient* ShellMainDelegate::CreateContentBrowserClient() { |
| 86 browser_client_.reset(new content::ShellContentBrowserClient); | 111 browser_client_.reset(new content::ShellContentBrowserClient); |
| 87 return browser_client_.get(); | 112 return browser_client_.get(); |
| 88 } | 113 } |
| 89 | 114 |
| 90 content::ContentRendererClient* | 115 content::ContentRendererClient* |
| 91 ShellMainDelegate::CreateContentRendererClient() { | 116 ShellMainDelegate::CreateContentRendererClient() { |
| 92 renderer_client_.reset(new content::ShellContentRendererClient); | 117 renderer_client_.reset(new content::ShellContentRendererClient); |
| 93 return renderer_client_.get(); | 118 return renderer_client_.get(); |
| 94 } | 119 } |
| OLD | NEW |