OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 #ifndef CHROME_BROWSER_VIEWS_ABOUT_NETWORK_DIALOG_H_ | 5 #ifndef CHROME_BROWSER_VIEWS_LOGGING_ABOUT_DIALOG_H_ |
6 #define CHROME_BROWSER_VIEWS_ABOUT_NETWORK_DIALOG_H_ | 6 #define CHROME_BROWSER_VIEWS_LOGGING_ABOUT_DIALOG_H_ |
7 | 7 |
8 #include "base/singleton.h" | 8 #include "base/singleton.h" |
9 #include "chrome/views/base_button.h" | 9 #include "chrome/views/base_button.h" |
10 #include "chrome/views/dialog_delegate.h" | 10 #include "chrome/views/dialog_delegate.h" |
11 | 11 |
12 namespace views { | 12 namespace views { |
| 13 class ColumnSet; |
| 14 class GridLayout; |
13 class TextButton; | 15 class TextButton; |
14 class TextField; | 16 class TextField; |
15 } // namespace views | 17 } // namespace views |
16 | 18 |
17 class AboutNetworkDialog : public views::DialogDelegate, | 19 // This is the base class for dialog boxes used in debugging that dump text |
18 public views::BaseButton::ButtonListener, | 20 // into a textbox. The derived class specifies which buttons appear at the top |
| 21 // of the dialog, this class manages the text area. |
| 22 class LoggingAboutDialog : public views::DialogDelegate, |
19 public views::View { | 23 public views::View { |
20 public: | 24 public: |
21 // This dialog is a singleton. If the dialog is already opened, it won't do | 25 virtual ~LoggingAboutDialog(); |
22 // anything, so you can just blindly call this function all you want. | |
23 static void RunDialog(); | |
24 | |
25 virtual ~AboutNetworkDialog(); | |
26 | 26 |
27 // Appends the given string to the dialog box. This is called by the job | 27 // Appends the given string to the dialog box. This is called by the job |
28 // tracker (see the .cc file) when "stuff happens." | 28 // tracker (see the .cc file) when "stuff happens." |
29 void AppendText(const std::wstring& text); | 29 void AppendText(const std::wstring& text); |
30 | 30 |
31 // Returns true if we're currently tracking network operations. | 31 protected: |
32 bool tracking() const { return tracking_; } | 32 // The derived class should be sure to call SetupControls. We don't want |
33 | 33 // this class to do it becuase it calls virtual functions, and the derived |
34 private: | 34 // class wouldn't be constructed yet. |
35 friend struct DefaultSingletonTraits<AboutNetworkDialog>; | 35 LoggingAboutDialog(); |
36 | |
37 AboutNetworkDialog(); | |
38 | 36 |
39 // Sets up all UI controls for the dialog. | 37 // Sets up all UI controls for the dialog. |
40 void SetupControls(); | 38 void SetupControls(); |
41 | 39 |
| 40 // Sets up the column set for the buttons that appears at the top of the |
| 41 // dialog. |
| 42 virtual void SetupButtonColumnSet(views::ColumnSet* set) = 0; |
| 43 |
| 44 // Adds any custom buttons to the layout. This will be in the column set |
| 45 // set up above. |
| 46 virtual void AddButtonControlsToLayout(views::GridLayout* layout) = 0; |
| 47 |
| 48 views::TextField* text_field() { return text_field_; } |
| 49 |
| 50 private: |
42 virtual gfx::Size GetPreferredSize(); | 51 virtual gfx::Size GetPreferredSize(); |
43 virtual views::View* GetContentsView(); | 52 virtual views::View* GetContentsView(); |
44 virtual int GetDialogButtons() const; | 53 virtual int GetDialogButtons() const; |
45 virtual std::wstring GetWindowTitle() const; | 54 virtual std::wstring GetWindowTitle() const; |
46 virtual void Layout(); | |
47 | 55 |
48 // views::WindowDelegate (via view::DialogDelegate). | 56 // views::WindowDelegate (via view::DialogDelegate). |
49 virtual bool CanResize() const; | 57 virtual bool CanResize() const; |
50 | 58 |
51 // views::BaseButton::ButtonListener. | 59 // The text field that contains the log messages. |
52 virtual void ButtonPressed(views::BaseButton* button); | |
53 | |
54 views::TextButton* track_toggle_; | |
55 views::TextButton* show_button_; | |
56 views::TextButton* clear_button_; | |
57 views::TextField* text_field_; | 60 views::TextField* text_field_; |
58 | 61 |
59 // Set to true when we're tracking network status. | 62 DISALLOW_COPY_AND_ASSIGN(LoggingAboutDialog); |
60 bool tracking_; | |
61 | |
62 DISALLOW_COPY_AND_ASSIGN(AboutNetworkDialog); | |
63 }; | 63 }; |
64 | 64 |
65 #endif // CHROME_BROWSER_VIEWS_ABOUT_NETWORK_DIALOG_H_ | 65 #endif // CHROME_BROWSER_VIEWS_LOGGING_ABOUT_DIALOG_H_ |
OLD | NEW |