OLD | NEW |
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 "chrome/browser/signin/signin_internals_util.h" | 5 #include "chrome/browser/signin/signin_internals_util.h" |
6 | 6 |
7 #include <sstream> | 7 #include <sstream> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 void AddSectionEntry(ListValue* section_list, | 110 void AddSectionEntry(ListValue* section_list, |
111 const std::string& field_name, | 111 const std::string& field_name, |
112 const std::string& field_val) { | 112 const std::string& field_val) { |
113 scoped_ptr<DictionaryValue> entry(new DictionaryValue()); | 113 scoped_ptr<DictionaryValue> entry(new DictionaryValue()); |
114 entry->SetString("label", field_name); | 114 entry->SetString("label", field_name); |
115 entry->SetString("value", field_val); | 115 entry->SetString("value", field_val); |
116 section_list->Append(entry.release()); | 116 section_list->Append(entry.release()); |
117 } | 117 } |
118 | 118 |
119 | 119 |
120 void AddSectionEntry(ListValue* section_list, | |
121 const std::string& field_name, | |
122 uint32 field_val) { | |
123 std::stringstream ss; | |
124 ss << field_val; | |
125 scoped_ptr<DictionaryValue> entry(new DictionaryValue()); | |
126 entry->SetString("label", field_name); | |
127 entry->SetString("value", ss.str()); | |
128 section_list->Append(entry.release()); | |
129 } | |
130 | |
131 // Returns a string describing the chrome version environment. Version format: | 120 // Returns a string describing the chrome version environment. Version format: |
132 // <Build Info> <OS> <Version number> (<Last change>)<channel or "-devel"> | 121 // <Build Info> <OS> <Version number> (<Last change>)<channel or "-devel"> |
133 // If version information is unavailable, returns "invalid." | 122 // If version information is unavailable, returns "invalid." |
134 std::string GetVersionString() { | 123 std::string GetVersionString() { |
135 // Build a version string that matches MakeUserAgentForSyncApi with the | 124 // Build a version string that matches MakeUserAgentForSyncApi with the |
136 // addition of channel info and proper OS names. | 125 // addition of channel info and proper OS names. |
137 chrome::VersionInfo chrome_version; | 126 chrome::VersionInfo chrome_version; |
138 if (!chrome_version.is_valid()) | 127 if (!chrome_version.is_valid()) |
139 return "invalid"; | 128 return "invalid"; |
140 // GetVersionStringModifier returns empty string for stable channel or | 129 // GetVersionStringModifier returns empty string for stable channel or |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 // Since each character in the hash string generates two hex charaters | 253 // Since each character in the hash string generates two hex charaters |
265 // we only need half as many charaters in |hash_val| as hex characters | 254 // we only need half as many charaters in |hash_val| as hex characters |
266 // returned. | 255 // returned. |
267 const int kTruncateSize = kTruncateTokenStringLength / 2; | 256 const int kTruncateSize = kTruncateTokenStringLength / 2; |
268 char hash_val[kTruncateSize]; | 257 char hash_val[kTruncateSize]; |
269 crypto::SHA256HashString(str, &hash_val[0], kTruncateSize); | 258 crypto::SHA256HashString(str, &hash_val[0], kTruncateSize); |
270 return StringToLowerASCII(base::HexEncode(&hash_val[0], kTruncateSize)); | 259 return StringToLowerASCII(base::HexEncode(&hash_val[0], kTruncateSize)); |
271 } | 260 } |
272 | 261 |
273 } // namespace signin_internals_util | 262 } // namespace signin_internals_util |
OLD | NEW |