Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(694)

Unified Diff: chrome/browser/ui/views/sync/profile_signin_confirmation_dialog_views.cc

Issue 1978403003: [MD] Eliminate as many SetStyle(STYLE_BUTTON) calls as possible. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/sync/profile_signin_confirmation_dialog_views.cc
diff --git a/chrome/browser/ui/views/sync/profile_signin_confirmation_dialog_views.cc b/chrome/browser/ui/views/sync/profile_signin_confirmation_dialog_views.cc
index 8472090738f2fa94d46a151ae315aebeb74846c5..2c32e34432967fc404e3976b73c3b9661a4393f4 100644
--- a/chrome/browser/ui/views/sync/profile_signin_confirmation_dialog_views.cc
+++ b/chrome/browser/ui/views/sync/profile_signin_confirmation_dialog_views.cc
@@ -27,6 +27,7 @@
#include "ui/gfx/range/range.h"
#include "ui/views/background.h"
#include "ui/views/border.h"
+#include "ui/views/controls/button/md_text_button.h"
#include "ui/views/controls/label.h"
#include "ui/views/controls/styled_label.h"
#include "ui/views/layout/box_layout.h"
@@ -42,9 +43,7 @@ ProfileSigninConfirmationDialogViews::ProfileSigninConfirmationDialogViews(
: browser_(browser),
username_(username),
delegate_(delegate),
- prompt_for_new_profile_(true),
- continue_signin_button_(NULL) {
-}
+ prompt_for_new_profile_(true) {}
ProfileSigninConfirmationDialogViews::~ProfileSigninConfirmationDialogViews() {}
@@ -103,14 +102,13 @@ int ProfileSigninConfirmationDialogViews::GetDefaultDialogButton() const {
}
views::View* ProfileSigninConfirmationDialogViews::CreateExtraView() {
- if (prompt_for_new_profile_) {
- const base::string16 continue_signin_text =
- l10n_util::GetStringUTF16(IDS_ENTERPRISE_SIGNIN_CONTINUE_NEW_STYLE);
- continue_signin_button_ =
- new views::LabelButton(this, continue_signin_text);
- continue_signin_button_->SetStyle(views::Button::STYLE_BUTTON);
- }
- return continue_signin_button_;
+ if (!prompt_for_new_profile_)
+ return nullptr;
+
+ const base::string16 continue_signin_text =
+ l10n_util::GetStringUTF16(IDS_ENTERPRISE_SIGNIN_CONTINUE_NEW_STYLE);
+ return views::MdTextButton::CreateSecondaryUiButton(this,
+ continue_signin_text);
}
bool ProfileSigninConfirmationDialogViews::Accept() {
@@ -182,8 +180,9 @@ void ProfileSigninConfirmationDialogViews::ViewHierarchyChanged(
IDS_ENTERPRISE_SIGNIN_EXPLANATION_WITH_PROFILE_CREATION_NEW_STYLE :
IDS_ENTERPRISE_SIGNIN_EXPLANATION_WITHOUT_PROFILE_CREATION_NEW_STYLE,
username, learn_more_text, &offsets);
- explanation_label_ = new views::StyledLabel(signin_explanation_text, this);
- explanation_label_->AddStyleRange(
+ views::StyledLabel* explanation_label =
+ new views::StyledLabel(signin_explanation_text, this);
+ explanation_label->AddStyleRange(
gfx::Range(offsets[1], offsets[1] + learn_more_text.size()),
views::StyledLabel::RangeStyleInfo::CreateForLink());
@@ -218,10 +217,9 @@ void ProfileSigninConfirmationDialogViews::ViewHierarchyChanged(
explanation_columns->AddPaddingColumn(0.0, views::kButtonHEdgeMarginNew);
dialog_layout->StartRow(0, 1);
const int kPreferredWidth = 440;
- dialog_layout->AddView(
- explanation_label_, 1, 1,
- views::GridLayout::FILL, views::GridLayout::FILL,
- kPreferredWidth, explanation_label_->GetHeightForWidth(kPreferredWidth));
+ dialog_layout->AddView(explanation_label, 1, 1, views::GridLayout::FILL,
+ views::GridLayout::FILL, kPreferredWidth,
+ explanation_label->GetHeightForWidth(kPreferredWidth));
}
void ProfileSigninConfirmationDialogViews::WindowClosing() {
@@ -245,7 +243,6 @@ void ProfileSigninConfirmationDialogViews::ButtonPressed(
views::Button* sender,
const ui::Event& event) {
DCHECK(prompt_for_new_profile_);
- DCHECK_EQ(continue_signin_button_, sender);
if (delegate_) {
delegate_->OnContinueSignin();
delegate_ = NULL;
« no previous file with comments | « chrome/browser/ui/views/sync/profile_signin_confirmation_dialog_views.h ('k') | ui/views/controls/button/md_text_button.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698