summaryrefslogtreecommitdiffstats
path: root/views
diff options
context:
space:
mode:
authorsaintlou@chromium.org <saintlou@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-06-23 16:48:23 +0000
committersaintlou@chromium.org <saintlou@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-06-23 16:48:23 +0000
commita7488a134b0b011c8724ccca6d6f16a549a561e0 (patch)
tree02248ca3a406edee5ff7d346b30cd20125003456 /views
parent512ac40edc7551c76bbd9bf288afee209f6bba15 (diff)
downloadchromium_src-a7488a134b0b011c8724ccca6d6f16a549a561e0.zip
chromium_src-a7488a134b0b011c8724ccca6d6f16a549a561e0.tar.gz
chromium_src-a7488a134b0b011c8724ccca6d6f16a549a561e0.tar.bz2
Updated remaining button to text button. Reverted the interposed
class NativeButtonBase which is no longer needed. BUG=none TEST=none Review URL: http://codereview.chromium.org/7218035 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@90220 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views')
-rw-r--r--views/controls/button/checkbox.cc10
-rw-r--r--views/controls/button/checkbox.h2
-rw-r--r--views/controls/button/native_button.cc93
-rw-r--r--views/controls/button/native_button.h44
-rw-r--r--views/controls/button/native_button_gtk.cc4
-rw-r--r--views/controls/button/native_button_gtk.h4
-rw-r--r--views/controls/button/native_button_win.cc4
-rw-r--r--views/controls/button/native_button_win.h4
-rw-r--r--views/controls/button/native_button_wrapper.h4
-rw-r--r--views/controls/button/text_button.cc4
-rw-r--r--views/controls/button/text_button.h4
-rw-r--r--views/examples/widget_example.cc6
-rw-r--r--views/view_unittest.cc20
-rw-r--r--views/window/dialog_client_view.cc18
-rw-r--r--views/window/dialog_client_view.h16
-rw-r--r--views/window/dialog_delegate.cc4
16 files changed, 82 insertions, 159 deletions
diff --git a/views/controls/button/checkbox.cc b/views/controls/button/checkbox.cc
index 2b43a4b..fe33428 100644
--- a/views/controls/button/checkbox.cc
+++ b/views/controls/button/checkbox.cc
@@ -24,12 +24,12 @@ static const int kLabelFocusPaddingVertical = 1;
////////////////////////////////////////////////////////////////////////////////
// NativeCheckbox, public:
-NativeCheckbox::NativeCheckbox() : NativeButtonBase(NULL), checked_(false) {
+NativeCheckbox::NativeCheckbox() : NativeButton(NULL), checked_(false) {
Init(std::wstring());
}
NativeCheckbox::NativeCheckbox(const std::wstring& label)
- : NativeButtonBase(NULL, label),
+ : NativeButton(NULL, label),
checked_(false) {
Init(label);
}
@@ -91,7 +91,7 @@ int NativeCheckbox::GetHeightForWidth(int w) {
}
void NativeCheckbox::OnEnabledChanged() {
- NativeButtonBase::OnEnabledChanged();
+ NativeButton::OnEnabledChanged();
if (label_)
label_->SetEnabled(IsEnabled());
}
@@ -168,7 +168,7 @@ void NativeCheckbox::GetAccessibleState(ui::AccessibleViewState* state) {
// NativeCheckbox, NativeButton overrides:
void NativeCheckbox::SetLabel(const std::wstring& label) {
- NativeButtonBase::SetLabel(label);
+ NativeButton::SetLabel(label);
if (!native_wrapper_->UsesNativeLabel())
label_->SetText(label);
}
@@ -189,7 +189,7 @@ void NativeCheckbox::OnPaintFocusBorder(gfx::Canvas* canvas) {
// Our focus border is rendered by the label, so we don't do anything here.
}
void NativeCheckbox::OnFocus() {
- NativeButtonBase::OnFocus();
+ NativeButton::OnFocus();
label_->set_paint_as_focused(true);
}
diff --git a/views/controls/button/checkbox.h b/views/controls/button/checkbox.h
index fb2fa0f..8c20b91 100644
--- a/views/controls/button/checkbox.h
+++ b/views/controls/button/checkbox.h
@@ -16,7 +16,7 @@ namespace views {
class Label;
// A NativeButton subclass representing a checkbox.
-class NativeCheckbox : public NativeButtonBase {
+class NativeCheckbox : public NativeButton {
public:
// The button's class name.
static const char kViewClassName[];
diff --git a/views/controls/button/native_button.cc b/views/controls/button/native_button.cc
index 5c55347..06e6b4c 100644
--- a/views/controls/button/native_button.cc
+++ b/views/controls/button/native_button.cc
@@ -32,12 +32,12 @@ static const int kButtonBorderHWidth = 0;
#endif
// static
-const char NativeButtonBase::kViewClassName[] = "views/NativeButtonBase";
+const char NativeButton::kViewClassName[] = "views/NativeButton";
////////////////////////////////////////////////////////////////////////////////
-// NativeButtonBase, public:
+// NativeButton, public:
-NativeButtonBase::NativeButtonBase(ButtonListener* listener)
+NativeButton::NativeButton(ButtonListener* listener)
: Button(listener),
native_wrapper_(NULL),
is_default_(false),
@@ -47,7 +47,7 @@ NativeButtonBase::NativeButtonBase(ButtonListener* listener)
set_focusable(true);
}
-NativeButtonBase::NativeButtonBase(ButtonListener* listener,
+NativeButton::NativeButton(ButtonListener* listener,
const std::wstring& label)
: Button(listener),
native_wrapper_(NULL),
@@ -59,10 +59,10 @@ NativeButtonBase::NativeButtonBase(ButtonListener* listener,
set_focusable(true);
}
-NativeButtonBase::~NativeButtonBase() {
+NativeButton::~NativeButton() {
}
-void NativeButtonBase::SetLabel(const std::wstring& label) {
+void NativeButton::SetLabel(const std::wstring& label) {
label_ = WideToUTF16Hack(label);
// Even though we create a flipped HWND for a native button when the locale
@@ -85,7 +85,7 @@ void NativeButtonBase::SetLabel(const std::wstring& label) {
PreferredSizeChanged();
}
-void NativeButtonBase::SetIsDefault(bool is_default) {
+void NativeButton::SetIsDefault(bool is_default) {
if (is_default == is_default_)
return;
is_default_ = is_default;
@@ -98,14 +98,14 @@ void NativeButtonBase::SetIsDefault(bool is_default) {
PreferredSizeChanged();
}
-void NativeButtonBase::SetNeedElevation(bool need_elevation) {
+void NativeButton::SetNeedElevation(bool need_elevation) {
need_elevation_ = need_elevation;
if (native_wrapper_)
native_wrapper_->UpdateLabel();
PreferredSizeChanged();
}
-void NativeButtonBase::ButtonPressed() {
+void NativeButton::ButtonPressed() {
RequestFocus();
// TODO(beng): obtain mouse event flags for native buttons someday.
@@ -124,9 +124,9 @@ void NativeButtonBase::ButtonPressed() {
}
////////////////////////////////////////////////////////////////////////////////
-// NativeButtonBase, View overrides:
+// NativeButton, View overrides:
-gfx::Size NativeButtonBase::GetPreferredSize() {
+gfx::Size NativeButton::GetPreferredSize() {
if (!native_wrapper_)
return gfx::Size();
@@ -157,20 +157,20 @@ gfx::Size NativeButtonBase::GetPreferredSize() {
return sz;
}
-void NativeButtonBase::Layout() {
+void NativeButton::Layout() {
if (native_wrapper_) {
native_wrapper_->GetView()->SetBounds(0, 0, width(), height());
native_wrapper_->GetView()->Layout();
}
}
-void NativeButtonBase::OnEnabledChanged() {
+void NativeButton::OnEnabledChanged() {
Button::OnEnabledChanged();
if (native_wrapper_)
native_wrapper_->UpdateEnabled();
}
-void NativeButtonBase::ViewHierarchyChanged(bool is_add, View* parent,
+void NativeButton::ViewHierarchyChanged(bool is_add, View* parent,
View* child) {
if (is_add && !native_wrapper_ && GetWidget()) {
// The native wrapper's lifetime will be managed by the view hierarchy after
@@ -181,11 +181,11 @@ void NativeButtonBase::ViewHierarchyChanged(bool is_add, View* parent,
}
}
-std::string NativeButtonBase::GetClassName() const {
+std::string NativeButton::GetClassName() const {
return kViewClassName;
}
-bool NativeButtonBase::AcceleratorPressed(const Accelerator& accelerator) {
+bool NativeButton::AcceleratorPressed(const Accelerator& accelerator) {
if (IsEnabled()) {
#if defined(OS_WIN)
DWORD pos = GetMessagePos();
@@ -203,7 +203,7 @@ bool NativeButtonBase::AcceleratorPressed(const Accelerator& accelerator) {
return false;
}
-void NativeButtonBase::OnFocus() {
+void NativeButton::OnFocus() {
// Forward the focus to the wrapper.
if (native_wrapper_)
native_wrapper_->SetFocus();
@@ -212,26 +212,26 @@ void NativeButtonBase::OnFocus() {
// keyboard messages).
}
-void NativeButtonBase::OnPaintFocusBorder(gfx::Canvas* canvas) {
+void NativeButton::OnPaintFocusBorder(gfx::Canvas* canvas) {
if (NativeViewHost::kRenderNativeControlFocus)
View::OnPaintFocusBorder(canvas);
}
////////////////////////////////////////////////////////////////////////////////
-// NativeButtonBase, protected:
+// NativeButton, protected:
-NativeButtonWrapper* NativeButtonBase::CreateWrapper() {
+NativeButtonWrapper* NativeButton::CreateWrapper() {
return NativeButtonWrapper::CreateNativeButtonWrapper(this);
}
-void NativeButtonBase::InitBorder() {
+void NativeButton::InitBorder() {
set_border(Border::CreateEmptyBorder(0, kButtonBorderHWidth, 0,
kButtonBorderHWidth));
}
////////////////////////////////////////////////////////////////////////////////
-// NativeButtonBase, private:
-void NativeButtonBase::UpdateAllStates() {
+// NativeButton, private:
+void NativeButton::UpdateAllStates() {
native_wrapper_->UpdateLabel();
native_wrapper_->UpdateFont();
native_wrapper_->UpdateEnabled();
@@ -240,51 +240,4 @@ void NativeButtonBase::UpdateAllStates() {
native_wrapper_->UpdateAccessibleName();
}
-#if defined(TOUCH_UI)
-////////////////////////////////////////////////////////////////////////////////
-// NativeButton, public:
-
-NativeButton::NativeButton(ButtonListener* listener, const std::wstring& label)
- : TextButton(listener, label), is_default_(false) {
- set_alignment(TextButton::ALIGN_CENTER);
- static_cast<TextButtonBorder*>(border())->copy_normal_set_to_hot_set();
- set_animate_on_state_change(false);
- set_focusable(true);
-}
-
-void NativeButton::SetLabel(const std::wstring& label) {
- SetText(label);
-}
-
-void NativeButton::set_font(const gfx::Font& font) {
- SetFont(font);
-}
-
-void NativeButton::SetIsDefault(bool default_button) {
- is_default_ = default_button;
-}
-
-bool NativeButton::is_default() const {
- return is_default_;
-}
-
-void NativeButton::set_ignore_minimum_size(bool) {
- // TODO(saintlou): ignoring for now
-}
-#else
-////////////////////////////////////////////////////////////////////////////////
-// NativeButton, public:
-
-NativeButton::NativeButton(ButtonListener* listener)
- : NativeButtonBase(listener) {
-}
-
-NativeButton::NativeButton(ButtonListener* listener, const std::wstring& label)
- : NativeButtonBase(listener, label) {
-}
-
-NativeButton::~NativeButton() {
-}
-#endif
-
} // namespace views
diff --git a/views/controls/button/native_button.h b/views/controls/button/native_button.h
index a2f97cc..09f2e6c 100644
--- a/views/controls/button/native_button.h
+++ b/views/controls/button/native_button.h
@@ -12,24 +12,20 @@
#include "views/controls/button/button.h"
#include "views/controls/button/native_button_wrapper.h"
-#if defined(TOUCH_UI)
-#include "views/controls/button/text_button.h"
-#endif
-
namespace gfx {
class Font;
}
namespace views {
-class NativeButtonBase : public Button {
+class NativeButton : public Button {
public:
// The button's class name.
static const char kViewClassName[];
- explicit NativeButtonBase(ButtonListener* listener);
- NativeButtonBase(ButtonListener* listener, const std::wstring& label);
- virtual ~NativeButtonBase();
+ explicit NativeButton(ButtonListener* listener);
+ NativeButton(ButtonListener* listener, const std::wstring& label);
+ virtual ~NativeButton();
// Sets/Gets the text to be used as the button's label.
virtual void SetLabel(const std::wstring& label);
@@ -103,40 +99,8 @@ class NativeButtonBase : public Button {
// is false. Set to true to create narrower buttons.
bool ignore_minimum_size_;
- DISALLOW_COPY_AND_ASSIGN(NativeButtonBase);
-};
-
-#if defined(TOUCH_UI)
-// TODO(saintlou): this maps NativeButton to TextButton in the touch case
-class NativeButton : public TextButton {
- public:
- NativeButton(ButtonListener* listener, const std::wstring& label);
- void SetLabel(const std::wstring& label);
- void set_font(const gfx::Font& font);
- void SetIsDefault(bool default_button);
- bool is_default() const;
- void set_ignore_minimum_size(bool);
-
- private:
- // True if the button is the default button in its context.
- bool is_default_;
-
- DISALLOW_COPY_AND_ASSIGN(NativeButton);
-};
-#else
-// TODO(saintlou): Windows and Clang do not like typedef, it
-// chokes in other modules that have a forward declaration for
-// NativeButton
-class NativeButton : public NativeButtonBase {
- public:
- explicit NativeButton(ButtonListener* listener);
- NativeButton(ButtonListener* listener, const std::wstring& label);
- virtual ~NativeButton();
-
- private:
DISALLOW_COPY_AND_ASSIGN(NativeButton);
};
-#endif
} // namespace views
diff --git a/views/controls/button/native_button_gtk.cc b/views/controls/button/native_button_gtk.cc
index 84a6732..079bc4c 100644
--- a/views/controls/button/native_button_gtk.cc
+++ b/views/controls/button/native_button_gtk.cc
@@ -18,7 +18,7 @@
namespace views {
-NativeButtonGtk::NativeButtonGtk(NativeButtonBase* native_button)
+NativeButtonGtk::NativeButtonGtk(NativeButton* native_button)
: native_button_(native_button),
deliver_click_event_(true) {
// Associates the actual GtkWidget with the native_button so the native_button
@@ -289,7 +289,7 @@ int NativeButtonWrapper::GetFixedWidth() {
// static
NativeButtonWrapper* NativeButtonWrapper::CreateNativeButtonWrapper(
- NativeButtonBase* native_button) {
+ NativeButton* native_button) {
return new NativeButtonGtk(native_button);
}
diff --git a/views/controls/button/native_button_gtk.h b/views/controls/button/native_button_gtk.h
index c7fa744..bf4c5bd 100644
--- a/views/controls/button/native_button_gtk.h
+++ b/views/controls/button/native_button_gtk.h
@@ -15,7 +15,7 @@ namespace views {
// A View that hosts a native GTK button.
class NativeButtonGtk : public NativeControlGtk, public NativeButtonWrapper {
public:
- explicit NativeButtonGtk(NativeButtonBase* native_button);
+ explicit NativeButtonGtk(NativeButton* native_button);
virtual ~NativeButtonGtk();
// Overridden from NativeButtonWrapper:
@@ -42,7 +42,7 @@ class NativeButtonGtk : public NativeControlGtk, public NativeButtonWrapper {
virtual void OnClicked();
// The NativeButton we are bound to.
- NativeButtonBase* native_button_;
+ NativeButton* native_button_;
// A flag to prevent OnClicked event when updating
// gtk control via API gtk_toggle_button_set_active.
diff --git a/views/controls/button/native_button_win.cc b/views/controls/button/native_button_win.cc
index f4bb2ff9..485a2f9 100644
--- a/views/controls/button/native_button_win.cc
+++ b/views/controls/button/native_button_win.cc
@@ -23,7 +23,7 @@ namespace views {
////////////////////////////////////////////////////////////////////////////////
// NativeButtonWin, public:
-NativeButtonWin::NativeButtonWin(NativeButtonBase* native_button)
+NativeButtonWin::NativeButtonWin(NativeButton* native_button)
: native_button_(native_button),
button_size_valid_(false) {
// Associates the actual HWND with the native_button so the native_button is
@@ -271,7 +271,7 @@ int NativeButtonWrapper::GetFixedWidth() {
// static
NativeButtonWrapper* NativeButtonWrapper::CreateNativeButtonWrapper(
- NativeButtonBase* native_button) {
+ NativeButton* native_button) {
return new NativeButtonWin(native_button);
}
diff --git a/views/controls/button/native_button_win.h b/views/controls/button/native_button_win.h
index 54f2d93..e68e03e 100644
--- a/views/controls/button/native_button_win.h
+++ b/views/controls/button/native_button_win.h
@@ -15,7 +15,7 @@ namespace views {
class NativeButtonWin : public NativeControlWin,
public NativeButtonWrapper {
public:
- explicit NativeButtonWin(NativeButtonBase* native_button);
+ explicit NativeButtonWin(NativeButton* native_button);
virtual ~NativeButtonWin();
// Overridden from NativeButtonWrapper:
@@ -49,7 +49,7 @@ class NativeButtonWin : public NativeControlWin,
private:
// The NativeButton we are bound to.
- NativeButtonBase* native_button_;
+ NativeButton* native_button_;
// It's expensive to find the size of a button on windows, so we cache it.
mutable gfx::Size button_size_;
diff --git a/views/controls/button/native_button_wrapper.h b/views/controls/button/native_button_wrapper.h
index 8262e5b..904f65a8 100644
--- a/views/controls/button/native_button_wrapper.h
+++ b/views/controls/button/native_button_wrapper.h
@@ -11,7 +11,7 @@
namespace views {
class NativeCheckbox;
-class NativeButtonBase;
+class NativeButton;
class NativeRadioButton;
class View;
@@ -68,7 +68,7 @@ class NativeButtonWrapper {
// Creates an appropriate NativeButtonWrapper for the platform.
static NativeButtonWrapper* CreateNativeButtonWrapper(
- NativeButtonBase* button);
+ NativeButton* button);
static NativeButtonWrapper* CreateCheckboxWrapper(
NativeCheckbox* checkbox);
static NativeButtonWrapper* CreateRadioButtonWrapper(
diff --git a/views/controls/button/text_button.cc b/views/controls/button/text_button.cc
index d688afe..f85a887 100644
--- a/views/controls/button/text_button.cc
+++ b/views/controls/button/text_button.cc
@@ -792,4 +792,8 @@ gfx::Size NativeTextButton::GetMinimumSize() {
return GetPreferredSize();
}
+std::string NativeTextButton::GetClassName() const {
+ return kViewClassName;
+}
+
} // namespace views
diff --git a/views/controls/button/text_button.h b/views/controls/button/text_button.h
index 16efcc0..588765b 100644
--- a/views/controls/button/text_button.h
+++ b/views/controls/button/text_button.h
@@ -213,7 +213,7 @@ class TextButtonBase : public CustomButton, public NativeThemeDelegate {
static const SkColor kHoverColor;
// Returns views/TextButton.
- virtual std::string GetClassName() const;
+ virtual std::string GetClassName() const OVERRIDE;
protected:
TextButtonBase(ButtonListener* listener, const std::wstring& text);
@@ -418,6 +418,8 @@ class NativeTextButton : public TextButton {
// Overridden from TextButton:
virtual gfx::Size GetMinimumSize() OVERRIDE;
+ virtual std::string GetClassName() const OVERRIDE;
+
private:
void Init();
diff --git a/views/examples/widget_example.cc b/views/examples/widget_example.cc
index daa8c66..07d21d1 100644
--- a/views/examples/widget_example.cc
+++ b/views/examples/widget_example.cc
@@ -4,7 +4,7 @@
#include "views/examples/widget_example.h"
-#include "views/controls/button/native_button.h"
+#include "views/controls/button/text_button.h"
#include "views/layout/box_layout.h"
#include "views/layout/layout_manager.h"
#include "views/view.h"
@@ -81,8 +81,8 @@ void WidgetExample::InitWidget(views::Widget* widget, bool transparent) {
views::TextButton* close_button = new views::TextButton(this, L"Close");
close_button->set_tag(CLOSE_WIDGET);
// TODO(oshima): support transparent native view.
- views::NativeButton* native_button =
- new views::NativeButton(this, L"Native Close");
+ views::NativeTextButton* native_button =
+ new views::NativeTextButton(this, L"Native Close");
native_button->set_tag(CLOSE_WIDGET);
views::View* button_container = new views::View();
diff --git a/views/view_unittest.cc b/views/view_unittest.cc
index 765e2c9..030e6cd 100644
--- a/views/view_unittest.cc
+++ b/views/view_unittest.cc
@@ -931,10 +931,10 @@ TEST_F(ViewTest, HiddenViewWithAccelerator) {
////////////////////////////////////////////////////////////////////////////////
// Mouse-wheel message rerouting
////////////////////////////////////////////////////////////////////////////////
-class ButtonTest : public NativeButtonBase {
+class ButtonTest : public NativeButton {
public:
ButtonTest(ButtonListener* listener, const std::wstring& label)
- : NativeButtonBase(listener, label) {
+ : NativeButton(listener, label) {
}
HWND GetHWND() {
@@ -1112,8 +1112,8 @@ class TestDialog : public DialogDelegate, public ButtonListener {
virtual View* GetContentsView() OVERRIDE {
if (!contents_) {
contents_ = new View();
- button1_ = new NativeButtonBase(this, L"Button1");
- button2_ = new NativeButtonBase(this, L"Button2");
+ button1_ = new NativeTextButton(this, L"Button1");
+ button2_ = new NativeTextButton(this, L"Button2");
checkbox_ = new NativeCheckbox(L"My checkbox");
button_drop_ = new ButtonDropDown(this, mock_menu_model_);
contents_->AddChildView(button1_);
@@ -1165,9 +1165,9 @@ class TestDialog : public DialogDelegate, public ButtonListener {
}
View* contents_;
- NativeButtonBase* button1_;
- NativeButtonBase* button2_;
- NativeButtonBase* checkbox_;
+ NativeTextButton* button1_;
+ NativeTextButton* button2_;
+ NativeCheckbox* checkbox_;
ButtonDropDown* button_drop_;
Button* last_pressed_button_;
MockMenuModel* mock_menu_model_;
@@ -1241,8 +1241,8 @@ class DefaultButtonTest : public ViewTest {
FocusManager* focus_manager_;
TestDialog* test_dialog_;
DialogClientView* client_view_;
- NativeButton* ok_button_;
- NativeButton* cancel_button_;
+ NativeTextButton* ok_button_;
+ NativeTextButton* cancel_button_;
};
TEST_F(DefaultButtonTest, DialogDefaultButtonTest) {
@@ -1344,7 +1344,7 @@ TEST_F(ViewTest, ChangeVisibility) {
scoped_ptr<Widget> window(CreateWidget());
window->Init(NULL, gfx::Rect(0, 0, 500, 300));
View* root_view = window->GetRootView();
- NativeButtonBase* native = new NativeButtonBase(NULL, L"Native");
+ NativeTextButton* native = new NativeTextButton(NULL, L"Native");
root_view->SetContentsView(native);
native->SetVisible(true);
diff --git a/views/window/dialog_client_view.cc b/views/window/dialog_client_view.cc
index b17f370..583443f 100644
--- a/views/window/dialog_client_view.cc
+++ b/views/window/dialog_client_view.cc
@@ -21,7 +21,7 @@
#include "ui/base/resource/resource_bundle.h"
#include "ui/gfx/canvas_skia.h"
#include "ui/gfx/font.h"
-#include "views/controls/button/native_button.h"
+#include "views/controls/button/text_button.h"
#include "views/layout/layout_constants.h"
#include "views/widget/root_view.h"
#include "views/widget/widget.h"
@@ -42,7 +42,7 @@ namespace views {
namespace {
// Updates any of the standard buttons according to the delegate.
-void UpdateButtonHelper(NativeButton* button_view,
+void UpdateButtonHelper(NativeTextButton* button_view,
DialogDelegate* delegate,
MessageBoxFlags::DialogButton button) {
std::wstring label = delegate->GetDialogButtonLabel(button);
@@ -65,14 +65,14 @@ void FillViewWithSysColor(gfx::Canvas* canvas, View* view, COLORREF color) {
// DialogButtons is used for the ok/cancel buttons of the window. DialogButton
// forwards AcceleratorPressed to the delegate.
-class DialogButton : public NativeButton {
+class DialogButton : public NativeTextButton {
public:
DialogButton(ButtonListener* listener,
Widget* owner,
MessageBoxFlags::DialogButton type,
const std::wstring& title,
bool is_default)
- : NativeButton(listener, title),
+ : NativeTextButton(listener, title),
owner_(owner),
type_(type) {
SetIsDefault(is_default);
@@ -84,7 +84,7 @@ class DialogButton : public NativeButton {
AreAcceleratorsEnabled(type_)) {
return false;
}
- return NativeButton::AcceleratorPressed(accelerator);
+ return NativeTextButton::AcceleratorPressed(accelerator);
}
private:
@@ -177,7 +177,7 @@ void DialogClientView::ShowDialogButtons() {
}
}
-void DialogClientView::SetDefaultButton(NativeButton* new_default_button) {
+void DialogClientView::SetDefaultButton(NativeTextButton* new_default_button) {
if (default_button_ && default_button_ != new_default_button) {
default_button_->SetIsDefault(false);
default_button_ = NULL;
@@ -191,10 +191,10 @@ void DialogClientView::SetDefaultButton(NativeButton* new_default_button) {
void DialogClientView::FocusWillChange(View* focused_before,
View* focused_now) {
- NativeButton* new_default_button = NULL;
+ NativeTextButton* new_default_button = NULL;
if (focused_now &&
- focused_now->GetClassName() == NativeButton::kViewClassName) {
- new_default_button = static_cast<NativeButton*>(focused_now);
+ focused_now->GetClassName() == NativeTextButton::kViewClassName) {
+ new_default_button = static_cast<NativeTextButton*>(focused_now);
} else {
// The focused view is not a button, get the default button from the
// delegate.
diff --git a/views/window/dialog_client_view.h b/views/window/dialog_client_view.h
index ad72e77..615cd50 100644
--- a/views/window/dialog_client_view.h
+++ b/views/window/dialog_client_view.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
@@ -14,7 +14,7 @@
namespace views {
class DialogDelegate;
-class NativeButton;
+class NativeTextButton;
class Widget;
namespace internal {
class RootView;
@@ -54,8 +54,8 @@ class DialogClientView : public ClientView,
void CancelWindow();
// Accessors in case the user wishes to adjust these buttons.
- NativeButton* ok_button() const { return ok_button_; }
- NativeButton* cancel_button() const { return cancel_button_; }
+ NativeTextButton* ok_button() const { return ok_button_; }
+ NativeTextButton* cancel_button() const { return cancel_button_; }
// Sets the view that is positioned along the bottom of the buttons. The
// bottom view is positioned beneath the buttons at the full width of the
@@ -107,7 +107,7 @@ class DialogClientView : public ClientView,
void LayoutContentsView();
// Makes the specified button the default button.
- void SetDefaultButton(NativeButton* button);
+ void SetDefaultButton(NativeTextButton* button);
bool has_dialog_buttons() const { return ok_button_ || cancel_button_; }
@@ -126,11 +126,11 @@ class DialogClientView : public ClientView,
static void InitClass();
// The dialog buttons.
- NativeButton* ok_button_;
- NativeButton* cancel_button_;
+ NativeTextButton* ok_button_;
+ NativeTextButton* cancel_button_;
// The button that is currently the default button if any.
- NativeButton* default_button_;
+ NativeTextButton* default_button_;
// The button-level extra view, NULL unless the dialog delegate supplies one.
View* extra_view_;
diff --git a/views/window/dialog_delegate.cc b/views/window/dialog_delegate.cc
index 13ff590..0d8f680 100644
--- a/views/window/dialog_delegate.cc
+++ b/views/window/dialog_delegate.cc
@@ -1,11 +1,11 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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 "views/window/dialog_delegate.h"
#include "base/logging.h"
-#include "views/controls/button/native_button.h"
+#include "views/controls/button/text_button.h"
#include "views/widget/widget.h"
namespace views {