| 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 <map> | 7 #include <map> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 } | 58 } |
| 59 } | 59 } |
| 60 | 60 |
| 61 void FakeBluetoothProfileManagerClient::UnregisterProfile( | 61 void FakeBluetoothProfileManagerClient::UnregisterProfile( |
| 62 const dbus::ObjectPath& profile_path, | 62 const dbus::ObjectPath& profile_path, |
| 63 const base::Closure& callback, | 63 const base::Closure& callback, |
| 64 const ErrorCallback& error_callback) { | 64 const ErrorCallback& error_callback) { |
| 65 VLOG(1) << "UnregisterProfile: " << profile_path.value(); | 65 VLOG(1) << "UnregisterProfile: " << profile_path.value(); |
| 66 | 66 |
| 67 ServiceProviderMap::iterator iter = service_provider_map_.find(profile_path); | 67 ServiceProviderMap::iterator iter = service_provider_map_.find(profile_path); |
| 68 if (iter != service_provider_map_.end()) { | 68 if (iter == service_provider_map_.end()) { |
| 69 error_callback.Run(bluetooth_profile_manager::kErrorInvalidArguments, | 69 error_callback.Run(bluetooth_profile_manager::kErrorInvalidArguments, |
| 70 "Profile still registered"); | 70 "Profile not registered"); |
| 71 } else { | 71 } else { |
| 72 for (ProfileMap::iterator piter = profile_map_.begin(); | 72 for (ProfileMap::iterator piter = profile_map_.begin(); |
| 73 piter != profile_map_.end(); ++piter) { | 73 piter != profile_map_.end(); ++piter) { |
| 74 if (piter->second == profile_path) { | 74 if (piter->second == profile_path) { |
| 75 profile_map_.erase(piter); | 75 profile_map_.erase(piter); |
| 76 break; | 76 break; |
| 77 } | 77 } |
| 78 } | 78 } |
| 79 | 79 |
| 80 callback.Run(); | 80 callback.Run(); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 97 FakeBluetoothProfileServiceProvider* | 97 FakeBluetoothProfileServiceProvider* |
| 98 FakeBluetoothProfileManagerClient::GetProfileServiceProvider( | 98 FakeBluetoothProfileManagerClient::GetProfileServiceProvider( |
| 99 const std::string& uuid) { | 99 const std::string& uuid) { |
| 100 ProfileMap::iterator iter = profile_map_.find(uuid); | 100 ProfileMap::iterator iter = profile_map_.find(uuid); |
| 101 if (iter == profile_map_.end()) | 101 if (iter == profile_map_.end()) |
| 102 return NULL; | 102 return NULL; |
| 103 return service_provider_map_[iter->second]; | 103 return service_provider_map_[iter->second]; |
| 104 } | 104 } |
| 105 | 105 |
| 106 } // namespace chromeos | 106 } // namespace chromeos |
| OLD | NEW |