summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-01-28 21:39:21 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-01-28 21:39:21 +0000
commit875ac10e1efb37bff2182aa82e4da47830c09a6b (patch)
tree24de27335e922af24e2c0fd76f2b58676145da6a /chrome
parent3596f90b2dffa20949870cd402833c3d5f05200e (diff)
downloadchromium_src-875ac10e1efb37bff2182aa82e4da47830c09a6b.zip
chromium_src-875ac10e1efb37bff2182aa82e4da47830c09a6b.tar.gz
chromium_src-875ac10e1efb37bff2182aa82e4da47830c09a6b.tar.bz2
Reverting 8822.
Review URL: http://codereview.chromium.org/19439 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8827 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/views/about_network_dialog.cc76
-rw-r--r--chrome/browser/views/about_network_dialog.h29
-rw-r--r--chrome/browser/views/browser_views.vcproj8
-rw-r--r--chrome/browser/views/logging_about_dialog.cc72
-rw-r--r--chrome/browser/views/logging_about_dialog.h65
5 files changed, 83 insertions, 167 deletions
diff --git a/chrome/browser/views/about_network_dialog.cc b/chrome/browser/views/about_network_dialog.cc
index 4b961d9..a1af274 100644
--- a/chrome/browser/views/about_network_dialog.cc
+++ b/chrome/browser/views/about_network_dialog.cc
@@ -265,11 +265,7 @@ JobTracker* tracker = NULL;
// AboutNetworkDialog ----------------------------------------------------------
-AboutNetworkDialog::AboutNetworkDialog()
- : track_toggle_(NULL),
- show_button_(NULL),
- clear_button_(NULL),
- tracking_(false) {
+AboutNetworkDialog::AboutNetworkDialog() : tracking_(false) {
SetupControls();
tracker = new JobTracker(this);
tracker->AddRef();
@@ -291,16 +287,14 @@ void AboutNetworkDialog::RunDialog() {
}
}
-void AboutNetworkDialog::SetupButtonColumnSet(views::ColumnSet* set) {
- set->AddColumn(views::GridLayout::CENTER, views::GridLayout::CENTER,
- 33.33f, views::GridLayout::FIXED, 0, 0);
- set->AddColumn(views::GridLayout::CENTER, views::GridLayout::CENTER,
- 33.33f, views::GridLayout::FIXED, 0, 0);
- set->AddColumn(views::GridLayout::CENTER, views::GridLayout::CENTER,
- 33.33f, views::GridLayout::FIXED, 0, 0);
+void AboutNetworkDialog::AppendText(const std::wstring& text) {
+ text_field_->AppendText(text);
}
-void AboutNetworkDialog::AddButtonControlsToLayout(views::GridLayout* layout) {
+void AboutNetworkDialog::SetupControls() {
+ views::GridLayout* layout = CreatePanelGridLayout(this);
+ SetLayoutManager(layout);
+
track_toggle_ = new views::TextButton(kStartTrackingLabel);
track_toggle_->SetListener(this, 1);
show_button_ = new views::TextButton(kShowCurrentLabel);
@@ -308,9 +302,63 @@ void AboutNetworkDialog::AddButtonControlsToLayout(views::GridLayout* layout) {
clear_button_ = new views::TextButton(kClearLabel);
clear_button_->SetListener(this, 3);
+ text_field_ = new views::TextField(static_cast<views::TextField::StyleFlags>(
+ views::TextField::STYLE_MULTILINE));
+ text_field_->SetReadOnly(true);
+
+ // TODO(brettw): We may want to add this in the future. It can't be called
+ // from here, though, since the hwnd for the field hasn't been created yet.
+ //
+ // This raises the maximum number of chars from 32K to some large maximum,
+ // probably 2GB. 32K is not nearly enough for our use-case.
+ //SendMessageW(text_field_->GetNativeComponent(), EM_SETLIMITTEXT, 0, 0);
+
+ static const int first_column_set = 1;
+ views::ColumnSet* column_set = layout->AddColumnSet(first_column_set);
+ column_set->AddColumn(views::GridLayout::CENTER, views::GridLayout::CENTER,
+ 33.33f, views::GridLayout::FIXED, 0, 0);
+ column_set->AddColumn(views::GridLayout::CENTER, views::GridLayout::CENTER,
+ 33.33f, views::GridLayout::FIXED, 0, 0);
+ column_set->AddColumn(views::GridLayout::CENTER, views::GridLayout::CENTER,
+ 33.33f, views::GridLayout::FIXED, 0, 0);
+
+ static const int text_column_set = 2;
+ column_set = layout->AddColumnSet(text_column_set);
+ column_set->AddColumn(views::GridLayout::FILL, views::GridLayout::FILL, 100.0f,
+ views::GridLayout::FIXED, 0, 0);
+
+ layout->StartRow(0, first_column_set);
layout->AddView(track_toggle_);
layout->AddView(show_button_);
layout->AddView(clear_button_);
+ layout->AddPaddingRow(0, kRelatedControlVerticalSpacing);
+ layout->StartRow(1.0f, text_column_set);
+ layout->AddView(text_field_);
+}
+
+gfx::Size AboutNetworkDialog::GetPreferredSize() {
+ return gfx::Size(800, 400);
+}
+
+views::View* AboutNetworkDialog::GetContentsView() {
+ return this;
+}
+
+int AboutNetworkDialog::GetDialogButtons() const {
+ // Don't want OK or Cancel.
+ return 0;
+}
+
+std::wstring AboutNetworkDialog::GetWindowTitle() const {
+ return L"about:network";
+}
+
+void AboutNetworkDialog::Layout() {
+ GetLayoutManager()->Layout(this);
+}
+
+bool AboutNetworkDialog::CanResize() const {
+ return true;
}
void AboutNetworkDialog::ButtonPressed(views::BaseButton* button) {
@@ -328,6 +376,6 @@ void AboutNetworkDialog::ButtonPressed(views::BaseButton* button) {
} else if (button == show_button_) {
tracker->ReportStatus();
} else if (button == clear_button_) {
- text_field()->SetText(std::wstring());
+ text_field_->SetText(std::wstring());
}
}
diff --git a/chrome/browser/views/about_network_dialog.h b/chrome/browser/views/about_network_dialog.h
index 68d6690..a9dd2cc 100644
--- a/chrome/browser/views/about_network_dialog.h
+++ b/chrome/browser/views/about_network_dialog.h
@@ -6,7 +6,6 @@
#define CHROME_BROWSER_VIEWS_ABOUT_NETWORK_DIALOG_H_
#include "base/singleton.h"
-#include "chrome/browser/views/logging_about_dialog.h"
#include "chrome/views/base_button.h"
#include "chrome/views/dialog_delegate.h"
@@ -15,8 +14,9 @@ class TextButton;
class TextField;
} // namespace views
-class AboutNetworkDialog : public LoggingAboutDialog,
- public views::BaseButton::ButtonListener {
+class AboutNetworkDialog : public views::DialogDelegate,
+ public views::BaseButton::ButtonListener,
+ public views::View {
public:
// This dialog is a singleton. If the dialog is already opened, it won't do
// anything, so you can just blindly call this function all you want.
@@ -24,6 +24,10 @@ class AboutNetworkDialog : public LoggingAboutDialog,
virtual ~AboutNetworkDialog();
+ // Appends the given string to the dialog box. This is called by the job
+ // tracker (see the .cc file) when "stuff happens."
+ void AppendText(const std::wstring& text);
+
// Returns true if we're currently tracking network operations.
bool tracking() const { return tracking_; }
@@ -32,16 +36,25 @@ class AboutNetworkDialog : public LoggingAboutDialog,
AboutNetworkDialog();
- // views::BaseButton::ButtonListener implementation.
- virtual void ButtonPressed(views::BaseButton* button);
+ // Sets up all UI controls for the dialog.
+ void SetupControls();
+
+ virtual gfx::Size GetPreferredSize();
+ virtual views::View* GetContentsView();
+ virtual int GetDialogButtons() const;
+ virtual std::wstring GetWindowTitle() const;
+ virtual void Layout();
- // LoggingAboutDialog implementation.
- virtual void SetupButtonColumnSet(views::ColumnSet* set);
- virtual void AddButtonControlsToLayout(views::GridLayout* layout);
+ // views::WindowDelegate (via view::DialogDelegate).
+ virtual bool CanResize() const;
+
+ // views::BaseButton::ButtonListener.
+ virtual void ButtonPressed(views::BaseButton* button);
views::TextButton* track_toggle_;
views::TextButton* show_button_;
views::TextButton* clear_button_;
+ views::TextField* text_field_;
// Set to true when we're tracking network status.
bool tracking_;
diff --git a/chrome/browser/views/browser_views.vcproj b/chrome/browser/views/browser_views.vcproj
index 6ac7983..825d0cc 100644
--- a/chrome/browser/views/browser_views.vcproj
+++ b/chrome/browser/views/browser_views.vcproj
@@ -634,14 +634,6 @@
>
</File>
<File
- RelativePath=".\logging_about_dialog.cc"
- >
- </File>
- <File
- RelativePath=".\logging_about_dialog.h"
- >
- </File>
- <File
RelativePath=".\login_view.cc"
>
</File>
diff --git a/chrome/browser/views/logging_about_dialog.cc b/chrome/browser/views/logging_about_dialog.cc
deleted file mode 100644
index 17913fd..0000000
--- a/chrome/browser/views/logging_about_dialog.cc
+++ /dev/null
@@ -1,72 +0,0 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/views/logging_about_dialog.h"
-
-#include "chrome/browser/views/standard_layout.h"
-#include "chrome/views/grid_layout.h"
-#include "chrome/views/text_field.h"
-#include "chrome/views/window.h"
-
-LoggingAboutDialog::LoggingAboutDialog() {
-}
-
-LoggingAboutDialog::~LoggingAboutDialog() {
-}
-
-void LoggingAboutDialog::SetupControls() {
- views::GridLayout* layout = CreatePanelGridLayout(this);
- SetLayoutManager(layout);
-
- static const int first_column_set = 1;
- views::ColumnSet* button_set = layout->AddColumnSet(first_column_set);
- SetupButtonColumnSet(button_set);
-
- text_field_ = new views::TextField(static_cast<views::TextField::StyleFlags>(
- views::TextField::STYLE_MULTILINE));
- text_field_->SetReadOnly(true);
-
- // TODO(brettw): We may want to add this in the future. It can't be called
- // from here, though, since the hwnd for the field hasn't been created yet.
- //
- // This raises the maximum number of chars from 32K to some large maximum,
- // probably 2GB. 32K is not nearly enough for our use-case.
- //SendMessageW(text_field_->GetNativeComponent(), EM_SETLIMITTEXT, 0, 0);
-
- static const int text_column_set = 2;
- views::ColumnSet* column_set = layout->AddColumnSet(text_column_set);
- column_set->AddColumn(views::GridLayout::FILL, views::GridLayout::FILL, 100.0f,
- views::GridLayout::FIXED, 0, 0);
-
- layout->StartRow(0, first_column_set);
- AddButtonControlsToLayout(layout);
- layout->AddPaddingRow(0, kRelatedControlVerticalSpacing);
- layout->StartRow(1.0f, text_column_set);
- layout->AddView(text_field_);
-}
-
-void LoggingAboutDialog::AppendText(const std::wstring& text) {
- text_field_->AppendText(text);
-}
-
-gfx::Size LoggingAboutDialog::GetPreferredSize() {
- return gfx::Size(800, 400);
-}
-
-views::View* LoggingAboutDialog::GetContentsView() {
- return this;
-}
-
-int LoggingAboutDialog::GetDialogButtons() const {
- // Don't want OK or Cancel.
- return 0;
-}
-
-std::wstring LoggingAboutDialog::GetWindowTitle() const {
- return L"about:network";
-}
-
-bool LoggingAboutDialog::CanResize() const {
- return true;
-}
diff --git a/chrome/browser/views/logging_about_dialog.h b/chrome/browser/views/logging_about_dialog.h
deleted file mode 100644
index 7f24884..0000000
--- a/chrome/browser/views/logging_about_dialog.h
+++ /dev/null
@@ -1,65 +0,0 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_BROWSER_VIEWS_LOGGING_ABOUT_DIALOG_H_
-#define CHROME_BROWSER_VIEWS_LOGGING_ABOUT_DIALOG_H_
-
-#include "base/singleton.h"
-#include "chrome/views/base_button.h"
-#include "chrome/views/dialog_delegate.h"
-
-namespace views {
-class ColumnSet;
-class GridLayout;
-class TextButton;
-class TextField;
-} // namespace views
-
-// This is the base class for dialog boxes used in debugging that dump text
-// into a textbox. The derived class specifies which buttons appear at the top
-// of the dialog, this class manages the text area.
-class LoggingAboutDialog : public views::DialogDelegate,
- public views::View {
- public:
- virtual ~LoggingAboutDialog();
-
- // Appends the given string to the dialog box. This is called by the job
- // tracker (see the .cc file) when "stuff happens."
- void AppendText(const std::wstring& text);
-
- protected:
- // The derived class should be sure to call SetupControls. We don't want
- // this class to do it becuase it calls virtual functions, and the derived
- // class wouldn't be constructed yet.
- LoggingAboutDialog();
-
- // Sets up all UI controls for the dialog.
- void SetupControls();
-
- // Sets up the column set for the buttons that appears at the top of the
- // dialog.
- virtual void SetupButtonColumnSet(views::ColumnSet* set) = 0;
-
- // Adds any custom buttons to the layout. This will be in the column set
- // set up above.
- virtual void AddButtonControlsToLayout(views::GridLayout* layout) = 0;
-
- views::TextField* text_field() { return text_field_; }
-
- private:
- virtual gfx::Size GetPreferredSize();
- virtual views::View* GetContentsView();
- virtual int GetDialogButtons() const;
- virtual std::wstring GetWindowTitle() const;
-
- // views::WindowDelegate (via view::DialogDelegate).
- virtual bool CanResize() const;
-
- // The text field that contains the log messages.
- views::TextField* text_field_;
-
- DISALLOW_COPY_AND_ASSIGN(LoggingAboutDialog);
-};
-
-#endif // CHROME_BROWSER_VIEWS_LOGGING_ABOUT_DIALOG_H_