OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "google_apis/gcm/engine/gservices_settings.h" | 5 #include "google_apis/gcm/engine/gservices_settings.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/sha1.h" | 9 #include "base/sha1.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 ++iter) { | 191 ++iter) { |
192 data += iter->first; | 192 data += iter->first; |
193 data += '\0'; | 193 data += '\0'; |
194 data += iter->second; | 194 data += iter->second; |
195 data += '\0'; | 195 data += '\0'; |
196 } | 196 } |
197 base::SHA1HashBytes( | 197 base::SHA1HashBytes( |
198 reinterpret_cast<const unsigned char*>(&data[0]), data.size(), hash); | 198 reinterpret_cast<const unsigned char*>(&data[0]), data.size(), hash); |
199 std::string digest = | 199 std::string digest = |
200 kDigestVersionPrefix + base::HexEncode(hash, base::kSHA1Length); | 200 kDigestVersionPrefix + base::HexEncode(hash, base::kSHA1Length); |
201 digest = base::StringToLowerASCII(digest); | 201 digest = base::ToLowerASCII(digest); |
202 return digest; | 202 return digest; |
203 } | 203 } |
204 | 204 |
205 GServicesSettings::GServicesSettings() : weak_ptr_factory_(this) { | 205 GServicesSettings::GServicesSettings() : weak_ptr_factory_(this) { |
206 digest_ = CalculateDigest(settings_); | 206 digest_ = CalculateDigest(settings_); |
207 } | 207 } |
208 | 208 |
209 GServicesSettings::~GServicesSettings() { | 209 GServicesSettings::~GServicesSettings() { |
210 } | 210 } |
211 | 211 |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
341 if (!command_line->HasSwitch(switches::kGCMRegistrationURL)) | 341 if (!command_line->HasSwitch(switches::kGCMRegistrationURL)) |
342 return GURL(kDefaultRegistrationURL); | 342 return GURL(kDefaultRegistrationURL); |
343 | 343 |
344 return GURL( | 344 return GURL( |
345 command_line->GetSwitchValueASCII(switches::kGCMRegistrationURL)); | 345 command_line->GetSwitchValueASCII(switches::kGCMRegistrationURL)); |
346 } | 346 } |
347 return GURL(iter->second); | 347 return GURL(iter->second); |
348 } | 348 } |
349 | 349 |
350 } // namespace gcm | 350 } // namespace gcm |
OLD | NEW |