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

Side by Side Diff: chrome/browser/ui/views/about_ipc_dialog.cc

Issue 12314090: Add utf_string_conversions to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 unified diff | Download patch | Annotate | Revision Log
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 // Need to include this before any other file because it defines 5 // Need to include this before any other file because it defines
6 // IPC_MESSAGE_LOG_ENABLED. We need to use it to define 6 // IPC_MESSAGE_LOG_ENABLED. We need to use it to define
7 // IPC_MESSAGE_MACROS_LOG_ENABLED so that all_messages.h will generate the 7 // IPC_MESSAGE_MACROS_LOG_ENABLED so that all_messages.h will generate the
8 // ViewMsgLog et al. functions. 8 // ViewMsgLog et al. functions.
9 #include "ipc/ipc_message.h" 9 #include "ipc/ipc_message.h"
10 10
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 messages->ModifyStyle(0, LVS_SORTASCENDING | LVS_NOCOLUMNHEADER); 89 messages->ModifyStyle(0, LVS_SORTASCENDING | LVS_NOCOLUMNHEADER);
90 messages->InsertColumn(0, L"id", LVCFMT_LEFT, 230); 90 messages->InsertColumn(0, L"id", LVCFMT_LEFT, 230);
91 91
92 LogFunctionMap* log_functions = IPC::Logging::log_function_map(); 92 LogFunctionMap* log_functions = IPC::Logging::log_function_map();
93 for (LogFunctionMap::iterator i(log_functions->begin()); 93 for (LogFunctionMap::iterator i(log_functions->begin());
94 i != log_functions->end(); ++i) { 94 i != log_functions->end(); ++i) {
95 std::string name; 95 std::string name;
96 (*i->second)(&name, NULL, NULL); 96 (*i->second)(&name, NULL, NULL);
97 if (name.empty()) 97 if (name.empty())
98 continue; // Will happen if the message file isn't included above. 98 continue; // Will happen if the message file isn't included above.
99 std::wstring wname = UTF8ToWide(name); 99 std::wstring wname = base::UTF8ToWide(name);
100 100
101 int index = messages->InsertItem( 101 int index = messages->InsertItem(
102 LVIF_TEXT | LVIF_PARAM, 0, wname.c_str(), 0, 0, 0, i->first); 102 LVIF_TEXT | LVIF_PARAM, 0, wname.c_str(), 0, 0, 0, i->first);
103 103
104 messages->SetItemText(index, 0, wname.c_str()); 104 messages->SetItemText(index, 0, wname.c_str());
105 105
106 if (disabled_messages.find(i->first) == disabled_messages.end()) 106 if (disabled_messages.find(i->first) == disabled_messages.end())
107 messages->SetCheckState(index, TRUE); 107 messages->SetCheckState(index, TRUE);
108 } 108 }
109 109
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 exploded.hour -= 12; 297 exploded.hour -= 12;
298 298
299 std::wstring sent_str = StringPrintf(L"%02d:%02d:%02d.%03d", 299 std::wstring sent_str = StringPrintf(L"%02d:%02d:%02d.%03d",
300 exploded.hour, exploded.minute, exploded.second, exploded.millisecond); 300 exploded.hour, exploded.minute, exploded.second, exploded.millisecond);
301 301
302 int count = message_list_.GetItemCount(); 302 int count = message_list_.GetItemCount();
303 int index = message_list_.InsertItem(count, sent_str.c_str()); 303 int index = message_list_.InsertItem(count, sent_str.c_str());
304 304
305 message_list_.SetItemText(index, kTimeColumn, sent_str.c_str()); 305 message_list_.SetItemText(index, kTimeColumn, sent_str.c_str());
306 message_list_.SetItemText(index, kChannelColumn, 306 message_list_.SetItemText(index, kChannelColumn,
307 ASCIIToWide(data.channel).c_str()); 307 base::ASCIIToWide(data.channel).c_str());
308 308
309 std::string message_name; 309 std::string message_name;
310 IPC::Logging::GetMessageText(data.type, &message_name, NULL, NULL); 310 IPC::Logging::GetMessageText(data.type, &message_name, NULL, NULL);
311 message_list_.SetItemText(index, kMessageColumn, 311 message_list_.SetItemText(index, kMessageColumn,
312 UTF8ToWide(message_name).c_str()); 312 base::UTF8ToWide(message_name).c_str());
313 message_list_.SetItemText(index, kFlagsColumn, 313 message_list_.SetItemText(index, kFlagsColumn,
314 UTF8ToWide(data.flags).c_str()); 314 base::UTF8ToWide(data.flags).c_str());
315 315
316 int64 time_to_send = (base::Time::FromInternalValue(data.receive) - 316 int64 time_to_send = (base::Time::FromInternalValue(data.receive) -
317 sent).InMilliseconds(); 317 sent).InMilliseconds();
318 // time can go backwards by a few ms (see Time), don't show that. 318 // time can go backwards by a few ms (see Time), don't show that.
319 time_to_send = std::max(static_cast<int>(time_to_send), 0); 319 time_to_send = std::max(static_cast<int>(time_to_send), 0);
320 std::wstring temp = StringPrintf(L"%d", time_to_send); 320 std::wstring temp = StringPrintf(L"%d", time_to_send);
321 message_list_.SetItemText(index, kDispatchColumn, temp.c_str()); 321 message_list_.SetItemText(index, kDispatchColumn, temp.c_str());
322 322
323 int64 time_to_process = (base::Time::FromInternalValue(data.dispatch) - 323 int64 time_to_process = (base::Time::FromInternalValue(data.dispatch) -
324 base::Time::FromInternalValue(data.receive)).InMilliseconds(); 324 base::Time::FromInternalValue(data.receive)).InMilliseconds();
325 time_to_process = std::max(static_cast<int>(time_to_process), 0); 325 time_to_process = std::max(static_cast<int>(time_to_process), 0);
326 temp = StringPrintf(L"%d", time_to_process); 326 temp = StringPrintf(L"%d", time_to_process);
327 message_list_.SetItemText(index, kProcessColumn, temp.c_str()); 327 message_list_.SetItemText(index, kProcessColumn, temp.c_str());
328 328
329 message_list_.SetItemText(index, kParamsColumn, 329 message_list_.SetItemText(index, kParamsColumn,
330 UTF8ToWide(data.params).c_str()); 330 base::UTF8ToWide(data.params).c_str());
331 message_list_.EnsureVisible(index, FALSE); 331 message_list_.EnsureVisible(index, FALSE);
332 } 332 }
333 333
334 bool AboutIPCDialog::CanResize() const { 334 bool AboutIPCDialog::CanResize() const {
335 return true; 335 return true;
336 } 336 }
337 337
338 void AboutIPCDialog::ButtonPressed( 338 void AboutIPCDialog::ButtonPressed(
339 views::Button* button, const ui::Event& event) { 339 views::Button* button, const ui::Event& event) {
340 if (button == track_toggle_) { 340 if (button == track_toggle_) {
(...skipping 16 matching lines...) Expand all
357 357
358 namespace chrome { 358 namespace chrome {
359 359
360 void ShowAboutIPCDialog() { 360 void ShowAboutIPCDialog() {
361 AboutIPCDialog::RunDialog(); 361 AboutIPCDialog::RunDialog();
362 } 362 }
363 363
364 } // namespace chrome 364 } // namespace chrome
365 365
366 #endif // IPC_MESSAGE_LOG_ENABLED 366 #endif // IPC_MESSAGE_LOG_ENABLED
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698