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_content_renderer_client.h" | 5 #include "content/shell/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 24 matching lines...) Expand all Loading... |
35 using WebKit::WebPluginParams; | 35 using WebKit::WebPluginParams; |
36 using WebKit::WebRTCPeerConnectionHandler; | 36 using WebKit::WebRTCPeerConnectionHandler; |
37 using WebKit::WebRTCPeerConnectionHandlerClient; | 37 using WebKit::WebRTCPeerConnectionHandlerClient; |
38 using WebKit::WebThemeEngine; | 38 using WebKit::WebThemeEngine; |
39 using WebTestRunner::WebTestDelegate; | 39 using WebTestRunner::WebTestDelegate; |
40 using WebTestRunner::WebTestInterfaces; | 40 using WebTestRunner::WebTestInterfaces; |
41 using WebTestRunner::WebTestProxyBase; | 41 using WebTestRunner::WebTestProxyBase; |
42 | 42 |
43 namespace content { | 43 namespace content { |
44 | 44 |
| 45 namespace { |
| 46 ShellContentRendererClient* g_renderer_client; |
| 47 } |
| 48 |
| 49 ShellContentRendererClient* ShellContentRendererClient::Get() { |
| 50 return g_renderer_client; |
| 51 } |
| 52 |
45 ShellContentRendererClient::ShellContentRendererClient() { | 53 ShellContentRendererClient::ShellContentRendererClient() { |
| 54 DCHECK(!g_renderer_client); |
| 55 g_renderer_client = this; |
46 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) { | 56 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) { |
47 EnableWebTestProxyCreation( | 57 EnableWebTestProxyCreation( |
48 base::Bind(&ShellContentRendererClient::WebTestProxyCreated, | 58 base::Bind(&ShellContentRendererClient::WebTestProxyCreated, |
49 base::Unretained(this))); | 59 base::Unretained(this))); |
50 } | 60 } |
51 } | 61 } |
52 | 62 |
53 ShellContentRendererClient::~ShellContentRendererClient() { | 63 ShellContentRendererClient::~ShellContentRendererClient() { |
| 64 g_renderer_client = NULL; |
54 } | 65 } |
55 | 66 |
56 void ShellContentRendererClient::LoadHyphenDictionary( | 67 void ShellContentRendererClient::LoadHyphenDictionary( |
57 base::PlatformFile dict_file) { | 68 base::PlatformFile dict_file) { |
58 if (!hyphenator_) | 69 if (!hyphenator_) |
59 hyphenator_.reset(new webkit_glue::MockWebHyphenator); | 70 hyphenator_.reset(new webkit_glue::MockWebHyphenator); |
60 base::SeekPlatformFile(dict_file, base::PLATFORM_FILE_FROM_BEGIN, 0); | 71 base::SeekPlatformFile(dict_file, base::PLATFORM_FILE_FROM_BEGIN, 0); |
61 hyphenator_->LoadDictionary(dict_file); | 72 hyphenator_->LoadDictionary(dict_file); |
62 } | 73 } |
63 | 74 |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 if (CommandLine::ForCurrentProcess()->HasSwitch( | 189 if (CommandLine::ForCurrentProcess()->HasSwitch( |
179 switches::kEnableBrowserPluginForAllViewTypes)) { | 190 switches::kEnableBrowserPluginForAllViewTypes)) { |
180 // Allow BrowserPlugin if forced by command line flag. This is generally | 191 // Allow BrowserPlugin if forced by command line flag. This is generally |
181 // true for tests. | 192 // true for tests. |
182 return true; | 193 return true; |
183 } | 194 } |
184 return ContentRendererClient::AllowBrowserPlugin(container); | 195 return ContentRendererClient::AllowBrowserPlugin(container); |
185 } | 196 } |
186 | 197 |
187 } // namespace content | 198 } // namespace content |
OLD | NEW |