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

Side by Side Diff: chrome/browser/chrome_content_browser_client.cc

Issue 2477573002: [Presentation API] (3rd) (1-UA) Split PresentationServiceDelegateImpl(PSDImpl) (Closed)
Patch Set: resolve code review comments from Derek Created 4 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/chrome_content_browser_client.h" 5 #include "chrome/browser/chrome_content_browser_client.h"
6 6
7 #include <map> 7 #include <map>
8 #include <set> 8 #include <set>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 #endif 329 #endif
330 330
331 #if defined(ENABLE_WEBRTC) 331 #if defined(ENABLE_WEBRTC)
332 #include "chrome/browser/media/audio_debug_recordings_handler.h" 332 #include "chrome/browser/media/audio_debug_recordings_handler.h"
333 #include "chrome/browser/media/webrtc/webrtc_logging_handler_host.h" 333 #include "chrome/browser/media/webrtc/webrtc_logging_handler_host.h"
334 #endif 334 #endif
335 335
336 #if defined(ENABLE_MEDIA_ROUTER) 336 #if defined(ENABLE_MEDIA_ROUTER)
337 #include "chrome/browser/media/router/media_router_feature.h" 337 #include "chrome/browser/media/router/media_router_feature.h"
338 #include "chrome/browser/media/router/presentation_service_delegate_impl.h" 338 #include "chrome/browser/media/router/presentation_service_delegate_impl.h"
339 #include "chrome/browser/media/router/receiver_presentation_service_delegate_imp l.h"
339 #endif // defined(ENABLE_MEDIA_ROUTER) 340 #endif // defined(ENABLE_MEDIA_ROUTER)
340 341
341 #if BUILDFLAG(ENABLE_MEDIA_REMOTING) && defined(ENABLE_MEDIA_ROUTER) 342 #if BUILDFLAG(ENABLE_MEDIA_REMOTING) && defined(ENABLE_MEDIA_ROUTER)
342 #include "chrome/browser/media/cast_remoting_connector.h" 343 #include "chrome/browser/media/cast_remoting_connector.h"
343 #endif 344 #endif
344 345
345 346
346 #if defined(ENABLE_WAYLAND_SERVER) 347 #if defined(ENABLE_WAYLAND_SERVER)
347 #include "chrome/browser/chrome_browser_main_extra_parts_exo.h" 348 #include "chrome/browser/chrome_browser_main_extra_parts_exo.h"
348 #endif 349 #endif
(...skipping 2746 matching lines...) Expand 10 before | Expand all | Expand 10 after
3095 params.url, 3096 params.url,
3096 params.transition); 3097 params.transition);
3097 FillNavigateParamsFromOpenURLParams(&nav_params, params); 3098 FillNavigateParamsFromOpenURLParams(&nav_params, params);
3098 nav_params.user_gesture = params.user_gesture; 3099 nav_params.user_gesture = params.user_gesture;
3099 3100
3100 Navigate(&nav_params); 3101 Navigate(&nav_params);
3101 callback.Run(nav_params.target_contents); 3102 callback.Run(nav_params.target_contents);
3102 #endif 3103 #endif
3103 } 3104 }
3104 3105
3105 content::PresentationServiceDelegate* 3106 content::ControllerPresentationServiceDelegate*
3106 ChromeContentBrowserClient::GetPresentationServiceDelegate( 3107 ChromeContentBrowserClient::GetControllerPresentationServiceDelegate(
3107 content::WebContents* web_contents) { 3108 content::WebContents* web_contents) {
3108 #if defined(ENABLE_MEDIA_ROUTER) 3109 #if defined(ENABLE_MEDIA_ROUTER)
3109 if (media_router::MediaRouterEnabled(web_contents->GetBrowserContext())) { 3110 if (media_router::MediaRouterEnabled(web_contents->GetBrowserContext())) {
3110 return media_router::PresentationServiceDelegateImpl:: 3111 return media_router::PresentationServiceDelegateImpl::
3111 GetOrCreateForWebContents(web_contents); 3112 GetOrCreateForWebContents(web_contents);
3112 } 3113 }
3113 #endif // defined(ENABLE_MEDIA_ROUTER) 3114 #endif // defined(ENABLE_MEDIA_ROUTER)
3114 return nullptr; 3115 return nullptr;
3115 } 3116 }
3116 3117
3118 content::ReceiverPresentationServiceDelegate*
3119 ChromeContentBrowserClient::GetReceiverPresentationServiceDelegate(
3120 content::WebContents* web_contents) {
3121 #if defined(ENABLE_MEDIA_ROUTER)
3122 if (media_router::MediaRouterEnabled(web_contents->GetBrowserContext())) {
3123 // ReceiverPresentationServiceDelegateImpl exists only for WebContents
3124 // created for offscreen presentations. The WebContents must belong to
3125 // an incognito profile.
3126 if (auto* impl = media_router::ReceiverPresentationServiceDelegateImpl::
3127 FromWebContents(web_contents)) {
3128 if (web_contents->GetBrowserContext()->IsOffTheRecord())
mark a. foltz 2016/12/02 22:09:05 Combine if() clauses into one statement.
zhaobin 2016/12/03 00:34:26 Done.
3129 return impl;
3130 }
3131 }
3132 #endif // defined(ENABLE_MEDIA_ROUTER)
3133 return nullptr;
3134 }
3135
3117 void ChromeContentBrowserClient::RecordURLMetric(const std::string& metric, 3136 void ChromeContentBrowserClient::RecordURLMetric(const std::string& metric,
3118 const GURL& url) { 3137 const GURL& url) {
3119 if (url.is_valid()) { 3138 if (url.is_valid()) {
3120 rappor::SampleDomainAndRegistryFromGURL(g_browser_process->rappor_service(), 3139 rappor::SampleDomainAndRegistryFromGURL(g_browser_process->rappor_service(),
3121 metric, url); 3140 metric, url);
3122 } 3141 }
3123 } 3142 }
3124 3143
3125 ScopedVector<content::NavigationThrottle> 3144 ScopedVector<content::NavigationThrottle>
3126 ChromeContentBrowserClient::CreateThrottlesForNavigation( 3145 ChromeContentBrowserClient::CreateThrottlesForNavigation(
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
3296 render_frame_host, std::move(source), std::move(request)); 3315 render_frame_host, std::move(source), std::move(request));
3297 #else 3316 #else
3298 // Chrome's media remoting implementation depends on the Media Router 3317 // Chrome's media remoting implementation depends on the Media Router
3299 // infrastructure to identify remote sinks and provide the user interface for 3318 // infrastructure to identify remote sinks and provide the user interface for
3300 // sink selection. In the case where the Media Router is not present, simply 3319 // sink selection. In the case where the Media Router is not present, simply
3301 // drop the interface request. This will prevent code paths for media remoting 3320 // drop the interface request. This will prevent code paths for media remoting
3302 // in the renderer process from activating. 3321 // in the renderer process from activating.
3303 #endif 3322 #endif
3304 } 3323 }
3305 #endif // BUILDFLAG(ENABLE_MEDIA_REMOTING) 3324 #endif // BUILDFLAG(ENABLE_MEDIA_REMOTING)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698