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

Side by Side Diff: chromeos/dbus/fake_bluetooth_profile_manager_client.cc

Issue 1124883004: Submission for C++ Readability (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address first round of review comments Created 5 years, 6 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 (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
8 #include "base/logging.h" 7 #include "base/logging.h"
9 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
10 #include "chromeos/dbus/fake_bluetooth_profile_service_provider.h" 9 #include "chromeos/dbus/fake_bluetooth_profile_service_provider.h"
11 #include "dbus/bus.h" 10 #include "dbus/bus.h"
12 #include "dbus/message.h" 11 #include "dbus/message.h"
13 #include "dbus/object_proxy.h" 12 #include "dbus/object_proxy.h"
14 #include "third_party/cros_system_api/dbus/service_constants.h" 13 #include "third_party/cros_system_api/dbus/service_constants.h"
15 14
16 namespace chromeos { 15 namespace chromeos {
17 16
(...skipping 22 matching lines...) Expand all
40 VLOG(1) << "RegisterProfile: " << profile_path.value() << ": " << uuid; 39 VLOG(1) << "RegisterProfile: " << profile_path.value() << ": " << uuid;
41 40
42 if (uuid == kUnregisterableUuid) { 41 if (uuid == kUnregisterableUuid) {
43 base::MessageLoop::current()->PostTask( 42 base::MessageLoop::current()->PostTask(
44 FROM_HERE, base::Bind(error_callback, 43 FROM_HERE, base::Bind(error_callback,
45 bluetooth_profile_manager::kErrorInvalidArguments, 44 bluetooth_profile_manager::kErrorInvalidArguments,
46 "Can't register this UUID")); 45 "Can't register this UUID"));
47 return; 46 return;
48 } 47 }
49 48
50 // check options for channel & psm 49 // TODO(jamuraa): check options for channel & psm
51 50
52 ServiceProviderMap::iterator iter = service_provider_map_.find(profile_path); 51 ServiceProviderMap::iterator iter = service_provider_map_.find(profile_path);
53 if (iter == service_provider_map_.end()) { 52 if (iter == service_provider_map_.end()) {
54 error_callback.Run(bluetooth_profile_manager::kErrorInvalidArguments, 53 error_callback.Run(bluetooth_profile_manager::kErrorInvalidArguments,
55 "No profile created"); 54 "No profile created");
56 } else { 55 } else {
57 ProfileMap::iterator piter = profile_map_.find(uuid); 56 ProfileMap::iterator piter = profile_map_.find(uuid);
58 if (piter != profile_map_.end()) { 57 if (piter != profile_map_.end()) {
59 error_callback.Run(bluetooth_profile_manager::kErrorAlreadyExists, 58 error_callback.Run(bluetooth_profile_manager::kErrorAlreadyExists,
60 "Profile already registered"); 59 "Profile already registered");
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 service_provider_map_.find(service_provider->object_path_); 98 service_provider_map_.find(service_provider->object_path_);
100 if (iter != service_provider_map_.end() && iter->second == service_provider) 99 if (iter != service_provider_map_.end() && iter->second == service_provider)
101 service_provider_map_.erase(iter); 100 service_provider_map_.erase(iter);
102 } 101 }
103 102
104 FakeBluetoothProfileServiceProvider* 103 FakeBluetoothProfileServiceProvider*
105 FakeBluetoothProfileManagerClient::GetProfileServiceProvider( 104 FakeBluetoothProfileManagerClient::GetProfileServiceProvider(
106 const std::string& uuid) { 105 const std::string& uuid) {
107 ProfileMap::iterator iter = profile_map_.find(uuid); 106 ProfileMap::iterator iter = profile_map_.find(uuid);
108 if (iter == profile_map_.end()) 107 if (iter == profile_map_.end())
109 return NULL; 108 return nullptr;
110 return service_provider_map_[iter->second]; 109 return service_provider_map_[iter->second];
111 } 110 }
112 111
113 } // namespace chromeos 112 } // namespace chromeos
113
omoikane 2015/06/23 01:23:40 This trailing blank line is redundant and should b
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698