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

Side by Side Diff: content/browser/bluetooth/bluetooth_dispatcher_host.cc

Issue 1601323002: Use GetLastCommittedOrigin instead of GetLastCommittedURL in bluetooth chooser (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: changed bluetooth test at: requestDevice.html Created 4 years, 11 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
« no previous file with comments | « chrome/browser/ui/browser.cc ('k') | content/public/browser/web_contents_delegate.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 // ID Not In Map Note: 5 // ID Not In Map Note:
6 // A service, characteristic, or descriptor ID not in the corresponding 6 // A service, characteristic, or descriptor ID not in the corresponding
7 // BluetoothDispatcherHost map [service_to_device_, characteristic_to_service_, 7 // BluetoothDispatcherHost map [service_to_device_, characteristic_to_service_,
8 // descriptor_to_characteristic_] implies a hostile renderer because a renderer 8 // descriptor_to_characteristic_] implies a hostile renderer because a renderer
9 // obtains the corresponding ID from this class and it will be added to the map 9 // obtains the corresponding ID from this class and it will be added to the map
10 // at that time. 10 // at that time.
(...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after
627 if (!render_frame_host) { 627 if (!render_frame_host) {
628 DLOG(WARNING) 628 DLOG(WARNING)
629 << "Got a requestDevice IPC without a matching RenderFrameHost: " 629 << "Got a requestDevice IPC without a matching RenderFrameHost: "
630 << render_process_id_ << ", " << frame_routing_id; 630 << render_process_id_ << ", " << frame_routing_id;
631 RecordRequestDeviceOutcome(UMARequestDeviceOutcome::NO_RENDER_FRAME); 631 RecordRequestDeviceOutcome(UMARequestDeviceOutcome::NO_RENDER_FRAME);
632 Send(new BluetoothMsg_RequestDeviceError( 632 Send(new BluetoothMsg_RequestDeviceError(
633 thread_id, request_id, WebBluetoothError::RequestDeviceWithoutFrame)); 633 thread_id, request_id, WebBluetoothError::RequestDeviceWithoutFrame));
634 return; 634 return;
635 } 635 }
636 636
637 if (render_frame_host->GetLastCommittedOrigin().unique()) {
638 VLOG(1) << "Request device with unique origin.";
639 Send(new BluetoothMsg_RequestDeviceError(
640 thread_id, request_id,
641 WebBluetoothError::RequestDeviceWithUniqueOrigin));
642 return;
643 }
644
637 if (!adapter_) { 645 if (!adapter_) {
638 VLOG(1) << "No BluetoothAdapter. Can't serve requestDevice."; 646 VLOG(1) << "No BluetoothAdapter. Can't serve requestDevice.";
639 RecordRequestDeviceOutcome(UMARequestDeviceOutcome::NO_BLUETOOTH_ADAPTER); 647 RecordRequestDeviceOutcome(UMARequestDeviceOutcome::NO_BLUETOOTH_ADAPTER);
640 Send(new BluetoothMsg_RequestDeviceError( 648 Send(new BluetoothMsg_RequestDeviceError(
641 thread_id, request_id, WebBluetoothError::NoBluetoothAdapter)); 649 thread_id, request_id, WebBluetoothError::NoBluetoothAdapter));
642 return; 650 return;
643 } 651 }
644 652
645 if (!adapter_->IsPresent()) { 653 if (!adapter_->IsPresent()) {
646 VLOG(1) << "Bluetooth Adapter not present. Can't serve requestDevice."; 654 VLOG(1) << "Bluetooth Adapter not present. Can't serve requestDevice.";
(...skipping 19 matching lines...) Expand all
666 int chooser_id = request_device_sessions_.Add(session); 674 int chooser_id = request_device_sessions_.Add(session);
667 675
668 BluetoothChooser::EventHandler chooser_event_handler = 676 BluetoothChooser::EventHandler chooser_event_handler =
669 base::Bind(&BluetoothDispatcherHost::OnBluetoothChooserEvent, 677 base::Bind(&BluetoothDispatcherHost::OnBluetoothChooserEvent,
670 weak_ptr_on_ui_thread_, chooser_id); 678 weak_ptr_on_ui_thread_, chooser_id);
671 if (WebContents* web_contents = 679 if (WebContents* web_contents =
672 WebContents::FromRenderFrameHost(render_frame_host)) { 680 WebContents::FromRenderFrameHost(render_frame_host)) {
673 if (WebContentsDelegate* delegate = web_contents->GetDelegate()) { 681 if (WebContentsDelegate* delegate = web_contents->GetDelegate()) {
674 session->chooser = delegate->RunBluetoothChooser( 682 session->chooser = delegate->RunBluetoothChooser(
675 web_contents, chooser_event_handler, 683 web_contents, chooser_event_handler,
676 // TODO(ortuno): Replace with GetLastCommittedOrigin. 684 render_frame_host->GetLastCommittedOrigin());
677 // http://crbug.com/577451
678 render_frame_host->GetLastCommittedURL().GetOrigin());
679 } 685 }
680 } 686 }
681 if (!session->chooser) { 687 if (!session->chooser) {
682 LOG(WARNING) 688 LOG(WARNING)
683 << "No Bluetooth chooser implementation; falling back to first device."; 689 << "No Bluetooth chooser implementation; falling back to first device.";
684 session->chooser.reset( 690 session->chooser.reset(
685 new FirstDeviceBluetoothChooser(chooser_event_handler)); 691 new FirstDeviceBluetoothChooser(chooser_event_handler));
686 } 692 }
687 693
688 if (!session->chooser->CanAskForScanningPermission()) { 694 if (!session->chooser->CanAskForScanningPermission()) {
(...skipping 769 matching lines...) Expand 10 before | Expand all | Expand 10 after
1458 DCHECK_CURRENTLY_ON(BrowserThread::UI); 1464 DCHECK_CURRENTLY_ON(BrowserThread::UI);
1459 NOTIMPLEMENTED(); 1465 NOTIMPLEMENTED();
1460 } 1466 }
1461 1467
1462 void BluetoothDispatcherHost::ShowNeedLocationLink() { 1468 void BluetoothDispatcherHost::ShowNeedLocationLink() {
1463 DCHECK_CURRENTLY_ON(BrowserThread::UI); 1469 DCHECK_CURRENTLY_ON(BrowserThread::UI);
1464 NOTIMPLEMENTED(); 1470 NOTIMPLEMENTED();
1465 } 1471 }
1466 1472
1467 } // namespace content 1473 } // namespace content
OLDNEW
« no previous file with comments | « chrome/browser/ui/browser.cc ('k') | content/public/browser/web_contents_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698