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 "content/public/common/content_constants.h" | 9 #include "content/public/common/content_constants.h" |
10 #include "content/public/common/content_switches.h" | 10 #include "content/public/common/content_switches.h" |
11 #include "content/public/common/url_constants.h" | 11 #include "content/public/common/url_constants.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/shell_render_process_observer.h" | 14 #include "content/shell/shell_render_process_observer.h" |
15 #include "content/shell/shell_switches.h" | 15 #include "content/shell/shell_switches.h" |
16 #include "content/shell/webkit_test_runner.h" | 16 #include "content/shell/webkit_test_runner.h" |
17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" | 17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" |
18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginParams.h" | 18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginParams.h" |
19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" | 19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" |
20 #include "third_party/WebKit/Tools/DumpRenderTree/chromium/TestRunner/public/Web
TestPlugin.h" | |
21 #include "third_party/WebKit/Tools/DumpRenderTree/chromium/TestRunner/public/Web
TestProxy.h" | 20 #include "third_party/WebKit/Tools/DumpRenderTree/chromium/TestRunner/public/Web
TestProxy.h" |
22 #include "v8/include/v8.h" | 21 #include "v8/include/v8.h" |
23 | 22 |
24 using WebKit::WebFrame; | 23 using WebKit::WebFrame; |
25 using WebTestRunner::WebTestPlugin; | |
26 using WebTestRunner::WebTestProxyBase; | 24 using WebTestRunner::WebTestProxyBase; |
27 | 25 |
28 namespace content { | 26 namespace content { |
29 | 27 |
30 namespace { | 28 namespace { |
31 | 29 |
32 bool IsLocalhost(const std::string& host) { | 30 bool IsLocalhost(const std::string& host) { |
33 return host == "127.0.0.1" || host == "localhost"; | 31 return host == "127.0.0.1" || host == "localhost"; |
34 } | 32 } |
35 | 33 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 WebKit::WebFrame* frame, | 69 WebKit::WebFrame* frame, |
72 const WebKit::WebPluginParams& params, | 70 const WebKit::WebPluginParams& params, |
73 WebKit::WebPlugin** plugin) { | 71 WebKit::WebPlugin** plugin) { |
74 std::string mime_type = params.mimeType.utf8(); | 72 std::string mime_type = params.mimeType.utf8(); |
75 if (mime_type == content::kBrowserPluginMimeType) { | 73 if (mime_type == content::kBrowserPluginMimeType) { |
76 // Allow browser plugin in content_shell only if it is forced by flag. | 74 // Allow browser plugin in content_shell only if it is forced by flag. |
77 // Returning true here disables the plugin. | 75 // Returning true here disables the plugin. |
78 return !CommandLine::ForCurrentProcess()->HasSwitch( | 76 return !CommandLine::ForCurrentProcess()->HasSwitch( |
79 switches::kEnableBrowserPluginForAllViewTypes); | 77 switches::kEnableBrowserPluginForAllViewTypes); |
80 } | 78 } |
81 if (params.mimeType == WebTestPlugin::mimeType()) { | |
82 *plugin = WebTestPlugin::create( | |
83 frame, | |
84 params, | |
85 ShellRenderProcessObserver::GetInstance()->test_delegate()); | |
86 return true; | |
87 } | |
88 return false; | 79 return false; |
89 } | 80 } |
90 | 81 |
91 bool ShellContentRendererClient::WillSendRequest( | 82 bool ShellContentRendererClient::WillSendRequest( |
92 WebFrame* frame, | 83 WebFrame* frame, |
93 PageTransition transition_type, | 84 PageTransition transition_type, |
94 const GURL& url, | 85 const GURL& url, |
95 const GURL& first_party_for_cookies, | 86 const GURL& first_party_for_cookies, |
96 GURL* new_url) { | 87 GURL* new_url) { |
97 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 88 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
(...skipping 11 matching lines...) Expand all Loading... |
109 return true; | 100 return true; |
110 } | 101 } |
111 if (render_process_observer->test_delegate()) { | 102 if (render_process_observer->test_delegate()) { |
112 *new_url = render_process_observer->test_delegate()->rewriteLayoutTestsURL( | 103 *new_url = render_process_observer->test_delegate()->rewriteLayoutTestsURL( |
113 url.spec()); | 104 url.spec()); |
114 } | 105 } |
115 return true; | 106 return true; |
116 } | 107 } |
117 | 108 |
118 } // namespace content | 109 } // namespace content |
OLD | NEW |