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

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

Issue 2050803002: Better way to implement FrameConnectedBluetoothDevicesTest Base URL: https://chromium.googlesource.com/chromium/src.git@patch_ortuno
Patch Set: Created 4 years, 6 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 <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 1945 matching lines...) Expand 10 before | Expand all | Expand 10 after
1956 base::Bind(&device::VibrationManagerImpl::Create)); 1956 base::Bind(&device::VibrationManagerImpl::Create));
1957 #endif 1957 #endif
1958 1958
1959 bool enable_web_bluetooth = base::CommandLine::ForCurrentProcess()->HasSwitch( 1959 bool enable_web_bluetooth = base::CommandLine::ForCurrentProcess()->HasSwitch(
1960 switches::kEnableWebBluetooth); 1960 switches::kEnableWebBluetooth);
1961 #if defined(OS_CHROMEOS) || defined(OS_ANDROID) 1961 #if defined(OS_CHROMEOS) || defined(OS_ANDROID)
1962 enable_web_bluetooth = true; 1962 enable_web_bluetooth = true;
1963 #endif 1963 #endif
1964 1964
1965 if (enable_web_bluetooth) { 1965 if (enable_web_bluetooth) {
1966 GetServiceRegistry()->AddService( 1966 GetServiceRegistry()->AddService(base::Bind(
1967 base::Bind(&RenderFrameHostImpl::CreateWebBluetoothService, 1967 base::IgnoreResult(&RenderFrameHostImpl::CreateWebBluetoothService),
1968 base::Unretained(this))); 1968 base::Unretained(this)));
1969 } 1969 }
1970 1970
1971 if (!frame_mojo_shell_) 1971 if (!frame_mojo_shell_)
1972 frame_mojo_shell_.reset(new FrameMojoShell(this)); 1972 frame_mojo_shell_.reset(new FrameMojoShell(this));
1973 1973
1974 GetServiceRegistry()->AddService<shell::mojom::Connector>(base::Bind( 1974 GetServiceRegistry()->AddService<shell::mojom::Connector>(base::Bind(
1975 &FrameMojoShell::BindRequest, base::Unretained(frame_mojo_shell_.get()))); 1975 &FrameMojoShell::BindRequest, base::Unretained(frame_mojo_shell_.get())));
1976 1976
1977 #if defined(ENABLE_WEBVR) 1977 #if defined(ENABLE_WEBVR)
1978 const base::CommandLine& browser_command_line = 1978 const base::CommandLine& browser_command_line =
(...skipping 814 matching lines...) Expand 10 before | Expand all | Expand 10 after
2793 // For the root frame tree node, also store the AXTreeID of the focused frame. 2793 // For the root frame tree node, also store the AXTreeID of the focused frame.
2794 FrameTreeNode* focused_frame_tree_node = frame_tree_->GetFocusedFrame(); 2794 FrameTreeNode* focused_frame_tree_node = frame_tree_->GetFocusedFrame();
2795 if (!focused_frame_tree_node) 2795 if (!focused_frame_tree_node)
2796 return; 2796 return;
2797 RenderFrameHostImpl* focused_frame = 2797 RenderFrameHostImpl* focused_frame =
2798 focused_frame_tree_node->current_frame_host(); 2798 focused_frame_tree_node->current_frame_host();
2799 DCHECK(focused_frame); 2799 DCHECK(focused_frame);
2800 dst->focused_tree_id = focused_frame->GetAXTreeID(); 2800 dst->focused_tree_id = focused_frame->GetAXTreeID();
2801 } 2801 }
2802 2802
2803 void RenderFrameHostImpl::CreateWebBluetoothService( 2803 WebBluetoothServiceImpl* RenderFrameHostImpl::CreateWebBluetoothService(
2804 blink::mojom::WebBluetoothServiceRequest request) { 2804 blink::mojom::WebBluetoothServiceRequest request) {
2805 DCHECK(!web_bluetooth_service_); 2805 DCHECK(!web_bluetooth_service_);
2806 web_bluetooth_service_.reset( 2806 web_bluetooth_service_.reset(
2807 new WebBluetoothServiceImpl(this, std::move(request))); 2807 new WebBluetoothServiceImpl(this, std::move(request)));
2808 // RFHI owns web_bluetooth_service_ and web_bluetooth_service owns the 2808 // RFHI owns web_bluetooth_service_ and web_bluetooth_service owns the
2809 // binding_ which may run the error handler. binding_ can't run the error 2809 // binding_ which may run the error handler. binding_ can't run the error
2810 // handler after it's destroyed so it can't run after the RFHI is destroyed. 2810 // handler after it's destroyed so it can't run after the RFHI is destroyed.
2811 web_bluetooth_service_->SetClientConnectionErrorHandler(base::Bind( 2811 web_bluetooth_service_->SetClientConnectionErrorHandler(base::Bind(
2812 &RenderFrameHostImpl::DeleteWebBluetoothService, base::Unretained(this))); 2812 &RenderFrameHostImpl::DeleteWebBluetoothService, base::Unretained(this)));
2813 return web_bluetooth_service_.get();
2813 } 2814 }
2814 2815
2815 void RenderFrameHostImpl::DeleteWebBluetoothService() { 2816 void RenderFrameHostImpl::DeleteWebBluetoothService() {
2816 web_bluetooth_service_.reset(); 2817 web_bluetooth_service_.reset();
2817 } 2818 }
2818 2819
2819 } // namespace content 2820 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/frame_host/render_frame_host_impl.h ('k') | content/test/test_render_frame_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698