Roll leveldb 3f7758:803d69 (v1.17 -> v1.18)
[chromium-blink-merge.git] / chromecast / renderer / cast_content_renderer_client.cc
blob2a3c4d5bc778c2a5b5792a43e5a2b43559601c53
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
3 // found in the LICENSE file.
5 #include "chromecast/renderer/cast_content_renderer_client.h"
7 #include <sys/sysinfo.h>
9 #include "base/command_line.h"
10 #include "base/memory/memory_pressure_listener.h"
11 #include "chromecast/renderer/key_systems_cast.h"
12 #include "content/public/common/content_switches.h"
13 #include "content/public/renderer/render_view.h"
14 #include "crypto/nss_util.h"
15 #include "third_party/WebKit/public/platform/WebColor.h"
16 #include "third_party/WebKit/public/web/WebSettings.h"
17 #include "third_party/WebKit/public/web/WebView.h"
19 namespace chromecast {
20 namespace shell {
22 namespace {
24 // Default background color to set for WebViews. WebColor is in ARGB format
25 // though the comment of WebColor says it is in RGBA.
26 const blink::WebColor kColorBlack = 0xFF000000;
28 } // namespace
30 void CastContentRendererClient::RenderThreadStarted() {
31 #if defined(USE_NSS)
32 // Note: Copied from chrome_render_process_observer.cc to fix b/8676652.
34 // On platforms where the system NSS shared libraries are used,
35 // initialize NSS now because it won't be able to load the .so's
36 // after entering the sandbox.
37 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess))
38 crypto::InitNSSSafely();
39 #endif
42 void CastContentRendererClient::RenderViewCreated(
43 content::RenderView* render_view) {
44 blink::WebView* webview = render_view->GetWebView();
45 if (webview) {
46 webview->setBaseBackgroundColor(kColorBlack);
48 // The following settings express consistent behaviors across Cast
49 // embedders, though Android has enabled by default for mobile browsers.
50 webview->settings()->setShrinksViewportContentToFit(false);
51 webview->settings()->setMediaControlsOverlayPlayButtonEnabled(false);
55 void CastContentRendererClient::AddKeySystems(
56 std::vector< ::media::KeySystemInfo>* key_systems) {
57 AddChromecastKeySystems(key_systems);
58 AddChromecastPlatformKeySystems(key_systems);
61 } // namespace shell
62 } // namespace chromecast