| 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 <stdint.h> | 7 #include <stdint.h> |
| 8 #include <sys/sysinfo.h> | 8 #include <sys/sysinfo.h> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 11 #include "base/location.h" | 11 #include "base/location.h" |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/memory/memory_pressure_listener.h" | 13 #include "base/memory/memory_pressure_listener.h" |
| 14 #include "base/strings/string_number_conversions.h" | 14 #include "base/strings/string_number_conversions.h" |
| 15 #include "base/thread_task_runner_handle.h" | 15 #include "base/thread_task_runner_handle.h" |
| 16 #include "build/build_config.h" | 16 #include "build/build_config.h" |
| 17 #include "chromecast/base/chromecast_switches.h" | 17 #include "chromecast/base/chromecast_switches.h" |
| 18 #include "chromecast/crash/cast_crash_keys.h" | 18 #include "chromecast/crash/cast_crash_keys.h" |
| 19 #include "chromecast/media/base/media_caps.h" | 19 #include "chromecast/media/base/media_caps.h" |
| 20 #include "chromecast/renderer/cast_media_load_deferrer.h" | 20 #include "chromecast/renderer/cast_media_load_deferrer.h" |
| 21 #include "chromecast/renderer/cast_render_process_observer.h" | 21 #include "chromecast/renderer/cast_render_process_observer.h" |
| 22 #include "chromecast/renderer/key_systems_cast.h" | 22 #include "chromecast/renderer/key_systems_cast.h" |
| 23 #include "chromecast/renderer/media/chromecast_media_renderer_factory.h" | 23 #include "chromecast/renderer/media/chromecast_media_renderer_factory.h" |
| 24 #include "components/network_hints/renderer/prescient_networking_dispatcher.h" | 24 #include "components/network_hints/renderer/prescient_networking_dispatcher.h" |
| 25 #include "content/public/common/content_switches.h" | 25 #include "content/public/common/content_switches.h" |
| 26 #include "content/public/renderer/render_frame.h" | 26 #include "content/public/renderer/render_frame.h" |
| 27 #include "content/public/renderer/render_view.h" | 27 #include "content/public/renderer/render_view.h" |
| 28 #include "content/public/renderer/render_view_observer.h" | 28 #include "content/public/renderer/render_view_observer.h" |
| 29 #include "third_party/WebKit/public/platform/WebColor.h" | 29 #include "third_party/WebKit/public/platform/WebColor.h" |
| 30 #include "third_party/WebKit/public/web/WebFrameWidget.h" |
| 30 #include "third_party/WebKit/public/web/WebSettings.h" | 31 #include "third_party/WebKit/public/web/WebSettings.h" |
| 31 #include "third_party/WebKit/public/web/WebView.h" | 32 #include "third_party/WebKit/public/web/WebView.h" |
| 32 | 33 |
| 33 namespace chromecast { | 34 namespace chromecast { |
| 34 namespace shell { | 35 namespace shell { |
| 35 | 36 |
| 36 namespace { | 37 namespace { |
| 37 | 38 |
| 38 #if defined(ARCH_CPU_ARM_FAMILY) && !defined(OS_ANDROID) | 39 #if defined(ARCH_CPU_ARM_FAMILY) && !defined(OS_ANDROID) |
| 39 // This memory threshold is set for Chromecast. See the UMA histogram | 40 // This memory threshold is set for Chromecast. See the UMA histogram |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 std::string previous_app = | 142 std::string previous_app = |
| 142 command_line->GetSwitchValueNative(switches::kPreviousApp); | 143 command_line->GetSwitchValueNative(switches::kPreviousApp); |
| 143 if (!previous_app.empty()) | 144 if (!previous_app.empty()) |
| 144 base::debug::SetCrashKeyValue(crash_keys::kPreviousApp, previous_app); | 145 base::debug::SetCrashKeyValue(crash_keys::kPreviousApp, previous_app); |
| 145 } | 146 } |
| 146 | 147 |
| 147 void CastContentRendererClient::RenderViewCreated( | 148 void CastContentRendererClient::RenderViewCreated( |
| 148 content::RenderView* render_view) { | 149 content::RenderView* render_view) { |
| 149 blink::WebView* webview = render_view->GetWebView(); | 150 blink::WebView* webview = render_view->GetWebView(); |
| 150 if (webview) { | 151 if (webview) { |
| 151 webview->setBaseBackgroundColor(kColorBlack); | 152 blink::WebFrameWidget* web_frame_widget = render_view->GetWebFrameWidget(); |
| 153 web_frame_widget->setBaseBackgroundColor(kColorBlack); |
| 152 | 154 |
| 153 // The following settings express consistent behaviors across Cast | 155 // The following settings express consistent behaviors across Cast |
| 154 // embedders, though Android has enabled by default for mobile browsers. | 156 // embedders, though Android has enabled by default for mobile browsers. |
| 155 webview->settings()->setShrinksViewportContentToFit(false); | 157 webview->settings()->setShrinksViewportContentToFit(false); |
| 156 webview->settings()->setMediaControlsOverlayPlayButtonEnabled(false); | 158 webview->settings()->setMediaControlsOverlayPlayButtonEnabled(false); |
| 157 | 159 |
| 158 // Scale 1 ensures window.innerHeight/Width match application resolution. | 160 // Scale 1 ensures window.innerHeight/Width match application resolution. |
| 159 // PageScaleOverride is the 'user agent' value which overrides page | 161 // PageScaleOverride is the 'user agent' value which overrides page |
| 160 // settings (from meta viewport tag) - thus preventing inconsistency | 162 // settings (from meta viewport tag) - thus preventing inconsistency |
| 161 // between Android and non-Android cast_shell. | 163 // between Android and non-Android cast_shell. |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 closure.Run(); | 207 closure.Run(); |
| 206 return; | 208 return; |
| 207 } | 209 } |
| 208 | 210 |
| 209 // Lifetime is tied to |render_frame| via content::RenderFrameObserver. | 211 // Lifetime is tied to |render_frame| via content::RenderFrameObserver. |
| 210 new CastMediaLoadDeferrer(render_frame, closure); | 212 new CastMediaLoadDeferrer(render_frame, closure); |
| 211 } | 213 } |
| 212 | 214 |
| 213 } // namespace shell | 215 } // namespace shell |
| 214 } // namespace chromecast | 216 } // namespace chromecast |
| OLD | NEW |