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_frame_observer.h" |
15 #include "content/shell/renderer/shell_render_process_observer.h" | 16 #include "content/shell/renderer/shell_render_process_observer.h" |
16 #include "content/shell/renderer/shell_render_view_observer.h" | 17 #include "content/shell/renderer/shell_render_view_observer.h" |
17 #include "content/shell/renderer/webkit_test_runner.h" | 18 #include "content/shell/renderer/webkit_test_runner.h" |
18 #include "content/test/mock_webclipboard_impl.h" | 19 #include "content/test/mock_webclipboard_impl.h" |
19 #include "third_party/WebKit/public/platform/WebMediaStreamCenter.h" | 20 #include "third_party/WebKit/public/platform/WebMediaStreamCenter.h" |
20 #include "third_party/WebKit/public/testing/WebTestInterfaces.h" | 21 #include "third_party/WebKit/public/testing/WebTestInterfaces.h" |
21 #include "third_party/WebKit/public/testing/WebTestProxy.h" | 22 #include "third_party/WebKit/public/testing/WebTestProxy.h" |
22 #include "third_party/WebKit/public/testing/WebTestRunner.h" | 23 #include "third_party/WebKit/public/testing/WebTestRunner.h" |
23 #include "third_party/WebKit/public/web/WebPluginParams.h" | 24 #include "third_party/WebKit/public/web/WebPluginParams.h" |
24 #include "third_party/WebKit/public/web/WebView.h" | 25 #include "third_party/WebKit/public/web/WebView.h" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 | 67 |
67 void ShellContentRendererClient::RenderThreadStarted() { | 68 void ShellContentRendererClient::RenderThreadStarted() { |
68 shell_observer_.reset(new ShellRenderProcessObserver()); | 69 shell_observer_.reset(new ShellRenderProcessObserver()); |
69 #if defined(OS_MACOSX) | 70 #if defined(OS_MACOSX) |
70 // We need to call this once before the sandbox was initialized to cache the | 71 // We need to call this once before the sandbox was initialized to cache the |
71 // value. | 72 // value. |
72 base::debug::BeingDebugged(); | 73 base::debug::BeingDebugged(); |
73 #endif | 74 #endif |
74 } | 75 } |
75 | 76 |
| 77 void ShellContentRendererClient::RenderFrameCreated(RenderFrame* render_frame) { |
| 78 new ShellRenderFrameObserver(render_frame); |
| 79 } |
| 80 |
76 void ShellContentRendererClient::RenderViewCreated(RenderView* render_view) { | 81 void ShellContentRendererClient::RenderViewCreated(RenderView* render_view) { |
77 new ShellRenderViewObserver(render_view); | 82 new ShellRenderViewObserver(render_view); |
78 | 83 |
79 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) | 84 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) |
80 return; | 85 return; |
81 WebKitTestRunner* test_runner = WebKitTestRunner::Get(render_view); | 86 WebKitTestRunner* test_runner = WebKitTestRunner::Get(render_view); |
82 test_runner->Reset(); | 87 test_runner->Reset(); |
83 render_view->GetWebView()->setSpellCheckClient( | 88 render_view->GetWebView()->setSpellCheckClient( |
84 test_runner->proxy()->spellCheckClient()); | 89 test_runner->proxy()->spellCheckClient()); |
85 render_view->GetWebView()->setValidationMessageClient( | 90 render_view->GetWebView()->setValidationMessageClient( |
86 test_runner->proxy()->validationMessageClient()); | 91 test_runner->proxy()->validationMessageClient()); |
87 render_view->GetWebView()->setPermissionClient( | |
88 ShellRenderProcessObserver::GetInstance()->test_interfaces()->testRunner() | |
89 ->webPermissions()); | |
90 WebTestDelegate* delegate = | 92 WebTestDelegate* delegate = |
91 ShellRenderProcessObserver::GetInstance()->test_delegate(); | 93 ShellRenderProcessObserver::GetInstance()->test_delegate(); |
92 if (delegate == static_cast<WebTestDelegate*>(test_runner)) | 94 if (delegate == static_cast<WebTestDelegate*>(test_runner)) |
93 ShellRenderProcessObserver::GetInstance()->SetMainWindow(render_view); | 95 ShellRenderProcessObserver::GetInstance()->SetMainWindow(render_view); |
94 } | 96 } |
95 | 97 |
96 bool ShellContentRendererClient::OverrideCreatePlugin( | 98 bool ShellContentRendererClient::OverrideCreatePlugin( |
97 RenderFrame* render_frame, | 99 RenderFrame* render_frame, |
98 WebFrame* frame, | 100 WebFrame* frame, |
99 const WebPluginParams& params, | 101 const WebPluginParams& params, |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 if (CommandLine::ForCurrentProcess()->HasSwitch( | 186 if (CommandLine::ForCurrentProcess()->HasSwitch( |
185 switches::kEnableBrowserPluginForAllViewTypes)) { | 187 switches::kEnableBrowserPluginForAllViewTypes)) { |
186 // Allow BrowserPlugin if forced by command line flag. This is generally | 188 // Allow BrowserPlugin if forced by command line flag. This is generally |
187 // true for tests. | 189 // true for tests. |
188 return true; | 190 return true; |
189 } | 191 } |
190 return ContentRendererClient::AllowBrowserPlugin(container); | 192 return ContentRendererClient::AllowBrowserPlugin(container); |
191 } | 193 } |
192 | 194 |
193 } // namespace content | 195 } // namespace content |
OLD | NEW |