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 3 // found in the LICENSE file. 4 5 #ifndef CHROME_BROWSER_UI_VIEWS_ABOUT_IPC_DIALOG_H_ 6 #define CHROME_BROWSER_UI_VIEWS_ABOUT_IPC_DIALOG_H_ 7 8 #include "ipc/ipc_message.h" // For IPC_MESSAGE_LOG_ENABLED. 9 10 #if defined(OS_WIN) && defined(IPC_MESSAGE_LOG_ENABLED) 11 12 #include <atlbase.h> 13 #include <atlapp.h> 14 #include <atlctrls.h> 15 #include <atlwin.h> 16 17 #include "ipc/ipc_logging.h" 18 #include "ui/views/controls/button/button.h" 19 #include "ui/views/window/dialog_delegate.h" 20 21 template <typename T> struct DefaultSingletonTraits; 22 23 namespace views { 24 class LabelButton; 25 class NativeViewHost; 26 } 27 28 class AboutIPCDialog : public views::DialogDelegateView, 29 public views::ButtonListener, 30 public IPC::Logging::Consumer { 31 public: 32 // This dialog is a singleton. If the dialog is already opened, it won't do 33 // anything, so you can just blindly call this function all you want. 34 static void RunDialog(); 35 36 virtual ~AboutIPCDialog(); 37 38 private: 39 friend struct DefaultSingletonTraits<AboutIPCDialog>; 40 41 AboutIPCDialog(); 42 43 // Sets up all UI controls for the dialog. 44 void SetupControls(); 45 46 // views::View overrides. 47 virtual gfx::Size GetPreferredSize() OVERRIDE; 48 virtual int GetDialogButtons() const OVERRIDE; 49 virtual base::string16 GetWindowTitle() const OVERRIDE; 50 virtual void Layout() OVERRIDE; 51 52 // IPC::Logging::Consumer implementation. 53 virtual void Log(const IPC::LogData& data) OVERRIDE; 54 55 // views::WidgetDelegate (via views::DialogDelegateView). 56 virtual bool CanResize() const OVERRIDE; 57 virtual bool UseNewStyleForThisDialog() const OVERRIDE; 58 59 // views::ButtonListener. 60 virtual void ButtonPressed(views::Button* button, 61 const ui::Event& event) OVERRIDE; 62 63 WTL::CListViewCtrl message_list_; 64 65 views::LabelButton* track_toggle_; 66 views::LabelButton* clear_button_; 67 views::LabelButton* filter_button_; 68 views::NativeViewHost* table_; 69 70 // Set to true when we're tracking network status. 71 bool tracking_; 72 73 DISALLOW_COPY_AND_ASSIGN(AboutIPCDialog); 74 }; 75 76 #endif // OS_WIN && IPC_MESSAGE_LOG_ENABLED 77 78 #endif // CHROME_BROWSER_UI_VIEWS_ABOUT_IPC_DIALOG_H_ 79