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 "components/web_cache/renderer/web_cache_render_process_observer.h" |
10 #include "content/common/sandbox_win.h" | 11 #include "content/common/sandbox_win.h" |
11 #include "content/public/common/content_constants.h" | 12 #include "content/public/common/content_constants.h" |
12 #include "content/public/common/content_switches.h" | 13 #include "content/public/common/content_switches.h" |
| 14 #include "content/public/renderer/render_thread.h" |
13 #include "content/public/renderer/render_view.h" | 15 #include "content/public/renderer/render_view.h" |
14 #include "content/public/test/layouttest_support.h" | 16 #include "content/public/test/layouttest_support.h" |
15 #include "content/shell/common/shell_switches.h" | 17 #include "content/shell/common/shell_switches.h" |
16 #include "content/shell/common/webkit_test_helpers.h" | 18 #include "content/shell/common/webkit_test_helpers.h" |
17 #include "content/shell/renderer/shell_render_frame_observer.h" | 19 #include "content/shell/renderer/shell_render_frame_observer.h" |
18 #include "content/shell/renderer/shell_render_process_observer.h" | 20 #include "content/shell/renderer/shell_render_process_observer.h" |
19 #include "content/shell/renderer/shell_render_view_observer.h" | 21 #include "content/shell/renderer/shell_render_view_observer.h" |
20 #include "content/shell/renderer/test_runner/WebTestInterfaces.h" | 22 #include "content/shell/renderer/test_runner/WebTestInterfaces.h" |
21 #include "content/shell/renderer/test_runner/web_test_proxy.h" | 23 #include "content/shell/renderer/test_runner/web_test_proxy.h" |
22 #include "content/shell/renderer/webkit_test_runner.h" | 24 #include "content/shell/renderer/webkit_test_runner.h" |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 #if defined(OS_WIN) | 79 #if defined(OS_WIN) |
78 if (ShouldUseDirectWrite()) | 80 if (ShouldUseDirectWrite()) |
79 RegisterSideloadedTypefaces(GetPreSandboxWarmupFontMgr()); | 81 RegisterSideloadedTypefaces(GetPreSandboxWarmupFontMgr()); |
80 #endif | 82 #endif |
81 } | 83 } |
82 | 84 |
83 ShellContentRendererClient::~ShellContentRendererClient() { | 85 ShellContentRendererClient::~ShellContentRendererClient() { |
84 } | 86 } |
85 | 87 |
86 void ShellContentRendererClient::RenderThreadStarted() { | 88 void ShellContentRendererClient::RenderThreadStarted() { |
| 89 RenderThread* thread = RenderThread::Get(); |
87 shell_observer_.reset(new ShellRenderProcessObserver()); | 90 shell_observer_.reset(new ShellRenderProcessObserver()); |
| 91 web_cache_observer_.reset(new web_cache::WebCacheRenderProcessObserver()); |
88 #if defined(OS_MACOSX) | 92 #if defined(OS_MACOSX) |
89 // We need to call this once before the sandbox was initialized to cache the | 93 // We need to call this once before the sandbox was initialized to cache the |
90 // value. | 94 // value. |
91 base::debug::BeingDebugged(); | 95 base::debug::BeingDebugged(); |
92 #endif | 96 #endif |
| 97 thread->AddObserver(web_cache_observer_.get()); |
93 } | 98 } |
94 | 99 |
95 void ShellContentRendererClient::RenderFrameCreated(RenderFrame* render_frame) { | 100 void ShellContentRendererClient::RenderFrameCreated(RenderFrame* render_frame) { |
96 new ShellRenderFrameObserver(render_frame); | 101 new ShellRenderFrameObserver(render_frame); |
97 } | 102 } |
98 | 103 |
99 void ShellContentRendererClient::RenderViewCreated(RenderView* render_view) { | 104 void ShellContentRendererClient::RenderViewCreated(RenderView* render_view) { |
100 new ShellRenderViewObserver(render_view); | 105 new ShellRenderViewObserver(render_view); |
101 | 106 |
102 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) | 107 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 return CommandLine::ForCurrentProcess()->HasSwitch( | 208 return CommandLine::ForCurrentProcess()->HasSwitch( |
204 switches::kEnablePepperTesting); | 209 switches::kEnablePepperTesting); |
205 } | 210 } |
206 | 211 |
207 bool ShellContentRendererClient::IsPluginAllowedToUseDevChannelAPIs() { | 212 bool ShellContentRendererClient::IsPluginAllowedToUseDevChannelAPIs() { |
208 return CommandLine::ForCurrentProcess()->HasSwitch( | 213 return CommandLine::ForCurrentProcess()->HasSwitch( |
209 switches::kEnablePepperTesting); | 214 switches::kEnablePepperTesting); |
210 } | 215 } |
211 | 216 |
212 } // namespace content | 217 } // namespace content |
OLD | NEW |