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

Unified Diff: chrome/browser/metrics/metrics_log.cc

Issue 31014: Port DictionaryValue to use string16 instead of wstring. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/importer/importer.cc ('k') | chrome/browser/metrics/metrics_service.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/metrics/metrics_log.cc
===================================================================
--- chrome/browser/metrics/metrics_log.cc (revision 10828)
+++ chrome/browser/metrics/metrics_log.cc (working copy)
@@ -383,24 +383,28 @@
}
DictionaryValue* plugin_dict = static_cast<DictionaryValue*>(*iter);
- std::wstring plugin_name;
- plugin_dict->GetString(prefs::kStabilityPluginName, &plugin_name);
+ string16 plugin_name;
+ plugin_dict->GetString(WideToUTF16Hack(prefs::kStabilityPluginName),
+ &plugin_name);
OPEN_ELEMENT_FOR_SCOPE("pluginstability");
// Use "filename" instead of "name", otherwise we need to update the
// UMA servers.
- WriteAttribute("filename", CreateBase64Hash(WideToUTF8(plugin_name)));
+ WriteAttribute("filename", CreateBase64Hash(UTF16ToUTF8(plugin_name)));
int launches = 0;
- plugin_dict->GetInteger(prefs::kStabilityPluginLaunches, &launches);
+ plugin_dict->GetInteger(WideToUTF16Hack(prefs::kStabilityPluginLaunches),
+ &launches);
WriteIntAttribute("launchcount", launches);
int instances = 0;
- plugin_dict->GetInteger(prefs::kStabilityPluginInstances, &instances);
+ plugin_dict->GetInteger(WideToUTF16Hack(prefs::kStabilityPluginInstances),
+ &instances);
WriteIntAttribute("instancecount", instances);
int crashes = 0;
- plugin_dict->GetInteger(prefs::kStabilityPluginCrashes, &crashes);
+ plugin_dict->GetInteger(WideToUTF16Hack(prefs::kStabilityPluginCrashes),
+ &crashes);
WriteIntAttribute("crashcount", crashes);
}
@@ -568,10 +572,11 @@
const std::wstring profile_prefix(prefs::kProfilePrefix);
for (DictionaryValue::key_iterator i = all_profiles_metrics.begin_keys();
i != all_profiles_metrics.end_keys(); ++i) {
- const std::wstring& key_name = *i;
+ const string16 key_name16 = *i;
+ const std::wstring& key_name = UTF16ToWideHack(key_name16);
if (key_name.compare(0, profile_prefix.size(), profile_prefix) == 0) {
DictionaryValue* profile;
- if (all_profiles_metrics.GetDictionary(key_name, &profile))
+ if (all_profiles_metrics.GetDictionary(key_name16, &profile))
WriteProfileMetrics(key_name.substr(profile_prefix.size()), *profile);
}
}
@@ -585,13 +590,13 @@
i != profile_metrics.end_keys(); ++i) {
Value* value;
if (profile_metrics.Get(*i, &value)) {
- DCHECK(*i != L"id");
+ DCHECK(*i != ASCIIToUTF16("id"));
switch (value->GetType()) {
case Value::TYPE_STRING: {
std::string string_value;
if (value->GetAsString(&string_value)) {
OPEN_ELEMENT_FOR_SCOPE("profileparam");
- WriteAttribute("name", WideToUTF8(*i));
+ WriteAttribute("name", UTF16ToUTF8(*i));
WriteAttribute("value", string_value);
}
break;
@@ -601,7 +606,7 @@
bool bool_value;
if (value->GetAsBoolean(&bool_value)) {
OPEN_ELEMENT_FOR_SCOPE("profileparam");
- WriteAttribute("name", WideToUTF8(*i));
+ WriteAttribute("name", UTF16ToUTF8(*i));
WriteIntAttribute("value", bool_value ? 1 : 0);
}
break;
@@ -611,7 +616,7 @@
int int_value;
if (value->GetAsInteger(&int_value)) {
OPEN_ELEMENT_FOR_SCOPE("profileparam");
- WriteAttribute("name", WideToUTF8(*i));
+ WriteAttribute("name", UTF16ToUTF8(*i));
WriteIntAttribute("value", int_value);
}
break;
« no previous file with comments | « chrome/browser/importer/importer.cc ('k') | chrome/browser/metrics/metrics_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698