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

Side by Side Diff: chrome/browser/task_manager.cc

Issue 3108027: Convert GetDisplayStringInLTRDirectionality from wstring to string16. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: Created 10 years, 4 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
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/task_manager.h" 5 #include "chrome/browser/task_manager.h"
6 6
7 #include "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "app/resource_bundle.h" 8 #include "app/resource_bundle.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/i18n/number_formatting.h" 10 #include "base/i18n/number_formatting.h"
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 return WideToUTF16Hack(resources_[index]->GetTitle()); 119 return WideToUTF16Hack(resources_[index]->GetTitle());
120 } 120 }
121 121
122 string16 TaskManagerModel::GetResourceNetworkUsage(int index) const { 122 string16 TaskManagerModel::GetResourceNetworkUsage(int index) const {
123 DCHECK(index < ResourceCount()); 123 DCHECK(index < ResourceCount());
124 int64 net_usage = GetNetworkUsage(resources_[index]); 124 int64 net_usage = GetNetworkUsage(resources_[index]);
125 if (net_usage == -1) 125 if (net_usage == -1)
126 return l10n_util::GetStringUTF16(IDS_TASK_MANAGER_NA_CELL_TEXT); 126 return l10n_util::GetStringUTF16(IDS_TASK_MANAGER_NA_CELL_TEXT);
127 if (net_usage == 0) 127 if (net_usage == 0)
128 return ASCIIToUTF16("0"); 128 return ASCIIToUTF16("0");
129 std::wstring net_byte = 129 string16 net_byte = WideToUTF16(
130 FormatSpeed(net_usage, GetByteDisplayUnits(net_usage), true); 130 FormatSpeed(net_usage, GetByteDisplayUnits(net_usage), true));
131 // Force number string to have LTR directionality. 131 // Force number string to have LTR directionality.
132 base::i18n::GetDisplayStringInLTRDirectionality(&net_byte); 132 return base::i18n::GetDisplayStringInLTRDirectionality(net_byte);
133 return WideToUTF16Hack(net_byte);
134 } 133 }
135 134
136 string16 TaskManagerModel::GetResourceCPUUsage(int index) const { 135 string16 TaskManagerModel::GetResourceCPUUsage(int index) const {
137 DCHECK(index < ResourceCount()); 136 DCHECK(index < ResourceCount());
138 return WideToUTF16Hack(StringPrintf( 137 return WideToUTF16Hack(StringPrintf(
139 #if defined(OS_MACOSX) 138 #if defined(OS_MACOSX)
140 // Activity Monitor shows %cpu with one decimal digit -- be 139 // Activity Monitor shows %cpu with one decimal digit -- be
141 // consistent with that. 140 // consistent with that.
142 L"%.1f", 141 L"%.1f",
143 #else 142 #else
(...skipping 830 matching lines...) Expand 10 before | Expand all | Expand 10 after
974 MetricsMap::const_iterator iter = metrics_map_.find(handle); 973 MetricsMap::const_iterator iter = metrics_map_.find(handle);
975 if (iter == metrics_map_.end()) 974 if (iter == metrics_map_.end())
976 return false; 975 return false;
977 976
978 if (!iter->second->GetMemoryBytes(&usage->first, &usage->second)) 977 if (!iter->second->GetMemoryBytes(&usage->first, &usage->second))
979 return false; 978 return false;
980 979
981 memory_usage_map_.insert(std::make_pair(handle, *usage)); 980 memory_usage_map_.insert(std::make_pair(handle, *usage));
982 return true; 981 return true;
983 } 982 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698