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/files/file_path.h" | 8 #include "base/files/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" |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 } | 87 } |
88 | 88 |
89 ShellMainDelegate::~ShellMainDelegate() { | 89 ShellMainDelegate::~ShellMainDelegate() { |
90 } | 90 } |
91 | 91 |
92 bool ShellMainDelegate::BasicStartupComplete(int* exit_code) { | 92 bool ShellMainDelegate::BasicStartupComplete(int* exit_code) { |
93 #if defined(OS_WIN) | 93 #if defined(OS_WIN) |
94 // Enable trace control and transport through event tracing for Windows. | 94 // Enable trace control and transport through event tracing for Windows. |
95 logging::LogEventProvider::Initialize(kContentShellProviderName); | 95 logging::LogEventProvider::Initialize(kContentShellProviderName); |
96 #endif | 96 #endif |
| 97 #if defined(OS_MACOSX) |
| 98 // Needs to happen before InitializeResourceBundle() and before |
| 99 // WebKitTestPlatformInitialize() are called. |
| 100 OverrideFrameworkBundlePath(); |
| 101 OverrideChildProcessPath(); |
| 102 #endif // OS_MACOSX |
97 | 103 |
98 InitLogging(); | 104 InitLogging(); |
99 CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 105 CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
100 if (command_line.HasSwitch(switches::kDumpRenderTree)) { | 106 if (command_line.HasSwitch(switches::kDumpRenderTree)) { |
101 command_line.AppendSwitch(switches::kAllowFileAccessFromFiles); | 107 command_line.AppendSwitch(switches::kAllowFileAccessFromFiles); |
102 command_line.AppendSwitchASCII( | 108 command_line.AppendSwitchASCII( |
103 switches::kUseGL, gfx::kGLImplementationOSMesaName); | 109 switches::kUseGL, gfx::kGLImplementationOSMesaName); |
104 SetAllowOSMesaImageTransportForTesting(); | 110 SetAllowOSMesaImageTransportForTesting(); |
105 command_line.AppendSwitch(switches::kIgnoreGpuBlacklist); | 111 command_line.AppendSwitch(switches::kIgnoreGpuBlacklist); |
106 command_line.AppendSwitch(switches::kEnableExperimentalWebKitFeatures); | 112 command_line.AppendSwitch(switches::kEnableExperimentalWebKitFeatures); |
107 command_line.AppendSwitch(switches::kEnableCssShaders); | 113 command_line.AppendSwitch(switches::kEnableCssShaders); |
108 command_line.AppendSwitchASCII(switches::kTouchEvents, | 114 command_line.AppendSwitchASCII(switches::kTouchEvents, |
109 switches::kTouchEventsEnabled); | 115 switches::kTouchEventsEnabled); |
110 if (command_line.HasSwitch(switches::kEnableSoftwareCompositing)) | 116 if (command_line.HasSwitch(switches::kEnableSoftwareCompositing)) |
111 command_line.AppendSwitch(switches::kEnableSoftwareCompositingGLAdapter); | 117 command_line.AppendSwitch(switches::kEnableSoftwareCompositingGLAdapter); |
112 | 118 |
113 net::CookieMonster::EnableFileScheme(); | 119 net::CookieMonster::EnableFileScheme(); |
114 if (!WebKitTestPlatformInitialize()) { | 120 if (!WebKitTestPlatformInitialize()) { |
115 if (exit_code) | 121 if (exit_code) |
116 *exit_code = 1; | 122 *exit_code = 1; |
117 return true; | 123 return true; |
118 } | 124 } |
119 } | 125 } |
120 SetContentClient(&content_client_); | 126 SetContentClient(&content_client_); |
121 return false; | 127 return false; |
122 } | 128 } |
123 | 129 |
124 void ShellMainDelegate::PreSandboxStartup() { | 130 void ShellMainDelegate::PreSandboxStartup() { |
125 #if defined(OS_MACOSX) | |
126 OverrideFrameworkBundlePath(); | |
127 OverrideChildProcessPath(); | |
128 #endif // OS_MACOSX | |
129 InitializeResourceBundle(); | 131 InitializeResourceBundle(); |
130 } | 132 } |
131 | 133 |
132 int ShellMainDelegate::RunProcess( | 134 int ShellMainDelegate::RunProcess( |
133 const std::string& process_type, | 135 const std::string& process_type, |
134 const MainFunctionParams& main_function_params) { | 136 const MainFunctionParams& main_function_params) { |
135 if (!process_type.empty()) | 137 if (!process_type.empty()) |
136 return -1; | 138 return -1; |
137 | 139 |
138 #if !defined(OS_ANDROID) | 140 #if !defined(OS_ANDROID) |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 browser_client_.reset(new ShellContentBrowserClient); | 188 browser_client_.reset(new ShellContentBrowserClient); |
187 return browser_client_.get(); | 189 return browser_client_.get(); |
188 } | 190 } |
189 | 191 |
190 ContentRendererClient* ShellMainDelegate::CreateContentRendererClient() { | 192 ContentRendererClient* ShellMainDelegate::CreateContentRendererClient() { |
191 renderer_client_.reset(new ShellContentRendererClient); | 193 renderer_client_.reset(new ShellContentRendererClient); |
192 return renderer_client_.get(); | 194 return renderer_client_.get(); |
193 } | 195 } |
194 | 196 |
195 } // namespace content | 197 } // namespace content |
OLD | NEW |