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

Side by Side Diff: content/browser/frame_host/render_frame_host_impl.cc

Issue 2865653002: [Device Service] Decouple NFC implementation from //content (Closed)
Patch Set: extra fix Created 3 years, 7 months 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 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 2650 matching lines...) Expand 10 before | Expand all | Expand 10 after
2673 // pointer. 2674 // pointer.
2674 GetInterfaceRegistry()->AddInterface( 2675 GetInterfaceRegistry()->AddInterface(
2675 base::Bind(&device::GeolocationServiceContext::CreateService, 2676 base::Bind(&device::GeolocationServiceContext::CreateService,
2676 base::Unretained(geolocation_service_context))); 2677 base::Unretained(geolocation_service_context)));
2677 } 2678 }
2678 2679
2679 GetInterfaceRegistry()->AddInterface<device::mojom::WakeLockService>( 2680 GetInterfaceRegistry()->AddInterface<device::mojom::WakeLockService>(
2680 base::Bind(&RenderFrameHostImpl::BindWakeLockServiceRequest, 2681 base::Bind(&RenderFrameHostImpl::BindWakeLockServiceRequest,
2681 base::Unretained(this))); 2682 base::Unretained(this)));
2682 2683
2684 #if defined(OS_ANDROID)
2685 if (base::FeatureList::IsEnabled(features::kWebNfc)) {
2686 GetInterfaceRegistry()->AddInterface<device::nfc::mojom::NFC>(base::Bind(
2687 &RenderFrameHostImpl::BindNFCRequest, base::Unretained(this)));
2688 }
2689 #endif
2690
2683 if (!permission_service_context_) 2691 if (!permission_service_context_)
2684 permission_service_context_.reset(new PermissionServiceContext(this)); 2692 permission_service_context_.reset(new PermissionServiceContext(this));
2685 2693
2686 GetInterfaceRegistry()->AddInterface( 2694 GetInterfaceRegistry()->AddInterface(
2687 base::Bind(&PermissionServiceContext::CreateService, 2695 base::Bind(&PermissionServiceContext::CreateService,
2688 base::Unretained(permission_service_context_.get()))); 2696 base::Unretained(permission_service_context_.get())));
2689 2697
2690 GetInterfaceRegistry()->AddInterface(base::Bind( 2698 GetInterfaceRegistry()->AddInterface(base::Bind(
2691 &PresentationServiceImpl::CreateMojoService, base::Unretained(this))); 2699 &PresentationServiceImpl::CreateMojoService, base::Unretained(this)));
2692 2700
(...skipping 1027 matching lines...) Expand 10 before | Expand all | Expand 10 after
3720 3728
3721 void RenderFrameHostImpl::BindWakeLockServiceRequest( 3729 void RenderFrameHostImpl::BindWakeLockServiceRequest(
3722 const service_manager::BindSourceInfo& source_info, 3730 const service_manager::BindSourceInfo& source_info,
3723 device::mojom::WakeLockServiceRequest request) { 3731 device::mojom::WakeLockServiceRequest request) {
3724 device::mojom::WakeLockContext* wake_lock_service_context = 3732 device::mojom::WakeLockContext* wake_lock_service_context =
3725 delegate_ ? delegate_->GetWakeLockServiceContext() : nullptr; 3733 delegate_ ? delegate_->GetWakeLockServiceContext() : nullptr;
3726 if (wake_lock_service_context) 3734 if (wake_lock_service_context)
3727 wake_lock_service_context->GetWakeLock(std::move(request)); 3735 wake_lock_service_context->GetWakeLock(std::move(request));
3728 } 3736 }
3729 3737
3738 void RenderFrameHostImpl::BindNFCRequest(
3739 const service_manager::BindSourceInfo& source_info,
3740 device::nfc::mojom::NFCRequest request) {
3741 if (delegate_)
3742 delegate_->GetNFC(std::move(request));
3743 }
3744
3730 void RenderFrameHostImpl::GetInterface( 3745 void RenderFrameHostImpl::GetInterface(
3731 const std::string& interface_name, 3746 const std::string& interface_name,
3732 mojo::ScopedMessagePipeHandle interface_pipe) { 3747 mojo::ScopedMessagePipeHandle interface_pipe) {
3733 if (interface_registry_.get()) { 3748 if (interface_registry_.get()) {
3734 service_manager::BindSourceInfo source_info( 3749 service_manager::BindSourceInfo source_info(
3735 GetProcess()->GetChildIdentity(), service_manager::CapabilitySet()); 3750 GetProcess()->GetChildIdentity(), service_manager::CapabilitySet());
3736 interface_registry_->BindInterface(source_info, interface_name, 3751 interface_registry_->BindInterface(source_info, interface_name,
3737 std::move(interface_pipe)); 3752 std::move(interface_pipe));
3738 } 3753 }
3739 } 3754 }
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
3901 } 3916 }
3902 3917
3903 void RenderFrameHostImpl::ForwardGetInterfaceToRenderFrame( 3918 void RenderFrameHostImpl::ForwardGetInterfaceToRenderFrame(
3904 const std::string& interface_name, 3919 const std::string& interface_name,
3905 mojo::ScopedMessagePipeHandle pipe) { 3920 mojo::ScopedMessagePipeHandle pipe) {
3906 GetRemoteInterfaces()->GetInterface(interface_name, std::move(pipe)); 3921 GetRemoteInterfaces()->GetInterface(interface_name, std::move(pipe));
3907 } 3922 }
3908 #endif 3923 #endif
3909 3924
3910 } // namespace content 3925 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698