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 "content/public/common/content_constants.h" | 10 #include "content/public/common/content_constants.h" |
10 #include "content/public/common/content_switches.h" | 11 #include "content/public/common/content_switches.h" |
11 #include "content/public/common/url_constants.h" | 12 #include "content/public/common/url_constants.h" |
12 #include "content/public/renderer/render_view.h" | 13 #include "content/public/renderer/render_view.h" |
13 #include "content/public/test/layouttest_support.h" | 14 #include "content/public/test/layouttest_support.h" |
14 #include "content/shell/shell_render_process_observer.h" | 15 #include "content/shell/shell_render_process_observer.h" |
15 #include "content/shell/shell_switches.h" | 16 #include "content/shell/shell_switches.h" |
16 #include "content/shell/webkit_test_runner.h" | 17 #include "content/shell/webkit_test_runner.h" |
17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" | 18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" |
18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginParams.h" | 19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginParams.h" |
(...skipping 27 matching lines...) Expand all Loading... |
46 } // namespace | 47 } // namespace |
47 | 48 |
48 ShellContentRendererClient::ShellContentRendererClient() { | 49 ShellContentRendererClient::ShellContentRendererClient() { |
49 } | 50 } |
50 | 51 |
51 ShellContentRendererClient::~ShellContentRendererClient() { | 52 ShellContentRendererClient::~ShellContentRendererClient() { |
52 } | 53 } |
53 | 54 |
54 void ShellContentRendererClient::RenderThreadStarted() { | 55 void ShellContentRendererClient::RenderThreadStarted() { |
55 shell_observer_.reset(new ShellRenderProcessObserver()); | 56 shell_observer_.reset(new ShellRenderProcessObserver()); |
| 57 #if defined(OS_MACOSX) |
| 58 // We need to call this once before the sandbox was initialized to cache the |
| 59 // value. |
| 60 base::debug::BeingDebugged(); |
| 61 #endif |
56 } | 62 } |
57 | 63 |
58 void ShellContentRendererClient::RenderViewCreated(RenderView* render_view) { | 64 void ShellContentRendererClient::RenderViewCreated(RenderView* render_view) { |
59 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) | 65 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) |
60 return; | 66 return; |
61 WebKitTestRunner* test_runner = new WebKitTestRunner(render_view); | 67 WebKitTestRunner* test_runner = new WebKitTestRunner(render_view); |
62 if (!ShellRenderProcessObserver::GetInstance()->test_delegate()) { | 68 if (!ShellRenderProcessObserver::GetInstance()->test_delegate()) { |
63 ShellRenderProcessObserver::GetInstance()->SetMainWindow(render_view, | 69 ShellRenderProcessObserver::GetInstance()->SetMainWindow(render_view, |
64 test_runner, | 70 test_runner, |
65 test_runner); | 71 test_runner); |
66 } | 72 } |
67 } | 73 } |
68 | 74 |
69 bool ShellContentRendererClient::OverrideCreatePlugin( | 75 bool ShellContentRendererClient::OverrideCreatePlugin( |
70 RenderView* render_view, | 76 RenderView* render_view, |
71 WebKit::WebFrame* frame, | 77 WebKit::WebFrame* frame, |
72 const WebKit::WebPluginParams& params, | 78 const WebKit::WebPluginParams& params, |
73 WebKit::WebPlugin** plugin) { | 79 WebKit::WebPlugin** plugin) { |
74 std::string mime_type = params.mimeType.utf8(); | 80 std::string mime_type = params.mimeType.utf8(); |
75 if (mime_type == content::kBrowserPluginMimeType) { | 81 if (mime_type == content::kBrowserPluginMimeType) { |
76 // Allow browser plugin in content_shell only if it is forced by flag. | 82 // Allow browser plugin in content_shell only if it is forced by flag. |
77 // Returning true here disables the plugin. | 83 // Returning true here disables the plugin. |
78 return !CommandLine::ForCurrentProcess()->HasSwitch( | 84 return !CommandLine::ForCurrentProcess()->HasSwitch( |
79 switches::kEnableBrowserPluginForAllViewTypes); | 85 switches::kEnableBrowserPluginForAllViewTypes); |
80 } | 86 } |
81 return false; | 87 return false; |
82 } | 88 } |
83 | 89 |
84 } // namespace content | 90 } // namespace content |
OLD | NEW |