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/logging.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
11 #include "content/public/browser/browser_main_runner.h" | 11 #include "content/public/browser/browser_main_runner.h" |
12 #include "content/public/common/content_switches.h" | 12 #include "content/public/common/content_switches.h" |
13 #include "content/public/common/url_constants.h" | 13 #include "content/public/common/url_constants.h" |
14 #include "content/shell/shell_browser_main.h" | 14 #include "content/shell/shell_browser_main.h" |
15 #include "content/shell/shell_content_browser_client.h" | 15 #include "content/shell/shell_content_browser_client.h" |
16 #include "content/shell/shell_content_renderer_client.h" | 16 #include "content/shell/shell_content_renderer_client.h" |
17 #include "content/shell/shell_switches.h" | 17 #include "content/shell/shell_switches.h" |
18 #include "ui/base/resource/resource_bundle.h" | 18 #include "ui/base/resource/resource_bundle.h" |
19 #include "ui/base/ui_base_paths.h" | 19 #include "ui/base/ui_base_paths.h" |
20 | 20 |
21 #if defined(OS_ANDROID) | 21 #if defined(OS_ANDROID) |
22 #include "base/global_descriptors_posix.h" | 22 #include "base/global_descriptors_posix.h" |
23 #include "content/shell/android/shell_descriptors.h" | 23 #include "content/shell/android/shell_descriptors.h" |
24 #endif | 24 #endif |
25 | 25 |
26 #if defined(OS_MACOSX) | 26 #if defined(OS_MACOSX) |
27 #include "content/shell/paths_mac.h" | 27 #include "content/shell/paths_mac.h" |
28 #endif // OS_MACOSX | 28 #endif // OS_MACOSX |
29 | 29 |
| 30 #if defined(OS_WIN) |
| 31 #include "base/logging_win.h" |
| 32 #include <initguid.h> |
| 33 #endif |
| 34 |
30 namespace { | 35 namespace { |
31 | 36 |
| 37 #if defined(OS_WIN) |
| 38 // If "Content Shell" doesn't show up in your list of trace providers in |
| 39 // Sawbuck, add these registry entries to your machine (NOTE the optional |
| 40 // Wow6432Node key for x64 machines): |
| 41 // 1. Find: HKLM\SOFTWARE\[Wow6432Node\]Google\Sawbuck\Providers |
| 42 // 2. Add a subkey with the name "{6A3E50A4-7E15-4099-8413-EC94D8C2A4B6}" |
| 43 // 3. Add these values: |
| 44 // "default_flags"=dword:00000001 |
| 45 // "default_level"=dword:00000004 |
| 46 // @="Content Shell" |
| 47 |
| 48 // {6A3E50A4-7E15-4099-8413-EC94D8C2A4B6} |
| 49 const GUID kContentShellProviderName = { |
| 50 0x6a3e50a4, 0x7e15, 0x4099, |
| 51 { 0x84, 0x13, 0xec, 0x94, 0xd8, 0xc2, 0xa4, 0xb6 } }; |
| 52 #endif |
| 53 |
32 void InitLogging() { | 54 void InitLogging() { |
33 FilePath log_filename; | 55 FilePath log_filename; |
34 PathService::Get(base::DIR_EXE, &log_filename); | 56 PathService::Get(base::DIR_EXE, &log_filename); |
35 log_filename = log_filename.AppendASCII("content_shell.log"); | 57 log_filename = log_filename.AppendASCII("content_shell.log"); |
36 logging::InitLogging( | 58 logging::InitLogging( |
37 log_filename.value().c_str(), | 59 log_filename.value().c_str(), |
38 logging::LOG_ONLY_TO_FILE, | 60 logging::LOG_ONLY_TO_FILE, |
39 logging::LOCK_LOG_FILE, | 61 logging::LOCK_LOG_FILE, |
40 logging::DELETE_OLD_LOG_FILE, | 62 logging::DELETE_OLD_LOG_FILE, |
41 logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS); | 63 logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS); |
42 logging::SetLogItems(true, true, true, true); | 64 logging::SetLogItems(true, true, true, true); |
43 } | 65 } |
44 | 66 |
45 } // namespace | 67 } // namespace |
46 | 68 |
47 namespace content { | 69 namespace content { |
48 | 70 |
49 ShellMainDelegate::ShellMainDelegate() { | 71 ShellMainDelegate::ShellMainDelegate() { |
50 } | 72 } |
51 | 73 |
52 ShellMainDelegate::~ShellMainDelegate() { | 74 ShellMainDelegate::~ShellMainDelegate() { |
53 #if defined(OS_ANDROID) | 75 #if defined(OS_ANDROID) |
54 NOTREACHED(); | 76 NOTREACHED(); |
55 #endif | 77 #endif |
56 } | 78 } |
57 | 79 |
58 bool ShellMainDelegate::BasicStartupComplete(int* exit_code) { | 80 bool ShellMainDelegate::BasicStartupComplete(int* exit_code) { |
| 81 #if defined(OS_WIN) |
| 82 // Enable trace control and transport through event tracing for Windows. |
| 83 logging::LogEventProvider::Initialize(kContentShellProviderName); |
| 84 #endif |
| 85 |
59 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) { | 86 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) { |
60 InitLogging(); | 87 InitLogging(); |
61 CommandLine::ForCurrentProcess()->AppendSwitch( | 88 CommandLine::ForCurrentProcess()->AppendSwitch( |
62 switches::kAllowFileAccessFromFiles); | 89 switches::kAllowFileAccessFromFiles); |
63 } | 90 } |
64 #if defined(OS_MACOSX) | 91 #if defined(OS_MACOSX) |
65 OverrideFrameworkBundlePath(); | 92 OverrideFrameworkBundlePath(); |
66 #endif | 93 #endif |
67 SetContentClient(&content_client_); | 94 SetContentClient(&content_client_); |
68 return false; | 95 return false; |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 browser_client_.reset(new ShellContentBrowserClient); | 159 browser_client_.reset(new ShellContentBrowserClient); |
133 return browser_client_.get(); | 160 return browser_client_.get(); |
134 } | 161 } |
135 | 162 |
136 ContentRendererClient* ShellMainDelegate::CreateContentRendererClient() { | 163 ContentRendererClient* ShellMainDelegate::CreateContentRendererClient() { |
137 renderer_client_.reset(new ShellContentRendererClient); | 164 renderer_client_.reset(new ShellContentRendererClient); |
138 return renderer_client_.get(); | 165 return renderer_client_.get(); |
139 } | 166 } |
140 | 167 |
141 } // namespace content | 168 } // namespace content |
OLD | NEW |