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

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

Issue 1315093002: Implement a bluetooth picker dialog for Android (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove unused member Created 5 years, 3 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 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 // NETWORK_ERROR Note: 5 // NETWORK_ERROR Note:
6 // When a device can't be found in the BluetoothAdapter, that generally 6 // When a device can't be found in the BluetoothAdapter, that generally
7 // indicates that it's gone out of range. We reject with a NetworkError in that 7 // indicates that it's gone out of range. We reject with a NetworkError in that
8 // case. 8 // case.
9 // https://webbluetoothchrome.github.io/web-bluetooth/#dom-bluetoothdevice-conne ctgatt 9 // https://webbluetoothchrome.github.io/web-bluetooth/#dom-bluetoothdevice-conne ctgatt
10 10
(...skipping 691 matching lines...) Expand 10 before | Expand all | Expand 10 after
702 } 702 }
703 // Ignore discovery session start errors when the dialog was already closed by 703 // Ignore discovery session start errors when the dialog was already closed by
704 // the time they happen. 704 // the time they happen.
705 } 705 }
706 706
707 void BluetoothDispatcherHost::OnBluetoothChooserEvent( 707 void BluetoothDispatcherHost::OnBluetoothChooserEvent(
708 int chooser_id, 708 int chooser_id,
709 BluetoothChooser::Event event, 709 BluetoothChooser::Event event,
710 const std::string& device_id) { 710 const std::string& device_id) {
711 switch (event) { 711 switch (event) {
712 case BluetoothChooser::Event::RESCAN:
713 // TODO(jyasskin): Implement starting a new Bluetooth discovery session.
714 NOTIMPLEMENTED();
715 break;
712 case BluetoothChooser::Event::CANCELLED: 716 case BluetoothChooser::Event::CANCELLED:
713 case BluetoothChooser::Event::SELECTED: 717 case BluetoothChooser::Event::SELECTED: {
714 RequestDeviceSession* session = 718 RequestDeviceSession* session =
715 request_device_sessions_.Lookup(chooser_id); 719 request_device_sessions_.Lookup(chooser_id);
716 DCHECK(session) << "Shouldn't close the dialog twice."; 720 DCHECK(session) << "Shouldn't close the dialog twice.";
717 CHECK(session->chooser) << "Shouldn't close the dialog twice."; 721 CHECK(session->chooser) << "Shouldn't close the dialog twice.";
718 722
719 // Synchronously ensure nothing else calls into the chooser after it has 723 // Synchronously ensure nothing else calls into the chooser after it has
720 // asked to be closed. 724 // asked to be closed.
721 session->chooser.reset(); 725 session->chooser.reset();
722 726
723 // Yield to the event loop to make sure we don't destroy the session 727 // Yield to the event loop to make sure we don't destroy the session
724 // within a BluetoothDispatcherHost stack frame. 728 // within a BluetoothDispatcherHost stack frame.
725 if (!base::ThreadTaskRunnerHandle::Get()->PostTask( 729 if (!base::ThreadTaskRunnerHandle::Get()->PostTask(
726 FROM_HERE, 730 FROM_HERE,
727 base::Bind(&BluetoothDispatcherHost::FinishClosingChooser, 731 base::Bind(&BluetoothDispatcherHost::FinishClosingChooser,
728 weak_ptr_factory_.GetWeakPtr(), chooser_id, event, 732 weak_ptr_factory_.GetWeakPtr(), chooser_id, event,
729 device_id))) { 733 device_id))) {
730 LOG(WARNING) << "No TaskRunner; not closing requestDevice dialog."; 734 LOG(WARNING) << "No TaskRunner; not closing requestDevice dialog.";
731 } 735 }
732 break; 736 break;
737 }
738 case BluetoothChooser::Event::SHOW_OVERVIEW_HELP:
739 ShowBluetoothOverviewLink();
740 break;
741 case BluetoothChooser::Event::SHOW_PAIRING_HELP:
742 ShowBluetoothPairingLink();
743 break;
744 case BluetoothChooser::Event::SHOW_ADAPTER_OFF_HELP:
745 ShowBluetoothAdapterOffLink();
746 break;
733 } 747 }
734 } 748 }
735 749
736 void BluetoothDispatcherHost::FinishClosingChooser( 750 void BluetoothDispatcherHost::FinishClosingChooser(
737 int chooser_id, 751 int chooser_id,
738 BluetoothChooser::Event event, 752 BluetoothChooser::Event event,
739 const std::string& device_id) { 753 const std::string& device_id) {
740 RequestDeviceSession* session = request_device_sessions_.Lookup(chooser_id); 754 RequestDeviceSession* session = request_device_sessions_.Lookup(chooser_id);
741 DCHECK(session) << "Session removed unexpectedly."; 755 DCHECK(session) << "Session removed unexpectedly.";
742 756
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
880 void BluetoothDispatcherHost::OnWriteValueFailed( 894 void BluetoothDispatcherHost::OnWriteValueFailed(
881 int thread_id, 895 int thread_id,
882 int request_id, 896 int request_id,
883 device::BluetoothGattService::GattErrorCode error_code) { 897 device::BluetoothGattService::GattErrorCode error_code) {
884 // TranslateGATTError calls RecordGATTOperationOutcome. 898 // TranslateGATTError calls RecordGATTOperationOutcome.
885 Send(new BluetoothMsg_WriteCharacteristicValueError( 899 Send(new BluetoothMsg_WriteCharacteristicValueError(
886 thread_id, request_id, 900 thread_id, request_id,
887 TranslateGATTError(error_code, UMAGATTOperation::CHARACTERISTIC_WRITE))); 901 TranslateGATTError(error_code, UMAGATTOperation::CHARACTERISTIC_WRITE)));
888 } 902 }
889 903
904 void BluetoothDispatcherHost::ShowBluetoothOverviewLink() {
905 NOTIMPLEMENTED();
906 }
907
908 void BluetoothDispatcherHost::ShowBluetoothPairingLink() {
909 NOTIMPLEMENTED();
910 }
911
912 void BluetoothDispatcherHost::ShowBluetoothAdapterOffLink() {
913 NOTIMPLEMENTED();
914 }
915
890 } // namespace content 916 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698