| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/extensions/chrome_mojo_service_registration.h" | 5 #include "chrome/browser/extensions/chrome_mojo_service_registration.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "chrome/browser/media/router/media_router_feature.h" // nogncheck |
| 10 #include "chrome/browser/media/router/mojo/media_router_mojo_impl.h" // nognche
ck |
| 9 #include "content/public/browser/render_frame_host.h" | 11 #include "content/public/browser/render_frame_host.h" |
| 10 #include "content/public/browser/render_process_host.h" | 12 #include "content/public/browser/render_process_host.h" |
| 11 #include "extensions/common/extension.h" | 13 #include "extensions/common/extension.h" |
| 12 #include "extensions/common/permissions/api_permission.h" | 14 #include "extensions/common/permissions/api_permission.h" |
| 13 #include "extensions/common/permissions/permissions_data.h" | 15 #include "extensions/common/permissions/permissions_data.h" |
| 14 #include "services/service_manager/public/cpp/interface_registry.h" | 16 #include "services/service_manager/public/cpp/interface_registry.h" |
| 15 | 17 |
| 16 #if defined(ENABLE_MEDIA_ROUTER) | |
| 17 #include "chrome/browser/media/router/media_router_feature.h" // nogncheck | |
| 18 #include "chrome/browser/media/router/mojo/media_router_mojo_impl.h" // nognche
ck | |
| 19 #endif | |
| 20 | |
| 21 namespace extensions { | 18 namespace extensions { |
| 22 | 19 |
| 23 void RegisterChromeServicesForFrame(content::RenderFrameHost* render_frame_host, | 20 void RegisterChromeServicesForFrame(content::RenderFrameHost* render_frame_host, |
| 24 const Extension* extension) { | 21 const Extension* extension) { |
| 25 DCHECK(render_frame_host); | 22 DCHECK(render_frame_host); |
| 26 DCHECK(extension); | 23 DCHECK(extension); |
| 27 | 24 |
| 28 #if defined(ENABLE_MEDIA_ROUTER) | |
| 29 content::BrowserContext* context = | 25 content::BrowserContext* context = |
| 30 render_frame_host->GetProcess()->GetBrowserContext(); | 26 render_frame_host->GetProcess()->GetBrowserContext(); |
| 31 if (media_router::MediaRouterEnabled(context)) { | 27 if (media_router::MediaRouterEnabled(context)) { |
| 32 if (extension->permissions_data()->HasAPIPermission( | 28 if (extension->permissions_data()->HasAPIPermission( |
| 33 APIPermission::kMediaRouterPrivate)) { | 29 APIPermission::kMediaRouterPrivate)) { |
| 34 render_frame_host->GetInterfaceRegistry()->AddInterface( | 30 render_frame_host->GetInterfaceRegistry()->AddInterface( |
| 35 base::Bind(media_router::MediaRouterMojoImpl::BindToRequest, | 31 base::Bind(media_router::MediaRouterMojoImpl::BindToRequest, |
| 36 extension, context)); | 32 extension, context)); |
| 37 } | 33 } |
| 38 } | 34 } |
| 39 #endif // defined(ENABLE_MEDIA_ROUTER) | |
| 40 } | 35 } |
| 41 | 36 |
| 42 } // namespace extensions | 37 } // namespace extensions |
| OLD | NEW |