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 "extensions/browser/mojo/service_registration.h" | 5 #include "extensions/browser/mojo/service_registration.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
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 "content/public/browser/site_instance.h" | 13 #include "content/public/browser/site_instance.h" |
14 #include "extensions/browser/api/serial/serial_service_factory.h" | 14 #include "extensions/browser/api/serial/serial_service_factory.h" |
15 #include "extensions/browser/extension_registry.h" | 15 #include "extensions/browser/extension_registry.h" |
| 16 #include "extensions/browser/extension_util.h" |
16 #include "extensions/browser/extensions_browser_client.h" | 17 #include "extensions/browser/extensions_browser_client.h" |
17 #include "extensions/browser/mojo/keep_alive_impl.h" | 18 #include "extensions/browser/mojo/keep_alive_impl.h" |
18 #include "extensions/browser/process_map.h" | 19 #include "extensions/browser/process_map.h" |
19 #include "extensions/common/constants.h" | 20 #include "extensions/common/constants.h" |
20 #include "extensions/common/extension_api.h" | 21 #include "extensions/common/extension_api.h" |
21 #include "extensions/common/switches.h" | 22 #include "extensions/common/switches.h" |
22 #include "services/shell/public/cpp/interface_registry.h" | 23 #include "services/shell/public/cpp/interface_registry.h" |
23 | 24 |
24 #if defined(ENABLE_WIFI_DISPLAY) | 25 #if defined(ENABLE_WIFI_DISPLAY) |
25 #include "extensions/browser/api/display_source/wifi_display/wifi_display_media_
service_impl.h" | 26 #include "extensions/browser/api/display_source/wifi_display/wifi_display_media_
service_impl.h" |
26 #include "extensions/browser/api/display_source/wifi_display/wifi_display_sessio
n_service_impl.h" | 27 #include "extensions/browser/api/display_source/wifi_display/wifi_display_sessio
n_service_impl.h" |
27 #endif | 28 #endif |
28 | 29 |
29 namespace extensions { | 30 namespace extensions { |
30 namespace { | 31 namespace { |
31 | 32 |
32 bool ExtensionHasPermission(const Extension* extension, | 33 bool ExtensionHasPermission(const Extension* extension, |
33 content::RenderProcessHost* render_process_host, | 34 content::RenderProcessHost* render_process_host, |
34 const std::string& permission_name) { | 35 const std::string& permission_name) { |
35 Feature::Context context = | 36 Feature::Context context = |
36 ProcessMap::Get(render_process_host->GetBrowserContext()) | 37 ProcessMap::Get(render_process_host->GetBrowserContext()) |
37 ->GetMostLikelyContextType(extension, render_process_host->GetID()); | 38 ->GetMostLikelyContextType(extension, render_process_host->GetID()); |
38 | 39 |
39 return ExtensionAPI::GetSharedInstance() | 40 return ExtensionAPI::GetSharedInstance() |
40 ->IsAvailable(permission_name, extension, context, extension->url()) | 41 ->IsAvailable(permission_name, extension, context, |
| 42 util::GetCurrentSessionType(), extension->url()) |
41 .is_available(); | 43 .is_available(); |
42 } | 44 } |
43 | 45 |
44 } // namespace | 46 } // namespace |
45 | 47 |
46 void RegisterServicesForFrame(content::RenderFrameHost* render_frame_host, | 48 void RegisterServicesForFrame(content::RenderFrameHost* render_frame_host, |
47 const Extension* extension) { | 49 const Extension* extension) { |
48 DCHECK(extension); | 50 DCHECK(extension); |
49 | 51 |
50 shell::InterfaceRegistry* registry = | 52 shell::InterfaceRegistry* registry = |
(...skipping 15 matching lines...) Expand all Loading... |
66 registry->AddInterface( | 68 registry->AddInterface( |
67 base::Bind(WiFiDisplaySessionServiceImpl::BindToRequest, | 69 base::Bind(WiFiDisplaySessionServiceImpl::BindToRequest, |
68 render_frame_host->GetProcess()->GetBrowserContext())); | 70 render_frame_host->GetProcess()->GetBrowserContext())); |
69 registry->AddInterface( | 71 registry->AddInterface( |
70 base::Bind(WiFiDisplayMediaServiceImpl::BindToRequest)); | 72 base::Bind(WiFiDisplayMediaServiceImpl::BindToRequest)); |
71 } | 73 } |
72 #endif | 74 #endif |
73 } | 75 } |
74 | 76 |
75 } // namespace extensions | 77 } // namespace extensions |
OLD | NEW |