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

Side by Side Diff: chromeos/network/onc/onc_utils.cc

Issue 1023273004: Fix a case of writing an empty HexSSID to Shill. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/network/onc/onc_utils.h" 5 #include "chromeos/network/onc/onc_utils.h"
6 6
7 #include "base/base64.h" 7 #include "base/base64.h"
8 #include "base/json/json_reader.h" 8 #include "base/json/json_reader.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 GetFieldSignature(signature, it.key()); 257 GetFieldSignature(signature, it.key());
258 if (!field_signature) 258 if (!field_signature)
259 continue; 259 continue;
260 260
261 FillInHexSSIDFieldsInOncObject(*field_signature->value_signature, 261 FillInHexSSIDFieldsInOncObject(*field_signature->value_signature,
262 inner_object); 262 inner_object);
263 } 263 }
264 } 264 }
265 265
266 void FillInHexSSIDField(base::DictionaryValue* wifi_fields) { 266 void FillInHexSSIDField(base::DictionaryValue* wifi_fields) {
267 if (!wifi_fields->HasKey(::onc::wifi::kHexSSID)) { 267 std::string ssid_string;
268 std::string ssid_string; 268 if (wifi_fields->HasKey(::onc::wifi::kHexSSID) ||
269 wifi_fields->GetStringWithoutPathExpansion(::onc::wifi::kSSID, 269 !wifi_fields->GetStringWithoutPathExpansion(::onc::wifi::kSSID,
270 &ssid_string); 270 &ssid_string)) {
271 wifi_fields->SetStringWithoutPathExpansion( 271 return;
272 ::onc::wifi::kHexSSID,
273 base::HexEncode(ssid_string.c_str(), ssid_string.size()));
274 } 272 }
273 if (ssid_string.empty()) {
274 ONC_LOG_ERROR("Found empty SSID field.");
275 return;
276 }
277 wifi_fields->SetStringWithoutPathExpansion(
278 ::onc::wifi::kHexSSID,
279 base::HexEncode(ssid_string.c_str(), ssid_string.size()));
275 } 280 }
276 281
277 namespace { 282 namespace {
278 283
279 class OncMaskValues : public Mapper { 284 class OncMaskValues : public Mapper {
280 public: 285 public:
281 static scoped_ptr<base::DictionaryValue> Mask( 286 static scoped_ptr<base::DictionaryValue> Mask(
282 const OncValueSignature& signature, 287 const OncValueSignature& signature,
283 const base::DictionaryValue& onc_object, 288 const base::DictionaryValue& onc_object,
284 const std::string& mask) { 289 const std::string& mask) {
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after
735 } 740 }
736 741
737 const base::ListValue* recommended_keys = NULL; 742 const base::ListValue* recommended_keys = NULL;
738 return (onc->GetList(recommended_property_key, &recommended_keys) && 743 return (onc->GetList(recommended_property_key, &recommended_keys) &&
739 recommended_keys->Find(base::StringValue(property_basename)) != 744 recommended_keys->Find(base::StringValue(property_basename)) !=
740 recommended_keys->end()); 745 recommended_keys->end());
741 } 746 }
742 747
743 } // namespace onc 748 } // namespace onc
744 } // namespace chromeos 749 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698