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

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

Issue 759663004: ONC: add support for non-utf-8 SSIDs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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) 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"
11 #include "base/strings/string_number_conversions.h"
11 #include "base/strings/string_util.h" 12 #include "base/strings/string_util.h"
12 #include "base/values.h" 13 #include "base/values.h"
13 #include "chromeos/network/network_event_log.h" 14 #include "chromeos/network/network_event_log.h"
14 #include "chromeos/network/onc/onc_mapper.h" 15 #include "chromeos/network/onc/onc_mapper.h"
15 #include "chromeos/network/onc/onc_signature.h" 16 #include "chromeos/network/onc/onc_signature.h"
16 #include "chromeos/network/onc/onc_utils.h" 17 #include "chromeos/network/onc/onc_utils.h"
17 #include "chromeos/network/onc/onc_validator.h" 18 #include "chromeos/network/onc/onc_validator.h"
18 #include "crypto/encryptor.h" 19 #include "crypto/encryptor.h"
19 #include "crypto/hmac.h" 20 #include "crypto/hmac.h"
20 #include "crypto/symmetric_key.h" 21 #include "crypto/symmetric_key.h"
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 for (base::ListValue::iterator it = network_configs->begin(); 234 for (base::ListValue::iterator it = network_configs->begin();
234 it != network_configs->end(); ++it) { 235 it != network_configs->end(); ++it) {
235 base::DictionaryValue* network = NULL; 236 base::DictionaryValue* network = NULL;
236 (*it)->GetAsDictionary(&network); 237 (*it)->GetAsDictionary(&network);
237 DCHECK(network); 238 DCHECK(network);
238 ExpandStringsInOncObject( 239 ExpandStringsInOncObject(
239 kNetworkConfigurationSignature, substitution, network); 240 kNetworkConfigurationSignature, substitution, network);
240 } 241 }
241 } 242 }
242 243
244 void FillInHexSSIDField(base::DictionaryValue* wifi_fields) {
245 if (!wifi_fields->HasKey(::onc::wifi::kHexSSID)) {
246 std::string ssid_string;
247 wifi_fields->GetStringWithoutPathExpansion(::onc::wifi::kSSID,
248 &ssid_string);
249 std::string hex_ssid_string;
pneubeck (no reviews) 2014/11/26 10:15:34 nit: merge both lines and use c'tor arguments inst
cschuet (SLOW) 2014/11/27 11:03:58 Done.
250 hex_ssid_string = base::HexEncode(ssid_string.c_str(), ssid_string.size());
251 wifi_fields->SetStringWithoutPathExpansion(::onc::wifi::kHexSSID,
252 hex_ssid_string);
253 }
254 }
255
243 namespace { 256 namespace {
244 257
245 class OncMaskValues : public Mapper { 258 class OncMaskValues : public Mapper {
246 public: 259 public:
247 static scoped_ptr<base::DictionaryValue> Mask( 260 static scoped_ptr<base::DictionaryValue> Mask(
248 const OncValueSignature& signature, 261 const OncValueSignature& signature,
249 const base::DictionaryValue& onc_object, 262 const base::DictionaryValue& onc_object,
250 const std::string& mask) { 263 const std::string& mask) {
251 OncMaskValues masker(mask); 264 OncMaskValues masker(mask);
252 bool unused_error; 265 bool unused_error;
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after
690 } 703 }
691 704
692 const base::ListValue* recommended_keys = NULL; 705 const base::ListValue* recommended_keys = NULL;
693 return (onc->GetList(recommended_property_key, &recommended_keys) && 706 return (onc->GetList(recommended_property_key, &recommended_keys) &&
694 recommended_keys->Find(base::StringValue(property_basename)) != 707 recommended_keys->Find(base::StringValue(property_basename)) !=
695 recommended_keys->end()); 708 recommended_keys->end());
696 } 709 }
697 710
698 } // namespace onc 711 } // namespace onc
699 } // namespace chromeos 712 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698