OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chromecast/renderer/cast_content_renderer_client.h" | 5 #include "chromecast/renderer/cast_content_renderer_client.h" |
6 | 6 |
7 #include <sys/sysinfo.h> | 7 #include <sys/sysinfo.h> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
11 #include "base/memory/memory_pressure_listener.h" | 11 #include "base/memory/memory_pressure_listener.h" |
12 #include "base/strings/string_number_conversions.h" | 12 #include "base/strings/string_number_conversions.h" |
13 #include "base/thread_task_runner_handle.h" | 13 #include "base/thread_task_runner_handle.h" |
14 #include "chromecast/base/chromecast_switches.h" | 14 #include "chromecast/base/chromecast_switches.h" |
15 #include "chromecast/crash/cast_crash_keys.h" | 15 #include "chromecast/crash/cast_crash_keys.h" |
16 #include "chromecast/media/base/media_caps.h" | 16 #include "chromecast/media/base/media_caps.h" |
17 #include "chromecast/renderer/cast_media_load_deferrer.h" | 17 #include "chromecast/renderer/cast_media_load_deferrer.h" |
18 #include "chromecast/renderer/cast_render_process_observer.h" | 18 #include "chromecast/renderer/cast_render_process_observer.h" |
19 #include "chromecast/renderer/key_systems_cast.h" | 19 #include "chromecast/renderer/key_systems_cast.h" |
20 #include "chromecast/renderer/media/chromecast_media_renderer_factory.h" | 20 #include "chromecast/renderer/media/chromecast_media_renderer_factory.h" |
21 #include "components/network_hints/renderer/prescient_networking_dispatcher.h" | 21 #include "components/network_hints/renderer/prescient_networking_dispatcher.h" |
22 #include "content/public/common/content_switches.h" | 22 #include "content/public/common/content_switches.h" |
23 #include "content/public/renderer/render_frame.h" | 23 #include "content/public/renderer/render_frame.h" |
24 #include "content/public/renderer/render_view.h" | 24 #include "content/public/renderer/render_view.h" |
25 #include "content/public/renderer/render_view_observer.h" | 25 #include "content/public/renderer/render_view_observer.h" |
26 #include "crypto/nss_util.h" | 26 #include "crypto/nss_util.h" |
27 #include "ipc/message_filter.h" | |
28 #include "third_party/WebKit/public/platform/WebColor.h" | 27 #include "third_party/WebKit/public/platform/WebColor.h" |
29 #include "third_party/WebKit/public/web/WebSettings.h" | 28 #include "third_party/WebKit/public/web/WebSettings.h" |
30 #include "third_party/WebKit/public/web/WebView.h" | 29 #include "third_party/WebKit/public/web/WebView.h" |
31 | 30 |
32 namespace chromecast { | 31 namespace chromecast { |
33 namespace shell { | 32 namespace shell { |
34 | 33 |
35 namespace { | 34 namespace { |
36 | 35 |
37 #if defined(ARCH_CPU_ARM_FAMILY) && !defined(OS_ANDROID) | 36 #if defined(ARCH_CPU_ARM_FAMILY) && !defined(OS_ANDROID) |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 CastContentRendererClient::CastContentRendererClient() { | 99 CastContentRendererClient::CastContentRendererClient() { |
101 } | 100 } |
102 | 101 |
103 CastContentRendererClient::~CastContentRendererClient() { | 102 CastContentRendererClient::~CastContentRendererClient() { |
104 } | 103 } |
105 | 104 |
106 void CastContentRendererClient::AddRendererNativeBindings( | 105 void CastContentRendererClient::AddRendererNativeBindings( |
107 blink::WebLocalFrame* frame) { | 106 blink::WebLocalFrame* frame) { |
108 } | 107 } |
109 | 108 |
110 std::vector<scoped_refptr<IPC::MessageFilter>> | |
111 CastContentRendererClient::GetRendererMessageFilters() { | |
112 return std::vector<scoped_refptr<IPC::MessageFilter>>(); | |
113 } | |
114 | |
115 void CastContentRendererClient::RenderThreadStarted() { | 109 void CastContentRendererClient::RenderThreadStarted() { |
116 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 110 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
117 #if !defined(USE_OPENSSL) | 111 #if !defined(USE_OPENSSL) |
118 // Note: Copied from chrome_render_process_observer.cc to fix b/8676652. | 112 // Note: Copied from chrome_render_process_observer.cc to fix b/8676652. |
119 // | 113 // |
120 // On platforms where the system NSS shared libraries are used, | 114 // On platforms where the system NSS shared libraries are used, |
121 // initialize NSS now because it won't be able to load the .so's | 115 // initialize NSS now because it won't be able to load the .so's |
122 // after entering the sandbox. | 116 // after entering the sandbox. |
123 if (!command_line->HasSwitch(switches::kSingleProcess)) | 117 if (!command_line->HasSwitch(switches::kSingleProcess)) |
124 crypto::InitNSSSafely(); | 118 crypto::InitNSSSafely(); |
125 #endif | 119 #endif |
126 | 120 |
127 #if defined(ARCH_CPU_ARM_FAMILY) && !defined(OS_ANDROID) | 121 #if defined(ARCH_CPU_ARM_FAMILY) && !defined(OS_ANDROID) |
128 PlatformPollFreemem(); | 122 PlatformPollFreemem(); |
129 #endif | 123 #endif |
130 | 124 |
131 // Set the initial known codecs mask. | 125 // Set the initial known codecs mask. |
132 if (command_line->HasSwitch(switches::kHdmiSinkSupportedCodecs)) { | 126 if (command_line->HasSwitch(switches::kHdmiSinkSupportedCodecs)) { |
133 int hdmi_codecs_mask; | 127 int hdmi_codecs_mask; |
134 if (base::StringToInt(command_line->GetSwitchValueASCII( | 128 if (base::StringToInt(command_line->GetSwitchValueASCII( |
135 switches::kHdmiSinkSupportedCodecs), | 129 switches::kHdmiSinkSupportedCodecs), |
136 &hdmi_codecs_mask)) { | 130 &hdmi_codecs_mask)) { |
137 ::media::SetHdmiSinkCodecs(hdmi_codecs_mask); | 131 ::media::SetHdmiSinkCodecs(hdmi_codecs_mask); |
138 } | 132 } |
139 } | 133 } |
140 | 134 |
141 cast_observer_.reset( | 135 cast_observer_.reset(new CastRenderProcessObserver()); |
142 new CastRenderProcessObserver(GetRendererMessageFilters())); | |
143 | 136 |
144 prescient_networking_dispatcher_.reset( | 137 prescient_networking_dispatcher_.reset( |
145 new network_hints::PrescientNetworkingDispatcher()); | 138 new network_hints::PrescientNetworkingDispatcher()); |
146 | 139 |
147 std::string last_launched_app = | 140 std::string last_launched_app = |
148 command_line->GetSwitchValueNative(switches::kLastLaunchedApp); | 141 command_line->GetSwitchValueNative(switches::kLastLaunchedApp); |
149 if (!last_launched_app.empty()) | 142 if (!last_launched_app.empty()) |
150 base::debug::SetCrashKeyValue(crash_keys::kLastApp, last_launched_app); | 143 base::debug::SetCrashKeyValue(crash_keys::kLastApp, last_launched_app); |
151 | 144 |
152 std::string previous_app = | 145 std::string previous_app = |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 closure.Run(); | 209 closure.Run(); |
217 return; | 210 return; |
218 } | 211 } |
219 | 212 |
220 // Lifetime is tied to |render_frame| via content::RenderFrameObserver. | 213 // Lifetime is tied to |render_frame| via content::RenderFrameObserver. |
221 new CastMediaLoadDeferrer(render_frame, closure); | 214 new CastMediaLoadDeferrer(render_frame, closure); |
222 } | 215 } |
223 | 216 |
224 } // namespace shell | 217 } // namespace shell |
225 } // namespace chromecast | 218 } // namespace chromecast |
OLD | NEW |