Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(260)

Side by Side Diff: chromecast/renderer/cast_content_renderer_client.cc

Issue 785693002: Adds DNS prefetch support to Chromecast. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@prefetch-browser
Patch Set: add blink dep to gyp/gn Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chromecast/renderer/cast_content_renderer_client.h ('k') | components/dns_prefetch.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/renderer/key_systems_cast.h" 11 #include "chromecast/renderer/key_systems_cast.h"
12 #include "components/dns_prefetch/renderer/prescient_networking_dispatcher.h"
12 #include "content/public/common/content_switches.h" 13 #include "content/public/common/content_switches.h"
13 #include "content/public/renderer/render_view.h" 14 #include "content/public/renderer/render_view.h"
14 #include "crypto/nss_util.h" 15 #include "crypto/nss_util.h"
15 #include "third_party/WebKit/public/platform/WebColor.h" 16 #include "third_party/WebKit/public/platform/WebColor.h"
16 #include "third_party/WebKit/public/web/WebSettings.h" 17 #include "third_party/WebKit/public/web/WebSettings.h"
17 #include "third_party/WebKit/public/web/WebView.h" 18 #include "third_party/WebKit/public/web/WebView.h"
18 19
19 namespace chromecast { 20 namespace chromecast {
20 namespace shell { 21 namespace shell {
21 22
22 namespace { 23 namespace {
23 24
24 // Default background color to set for WebViews. WebColor is in ARGB format 25 // Default background color to set for WebViews. WebColor is in ARGB format
25 // though the comment of WebColor says it is in RGBA. 26 // though the comment of WebColor says it is in RGBA.
26 const blink::WebColor kColorBlack = 0xFF000000; 27 const blink::WebColor kColorBlack = 0xFF000000;
27 28
28 } // namespace 29 } // namespace
29 30
31 CastContentRendererClient::CastContentRendererClient() {
32 }
33
34 CastContentRendererClient::~CastContentRendererClient() {
35 }
36
30 void CastContentRendererClient::RenderThreadStarted() { 37 void CastContentRendererClient::RenderThreadStarted() {
31 #if defined(USE_NSS) 38 #if defined(USE_NSS)
32 // Note: Copied from chrome_render_process_observer.cc to fix b/8676652. 39 // Note: Copied from chrome_render_process_observer.cc to fix b/8676652.
33 // 40 //
34 // On platforms where the system NSS shared libraries are used, 41 // 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 42 // initialize NSS now because it won't be able to load the .so's
36 // after entering the sandbox. 43 // after entering the sandbox.
37 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); 44 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
38 if (!command_line->HasSwitch(switches::kSingleProcess)) 45 if (!command_line->HasSwitch(switches::kSingleProcess))
39 crypto::InitNSSSafely(); 46 crypto::InitNSSSafely();
40 #endif 47 #endif
48
49 prescient_networking_dispatcher_.reset(
50 new dns_prefetch::PrescientNetworkingDispatcher());
41 } 51 }
42 52
43 void CastContentRendererClient::RenderViewCreated( 53 void CastContentRendererClient::RenderViewCreated(
44 content::RenderView* render_view) { 54 content::RenderView* render_view) {
45 blink::WebView* webview = render_view->GetWebView(); 55 blink::WebView* webview = render_view->GetWebView();
46 if (webview) { 56 if (webview) {
47 webview->setBaseBackgroundColor(kColorBlack); 57 webview->setBaseBackgroundColor(kColorBlack);
48 58
49 // The following settings express consistent behaviors across Cast 59 // The following settings express consistent behaviors across Cast
50 // embedders, though Android has enabled by default for mobile browsers. 60 // embedders, though Android has enabled by default for mobile browsers.
51 webview->settings()->setShrinksViewportContentToFit(false); 61 webview->settings()->setShrinksViewportContentToFit(false);
52 webview->settings()->setMediaControlsOverlayPlayButtonEnabled(false); 62 webview->settings()->setMediaControlsOverlayPlayButtonEnabled(false);
53 } 63 }
54 } 64 }
55 65
56 void CastContentRendererClient::AddKeySystems( 66 void CastContentRendererClient::AddKeySystems(
57 std::vector< ::media::KeySystemInfo>* key_systems) { 67 std::vector< ::media::KeySystemInfo>* key_systems) {
58 AddChromecastKeySystems(key_systems); 68 AddChromecastKeySystems(key_systems);
59 AddChromecastPlatformKeySystems(key_systems); 69 AddChromecastPlatformKeySystems(key_systems);
60 } 70 }
61 71
72 blink::WebPrescientNetworking*
73 CastContentRendererClient::GetPrescientNetworking() {
74 return prescient_networking_dispatcher_.get();
75 }
76
62 } // namespace shell 77 } // namespace shell
63 } // namespace chromecast 78 } // namespace chromecast
OLDNEW
« no previous file with comments | « chromecast/renderer/cast_content_renderer_client.h ('k') | components/dns_prefetch.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698