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

Side by Side Diff: chromecast/browser/cast_content_browser_client.cc

Issue 2144533002: Convert network hints to Mojo (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 5 months 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
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/browser/cast_content_browser_client.h" 5 #include "chromecast/browser/cast_content_browser_client.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 #include "content/public/browser/geolocation_delegate.h" 45 #include "content/public/browser/geolocation_delegate.h"
46 #include "content/public/browser/render_process_host.h" 46 #include "content/public/browser/render_process_host.h"
47 #include "content/public/browser/resource_dispatcher_host.h" 47 #include "content/public/browser/resource_dispatcher_host.h"
48 #include "content/public/browser/web_contents.h" 48 #include "content/public/browser/web_contents.h"
49 #include "content/public/common/content_descriptors.h" 49 #include "content/public/common/content_descriptors.h"
50 #include "content/public/common/content_switches.h" 50 #include "content/public/common/content_switches.h"
51 #include "content/public/common/url_constants.h" 51 #include "content/public/common/url_constants.h"
52 #include "content/public/common/web_preferences.h" 52 #include "content/public/common/web_preferences.h"
53 #include "net/ssl/ssl_cert_request_info.h" 53 #include "net/ssl/ssl_cert_request_info.h"
54 #include "net/url_request/url_request_context_getter.h" 54 #include "net/url_request/url_request_context_getter.h"
55 #include "services/shell/public/cpp/interface_registry.h"
55 #include "ui/display/display.h" 56 #include "ui/display/display.h"
56 #include "ui/display/screen.h" 57 #include "ui/display/screen.h"
57 #include "ui/gl/gl_switches.h" 58 #include "ui/gl/gl_switches.h"
58 59
59 #if defined(ENABLE_MOJO_MEDIA_IN_BROWSER_PROCESS) 60 #if defined(ENABLE_MOJO_MEDIA_IN_BROWSER_PROCESS)
60 #include "chromecast/browser/media/cast_mojo_media_client.h" 61 #include "chromecast/browser/media/cast_mojo_media_client.h"
61 #include "media/mojo/services/mojo_media_application.h" // nogncheck 62 #include "media/mojo/services/mojo_media_application.h" // nogncheck
62 #endif // ENABLE_MOJO_MEDIA_IN_BROWSER_PROCESS 63 #endif // ENABLE_MOJO_MEDIA_IN_BROWSER_PROCESS
63 64
64 #if defined(OS_ANDROID) 65 #if defined(OS_ANDROID)
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 base::Bind(&CastContentBrowserClient::CreateMediaPipelineBackend, 202 base::Bind(&CastContentBrowserClient::CreateMediaPipelineBackend,
202 base::Unretained(this)), 203 base::Unretained(this)),
203 GetMediaTaskRunner(), media_resource_tracker())); 204 GetMediaTaskRunner(), media_resource_tracker()));
204 host->AddFilter(cma_message_filter.get()); 205 host->AddFilter(cma_message_filter.get());
205 #endif // !defined(OS_ANDROID) 206 #endif // !defined(OS_ANDROID)
206 207
207 // Forcibly trigger I/O-thread URLRequestContext initialization before 208 // Forcibly trigger I/O-thread URLRequestContext initialization before
208 // getting HostResolver. 209 // getting HostResolver.
209 content::BrowserThread::PostTaskAndReplyWithResult( 210 content::BrowserThread::PostTaskAndReplyWithResult(
210 content::BrowserThread::IO, FROM_HERE, 211 content::BrowserThread::IO, FROM_HERE,
211 base::Bind(&net::URLRequestContextGetter::GetURLRequestContext, 212 base::Bind(
212 base::Unretained( 213 &net::URLRequestContextGetter::GetURLRequestContext,
213 url_request_context_factory_->GetSystemGetter())), 214 base::Unretained(url_request_context_factory_->GetSystemGetter())),
214 base::Bind(&CastContentBrowserClient::AddNetworkHintsMessageFilter, 215 base::Bind(&CastContentBrowserClient::AddNetworkHintsImpl,
215 base::Unretained(this), host->GetID())); 216 base::Unretained(this), host->GetID()));
216 } 217 }
217 218
218 void CastContentBrowserClient::AddNetworkHintsMessageFilter( 219 void CastContentBrowserClient::AddNetworkHintsImpl(
219 int render_process_id, net::URLRequestContext* context) { 220 int render_process_id,
221 net::URLRequestContext* context) {
220 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 222 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
221 223
222 content::RenderProcessHost* host = 224 content::RenderProcessHost* host =
223 content::RenderProcessHost::FromID(render_process_id); 225 content::RenderProcessHost::FromID(render_process_id);
224 if (!host) 226 if (!host)
225 return; 227 return;
226 228
227 scoped_refptr<content::BrowserMessageFilter> network_hints_message_filter( 229 network_hints_.reset(new network_hints::NetworkHintsImpl(
228 new network_hints::NetworkHintsMessageFilter( 230 url_request_context_factory_->host_resolver()));
229 url_request_context_factory_->host_resolver())); 231 host->GetInterfaceRegistry()->AddInterface(
230 host->AddFilter(network_hints_message_filter.get()); 232 base::Bind(&network_hints::NetworkHintsImpl::Bind,
233 base::Unretained(network_hints_.get())),
234 content::BrowserThread::GetTaskRunnerForThread(
235 content::BrowserThread::IO));
231 } 236 }
232 237
233 bool CastContentBrowserClient::IsHandledURL(const GURL& url) { 238 bool CastContentBrowserClient::IsHandledURL(const GURL& url) {
234 if (!url.is_valid()) 239 if (!url.is_valid())
235 return false; 240 return false;
236 241
237 static const char* const kProtocolList[] = { 242 static const char* const kProtocolList[] = {
238 content::kChromeUIScheme, 243 content::kChromeUIScheme,
239 content::kChromeDevToolsScheme, 244 content::kChromeDevToolsScheme,
240 kChromeResourceScheme, 245 kChromeResourceScheme,
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
553 process_type, dumps_path, false /* upload */); 558 process_type, dumps_path, false /* upload */);
554 // StartUploaderThread() even though upload is diferred. 559 // StartUploaderThread() even though upload is diferred.
555 // Breakpad-related memory is freed in the uploader thread. 560 // Breakpad-related memory is freed in the uploader thread.
556 crash_handler->StartUploaderThread(); 561 crash_handler->StartUploaderThread();
557 return crash_handler; 562 return crash_handler;
558 } 563 }
559 #endif // !defined(OS_ANDROID) 564 #endif // !defined(OS_ANDROID)
560 565
561 } // namespace shell 566 } // namespace shell
562 } // namespace chromecast 567 } // namespace chromecast
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698