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