| 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 // 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 kChannelColumn, | 53 kChannelColumn, |
| 54 kMessageColumn, | 54 kMessageColumn, |
| 55 kFlagsColumn, | 55 kFlagsColumn, |
| 56 kDispatchColumn, | 56 kDispatchColumn, |
| 57 kProcessColumn, | 57 kProcessColumn, |
| 58 kParamsColumn, | 58 kParamsColumn, |
| 59 }; | 59 }; |
| 60 | 60 |
| 61 // The singleton dialog box. This is non-NULL when a dialog is active so we | 61 // The singleton dialog box. This is non-NULL when a dialog is active so we |
| 62 // know not to create a new one. | 62 // know not to create a new one. |
| 63 AboutIPCDialog* g_active_dialog = NULL; | 63 AboutIPCDialog* g_dialog = NULL; |
| 64 | 64 |
| 65 std::set<int> disabled_messages; | 65 std::set<int> disabled_messages; |
| 66 | 66 |
| 67 // Settings dialog ------------------------------------------------------------- | 67 // Settings dialog ------------------------------------------------------------- |
| 68 | 68 |
| 69 bool init_done = false; | 69 bool init_done = false; |
| 70 HWND settings_dialog = NULL; | 70 HWND settings_dialog = NULL; |
| 71 // Settings. | 71 // Settings. |
| 72 CListViewCtrl* messages = NULL; | 72 CListViewCtrl* messages = NULL; |
| 73 | 73 |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 : track_toggle_(NULL), | 193 : track_toggle_(NULL), |
| 194 clear_button_(NULL), | 194 clear_button_(NULL), |
| 195 filter_button_(NULL), | 195 filter_button_(NULL), |
| 196 table_(NULL), | 196 table_(NULL), |
| 197 tracking_(false) { | 197 tracking_(false) { |
| 198 SetupControls(); | 198 SetupControls(); |
| 199 IPC::Logging::GetInstance()->SetConsumer(this); | 199 IPC::Logging::GetInstance()->SetConsumer(this); |
| 200 } | 200 } |
| 201 | 201 |
| 202 AboutIPCDialog::~AboutIPCDialog() { | 202 AboutIPCDialog::~AboutIPCDialog() { |
| 203 g_active_dialog = NULL; | 203 g_dialog = NULL; |
| 204 IPC::Logging::GetInstance()->SetConsumer(NULL); | 204 IPC::Logging::GetInstance()->SetConsumer(NULL); |
| 205 } | 205 } |
| 206 | 206 |
| 207 // static | 207 // static |
| 208 void AboutIPCDialog::RunDialog() { | 208 void AboutIPCDialog::RunDialog() { |
| 209 if (!g_active_dialog) { | 209 if (!g_dialog) { |
| 210 g_active_dialog = new AboutIPCDialog; | 210 g_dialog = new AboutIPCDialog; |
| 211 views::Widget::CreateWindow(g_active_dialog)->Show(); | 211 views::DialogDelegate::CreateDialogWidget(g_dialog, NULL, NULL)->Show(); |
| 212 } else { | 212 } else { |
| 213 // TODO(brettw) it would be nice to focus the existing window. | 213 // TODO(brettw) it would be nice to focus the existing window. |
| 214 } | 214 } |
| 215 } | 215 } |
| 216 | 216 |
| 217 void AboutIPCDialog::SetupControls() { | 217 void AboutIPCDialog::SetupControls() { |
| 218 views::GridLayout* layout = views::GridLayout::CreatePanel(this); | 218 views::GridLayout* layout = views::GridLayout::CreatePanel(this); |
| 219 SetLayoutManager(layout); | 219 SetLayoutManager(layout); |
| 220 | 220 |
| 221 track_toggle_ = new views::LabelButton(this, kStartTrackingLabel); | 221 track_toggle_ = new views::LabelButton(this, kStartTrackingLabel); |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 | 328 |
| 329 message_list_.SetItemText(index, kParamsColumn, | 329 message_list_.SetItemText(index, kParamsColumn, |
| 330 UTF8ToWide(data.params).c_str()); | 330 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 bool AboutIPCDialog::UseNewStyleForThisDialog() const { |
| 339 return false; |
| 340 } |
| 341 |
| 338 void AboutIPCDialog::ButtonPressed( | 342 void AboutIPCDialog::ButtonPressed( |
| 339 views::Button* button, const ui::Event& event) { | 343 views::Button* button, const ui::Event& event) { |
| 340 if (button == track_toggle_) { | 344 if (button == track_toggle_) { |
| 341 if (tracking_) { | 345 if (tracking_) { |
| 342 track_toggle_->SetText(kStartTrackingLabel); | 346 track_toggle_->SetText(kStartTrackingLabel); |
| 343 tracking_ = false; | 347 tracking_ = false; |
| 344 content::EnableIPCLogging(false); | 348 content::EnableIPCLogging(false); |
| 345 } else { | 349 } else { |
| 346 track_toggle_->SetText(kStopTrackingLabel); | 350 track_toggle_->SetText(kStopTrackingLabel); |
| 347 tracking_ = true; | 351 tracking_ = true; |
| 348 content::EnableIPCLogging(true); | 352 content::EnableIPCLogging(true); |
| 349 } | 353 } |
| 350 track_toggle_->SchedulePaint(); | 354 track_toggle_->SchedulePaint(); |
| 351 } else if (button == clear_button_) { | 355 } else if (button == clear_button_) { |
| 352 message_list_.DeleteAllItems(); | 356 message_list_.DeleteAllItems(); |
| 353 } else if (button == filter_button_) { | 357 } else if (button == filter_button_) { |
| 354 RunSettingsDialog(GetWidget()->GetNativeView()); | 358 RunSettingsDialog(GetWidget()->GetNativeView()); |
| 355 } | 359 } |
| 356 } | 360 } |
| 357 | 361 |
| 358 namespace chrome { | 362 namespace chrome { |
| 359 | 363 |
| 360 void ShowAboutIPCDialog() { | 364 void ShowAboutIPCDialog() { |
| 361 AboutIPCDialog::RunDialog(); | 365 AboutIPCDialog::RunDialog(); |
| 362 } | 366 } |
| 363 | 367 |
| 364 } // namespace chrome | 368 } // namespace chrome |
| 365 | 369 |
| 366 #endif // IPC_MESSAGE_LOG_ENABLED | 370 #endif // IPC_MESSAGE_LOG_ENABLED |
| OLD | NEW |