Commit 1d0fe4ed authored by tfarina@chromium.org's avatar tfarina@chromium.org

views: Convert one_click_signin_bubble_view* to LabelButton.

BUG=155363
R=msw@chromium.org
TBR=ben@chromium.org

Review URL: https://chromiumcodereview.appspot.com/13991002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@193402 0039d316-1c4b-4281-b951-d872f2087c98
parent 1307bae3
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
#include "ui/base/l10n/l10n_util.h" #include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h" #include "ui/base/resource/resource_bundle.h"
#include "ui/views/controls/button/image_button.h" #include "ui/views/controls/button/image_button.h"
#include "ui/views/controls/button/text_button.h" #include "ui/views/controls/button/label_button.h"
#include "ui/views/controls/image_view.h" #include "ui/views/controls/image_view.h"
#include "ui/views/controls/label.h" #include "ui/views/controls/label.h"
#include "ui/views/controls/link.h" #include "ui/views/controls/link.h"
...@@ -55,8 +55,8 @@ class OneClickSigninDialogView : public OneClickSigninBubbleView { ...@@ -55,8 +55,8 @@ class OneClickSigninDialogView : public OneClickSigninBubbleView {
// Overridden from OneClickSigninBubbleView: // Overridden from OneClickSigninBubbleView:
virtual void InitContent(views::GridLayout* layout) OVERRIDE; virtual void InitContent(views::GridLayout* layout) OVERRIDE;
virtual void GetButtons(views::TextButton** ok_button, virtual void GetButtons(views::LabelButton** ok_button,
views::TextButton** undo_button) OVERRIDE; views::LabelButton** undo_button) OVERRIDE;
virtual views::Link* GetAdvancedLink() OVERRIDE; virtual views::Link* GetAdvancedLink() OVERRIDE;
// Overridden from views::LinkListener: // Overridden from views::LinkListener:
...@@ -143,16 +143,19 @@ void OneClickSigninDialogView::InitContent(views::GridLayout* layout) { ...@@ -143,16 +143,19 @@ void OneClickSigninDialogView::InitContent(views::GridLayout* layout) {
layout->AddPaddingRow(0, views::kUnrelatedControlVerticalSpacing); layout->AddPaddingRow(0, views::kUnrelatedControlVerticalSpacing);
} }
void OneClickSigninDialogView::GetButtons(views::TextButton** ok_button, void OneClickSigninDialogView::GetButtons(views::LabelButton** ok_button,
views::TextButton** undo_button) { views::LabelButton** undo_button) {
*ok_button = new views::NativeTextButton(this); *ok_button = new views::LabelButton(this, string16());
*undo_button = new views::NativeTextButton(this); (*ok_button)->SetStyle(views::Button::STYLE_NATIVE_TEXTBUTTON);
*undo_button = new views::LabelButton(this, string16());
(*undo_button)->SetStyle(views::Button::STYLE_NATIVE_TEXTBUTTON);
// The default size of the buttons is too large. To allow them to be smaller // The default size of the buttons is too large. To allow them to be smaller
// ignore the minimum default size. Furthermore, to make sure they are the // ignore the minimum default size. Furthermore, to make sure they are the
// same size, SetText() is called with both strings on both buttons. // same size, SetText() is called with both strings on both buttons.
(*ok_button)->set_ignore_minimum_size(true); (*ok_button)->set_min_size(gfx::Size());
(*undo_button)->set_ignore_minimum_size(true); (*undo_button)->set_min_size(gfx::Size());
string16 ok_label = string16 ok_label =
l10n_util::GetStringUTF16(IDS_ONE_CLICK_SIGNIN_DIALOG_OK_BUTTON); l10n_util::GetStringUTF16(IDS_ONE_CLICK_SIGNIN_DIALOG_OK_BUTTON);
string16 undo_label = string16 undo_label =
...@@ -289,16 +292,19 @@ void OneClickSigninBubbleView::InitContent(views::GridLayout* layout) { ...@@ -289,16 +292,19 @@ void OneClickSigninBubbleView::InitContent(views::GridLayout* layout) {
layout->AddPaddingRow(0, views::kRelatedControlSmallVerticalSpacing); layout->AddPaddingRow(0, views::kRelatedControlSmallVerticalSpacing);
} }
void OneClickSigninBubbleView::GetButtons(views::TextButton** ok_button, void OneClickSigninBubbleView::GetButtons(views::LabelButton** ok_button,
views::TextButton** undo_button) { views::LabelButton** undo_button) {
*ok_button = new views::NativeTextButton(this); *ok_button = new views::LabelButton(this, string16());
*undo_button = new views::NativeTextButton(this); (*ok_button)->SetStyle(views::Button::STYLE_NATIVE_TEXTBUTTON);
*undo_button = new views::LabelButton(this, string16());
(*undo_button)->SetStyle(views::Button::STYLE_NATIVE_TEXTBUTTON);
// The default size of the buttons is too large. To allow them to be smaller // The default size of the buttons is too large. To allow them to be smaller
// ignore the minimum default size. Furthermore, to make sure they are the // ignore the minimum default size. Furthermore, to make sure they are the
// same size, SetText() is called with both strings on both buttons. // same size, SetText() is called with both strings on both buttons.
(*ok_button)->set_ignore_minimum_size(true); (*ok_button)->set_min_size(gfx::Size());
(*undo_button)->set_ignore_minimum_size(true); (*undo_button)->set_min_size(gfx::Size());
string16 ok_label = l10n_util::GetStringUTF16(IDS_OK); string16 ok_label = l10n_util::GetStringUTF16(IDS_OK);
string16 undo_label = l10n_util::GetStringUTF16(IDS_ONE_CLICK_BUBBLE_UNDO); string16 undo_label = l10n_util::GetStringUTF16(IDS_ONE_CLICK_BUBBLE_UNDO);
(*ok_button)->SetText(undo_label); (*ok_button)->SetText(undo_label);
......
...@@ -22,7 +22,7 @@ class MessageLoop; ...@@ -22,7 +22,7 @@ class MessageLoop;
namespace views { namespace views {
class GridLayout; class GridLayout;
class TextButton; class LabelButton;
} }
// OneClickSigninBubbleView is a view intended to be used as the content of an // OneClickSigninBubbleView is a view intended to be used as the content of an
...@@ -80,8 +80,8 @@ class OneClickSigninBubbleView : public views::BubbleDelegateView, ...@@ -80,8 +80,8 @@ class OneClickSigninBubbleView : public views::BubbleDelegateView,
// Creates OK and Undo buttons to be used at the bottom of the bubble. // Creates OK and Undo buttons to be used at the bottom of the bubble.
// Derived classes can reimplement to have buttons with different labels, // Derived classes can reimplement to have buttons with different labels,
// colours, or sizes. The caller of this function owns the returned buttons. // colours, or sizes. The caller of this function owns the returned buttons.
virtual void GetButtons(views::TextButton** ok_button, virtual void GetButtons(views::LabelButton** ok_button,
views::TextButton** undo_button); views::LabelButton** undo_button);
// Creates advanced link to be used at the bottom of the bubble. // Creates advanced link to be used at the bottom of the bubble.
// Derived classes can reimplement. The caller of this function owns the // Derived classes can reimplement. The caller of this function owns the
...@@ -101,8 +101,8 @@ class OneClickSigninBubbleView : public views::BubbleDelegateView, ...@@ -101,8 +101,8 @@ class OneClickSigninBubbleView : public views::BubbleDelegateView,
views::Link* advanced_link_; views::Link* advanced_link_;
// Controls at bottom of bubble. // Controls at bottom of bubble.
views::TextButton* ok_button_; views::LabelButton* ok_button_;
views::TextButton* undo_button_; views::LabelButton* undo_button_;
// This callback is nulled once its called, so that it is called only once. // This callback is nulled once its called, so that it is called only once.
// It will be called when the bubble is closed if it has not been called // It will be called when the bubble is closed if it has not been called
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
#include "chrome/test/base/in_process_browser_test.h" #include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/ui_test_utils.h" #include "chrome/test/base/ui_test_utils.h"
#include "content/public/common/page_transition_types.h" #include "content/public/common/page_transition_types.h"
#include "ui/views/controls/button/text_button.h" #include "ui/views/controls/button/label_button.h"
class OneClickSigninBubbleViewBrowserTest : public InProcessBrowserTest { class OneClickSigninBubbleViewBrowserTest : public InProcessBrowserTest {
public: public:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment