1116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch// Copyright 2014 The Chromium Authors. All rights reserved. 2116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch// Use of this source code is governed by a BSD-style license that can be 3116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch// found in the LICENSE file. 4116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch 5116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch#include "chromecast/shell/renderer/cast_content_renderer_client.h" 6116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch 7116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch#include <sys/sysinfo.h> 8116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch 9116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch#include "base/command_line.h" 10116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch#include "base/memory/memory_pressure_listener.h" 111320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci#include "chromecast/shell/renderer/key_systems_cast.h" 12116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch#include "content/public/common/content_switches.h" 136e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)#include "content/public/renderer/render_view.h" 14116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch#include "crypto/nss_util.h" 156e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)#include "third_party/WebKit/public/platform/WebColor.h" 161320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci#include "third_party/WebKit/public/web/WebSettings.h" 176e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)#include "third_party/WebKit/public/web/WebView.h" 18116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch 19116680a4aac90f2aa7413d9095a592090648e557Ben Murdochnamespace chromecast { 20116680a4aac90f2aa7413d9095a592090648e557Ben Murdochnamespace shell { 21116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch 226e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)namespace { 236e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles) 246e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)// Default background color to set for WebViews 256e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)const blink::WebColor kColorBlack = 0x000000FF; 266e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles) 276e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)} // namespace 286e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles) 29116680a4aac90f2aa7413d9095a592090648e557Ben Murdochvoid CastContentRendererClient::RenderThreadStarted() { 30116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch#if defined(USE_NSS) 31116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch // Note: Copied from chrome_render_process_observer.cc to fix b/8676652. 32116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch // 33116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch // On platforms where the system NSS shared libraries are used, 34116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch // initialize NSS now because it won't be able to load the .so's 35116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch // after entering the sandbox. 36116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess)) 37116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch crypto::InitNSSSafely(); 38116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch#endif 39116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch} 40116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch 416e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)void CastContentRendererClient::RenderViewCreated( 426e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles) content::RenderView* render_view) { 436e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles) blink::WebView* webview = render_view->GetWebView(); 446e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles) if (webview) { 456e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles) webview->setBaseBackgroundColor(kColorBlack); 461320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci webview->settings()->setShrinksViewportContentToFit(false); 476e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles) } 486e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)} 496e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles) 50116680a4aac90f2aa7413d9095a592090648e557Ben Murdochvoid CastContentRendererClient::AddKeySystems( 51116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch std::vector<content::KeySystemInfo>* key_systems) { 521320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci AddChromecastKeySystems(key_systems); 531320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci AddChromecastPlatformKeySystems(key_systems); 54116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch} 55116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch 56116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch} // namespace shell 57116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch} // namespace chromecast 58