| 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/memory/memory_pressure_listener.h" | 10 #include "base/memory/memory_pressure_listener.h" |
| 11 #include "chromecast/common/chromecast_switches.h" | 11 #include "chromecast/common/chromecast_switches.h" |
| 12 #include "chromecast/renderer/cast_media_load_deferrer.h" | 12 #include "chromecast/renderer/cast_media_load_deferrer.h" |
| 13 #include "chromecast/renderer/cast_render_process_observer.h" | 13 #include "chromecast/renderer/cast_render_process_observer.h" |
| 14 #include "chromecast/renderer/key_systems_cast.h" | 14 #include "chromecast/renderer/key_systems_cast.h" |
| 15 #include "chromecast/renderer/media/cma_media_renderer_factory.h" | 15 #include "chromecast/renderer/media/cma_media_renderer_factory.h" |
| 16 #include "components/dns_prefetch/renderer/prescient_networking_dispatcher.h" | 16 #include "components/dns_prefetch/renderer/prescient_networking_dispatcher.h" |
| 17 #include "content/public/common/content_switches.h" | 17 #include "content/public/common/content_switches.h" |
| 18 #include "content/public/renderer/render_frame.h" | 18 #include "content/public/renderer/render_frame.h" |
| 19 #include "content/public/renderer/render_view.h" | 19 #include "content/public/renderer/render_view.h" |
| 20 #include "content/public/renderer/render_view_observer.h" |
| 20 #include "crypto/nss_util.h" | 21 #include "crypto/nss_util.h" |
| 21 #include "third_party/WebKit/public/platform/WebColor.h" | 22 #include "third_party/WebKit/public/platform/WebColor.h" |
| 22 #include "third_party/WebKit/public/web/WebSettings.h" | 23 #include "third_party/WebKit/public/web/WebSettings.h" |
| 23 #include "third_party/WebKit/public/web/WebView.h" | 24 #include "third_party/WebKit/public/web/WebView.h" |
| 24 | 25 |
| 25 namespace chromecast { | 26 namespace chromecast { |
| 26 namespace shell { | 27 namespace shell { |
| 27 | 28 |
| 28 namespace { | 29 namespace { |
| 29 | 30 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 FROM_HERE, | 65 FROM_HERE, |
| 65 base::Bind(&PlatformPollFreemem), | 66 base::Bind(&PlatformPollFreemem), |
| 66 base::TimeDelta::FromMilliseconds(kPollingIntervalMS)); | 67 base::TimeDelta::FromMilliseconds(kPollingIntervalMS)); |
| 67 } | 68 } |
| 68 #endif | 69 #endif |
| 69 | 70 |
| 70 // Default background color to set for WebViews. WebColor is in ARGB format | 71 // Default background color to set for WebViews. WebColor is in ARGB format |
| 71 // though the comment of WebColor says it is in RGBA. | 72 // though the comment of WebColor says it is in RGBA. |
| 72 const blink::WebColor kColorBlack = 0xFF000000; | 73 const blink::WebColor kColorBlack = 0xFF000000; |
| 73 | 74 |
| 75 class CastRenderViewObserver : content::RenderViewObserver { |
| 76 public: |
| 77 explicit CastRenderViewObserver(content::RenderView* render_view); |
| 78 ~CastRenderViewObserver() override {} |
| 79 |
| 80 void DidClearWindowObject(blink::WebLocalFrame* frame) override; |
| 81 }; |
| 82 |
| 83 CastRenderViewObserver::CastRenderViewObserver(content::RenderView* render_view) |
| 84 : content::RenderViewObserver(render_view) { |
| 85 } |
| 86 |
| 87 void CastRenderViewObserver::DidClearWindowObject(blink::WebLocalFrame* frame) { |
| 88 // Native bindings go here. |
| 89 } |
| 90 |
| 74 } // namespace | 91 } // namespace |
| 75 | 92 |
| 76 CastContentRendererClient::CastContentRendererClient() { | 93 CastContentRendererClient::CastContentRendererClient() { |
| 77 } | 94 } |
| 78 | 95 |
| 79 CastContentRendererClient::~CastContentRendererClient() { | 96 CastContentRendererClient::~CastContentRendererClient() { |
| 80 } | 97 } |
| 81 | 98 |
| 82 void CastContentRendererClient::RenderThreadStarted() { | 99 void CastContentRendererClient::RenderThreadStarted() { |
| 83 #if defined(USE_NSS) | 100 #if defined(USE_NSS) |
| (...skipping 25 matching lines...) Expand all Loading... |
| 109 | 126 |
| 110 // The following settings express consistent behaviors across Cast | 127 // The following settings express consistent behaviors across Cast |
| 111 // embedders, though Android has enabled by default for mobile browsers. | 128 // embedders, though Android has enabled by default for mobile browsers. |
| 112 webview->settings()->setShrinksViewportContentToFit(false); | 129 webview->settings()->setShrinksViewportContentToFit(false); |
| 113 webview->settings()->setMediaControlsOverlayPlayButtonEnabled(false); | 130 webview->settings()->setMediaControlsOverlayPlayButtonEnabled(false); |
| 114 | 131 |
| 115 // Disable application cache as Chromecast doesn't support off-line | 132 // Disable application cache as Chromecast doesn't support off-line |
| 116 // application running. | 133 // application running. |
| 117 webview->settings()->setOfflineWebApplicationCacheEnabled(false); | 134 webview->settings()->setOfflineWebApplicationCacheEnabled(false); |
| 118 } | 135 } |
| 136 |
| 137 // Note: RenderView will own the lifetime of its observer. |
| 138 new CastRenderViewObserver(render_view); |
| 119 } | 139 } |
| 120 | 140 |
| 121 void CastContentRendererClient::AddKeySystems( | 141 void CastContentRendererClient::AddKeySystems( |
| 122 std::vector< ::media::KeySystemInfo>* key_systems) { | 142 std::vector< ::media::KeySystemInfo>* key_systems) { |
| 123 AddChromecastKeySystems(key_systems); | 143 AddChromecastKeySystems(key_systems); |
| 124 AddChromecastPlatformKeySystems(key_systems); | 144 AddChromecastPlatformKeySystems(key_systems); |
| 125 } | 145 } |
| 126 | 146 |
| 127 #if !defined(OS_ANDROID) | 147 #if !defined(OS_ANDROID) |
| 128 scoped_ptr<::media::RendererFactory> | 148 scoped_ptr<::media::RendererFactory> |
| (...skipping 21 matching lines...) Expand all Loading... |
| 150 closure.Run(); | 170 closure.Run(); |
| 151 return; | 171 return; |
| 152 } | 172 } |
| 153 | 173 |
| 154 // Lifetime is tied to |render_frame| via content::RenderFrameObserver. | 174 // Lifetime is tied to |render_frame| via content::RenderFrameObserver. |
| 155 new CastMediaLoadDeferrer(render_frame, closure); | 175 new CastMediaLoadDeferrer(render_frame, closure); |
| 156 } | 176 } |
| 157 | 177 |
| 158 } // namespace shell | 178 } // namespace shell |
| 159 } // namespace chromecast | 179 } // namespace chromecast |
| OLD | NEW |