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/renderer/shell_content_renderer_client.h" | 5 #include "content/shell/renderer/shell_content_renderer_client.h" |
6 | 6 |
7 #include "base/callback.h" | 7 #include "base/callback.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/debug/debugger.h" | 9 #include "base/debug/debugger.h" |
10 #include "content/public/common/content_constants.h" | 10 #include "content/public/common/content_constants.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 using blink::WebPluginParams; | 36 using blink::WebPluginParams; |
37 using blink::WebRTCPeerConnectionHandler; | 37 using blink::WebRTCPeerConnectionHandler; |
38 using blink::WebRTCPeerConnectionHandlerClient; | 38 using blink::WebRTCPeerConnectionHandlerClient; |
39 using blink::WebThemeEngine; | 39 using blink::WebThemeEngine; |
40 using WebTestRunner::WebTestDelegate; | 40 using WebTestRunner::WebTestDelegate; |
41 using WebTestRunner::WebTestInterfaces; | 41 using WebTestRunner::WebTestInterfaces; |
42 using WebTestRunner::WebTestProxyBase; | 42 using WebTestRunner::WebTestProxyBase; |
43 | 43 |
44 namespace content { | 44 namespace content { |
45 | 45 |
46 namespace { | |
47 ShellContentRendererClient* g_renderer_client; | |
48 } | |
49 | |
50 ShellContentRendererClient* ShellContentRendererClient::Get() { | |
51 return g_renderer_client; | |
52 } | |
53 | |
54 ShellContentRendererClient::ShellContentRendererClient() { | 46 ShellContentRendererClient::ShellContentRendererClient() { |
55 DCHECK(!g_renderer_client); | |
56 g_renderer_client = this; | |
57 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) { | 47 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) { |
58 EnableWebTestProxyCreation( | 48 EnableWebTestProxyCreation( |
59 base::Bind(&ShellContentRendererClient::WebTestProxyCreated, | 49 base::Bind(&ShellContentRendererClient::WebTestProxyCreated, |
60 base::Unretained(this))); | 50 base::Unretained(this))); |
61 } | 51 } |
62 } | 52 } |
63 | 53 |
64 ShellContentRendererClient::~ShellContentRendererClient() { | 54 ShellContentRendererClient::~ShellContentRendererClient() { |
65 g_renderer_client = NULL; | |
66 } | 55 } |
67 | 56 |
68 void ShellContentRendererClient::RenderThreadStarted() { | 57 void ShellContentRendererClient::RenderThreadStarted() { |
69 shell_observer_.reset(new ShellRenderProcessObserver()); | 58 shell_observer_.reset(new ShellRenderProcessObserver()); |
70 #if defined(OS_MACOSX) | 59 #if defined(OS_MACOSX) |
71 // We need to call this once before the sandbox was initialized to cache the | 60 // We need to call this once before the sandbox was initialized to cache the |
72 // value. | 61 // value. |
73 base::debug::BeingDebugged(); | 62 base::debug::BeingDebugged(); |
74 #endif | 63 #endif |
75 } | 64 } |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 if (CommandLine::ForCurrentProcess()->HasSwitch( | 173 if (CommandLine::ForCurrentProcess()->HasSwitch( |
185 switches::kEnableBrowserPluginForAllViewTypes)) { | 174 switches::kEnableBrowserPluginForAllViewTypes)) { |
186 // Allow BrowserPlugin if forced by command line flag. This is generally | 175 // Allow BrowserPlugin if forced by command line flag. This is generally |
187 // true for tests. | 176 // true for tests. |
188 return true; | 177 return true; |
189 } | 178 } |
190 return ContentRendererClient::AllowBrowserPlugin(container); | 179 return ContentRendererClient::AllowBrowserPlugin(container); |
191 } | 180 } |
192 | 181 |
193 } // namespace content | 182 } // namespace content |
OLD | NEW |