OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "device/bluetooth/dbus/fake_bluetooth_device_client.h" | 5 #include "device/bluetooth/dbus/fake_bluetooth_device_client.h" |
6 | 6 |
7 #include <fcntl.h> | 7 #include <fcntl.h> |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <sys/socket.h> | 9 #include <sys/socket.h> |
10 #include <sys/types.h> | 10 #include <sys/types.h> |
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
472 | 472 |
473 base::WorkerPool::GetTaskRunner(false) | 473 base::WorkerPool::GetTaskRunner(false) |
474 ->PostTask(FROM_HERE, base::Bind(&SimulatedProfileSocket, fds[0])); | 474 ->PostTask(FROM_HERE, base::Bind(&SimulatedProfileSocket, fds[0])); |
475 | 475 |
476 scoped_ptr<dbus::FileDescriptor> fd(new dbus::FileDescriptor(fds[1])); | 476 scoped_ptr<dbus::FileDescriptor> fd(new dbus::FileDescriptor(fds[1])); |
477 | 477 |
478 // Post the new connection to the service provider. | 478 // Post the new connection to the service provider. |
479 BluetoothProfileServiceProvider::Delegate::Options options; | 479 BluetoothProfileServiceProvider::Delegate::Options options; |
480 | 480 |
481 profile_service_provider->NewConnection( | 481 profile_service_provider->NewConnection( |
482 object_path, fd.Pass(), options, | 482 object_path, std::move(fd), options, |
483 base::Bind(&FakeBluetoothDeviceClient::ConnectionCallback, | 483 base::Bind(&FakeBluetoothDeviceClient::ConnectionCallback, |
484 base::Unretained(this), object_path, callback, | 484 base::Unretained(this), object_path, callback, |
485 error_callback)); | 485 error_callback)); |
486 } | 486 } |
487 | 487 |
488 void FakeBluetoothDeviceClient::DisconnectProfile( | 488 void FakeBluetoothDeviceClient::DisconnectProfile( |
489 const dbus::ObjectPath& object_path, | 489 const dbus::ObjectPath& object_path, |
490 const std::string& uuid, | 490 const std::string& uuid, |
491 const base::Closure& callback, | 491 const base::Closure& callback, |
492 const ErrorCallback& error_callback) { | 492 const ErrorCallback& error_callback) { |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
756 pairedDevice->SetString("name", kPairedDeviceName); | 756 pairedDevice->SetString("name", kPairedDeviceName); |
757 pairedDevice->SetString("alias", kPairedDeviceName); | 757 pairedDevice->SetString("alias", kPairedDeviceName); |
758 pairedDevice->SetString("pairingMethod", ""); | 758 pairedDevice->SetString("pairingMethod", ""); |
759 pairedDevice->SetString("pairingAuthToken", ""); | 759 pairedDevice->SetString("pairingAuthToken", ""); |
760 pairedDevice->SetString("pairingAction", ""); | 760 pairedDevice->SetString("pairingAction", ""); |
761 pairedDevice->SetInteger("classValue", kPairedDeviceClass); | 761 pairedDevice->SetInteger("classValue", kPairedDeviceClass); |
762 pairedDevice->SetBoolean("discoverable", true); | 762 pairedDevice->SetBoolean("discoverable", true); |
763 pairedDevice->SetBoolean("isTrusted", true); | 763 pairedDevice->SetBoolean("isTrusted", true); |
764 pairedDevice->SetBoolean("paired", true); | 764 pairedDevice->SetBoolean("paired", true); |
765 pairedDevice->SetBoolean("incoming", false); | 765 pairedDevice->SetBoolean("incoming", false); |
766 predefined_devices->Append(pairedDevice.Pass()); | 766 predefined_devices->Append(std::move(pairedDevice)); |
767 | 767 |
768 scoped_ptr<base::DictionaryValue> legacyDevice(new base::DictionaryValue); | 768 scoped_ptr<base::DictionaryValue> legacyDevice(new base::DictionaryValue); |
769 legacyDevice->SetString("path", kLegacyAutopairPath); | 769 legacyDevice->SetString("path", kLegacyAutopairPath); |
770 legacyDevice->SetString("address", kLegacyAutopairAddress); | 770 legacyDevice->SetString("address", kLegacyAutopairAddress); |
771 legacyDevice->SetString("name", kLegacyAutopairName); | 771 legacyDevice->SetString("name", kLegacyAutopairName); |
772 legacyDevice->SetString("alias", kLegacyAutopairName); | 772 legacyDevice->SetString("alias", kLegacyAutopairName); |
773 legacyDevice->SetString("pairingMethod", ""); | 773 legacyDevice->SetString("pairingMethod", ""); |
774 legacyDevice->SetString("pairingAuthToken", ""); | 774 legacyDevice->SetString("pairingAuthToken", ""); |
775 legacyDevice->SetString("pairingAction", ""); | 775 legacyDevice->SetString("pairingAction", ""); |
776 legacyDevice->SetInteger("classValue", kLegacyAutopairClass); | 776 legacyDevice->SetInteger("classValue", kLegacyAutopairClass); |
777 legacyDevice->SetBoolean("isTrusted", true); | 777 legacyDevice->SetBoolean("isTrusted", true); |
778 legacyDevice->SetBoolean("discoverable", false); | 778 legacyDevice->SetBoolean("discoverable", false); |
779 legacyDevice->SetBoolean("paired", false); | 779 legacyDevice->SetBoolean("paired", false); |
780 legacyDevice->SetBoolean("incoming", false); | 780 legacyDevice->SetBoolean("incoming", false); |
781 predefined_devices->Append(legacyDevice.Pass()); | 781 predefined_devices->Append(std::move(legacyDevice)); |
782 | 782 |
783 scoped_ptr<base::DictionaryValue> pin(new base::DictionaryValue); | 783 scoped_ptr<base::DictionaryValue> pin(new base::DictionaryValue); |
784 pin->SetString("path", kDisplayPinCodePath); | 784 pin->SetString("path", kDisplayPinCodePath); |
785 pin->SetString("address", kDisplayPinCodeAddress); | 785 pin->SetString("address", kDisplayPinCodeAddress); |
786 pin->SetString("name", kDisplayPinCodeName); | 786 pin->SetString("name", kDisplayPinCodeName); |
787 pin->SetString("alias", kDisplayPinCodeName); | 787 pin->SetString("alias", kDisplayPinCodeName); |
788 pin->SetString("pairingMethod", kPairingMethodPinCode); | 788 pin->SetString("pairingMethod", kPairingMethodPinCode); |
789 pin->SetString("pairingAuthToken", kTestPinCode); | 789 pin->SetString("pairingAuthToken", kTestPinCode); |
790 pin->SetString("pairingAction", kPairingActionDisplay); | 790 pin->SetString("pairingAction", kPairingActionDisplay); |
791 pin->SetInteger("classValue", kDisplayPinCodeClass); | 791 pin->SetInteger("classValue", kDisplayPinCodeClass); |
792 pin->SetBoolean("isTrusted", false); | 792 pin->SetBoolean("isTrusted", false); |
793 pin->SetBoolean("discoverable", false); | 793 pin->SetBoolean("discoverable", false); |
794 pin->SetBoolean("paired", false); | 794 pin->SetBoolean("paired", false); |
795 pin->SetBoolean("incoming", false); | 795 pin->SetBoolean("incoming", false); |
796 predefined_devices->Append(pin.Pass()); | 796 predefined_devices->Append(std::move(pin)); |
797 | 797 |
798 scoped_ptr<base::DictionaryValue> vanishing(new base::DictionaryValue); | 798 scoped_ptr<base::DictionaryValue> vanishing(new base::DictionaryValue); |
799 vanishing->SetString("path", kVanishingDevicePath); | 799 vanishing->SetString("path", kVanishingDevicePath); |
800 vanishing->SetString("address", kVanishingDeviceAddress); | 800 vanishing->SetString("address", kVanishingDeviceAddress); |
801 vanishing->SetString("name", kVanishingDeviceName); | 801 vanishing->SetString("name", kVanishingDeviceName); |
802 vanishing->SetString("alias", kVanishingDeviceName); | 802 vanishing->SetString("alias", kVanishingDeviceName); |
803 vanishing->SetString("pairingMethod", ""); | 803 vanishing->SetString("pairingMethod", ""); |
804 vanishing->SetString("pairingAuthToken", ""); | 804 vanishing->SetString("pairingAuthToken", ""); |
805 vanishing->SetString("pairingAction", ""); | 805 vanishing->SetString("pairingAction", ""); |
806 vanishing->SetInteger("classValue", kVanishingDeviceClass); | 806 vanishing->SetInteger("classValue", kVanishingDeviceClass); |
807 vanishing->SetBoolean("isTrusted", false); | 807 vanishing->SetBoolean("isTrusted", false); |
808 vanishing->SetBoolean("discoverable", false); | 808 vanishing->SetBoolean("discoverable", false); |
809 vanishing->SetBoolean("paired", false); | 809 vanishing->SetBoolean("paired", false); |
810 vanishing->SetBoolean("incoming", false); | 810 vanishing->SetBoolean("incoming", false); |
811 predefined_devices->Append(vanishing.Pass()); | 811 predefined_devices->Append(std::move(vanishing)); |
812 | 812 |
813 scoped_ptr<base::DictionaryValue> connect_unpairable( | 813 scoped_ptr<base::DictionaryValue> connect_unpairable( |
814 new base::DictionaryValue); | 814 new base::DictionaryValue); |
815 connect_unpairable->SetString("path", kConnectUnpairablePath); | 815 connect_unpairable->SetString("path", kConnectUnpairablePath); |
816 connect_unpairable->SetString("address", kConnectUnpairableAddress); | 816 connect_unpairable->SetString("address", kConnectUnpairableAddress); |
817 connect_unpairable->SetString("name", kConnectUnpairableName); | 817 connect_unpairable->SetString("name", kConnectUnpairableName); |
818 connect_unpairable->SetString("pairingMethod", ""); | 818 connect_unpairable->SetString("pairingMethod", ""); |
819 connect_unpairable->SetString("pairingAuthToken", ""); | 819 connect_unpairable->SetString("pairingAuthToken", ""); |
820 connect_unpairable->SetString("pairingAction", ""); | 820 connect_unpairable->SetString("pairingAction", ""); |
821 connect_unpairable->SetString("alias", kConnectUnpairableName); | 821 connect_unpairable->SetString("alias", kConnectUnpairableName); |
822 connect_unpairable->SetInteger("classValue", kConnectUnpairableClass); | 822 connect_unpairable->SetInteger("classValue", kConnectUnpairableClass); |
823 connect_unpairable->SetBoolean("isTrusted", false); | 823 connect_unpairable->SetBoolean("isTrusted", false); |
824 connect_unpairable->SetBoolean("discoverable", false); | 824 connect_unpairable->SetBoolean("discoverable", false); |
825 connect_unpairable->SetBoolean("paired", false); | 825 connect_unpairable->SetBoolean("paired", false); |
826 connect_unpairable->SetBoolean("incoming", false); | 826 connect_unpairable->SetBoolean("incoming", false); |
827 predefined_devices->Append(connect_unpairable.Pass()); | 827 predefined_devices->Append(std::move(connect_unpairable)); |
828 | 828 |
829 scoped_ptr<base::DictionaryValue> passkey(new base::DictionaryValue); | 829 scoped_ptr<base::DictionaryValue> passkey(new base::DictionaryValue); |
830 passkey->SetString("path", kDisplayPasskeyPath); | 830 passkey->SetString("path", kDisplayPasskeyPath); |
831 passkey->SetString("address", kDisplayPasskeyAddress); | 831 passkey->SetString("address", kDisplayPasskeyAddress); |
832 passkey->SetString("name", kDisplayPasskeyName); | 832 passkey->SetString("name", kDisplayPasskeyName); |
833 passkey->SetString("alias", kDisplayPasskeyName); | 833 passkey->SetString("alias", kDisplayPasskeyName); |
834 passkey->SetString("pairingMethod", kPairingMethodPassKey); | 834 passkey->SetString("pairingMethod", kPairingMethodPassKey); |
835 passkey->SetInteger("pairingAuthToken", kTestPassKey); | 835 passkey->SetInteger("pairingAuthToken", kTestPassKey); |
836 passkey->SetString("pairingAction", kPairingActionDisplay); | 836 passkey->SetString("pairingAction", kPairingActionDisplay); |
837 passkey->SetInteger("classValue", kDisplayPasskeyClass); | 837 passkey->SetInteger("classValue", kDisplayPasskeyClass); |
838 passkey->SetBoolean("isTrusted", false); | 838 passkey->SetBoolean("isTrusted", false); |
839 passkey->SetBoolean("discoverable", false); | 839 passkey->SetBoolean("discoverable", false); |
840 passkey->SetBoolean("paired", false); | 840 passkey->SetBoolean("paired", false); |
841 passkey->SetBoolean("incoming", false); | 841 passkey->SetBoolean("incoming", false); |
842 predefined_devices->Append(passkey.Pass()); | 842 predefined_devices->Append(std::move(passkey)); |
843 | 843 |
844 scoped_ptr<base::DictionaryValue> request_pin(new base::DictionaryValue); | 844 scoped_ptr<base::DictionaryValue> request_pin(new base::DictionaryValue); |
845 request_pin->SetString("path", kRequestPinCodePath); | 845 request_pin->SetString("path", kRequestPinCodePath); |
846 request_pin->SetString("address", kRequestPinCodeAddress); | 846 request_pin->SetString("address", kRequestPinCodeAddress); |
847 request_pin->SetString("name", kRequestPinCodeName); | 847 request_pin->SetString("name", kRequestPinCodeName); |
848 request_pin->SetString("alias", kRequestPinCodeName); | 848 request_pin->SetString("alias", kRequestPinCodeName); |
849 request_pin->SetString("pairingMethod", ""); | 849 request_pin->SetString("pairingMethod", ""); |
850 request_pin->SetString("pairingAuthToken", ""); | 850 request_pin->SetString("pairingAuthToken", ""); |
851 request_pin->SetString("pairingAction", kPairingActionRequest); | 851 request_pin->SetString("pairingAction", kPairingActionRequest); |
852 request_pin->SetInteger("classValue", kRequestPinCodeClass); | 852 request_pin->SetInteger("classValue", kRequestPinCodeClass); |
853 request_pin->SetBoolean("isTrusted", false); | 853 request_pin->SetBoolean("isTrusted", false); |
854 request_pin->SetBoolean("discoverable", false); | 854 request_pin->SetBoolean("discoverable", false); |
855 request_pin->SetBoolean("paired", false); | 855 request_pin->SetBoolean("paired", false); |
856 request_pin->SetBoolean("incoming", false); | 856 request_pin->SetBoolean("incoming", false); |
857 predefined_devices->Append(request_pin.Pass()); | 857 predefined_devices->Append(std::move(request_pin)); |
858 | 858 |
859 scoped_ptr<base::DictionaryValue> confirm(new base::DictionaryValue); | 859 scoped_ptr<base::DictionaryValue> confirm(new base::DictionaryValue); |
860 confirm->SetString("path", kConfirmPasskeyPath); | 860 confirm->SetString("path", kConfirmPasskeyPath); |
861 confirm->SetString("address", kConfirmPasskeyAddress); | 861 confirm->SetString("address", kConfirmPasskeyAddress); |
862 confirm->SetString("name", kConfirmPasskeyName); | 862 confirm->SetString("name", kConfirmPasskeyName); |
863 confirm->SetString("alias", kConfirmPasskeyName); | 863 confirm->SetString("alias", kConfirmPasskeyName); |
864 confirm->SetString("pairingMethod", ""); | 864 confirm->SetString("pairingMethod", ""); |
865 confirm->SetInteger("pairingAuthToken", kTestPassKey); | 865 confirm->SetInteger("pairingAuthToken", kTestPassKey); |
866 confirm->SetString("pairingAction", kPairingActionConfirmation); | 866 confirm->SetString("pairingAction", kPairingActionConfirmation); |
867 confirm->SetInteger("classValue", kConfirmPasskeyClass); | 867 confirm->SetInteger("classValue", kConfirmPasskeyClass); |
868 confirm->SetBoolean("isTrusted", false); | 868 confirm->SetBoolean("isTrusted", false); |
869 confirm->SetBoolean("discoverable", false); | 869 confirm->SetBoolean("discoverable", false); |
870 confirm->SetBoolean("paired", false); | 870 confirm->SetBoolean("paired", false); |
871 confirm->SetBoolean("incoming", false); | 871 confirm->SetBoolean("incoming", false); |
872 predefined_devices->Append(confirm.Pass()); | 872 predefined_devices->Append(std::move(confirm)); |
873 | 873 |
874 scoped_ptr<base::DictionaryValue> request_passkey(new base::DictionaryValue); | 874 scoped_ptr<base::DictionaryValue> request_passkey(new base::DictionaryValue); |
875 request_passkey->SetString("path", kRequestPasskeyPath); | 875 request_passkey->SetString("path", kRequestPasskeyPath); |
876 request_passkey->SetString("address", kRequestPasskeyAddress); | 876 request_passkey->SetString("address", kRequestPasskeyAddress); |
877 request_passkey->SetString("name", kRequestPasskeyName); | 877 request_passkey->SetString("name", kRequestPasskeyName); |
878 request_passkey->SetString("alias", kRequestPasskeyName); | 878 request_passkey->SetString("alias", kRequestPasskeyName); |
879 request_passkey->SetString("pairingMethod", kPairingMethodPassKey); | 879 request_passkey->SetString("pairingMethod", kPairingMethodPassKey); |
880 request_passkey->SetString("pairingAction", kPairingActionRequest); | 880 request_passkey->SetString("pairingAction", kPairingActionRequest); |
881 request_passkey->SetInteger("pairingAuthToken", kTestPassKey); | 881 request_passkey->SetInteger("pairingAuthToken", kTestPassKey); |
882 request_passkey->SetInteger("classValue", kRequestPasskeyClass); | 882 request_passkey->SetInteger("classValue", kRequestPasskeyClass); |
883 request_passkey->SetBoolean("isTrusted", false); | 883 request_passkey->SetBoolean("isTrusted", false); |
884 request_passkey->SetBoolean("discoverable", false); | 884 request_passkey->SetBoolean("discoverable", false); |
885 request_passkey->SetBoolean("paired", false); | 885 request_passkey->SetBoolean("paired", false); |
886 request_passkey->SetBoolean("incoming", false); | 886 request_passkey->SetBoolean("incoming", false); |
887 predefined_devices->Append(request_passkey.Pass()); | 887 predefined_devices->Append(std::move(request_passkey)); |
888 | 888 |
889 scoped_ptr<base::DictionaryValue> unconnectable(new base::DictionaryValue); | 889 scoped_ptr<base::DictionaryValue> unconnectable(new base::DictionaryValue); |
890 unconnectable->SetString("path", kUnconnectableDevicePath); | 890 unconnectable->SetString("path", kUnconnectableDevicePath); |
891 unconnectable->SetString("address", kUnconnectableDeviceAddress); | 891 unconnectable->SetString("address", kUnconnectableDeviceAddress); |
892 unconnectable->SetString("name", kUnconnectableDeviceName); | 892 unconnectable->SetString("name", kUnconnectableDeviceName); |
893 unconnectable->SetString("alias", kUnconnectableDeviceName); | 893 unconnectable->SetString("alias", kUnconnectableDeviceName); |
894 unconnectable->SetString("pairingMethod", ""); | 894 unconnectable->SetString("pairingMethod", ""); |
895 unconnectable->SetString("pairingAuthToken", ""); | 895 unconnectable->SetString("pairingAuthToken", ""); |
896 unconnectable->SetString("pairingAction", ""); | 896 unconnectable->SetString("pairingAction", ""); |
897 unconnectable->SetInteger("classValue", kUnconnectableDeviceClass); | 897 unconnectable->SetInteger("classValue", kUnconnectableDeviceClass); |
898 unconnectable->SetBoolean("isTrusted", true); | 898 unconnectable->SetBoolean("isTrusted", true); |
899 unconnectable->SetBoolean("discoverable", false); | 899 unconnectable->SetBoolean("discoverable", false); |
900 unconnectable->SetBoolean("paired", false); | 900 unconnectable->SetBoolean("paired", false); |
901 unconnectable->SetBoolean("incoming", false); | 901 unconnectable->SetBoolean("incoming", false); |
902 predefined_devices->Append(unconnectable.Pass()); | 902 predefined_devices->Append(std::move(unconnectable)); |
903 | 903 |
904 scoped_ptr<base::DictionaryValue> unpairable(new base::DictionaryValue); | 904 scoped_ptr<base::DictionaryValue> unpairable(new base::DictionaryValue); |
905 unpairable->SetString("path", kUnpairableDevicePath); | 905 unpairable->SetString("path", kUnpairableDevicePath); |
906 unpairable->SetString("address", kUnpairableDeviceAddress); | 906 unpairable->SetString("address", kUnpairableDeviceAddress); |
907 unpairable->SetString("name", kUnpairableDeviceName); | 907 unpairable->SetString("name", kUnpairableDeviceName); |
908 unpairable->SetString("alias", kUnpairableDeviceName); | 908 unpairable->SetString("alias", kUnpairableDeviceName); |
909 unpairable->SetString("pairingMethod", ""); | 909 unpairable->SetString("pairingMethod", ""); |
910 unpairable->SetString("pairingAuthToken", ""); | 910 unpairable->SetString("pairingAuthToken", ""); |
911 unpairable->SetString("pairingAction", kPairingActionFail); | 911 unpairable->SetString("pairingAction", kPairingActionFail); |
912 unpairable->SetInteger("classValue", kUnpairableDeviceClass); | 912 unpairable->SetInteger("classValue", kUnpairableDeviceClass); |
913 unpairable->SetBoolean("isTrusted", false); | 913 unpairable->SetBoolean("isTrusted", false); |
914 unpairable->SetBoolean("discoverable", false); | 914 unpairable->SetBoolean("discoverable", false); |
915 unpairable->SetBoolean("paired", false); | 915 unpairable->SetBoolean("paired", false); |
916 unpairable->SetBoolean("incoming", false); | 916 unpairable->SetBoolean("incoming", false); |
917 predefined_devices->Append(unpairable.Pass()); | 917 predefined_devices->Append(std::move(unpairable)); |
918 | 918 |
919 scoped_ptr<base::DictionaryValue> just_works(new base::DictionaryValue); | 919 scoped_ptr<base::DictionaryValue> just_works(new base::DictionaryValue); |
920 just_works->SetString("path", kJustWorksPath); | 920 just_works->SetString("path", kJustWorksPath); |
921 just_works->SetString("address", kJustWorksAddress); | 921 just_works->SetString("address", kJustWorksAddress); |
922 just_works->SetString("name", kJustWorksName); | 922 just_works->SetString("name", kJustWorksName); |
923 just_works->SetString("alias", kJustWorksName); | 923 just_works->SetString("alias", kJustWorksName); |
924 just_works->SetString("pairingMethod", ""); | 924 just_works->SetString("pairingMethod", ""); |
925 just_works->SetString("pairingAuthToken", ""); | 925 just_works->SetString("pairingAuthToken", ""); |
926 just_works->SetString("pairingAction", ""); | 926 just_works->SetString("pairingAction", ""); |
927 just_works->SetInteger("classValue", kJustWorksClass); | 927 just_works->SetInteger("classValue", kJustWorksClass); |
928 just_works->SetBoolean("isTrusted", false); | 928 just_works->SetBoolean("isTrusted", false); |
929 just_works->SetBoolean("discoverable", false); | 929 just_works->SetBoolean("discoverable", false); |
930 just_works->SetBoolean("paired", false); | 930 just_works->SetBoolean("paired", false); |
931 just_works->SetBoolean("incoming", false); | 931 just_works->SetBoolean("incoming", false); |
932 predefined_devices->Append(just_works.Pass()); | 932 predefined_devices->Append(std::move(just_works)); |
933 | 933 |
934 scoped_ptr<base::DictionaryValue> low_energy(new base::DictionaryValue); | 934 scoped_ptr<base::DictionaryValue> low_energy(new base::DictionaryValue); |
935 low_energy->SetString("path", kLowEnergyPath); | 935 low_energy->SetString("path", kLowEnergyPath); |
936 low_energy->SetString("address", kLowEnergyAddress); | 936 low_energy->SetString("address", kLowEnergyAddress); |
937 low_energy->SetString("name", kLowEnergyName); | 937 low_energy->SetString("name", kLowEnergyName); |
938 low_energy->SetString("alias", kLowEnergyName); | 938 low_energy->SetString("alias", kLowEnergyName); |
939 low_energy->SetString("pairingMethod", ""); | 939 low_energy->SetString("pairingMethod", ""); |
940 low_energy->SetString("pairingAuthToken", ""); | 940 low_energy->SetString("pairingAuthToken", ""); |
941 low_energy->SetString("pairingAction", ""); | 941 low_energy->SetString("pairingAction", ""); |
942 low_energy->SetInteger("classValue", kLowEnergyClass); | 942 low_energy->SetInteger("classValue", kLowEnergyClass); |
943 low_energy->SetBoolean("isTrusted", false); | 943 low_energy->SetBoolean("isTrusted", false); |
944 low_energy->SetBoolean("discoverable", false); | 944 low_energy->SetBoolean("discoverable", false); |
945 low_energy->SetBoolean("paireed", false); | 945 low_energy->SetBoolean("paireed", false); |
946 low_energy->SetBoolean("incoming", false); | 946 low_energy->SetBoolean("incoming", false); |
947 predefined_devices->Append(low_energy.Pass()); | 947 predefined_devices->Append(std::move(low_energy)); |
948 | 948 |
949 scoped_ptr<base::DictionaryValue> paired_unconnectable( | 949 scoped_ptr<base::DictionaryValue> paired_unconnectable( |
950 new base::DictionaryValue); | 950 new base::DictionaryValue); |
951 paired_unconnectable->SetString("path", kPairedUnconnectableDevicePath); | 951 paired_unconnectable->SetString("path", kPairedUnconnectableDevicePath); |
952 paired_unconnectable->SetString("address", kPairedUnconnectableDeviceAddress); | 952 paired_unconnectable->SetString("address", kPairedUnconnectableDeviceAddress); |
953 paired_unconnectable->SetString("name", kPairedUnconnectableDeviceName); | 953 paired_unconnectable->SetString("name", kPairedUnconnectableDeviceName); |
954 paired_unconnectable->SetString("pairingMethod", ""); | 954 paired_unconnectable->SetString("pairingMethod", ""); |
955 paired_unconnectable->SetString("pairingAuthToken", ""); | 955 paired_unconnectable->SetString("pairingAuthToken", ""); |
956 paired_unconnectable->SetString("pairingAction", ""); | 956 paired_unconnectable->SetString("pairingAction", ""); |
957 paired_unconnectable->SetString("alias", kPairedUnconnectableDeviceName); | 957 paired_unconnectable->SetString("alias", kPairedUnconnectableDeviceName); |
958 paired_unconnectable->SetInteger("classValue", | 958 paired_unconnectable->SetInteger("classValue", |
959 kPairedUnconnectableDeviceClass); | 959 kPairedUnconnectableDeviceClass); |
960 paired_unconnectable->SetBoolean("isTrusted", false); | 960 paired_unconnectable->SetBoolean("isTrusted", false); |
961 paired_unconnectable->SetBoolean("discoverable", true); | 961 paired_unconnectable->SetBoolean("discoverable", true); |
962 paired_unconnectable->SetBoolean("paired", true); | 962 paired_unconnectable->SetBoolean("paired", true); |
963 paired_unconnectable->SetBoolean("incoming", false); | 963 paired_unconnectable->SetBoolean("incoming", false); |
964 predefined_devices->Append(paired_unconnectable.Pass()); | 964 predefined_devices->Append(std::move(paired_unconnectable)); |
965 | 965 |
966 scoped_ptr<base::DictionaryValue> connected_trusted_not_paired( | 966 scoped_ptr<base::DictionaryValue> connected_trusted_not_paired( |
967 new base::DictionaryValue); | 967 new base::DictionaryValue); |
968 connected_trusted_not_paired->SetString("path", | 968 connected_trusted_not_paired->SetString("path", |
969 kConnectedTrustedNotPairedDevicePath); | 969 kConnectedTrustedNotPairedDevicePath); |
970 connected_trusted_not_paired->SetString( | 970 connected_trusted_not_paired->SetString( |
971 "address", kConnectedTrustedNotPairedDeviceAddress); | 971 "address", kConnectedTrustedNotPairedDeviceAddress); |
972 connected_trusted_not_paired->SetString("name", | 972 connected_trusted_not_paired->SetString("name", |
973 kConnectedTrustedNotPairedDeviceName); | 973 kConnectedTrustedNotPairedDeviceName); |
974 connected_trusted_not_paired->SetString("pairingMethod", ""); | 974 connected_trusted_not_paired->SetString("pairingMethod", ""); |
975 connected_trusted_not_paired->SetString("pairingAuthToken", ""); | 975 connected_trusted_not_paired->SetString("pairingAuthToken", ""); |
976 connected_trusted_not_paired->SetString("pairingAction", ""); | 976 connected_trusted_not_paired->SetString("pairingAction", ""); |
977 connected_trusted_not_paired->SetString("alias", | 977 connected_trusted_not_paired->SetString("alias", |
978 kConnectedTrustedNotPairedDeviceName); | 978 kConnectedTrustedNotPairedDeviceName); |
979 connected_trusted_not_paired->SetInteger( | 979 connected_trusted_not_paired->SetInteger( |
980 "classValue", kConnectedTrustedNotPairedDeviceClass); | 980 "classValue", kConnectedTrustedNotPairedDeviceClass); |
981 connected_trusted_not_paired->SetBoolean("isTrusted", true); | 981 connected_trusted_not_paired->SetBoolean("isTrusted", true); |
982 connected_trusted_not_paired->SetBoolean("discoverable", true); | 982 connected_trusted_not_paired->SetBoolean("discoverable", true); |
983 connected_trusted_not_paired->SetBoolean("paired", false); | 983 connected_trusted_not_paired->SetBoolean("paired", false); |
984 connected_trusted_not_paired->SetBoolean("incoming", false); | 984 connected_trusted_not_paired->SetBoolean("incoming", false); |
985 predefined_devices->Append(connected_trusted_not_paired.Pass()); | 985 predefined_devices->Append(std::move(connected_trusted_not_paired)); |
986 | 986 |
987 return predefined_devices.Pass(); | 987 return predefined_devices; |
988 } | 988 } |
989 | 989 |
990 void FakeBluetoothDeviceClient::RemoveDevice( | 990 void FakeBluetoothDeviceClient::RemoveDevice( |
991 const dbus::ObjectPath& adapter_path, | 991 const dbus::ObjectPath& adapter_path, |
992 const dbus::ObjectPath& device_path) { | 992 const dbus::ObjectPath& device_path) { |
993 std::vector<dbus::ObjectPath>::iterator listiter = | 993 std::vector<dbus::ObjectPath>::iterator listiter = |
994 std::find(device_list_.begin(), device_list_.end(), device_path); | 994 std::find(device_list_.begin(), device_list_.end(), device_path); |
995 if (listiter == device_list_.end()) | 995 if (listiter == device_list_.end()) |
996 return; | 996 return; |
997 | 997 |
(...skipping 664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1662 // TODO(keybuk): tear down this side of the connection | 1662 // TODO(keybuk): tear down this side of the connection |
1663 callback.Run(); | 1663 callback.Run(); |
1664 } else if (status == BluetoothProfileServiceProvider::Delegate::CANCELLED) { | 1664 } else if (status == BluetoothProfileServiceProvider::Delegate::CANCELLED) { |
1665 error_callback.Run(bluetooth_device::kErrorFailed, "Canceled"); | 1665 error_callback.Run(bluetooth_device::kErrorFailed, "Canceled"); |
1666 } else if (status == BluetoothProfileServiceProvider::Delegate::REJECTED) { | 1666 } else if (status == BluetoothProfileServiceProvider::Delegate::REJECTED) { |
1667 error_callback.Run(bluetooth_device::kErrorFailed, "Rejected"); | 1667 error_callback.Run(bluetooth_device::kErrorFailed, "Rejected"); |
1668 } | 1668 } |
1669 } | 1669 } |
1670 | 1670 |
1671 } // namespace bluez | 1671 } // namespace bluez |
OLD | NEW |