| 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 "chromeos/dbus/fake_bluetooth_profile_manager_client.h" | 5 #include "chromeos/dbus/fake_bluetooth_profile_manager_client.h" |
| 6 | 6 |
| 7 #include "base/location.h" | 7 #include "base/location.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
| 10 #include "base/thread_task_runner_handle.h" | 10 #include "base/thread_task_runner_handle.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 VLOG(1) << "RegisterProfile: " << profile_path.value() << ": " << uuid; | 41 VLOG(1) << "RegisterProfile: " << profile_path.value() << ": " << uuid; |
| 42 | 42 |
| 43 if (uuid == kUnregisterableUuid) { | 43 if (uuid == kUnregisterableUuid) { |
| 44 base::ThreadTaskRunnerHandle::Get()->PostTask( | 44 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 45 FROM_HERE, base::Bind(error_callback, | 45 FROM_HERE, base::Bind(error_callback, |
| 46 bluetooth_profile_manager::kErrorInvalidArguments, | 46 bluetooth_profile_manager::kErrorInvalidArguments, |
| 47 "Can't register this UUID")); | 47 "Can't register this UUID")); |
| 48 return; | 48 return; |
| 49 } | 49 } |
| 50 | 50 |
| 51 // check options for channel & psm | 51 // TODO(jamuraa): check options for channel & psm |
| 52 | 52 |
| 53 ServiceProviderMap::iterator iter = service_provider_map_.find(profile_path); | 53 ServiceProviderMap::iterator iter = service_provider_map_.find(profile_path); |
| 54 if (iter == service_provider_map_.end()) { | 54 if (iter == service_provider_map_.end()) { |
| 55 error_callback.Run(bluetooth_profile_manager::kErrorInvalidArguments, | 55 error_callback.Run(bluetooth_profile_manager::kErrorInvalidArguments, |
| 56 "No profile created"); | 56 "No profile created"); |
| 57 } else { | 57 } else { |
| 58 ProfileMap::iterator piter = profile_map_.find(uuid); | 58 ProfileMap::iterator piter = profile_map_.find(uuid); |
| 59 if (piter != profile_map_.end()) { | 59 if (piter != profile_map_.end()) { |
| 60 error_callback.Run(bluetooth_profile_manager::kErrorAlreadyExists, | 60 error_callback.Run(bluetooth_profile_manager::kErrorAlreadyExists, |
| 61 "Profile already registered"); | 61 "Profile already registered"); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 service_provider_map_.find(service_provider->object_path_); | 100 service_provider_map_.find(service_provider->object_path_); |
| 101 if (iter != service_provider_map_.end() && iter->second == service_provider) | 101 if (iter != service_provider_map_.end() && iter->second == service_provider) |
| 102 service_provider_map_.erase(iter); | 102 service_provider_map_.erase(iter); |
| 103 } | 103 } |
| 104 | 104 |
| 105 FakeBluetoothProfileServiceProvider* | 105 FakeBluetoothProfileServiceProvider* |
| 106 FakeBluetoothProfileManagerClient::GetProfileServiceProvider( | 106 FakeBluetoothProfileManagerClient::GetProfileServiceProvider( |
| 107 const std::string& uuid) { | 107 const std::string& uuid) { |
| 108 ProfileMap::iterator iter = profile_map_.find(uuid); | 108 ProfileMap::iterator iter = profile_map_.find(uuid); |
| 109 if (iter == profile_map_.end()) | 109 if (iter == profile_map_.end()) |
| 110 return NULL; | 110 return nullptr; |
| 111 return service_provider_map_[iter->second]; | 111 return service_provider_map_[iter->second]; |
| 112 } | 112 } |
| 113 | 113 |
| 114 } // namespace chromeos | 114 } // namespace chromeos |
| OLD | NEW |