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

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

Issue 1353323002: Cleanup: Pass std::string as const reference from chromeos/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix FakeShillManagerClient::SetInitialNetworkState Created 5 years, 3 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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_shill_manager_client.h" 5 #include "chromeos/dbus/fake_shill_manager_client.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/location.h" 9 #include "base/location.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 1097 matching lines...) Expand 10 before | Expand all | Expand 10 after
1108 s_tdls_busy_count = 1; 1108 s_tdls_busy_count = 1;
1109 return true; 1109 return true;
1110 } else if (arg0 == "roaming") { 1110 } else if (arg0 == "roaming") {
1111 // "home", "roaming", or "required" 1111 // "home", "roaming", or "required"
1112 roaming_state_ = arg1; 1112 roaming_state_ = arg1;
1113 return true; 1113 return true;
1114 } 1114 }
1115 return SetInitialNetworkState(arg0, arg1); 1115 return SetInitialNetworkState(arg0, arg1);
1116 } 1116 }
1117 1117
1118 bool FakeShillManagerClient::SetInitialNetworkState(std::string type_arg, 1118 bool FakeShillManagerClient::SetInitialNetworkState(
1119 std::string state_arg) { 1119 const std::string& type_arg,
1120 const std::string& state_arg) {
1120 int state_arg_as_int = -1; 1121 int state_arg_as_int = -1;
1121 base::StringToInt(state_arg, &state_arg_as_int); 1122 base::StringToInt(state_arg, &state_arg_as_int);
1122 1123
1123 std::string state; 1124 std::string state;
1124 if (state_arg.empty() || state_arg == "1" || state_arg == "on" || 1125 if (state_arg.empty() || state_arg == "1" || state_arg == "on" ||
1125 state_arg == "enabled" || state_arg == "connected" || 1126 state_arg == "enabled" || state_arg == "connected" ||
1126 state_arg == "online") { 1127 state_arg == "online") {
1127 // Enabled and connected (default value) 1128 // Enabled and connected (default value)
1128 state = shill::kStateOnline; 1129 state = shill::kStateOnline;
1129 } else if (state_arg == "0" || state_arg == "off" || 1130 } else if (state_arg == "0" || state_arg == "off" ||
(...skipping 29 matching lines...) Expand all
1159 << state_arg; 1160 << state_arg;
1160 return false; 1161 return false;
1161 } 1162 }
1162 1163
1163 // Special cases 1164 // Special cases
1164 if (type_arg == "wireless") { 1165 if (type_arg == "wireless") {
1165 shill_initial_state_map_[shill::kTypeWifi] = state; 1166 shill_initial_state_map_[shill::kTypeWifi] = state;
1166 shill_initial_state_map_[shill::kTypeCellular] = state; 1167 shill_initial_state_map_[shill::kTypeCellular] = state;
1167 return true; 1168 return true;
1168 } 1169 }
1169 // Convenience synonyms.
1170 if (type_arg == "eth")
1171 type_arg = shill::kTypeEthernet;
1172 1170
1173 if (type_arg != shill::kTypeEthernet && 1171 if (type_arg != shill::kTypeEthernet &&
1172 type_arg != "eth" && // synonym for KTypeEthernet
Daniel Erat 2015/09/21 21:47:05 this is different behavior than what was there bef
ki.stfu 2015/09/21 22:20:40 Done.
1174 type_arg != shill::kTypeWifi && 1173 type_arg != shill::kTypeWifi &&
1175 type_arg != shill::kTypeCellular && 1174 type_arg != shill::kTypeCellular &&
1176 type_arg != shill::kTypeWimax && 1175 type_arg != shill::kTypeWimax &&
1177 type_arg != shill::kTypeVPN) { 1176 type_arg != shill::kTypeVPN) {
1178 LOG(WARNING) << "Unrecognized Shill network type: " << type_arg; 1177 LOG(WARNING) << "Unrecognized Shill network type: " << type_arg;
1179 return false; 1178 return false;
1180 } 1179 }
1181 1180
1182 // Disabled ethernet is the same as unavailable. 1181 // Disabled ethernet is the same as unavailable.
1183 if (type_arg == shill::kTypeEthernet && state == kNetworkDisabled) 1182 if (type_arg == shill::kTypeEthernet && state == kNetworkDisabled)
stevenjb 2015/09/21 22:23:39 Need to update this condition also. I think it wou
ki.stfu 2015/09/21 22:55:57 I have already reverted it back.
1184 state = kTechnologyUnavailable; 1183 state = kTechnologyUnavailable;
1185 1184
1186 shill_initial_state_map_[type_arg] = state; 1185 shill_initial_state_map_[type_arg] = state;
1187 return true; 1186 return true;
1188 } 1187 }
1189 1188
1190 std::string FakeShillManagerClient::GetInitialStateForType( 1189 std::string FakeShillManagerClient::GetInitialStateForType(
1191 const std::string& type, 1190 const std::string& type,
1192 bool* enabled) { 1191 bool* enabled) {
1193 std::string result; 1192 std::string result;
(...skipping 16 matching lines...) Expand all
1210 LOG(WARNING) << "Invalid state: " << state << " for " << type; 1209 LOG(WARNING) << "Invalid state: " << state << " for " << type;
1211 result = shill::kStateIdle; 1210 result = shill::kStateIdle;
1212 } 1211 }
1213 } 1212 }
1214 VLOG(1) << "Initial state for: " << type << " = " << result 1213 VLOG(1) << "Initial state for: " << type << " = " << result
1215 << " Enabled: " << *enabled; 1214 << " Enabled: " << *enabled;
1216 return result; 1215 return result;
1217 } 1216 }
1218 1217
1219 } // namespace chromeos 1218 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698