Chromium Code Reviews| 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 <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 3190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3201 if (!focused_frame_tree_node) | 3201 if (!focused_frame_tree_node) |
| 3202 return; | 3202 return; |
| 3203 RenderFrameHostImpl* focused_frame = | 3203 RenderFrameHostImpl* focused_frame = |
| 3204 focused_frame_tree_node->current_frame_host(); | 3204 focused_frame_tree_node->current_frame_host(); |
| 3205 DCHECK(focused_frame); | 3205 DCHECK(focused_frame); |
| 3206 dst->focused_tree_id = focused_frame->GetAXTreeID(); | 3206 dst->focused_tree_id = focused_frame->GetAXTreeID(); |
| 3207 } | 3207 } |
| 3208 | 3208 |
| 3209 WebBluetoothServiceImpl* RenderFrameHostImpl::CreateWebBluetoothService( | 3209 WebBluetoothServiceImpl* RenderFrameHostImpl::CreateWebBluetoothService( |
| 3210 blink::mojom::WebBluetoothServiceRequest request) { | 3210 blink::mojom::WebBluetoothServiceRequest request) { |
| 3211 DCHECK(!web_bluetooth_service_); | |
| 3212 web_bluetooth_service_.reset( | |
| 3213 new WebBluetoothServiceImpl(this, std::move(request))); | |
| 3214 // RFHI owns web_bluetooth_service_ and web_bluetooth_service owns the | 3211 // RFHI owns web_bluetooth_service_ and web_bluetooth_service owns the |
| 3215 // binding_ which may run the error handler. binding_ can't run the error | 3212 // binding_ which may run the error handler. binding_ can't run the error |
| 3216 // handler after it's destroyed so it can't run after the RFHI is destroyed. | 3213 // handler after it's destroyed so it can't run after the RFHI is destroyed. |
| 3217 web_bluetooth_service_->SetClientConnectionErrorHandler(base::Bind( | 3214 std::unique_ptr<WebBluetoothServiceImpl> web_bluetooth_service = |
| 3218 &RenderFrameHostImpl::DeleteWebBluetoothService, base::Unretained(this))); | 3215 base::MakeUnique<WebBluetoothServiceImpl>(this, std::move(request)); |
| 3219 return web_bluetooth_service_.get(); | 3216 WebBluetoothServiceImpl* web_bluetooth_service_ptr = |
| 3217 web_bluetooth_service.get(); | |
|
dougt
2016/12/16 00:11:44
I would probably not have this local variable, can
juncai
2016/12/17 01:18:51
Done.
| |
| 3218 web_bluetooth_service->SetClientConnectionErrorHandler( | |
| 3219 base::Bind(&RenderFrameHostImpl::DeleteWebBluetoothService, | |
| 3220 base::Unretained(this), web_bluetooth_service_ptr)); | |
| 3221 web_bluetooth_services_.insert(std::make_pair( | |
| 3222 web_bluetooth_service_ptr, std::move(web_bluetooth_service))); | |
| 3223 return web_bluetooth_service_ptr; | |
| 3220 } | 3224 } |
| 3221 | 3225 |
| 3222 void RenderFrameHostImpl::DeleteWebBluetoothService() { | 3226 void RenderFrameHostImpl::DeleteWebBluetoothService( |
| 3223 web_bluetooth_service_.reset(); | 3227 WebBluetoothServiceImpl* web_bluetooth_service_ptr) { |
|
dougt
2016/12/16 00:11:44
remove _ptr
juncai
2016/12/17 01:18:51
Done.
| |
| 3228 auto it = web_bluetooth_services_.find(web_bluetooth_service_ptr); | |
| 3229 DCHECK(it != web_bluetooth_services_.end()); | |
| 3230 web_bluetooth_services_.erase(it); | |
| 3224 } | 3231 } |
| 3225 | 3232 |
| 3226 void RenderFrameHostImpl::Create( | 3233 void RenderFrameHostImpl::Create( |
| 3227 const service_manager::Identity& remote_identity, | 3234 const service_manager::Identity& remote_identity, |
| 3228 media::mojom::InterfaceFactoryRequest request) { | 3235 media::mojom::InterfaceFactoryRequest request) { |
| 3229 DCHECK(!media_interface_proxy_); | 3236 DCHECK(!media_interface_proxy_); |
| 3230 media_interface_proxy_.reset(new MediaInterfaceProxy( | 3237 media_interface_proxy_.reset(new MediaInterfaceProxy( |
| 3231 this, std::move(request), | 3238 this, std::move(request), |
| 3232 base::Bind(&RenderFrameHostImpl::OnMediaInterfaceFactoryConnectionError, | 3239 base::Bind(&RenderFrameHostImpl::OnMediaInterfaceFactoryConnectionError, |
| 3233 base::Unretained(this)))); | 3240 base::Unretained(this)))); |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3316 // There is no pending NavigationEntry in these cases, so pass 0 as the | 3323 // There is no pending NavigationEntry in these cases, so pass 0 as the |
| 3317 // pending_nav_entry_id. If the previous handle was a prematurely aborted | 3324 // pending_nav_entry_id. If the previous handle was a prematurely aborted |
| 3318 // navigation loaded via LoadDataWithBaseURL, propagate the entry id. | 3325 // navigation loaded via LoadDataWithBaseURL, propagate the entry id. |
| 3319 return NavigationHandleImpl::Create( | 3326 return NavigationHandleImpl::Create( |
| 3320 params.url, frame_tree_node_, is_renderer_initiated, | 3327 params.url, frame_tree_node_, is_renderer_initiated, |
| 3321 params.was_within_same_page, base::TimeTicks::Now(), | 3328 params.was_within_same_page, base::TimeTicks::Now(), |
| 3322 entry_id_for_data_nav, false); // started_from_context_menu | 3329 entry_id_for_data_nav, false); // started_from_context_menu |
| 3323 } | 3330 } |
| 3324 | 3331 |
| 3325 } // namespace content | 3332 } // namespace content |
| OLD | NEW |