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

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 redundant include 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 704 matching lines...) Expand 10 before | Expand all | Expand 10 after
715 } 715 }
716 // Ignore discovery session start errors when the dialog was already closed by 716 // Ignore discovery session start errors when the dialog was already closed by
717 // the time they happen. 717 // the time they happen.
718 } 718 }
719 719
720 void BluetoothDispatcherHost::OnBluetoothChooserEvent( 720 void BluetoothDispatcherHost::OnBluetoothChooserEvent(
721 int chooser_id, 721 int chooser_id,
722 BluetoothChooser::Event event, 722 BluetoothChooser::Event event,
723 const std::string& device_id) { 723 const std::string& device_id) {
724 switch (event) { 724 switch (event) {
725 case BluetoothChooser::Event::RESCAN:
726 // TODO(jyasskin): Implement starting a new Bluetooth discovery session.
727 NOTIMPLEMENTED();
728 break;
725 case BluetoothChooser::Event::CANCELLED: 729 case BluetoothChooser::Event::CANCELLED:
726 case BluetoothChooser::Event::SELECTED: 730 case BluetoothChooser::Event::SELECTED: {
727 RequestDeviceSession* session = 731 RequestDeviceSession* session =
728 request_device_sessions_.Lookup(chooser_id); 732 request_device_sessions_.Lookup(chooser_id);
729 DCHECK(session) << "Shouldn't close the dialog twice."; 733 DCHECK(session) << "Shouldn't close the dialog twice.";
730 CHECK(session->chooser) << "Shouldn't close the dialog twice."; 734 CHECK(session->chooser) << "Shouldn't close the dialog twice.";
731 735
732 // Synchronously ensure nothing else calls into the chooser after it has 736 // Synchronously ensure nothing else calls into the chooser after it has
733 // asked to be closed. 737 // asked to be closed.
734 session->chooser.reset(); 738 session->chooser.reset();
735 739
736 // Yield to the event loop to make sure we don't destroy the session 740 // Yield to the event loop to make sure we don't destroy the session
737 // within a BluetoothDispatcherHost stack frame. 741 // within a BluetoothDispatcherHost stack frame.
738 if (!base::ThreadTaskRunnerHandle::Get()->PostTask( 742 if (!base::ThreadTaskRunnerHandle::Get()->PostTask(
739 FROM_HERE, 743 FROM_HERE,
740 base::Bind(&BluetoothDispatcherHost::FinishClosingChooser, 744 base::Bind(&BluetoothDispatcherHost::FinishClosingChooser,
741 weak_ptr_factory_.GetWeakPtr(), chooser_id, event, 745 weak_ptr_factory_.GetWeakPtr(), chooser_id, event,
742 device_id))) { 746 device_id))) {
743 LOG(WARNING) << "No TaskRunner; not closing requestDevice dialog."; 747 LOG(WARNING) << "No TaskRunner; not closing requestDevice dialog.";
744 } 748 }
745 break; 749 break;
750 }
751 case BluetoothChooser::Event::SHOW_OVERVIEW_HELP:
752 ShowBluetoothOverviewLink();
753 break;
754 case BluetoothChooser::Event::SHOW_PAIRING_HELP:
755 ShowBluetoothPairingLink();
756 break;
757 case BluetoothChooser::Event::SHOW_ADAPTER_OFF_HELP:
758 ShowBluetoothAdapterOffLink();
759 break;
746 } 760 }
747 } 761 }
748 762
749 void BluetoothDispatcherHost::FinishClosingChooser( 763 void BluetoothDispatcherHost::FinishClosingChooser(
750 int chooser_id, 764 int chooser_id,
751 BluetoothChooser::Event event, 765 BluetoothChooser::Event event,
752 const std::string& device_id) { 766 const std::string& device_id) {
753 RequestDeviceSession* session = request_device_sessions_.Lookup(chooser_id); 767 RequestDeviceSession* session = request_device_sessions_.Lookup(chooser_id);
754 DCHECK(session) << "Session removed unexpectedly."; 768 DCHECK(session) << "Session removed unexpectedly.";
755 769
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
893 void BluetoothDispatcherHost::OnWriteValueFailed( 907 void BluetoothDispatcherHost::OnWriteValueFailed(
894 int thread_id, 908 int thread_id,
895 int request_id, 909 int request_id,
896 device::BluetoothGattService::GattErrorCode error_code) { 910 device::BluetoothGattService::GattErrorCode error_code) {
897 // TranslateGATTError calls RecordGATTOperationOutcome. 911 // TranslateGATTError calls RecordGATTOperationOutcome.
898 Send(new BluetoothMsg_WriteCharacteristicValueError( 912 Send(new BluetoothMsg_WriteCharacteristicValueError(
899 thread_id, request_id, 913 thread_id, request_id,
900 TranslateGATTError(error_code, UMAGATTOperation::CHARACTERISTIC_WRITE))); 914 TranslateGATTError(error_code, UMAGATTOperation::CHARACTERISTIC_WRITE)));
901 } 915 }
902 916
917 void BluetoothDispatcherHost::ShowBluetoothOverviewLink() {
918 NOTIMPLEMENTED();
919 }
920
921 void BluetoothDispatcherHost::ShowBluetoothPairingLink() {
922 NOTIMPLEMENTED();
923 }
924
925 void BluetoothDispatcherHost::ShowBluetoothAdapterOffLink() {
926 NOTIMPLEMENTED();
927 }
928
903 } // namespace content 929 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/bluetooth/bluetooth_dispatcher_host.h ('k') | content/public/browser/bluetooth_chooser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698