Chromium Code Reviews| 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 | 7 |
|
omoikane
2015/05/22 23:55:26
Only 1 blank line needed here.
Marie Janssen
2015/06/18 21:08:34
Done.
| |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "chromeos/dbus/fake_bluetooth_profile_service_provider.h" | 10 #include "chromeos/dbus/fake_bluetooth_profile_service_provider.h" |
| 11 #include "dbus/bus.h" | 11 #include "dbus/bus.h" |
| 12 #include "dbus/message.h" | 12 #include "dbus/message.h" |
| 13 #include "dbus/object_proxy.h" | 13 #include "dbus/object_proxy.h" |
| 14 #include "third_party/cros_system_api/dbus/service_constants.h" | 14 #include "third_party/cros_system_api/dbus/service_constants.h" |
| 15 | 15 |
| 16 namespace chromeos { | 16 namespace chromeos { |
| 17 | 17 |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 36 const std::string& uuid, | 36 const std::string& uuid, |
| 37 const Options& options, | 37 const Options& options, |
| 38 const base::Closure& callback, | 38 const base::Closure& callback, |
| 39 const ErrorCallback& error_callback) { | 39 const ErrorCallback& error_callback) { |
| 40 VLOG(1) << "RegisterProfile: " << profile_path.value() << ": " << uuid; | 40 VLOG(1) << "RegisterProfile: " << profile_path.value() << ": " << uuid; |
| 41 | 41 |
| 42 if (uuid == kUnregisterableUuid) { | 42 if (uuid == kUnregisterableUuid) { |
| 43 base::MessageLoop::current()->PostTask( | 43 base::MessageLoop::current()->PostTask( |
| 44 FROM_HERE, base::Bind(error_callback, | 44 FROM_HERE, base::Bind(error_callback, |
| 45 bluetooth_profile_manager::kErrorInvalidArguments, | 45 bluetooth_profile_manager::kErrorInvalidArguments, |
| 46 "Can't register this UUID")); | 46 "Can't register this UUID")); |
|
omoikane
2015/05/22 23:55:26
Current format makes the comma that separates the
Marie Janssen
2015/06/18 21:08:34
Done.
| |
| 47 return; | 47 return; |
| 48 } | 48 } |
| 49 | 49 |
| 50 // check options for channel & psm | 50 // check options for channel & psm |
|
omoikane
2015/05/22 23:55:26
Is this a TODO comment? If so, consider formattin
Marie Janssen
2015/06/18 21:08:34
Done.
| |
| 51 | 51 |
| 52 ServiceProviderMap::iterator iter = service_provider_map_.find(profile_path); | 52 ServiceProviderMap::iterator iter = service_provider_map_.find(profile_path); |
| 53 if (iter == service_provider_map_.end()) { | 53 if (iter == service_provider_map_.end()) { |
| 54 error_callback.Run(bluetooth_profile_manager::kErrorInvalidArguments, | 54 error_callback.Run(bluetooth_profile_manager::kErrorInvalidArguments, |
| 55 "No profile created"); | 55 "No profile created"); |
| 56 } else { | 56 } else { |
| 57 ProfileMap::iterator piter = profile_map_.find(uuid); | 57 ProfileMap::iterator piter = profile_map_.find(uuid); |
| 58 if (piter != profile_map_.end()) { | 58 if (piter != profile_map_.end()) { |
| 59 error_callback.Run(bluetooth_profile_manager::kErrorAlreadyExists, | 59 error_callback.Run(bluetooth_profile_manager::kErrorAlreadyExists, |
| 60 "Profile already registered"); | 60 "Profile already registered"); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 99 service_provider_map_.find(service_provider->object_path_); | 99 service_provider_map_.find(service_provider->object_path_); |
| 100 if (iter != service_provider_map_.end() && iter->second == service_provider) | 100 if (iter != service_provider_map_.end() && iter->second == service_provider) |
| 101 service_provider_map_.erase(iter); | 101 service_provider_map_.erase(iter); |
| 102 } | 102 } |
| 103 | 103 |
| 104 FakeBluetoothProfileServiceProvider* | 104 FakeBluetoothProfileServiceProvider* |
| 105 FakeBluetoothProfileManagerClient::GetProfileServiceProvider( | 105 FakeBluetoothProfileManagerClient::GetProfileServiceProvider( |
| 106 const std::string& uuid) { | 106 const std::string& uuid) { |
| 107 ProfileMap::iterator iter = profile_map_.find(uuid); | 107 ProfileMap::iterator iter = profile_map_.find(uuid); |
| 108 if (iter == profile_map_.end()) | 108 if (iter == profile_map_.end()) |
| 109 return NULL; | 109 return NULL; |
|
omoikane
2015/05/22 23:55:26
nullptr is preferred over NULL, since nullptr prov
Marie Janssen
2015/06/18 21:08:34
Done.
| |
| 110 return service_provider_map_[iter->second]; | 110 return service_provider_map_[iter->second]; |
| 111 } | 111 } |
| 112 | 112 |
| 113 } // namespace chromeos | 113 } // namespace chromeos |
| 114 | |
| OLD | NEW |