diff options
author | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-11 11:47:37 +0000 |
---|---|---|
committer | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-11 11:47:37 +0000 |
commit | 4d77e1721b7d18fdec359eb064dec0e713ca09b3 (patch) | |
tree | 090f517533a7478fd8fa888ac3c41e8804005516 /chrome | |
parent | f189f3c6ce352198c6e2f33659bd81fd9d9f5f3e (diff) | |
download | chromium_src-4d77e1721b7d18fdec359eb064dec0e713ca09b3.zip chromium_src-4d77e1721b7d18fdec359eb064dec0e713ca09b3.tar.gz chromium_src-4d77e1721b7d18fdec359eb064dec0e713ca09b3.tar.bz2 |
views: Use InfoBarTextButton in the Autofill credit card infobar.
Use it instead of views::TextButton to avoid flickering and duplicating code.
BUG=39102
TEST=go to http://infernohacks.com/t/autofill/cc.html, fill the fields, hit send, see the infobar,
everything should work as before.
Review URL: http://codereview.chromium.org/3060051
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@55707 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/autofill/autofill_cc_infobar_win.cc | 36 |
1 files changed, 8 insertions, 28 deletions
diff --git a/chrome/browser/autofill/autofill_cc_infobar_win.cc b/chrome/browser/autofill/autofill_cc_infobar_win.cc index 1a6f8ad..31a7c6a 100644 --- a/chrome/browser/autofill/autofill_cc_infobar_win.cc +++ b/chrome/browser/autofill/autofill_cc_infobar_win.cc @@ -6,8 +6,8 @@ #include "app/resource_bundle.h" #include "chrome/browser/views/event_utils.h" -#include "chrome/browser/views/infobars/infobar_button_border.h" #include "chrome/browser/views/infobars/infobars.h" +#include "chrome/browser/views/infobars/infobar_text_button.h" #include "chrome/common/pref_names.h" #include "grit/chromium_strings.h" #include "grit/generated_resources.h" @@ -42,15 +42,14 @@ class SaveCCInfoConfirmInfoBar : public AlertInfoBar, private: void Init(); - views::TextButton* CreateTextButton(const std::wstring& text); ConfirmInfoBarDelegate* GetDelegate(); // The buttons are owned by InfoBar view from the moment they are added to its // hierarchy (Init() called), but we still need pointers to them to process // messages from them. - views::TextButton* save_button_; - views::TextButton* dont_save_button_; + InfoBarTextButton* save_button_; + InfoBarTextButton* dont_save_button_; views::Link* link_; bool initialized_; @@ -61,10 +60,11 @@ SaveCCInfoConfirmInfoBar::SaveCCInfoConfirmInfoBar( ConfirmInfoBarDelegate* delegate) : AlertInfoBar(delegate), initialized_(false) { - save_button_ = CreateTextButton(delegate->GetButtonLabel( - ConfirmInfoBarDelegate::BUTTON_OK)); - dont_save_button_ = CreateTextButton(delegate->GetButtonLabel( - ConfirmInfoBarDelegate::BUTTON_CANCEL)); + save_button_ = InfoBarTextButton::Create(this, + delegate->GetButtonLabel(ConfirmInfoBarDelegate::BUTTON_OK)); + dont_save_button_ = InfoBarTextButton::Create(this, + delegate->GetButtonLabel(ConfirmInfoBarDelegate::BUTTON_CANCEL)); + // Set up the link. link_ = new views::Link; link_->SetText(delegate->GetLinkText()); @@ -162,26 +162,6 @@ void SaveCCInfoConfirmInfoBar::Init() { AddChildView(link_); } -views::TextButton* SaveCCInfoConfirmInfoBar::CreateTextButton( - const std::wstring& text) { - views::TextButton* text_button = new views::TextButton(this, std::wstring()); - text_button->set_border(new InfoBarButtonBorder); - - // Set font colors for different states. - text_button->SetEnabledColor(SK_ColorBLACK); - text_button->SetHighlightColor(SK_ColorBLACK); - text_button->SetHoverColor(SK_ColorBLACK); - text_button->SetNormalHasBorder(true); - - // Set font then text, then size button to fit text. - text_button->SetFont(ResourceBundle::GetSharedInstance().GetFont( - ResourceBundle::MediumFont)); - text_button->SetText(text); - text_button->ClearMaxTextSize(); - text_button->SizeToPreferredSize(); - return text_button; -} - ConfirmInfoBarDelegate* SaveCCInfoConfirmInfoBar::GetDelegate() { return delegate()->AsConfirmInfoBarDelegate(); } |