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 | 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 | 10 #include "chrome/browser/media/router/mojo/media_router_mojo_impl.h" // nognche
ck |
11 #include "content/public/browser/render_frame_host.h" | 11 #include "content/public/browser/render_frame_host.h" |
12 #include "content/public/browser/render_process_host.h" | 12 #include "content/public/browser/render_process_host.h" |
13 #include "extensions/common/extension.h" | 13 #include "extensions/common/extension.h" |
14 #include "extensions/common/permissions/api_permission.h" | 14 #include "extensions/common/permissions/api_permission.h" |
15 #include "extensions/common/permissions/permissions_data.h" | 15 #include "extensions/common/permissions/permissions_data.h" |
16 #include "services/service_manager/public/cpp/interface_registry.h" | 16 #include "services/service_manager/public/cpp/binder_registry.h" |
17 | 17 |
18 namespace extensions { | 18 namespace extensions { |
19 | 19 |
20 void RegisterChromeServicesForFrame(content::RenderFrameHost* render_frame_host, | 20 void RegisterChromeServicesForFrame(content::RenderFrameHost* render_frame_host, |
21 const Extension* extension) { | 21 const Extension* extension) { |
22 DCHECK(render_frame_host); | 22 DCHECK(render_frame_host); |
23 DCHECK(extension); | 23 DCHECK(extension); |
24 | 24 |
25 content::BrowserContext* context = | 25 content::BrowserContext* context = |
26 render_frame_host->GetProcess()->GetBrowserContext(); | 26 render_frame_host->GetProcess()->GetBrowserContext(); |
27 if (media_router::MediaRouterEnabled(context)) { | 27 if (media_router::MediaRouterEnabled(context)) { |
28 if (extension->permissions_data()->HasAPIPermission( | 28 if (extension->permissions_data()->HasAPIPermission( |
29 APIPermission::kMediaRouterPrivate)) { | 29 APIPermission::kMediaRouterPrivate)) { |
30 render_frame_host->GetInterfaceRegistry()->AddInterface( | 30 render_frame_host->GetInterfaceRegistry()->AddInterface( |
31 base::Bind(media_router::MediaRouterMojoImpl::BindToRequest, | 31 base::Bind(media_router::MediaRouterMojoImpl::BindToRequest, |
32 extension, context)); | 32 extension, context)); |
33 } | 33 } |
34 } | 34 } |
35 } | 35 } |
36 | 36 |
37 } // namespace extensions | 37 } // namespace extensions |
OLD | NEW |