| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "content/browser/frame_host/render_frame_host_impl.h" | 5 #include "content/browser/frame_host/render_frame_host_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| 11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 12 #include "base/containers/hash_tables.h" | 12 #include "base/containers/hash_tables.h" |
| 13 #include "base/feature_list.h" |
| 13 #include "base/lazy_instance.h" | 14 #include "base/lazy_instance.h" |
| 14 #include "base/memory/ptr_util.h" | 15 #include "base/memory/ptr_util.h" |
| 15 #include "base/metrics/histogram_macros.h" | 16 #include "base/metrics/histogram_macros.h" |
| 16 #include "base/metrics/user_metrics.h" | 17 #include "base/metrics/user_metrics.h" |
| 17 #include "base/process/kill.h" | 18 #include "base/process/kill.h" |
| 18 #include "base/time/time.h" | 19 #include "base/time/time.h" |
| 19 #include "build/build_config.h" | 20 #include "build/build_config.h" |
| 20 #include "content/browser/accessibility/browser_accessibility_manager.h" | 21 #include "content/browser/accessibility/browser_accessibility_manager.h" |
| 21 #include "content/browser/accessibility/browser_accessibility_state_impl.h" | 22 #include "content/browser/accessibility/browser_accessibility_state_impl.h" |
| 22 #include "content/browser/bluetooth/web_bluetooth_service_impl.h" | 23 #include "content/browser/bluetooth/web_bluetooth_service_impl.h" |
| (...skipping 2652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2675 // pointer. | 2676 // pointer. |
| 2676 GetInterfaceRegistry()->AddInterface( | 2677 GetInterfaceRegistry()->AddInterface( |
| 2677 base::Bind(&device::GeolocationServiceContext::CreateService, | 2678 base::Bind(&device::GeolocationServiceContext::CreateService, |
| 2678 base::Unretained(geolocation_service_context))); | 2679 base::Unretained(geolocation_service_context))); |
| 2679 } | 2680 } |
| 2680 | 2681 |
| 2681 GetInterfaceRegistry()->AddInterface<device::mojom::WakeLockService>( | 2682 GetInterfaceRegistry()->AddInterface<device::mojom::WakeLockService>( |
| 2682 base::Bind(&RenderFrameHostImpl::BindWakeLockServiceRequest, | 2683 base::Bind(&RenderFrameHostImpl::BindWakeLockServiceRequest, |
| 2683 base::Unretained(this))); | 2684 base::Unretained(this))); |
| 2684 | 2685 |
| 2686 #if defined(OS_ANDROID) |
| 2687 if (base::FeatureList::IsEnabled(features::kWebNfc)) { |
| 2688 GetInterfaceRegistry()->AddInterface<device::nfc::mojom::NFC>(base::Bind( |
| 2689 &RenderFrameHostImpl::BindNFCRequest, base::Unretained(this))); |
| 2690 } |
| 2691 #endif |
| 2692 |
| 2685 if (!permission_service_context_) | 2693 if (!permission_service_context_) |
| 2686 permission_service_context_.reset(new PermissionServiceContext(this)); | 2694 permission_service_context_.reset(new PermissionServiceContext(this)); |
| 2687 | 2695 |
| 2688 GetInterfaceRegistry()->AddInterface( | 2696 GetInterfaceRegistry()->AddInterface( |
| 2689 base::Bind(&PermissionServiceContext::CreateService, | 2697 base::Bind(&PermissionServiceContext::CreateService, |
| 2690 base::Unretained(permission_service_context_.get()))); | 2698 base::Unretained(permission_service_context_.get()))); |
| 2691 | 2699 |
| 2692 GetInterfaceRegistry()->AddInterface(base::Bind( | 2700 GetInterfaceRegistry()->AddInterface(base::Bind( |
| 2693 &PresentationServiceImpl::CreateMojoService, base::Unretained(this))); | 2701 &PresentationServiceImpl::CreateMojoService, base::Unretained(this))); |
| 2694 | 2702 |
| (...skipping 1037 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3732 | 3740 |
| 3733 void RenderFrameHostImpl::BindWakeLockServiceRequest( | 3741 void RenderFrameHostImpl::BindWakeLockServiceRequest( |
| 3734 const service_manager::BindSourceInfo& source_info, | 3742 const service_manager::BindSourceInfo& source_info, |
| 3735 device::mojom::WakeLockServiceRequest request) { | 3743 device::mojom::WakeLockServiceRequest request) { |
| 3736 device::mojom::WakeLockService* renderer_wake_lock = | 3744 device::mojom::WakeLockService* renderer_wake_lock = |
| 3737 delegate_ ? delegate_->GetRendererWakeLock() : nullptr; | 3745 delegate_ ? delegate_->GetRendererWakeLock() : nullptr; |
| 3738 if (renderer_wake_lock) | 3746 if (renderer_wake_lock) |
| 3739 renderer_wake_lock->AddClient(std::move(request)); | 3747 renderer_wake_lock->AddClient(std::move(request)); |
| 3740 } | 3748 } |
| 3741 | 3749 |
| 3750 #if defined(OS_ANDROID) |
| 3751 void RenderFrameHostImpl::BindNFCRequest( |
| 3752 const service_manager::BindSourceInfo& source_info, |
| 3753 device::nfc::mojom::NFCRequest request) { |
| 3754 if (delegate_) |
| 3755 delegate_->GetNFC(std::move(request)); |
| 3756 } |
| 3757 #endif |
| 3758 |
| 3742 void RenderFrameHostImpl::GetInterface( | 3759 void RenderFrameHostImpl::GetInterface( |
| 3743 const std::string& interface_name, | 3760 const std::string& interface_name, |
| 3744 mojo::ScopedMessagePipeHandle interface_pipe) { | 3761 mojo::ScopedMessagePipeHandle interface_pipe) { |
| 3745 if (interface_registry_.get()) { | 3762 if (interface_registry_.get()) { |
| 3746 service_manager::BindSourceInfo source_info( | 3763 service_manager::BindSourceInfo source_info( |
| 3747 GetProcess()->GetChildIdentity(), service_manager::CapabilitySet()); | 3764 GetProcess()->GetChildIdentity(), service_manager::CapabilitySet()); |
| 3748 interface_registry_->BindInterface(source_info, interface_name, | 3765 interface_registry_->BindInterface(source_info, interface_name, |
| 3749 std::move(interface_pipe)); | 3766 std::move(interface_pipe)); |
| 3750 } | 3767 } |
| 3751 } | 3768 } |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3913 } | 3930 } |
| 3914 | 3931 |
| 3915 void RenderFrameHostImpl::ForwardGetInterfaceToRenderFrame( | 3932 void RenderFrameHostImpl::ForwardGetInterfaceToRenderFrame( |
| 3916 const std::string& interface_name, | 3933 const std::string& interface_name, |
| 3917 mojo::ScopedMessagePipeHandle pipe) { | 3934 mojo::ScopedMessagePipeHandle pipe) { |
| 3918 GetRemoteInterfaces()->GetInterface(interface_name, std::move(pipe)); | 3935 GetRemoteInterfaces()->GetInterface(interface_name, std::move(pipe)); |
| 3919 } | 3936 } |
| 3920 #endif | 3937 #endif |
| 3921 | 3938 |
| 3922 } // namespace content | 3939 } // namespace content |
| OLD | NEW |