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" |
11 #include "content/public/common/content_switches.h" | 11 #include "content/public/common/content_switches.h" |
12 #include "content/public/renderer/render_view.h" | 12 #include "content/public/renderer/render_view.h" |
13 #include "content/public/test/layouttest_support.h" | 13 #include "content/public/test/layouttest_support.h" |
14 #include "content/shell/common/shell_switches.h" | 14 #include "content/shell/common/shell_switches.h" |
15 #include "content/shell/renderer/shell_render_process_observer.h" | 15 #include "content/shell/renderer/shell_render_process_observer.h" |
| 16 #include "content/shell/renderer/shell_render_view_observer.h" |
16 #include "content/shell/renderer/webkit_test_runner.h" | 17 #include "content/shell/renderer/webkit_test_runner.h" |
17 #include "third_party/WebKit/public/platform/WebMediaStreamCenter.h" | 18 #include "third_party/WebKit/public/platform/WebMediaStreamCenter.h" |
18 #include "third_party/WebKit/public/testing/WebTestInterfaces.h" | 19 #include "third_party/WebKit/public/testing/WebTestInterfaces.h" |
19 #include "third_party/WebKit/public/testing/WebTestProxy.h" | 20 #include "third_party/WebKit/public/testing/WebTestProxy.h" |
20 #include "third_party/WebKit/public/testing/WebTestRunner.h" | 21 #include "third_party/WebKit/public/testing/WebTestRunner.h" |
21 #include "third_party/WebKit/public/web/WebPluginParams.h" | 22 #include "third_party/WebKit/public/web/WebPluginParams.h" |
22 #include "third_party/WebKit/public/web/WebView.h" | 23 #include "third_party/WebKit/public/web/WebView.h" |
23 #include "v8/include/v8.h" | 24 #include "v8/include/v8.h" |
24 #include "webkit/mocks/mock_webhyphenator.h" | 25 #include "webkit/mocks/mock_webhyphenator.h" |
25 #include "webkit/support/mock_webclipboard_impl.h" | 26 #include "webkit/support/mock_webclipboard_impl.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 void ShellContentRendererClient::RenderThreadStarted() { | 74 void ShellContentRendererClient::RenderThreadStarted() { |
74 shell_observer_.reset(new ShellRenderProcessObserver()); | 75 shell_observer_.reset(new ShellRenderProcessObserver()); |
75 #if defined(OS_MACOSX) | 76 #if defined(OS_MACOSX) |
76 // We need to call this once before the sandbox was initialized to cache the | 77 // We need to call this once before the sandbox was initialized to cache the |
77 // value. | 78 // value. |
78 base::debug::BeingDebugged(); | 79 base::debug::BeingDebugged(); |
79 #endif | 80 #endif |
80 } | 81 } |
81 | 82 |
82 void ShellContentRendererClient::RenderViewCreated(RenderView* render_view) { | 83 void ShellContentRendererClient::RenderViewCreated(RenderView* render_view) { |
| 84 new ShellRenderViewObserver(render_view); |
| 85 |
83 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) | 86 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) |
84 return; | 87 return; |
85 WebKitTestRunner* test_runner = WebKitTestRunner::Get(render_view); | 88 WebKitTestRunner* test_runner = WebKitTestRunner::Get(render_view); |
86 test_runner->Reset(); | 89 test_runner->Reset(); |
87 render_view->GetWebView()->setSpellCheckClient( | 90 render_view->GetWebView()->setSpellCheckClient( |
88 test_runner->proxy()->spellCheckClient()); | 91 test_runner->proxy()->spellCheckClient()); |
89 render_view->GetWebView()->setValidationMessageClient( | 92 render_view->GetWebView()->setValidationMessageClient( |
90 test_runner->proxy()->validationMessageClient()); | 93 test_runner->proxy()->validationMessageClient()); |
91 render_view->GetWebView()->setPermissionClient( | 94 render_view->GetWebView()->setPermissionClient( |
92 ShellRenderProcessObserver::GetInstance()->test_interfaces()->testRunner() | 95 ShellRenderProcessObserver::GetInstance()->test_interfaces()->testRunner() |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 if (CommandLine::ForCurrentProcess()->HasSwitch( | 184 if (CommandLine::ForCurrentProcess()->HasSwitch( |
182 switches::kEnableBrowserPluginForAllViewTypes)) { | 185 switches::kEnableBrowserPluginForAllViewTypes)) { |
183 // Allow BrowserPlugin if forced by command line flag. This is generally | 186 // Allow BrowserPlugin if forced by command line flag. This is generally |
184 // true for tests. | 187 // true for tests. |
185 return true; | 188 return true; |
186 } | 189 } |
187 return ContentRendererClient::AllowBrowserPlugin(container); | 190 return ContentRendererClient::AllowBrowserPlugin(container); |
188 } | 191 } |
189 | 192 |
190 } // namespace content | 193 } // namespace content |
OLD | NEW |