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

Side by Side Diff: chrome/browser/ui/views/infobars/confirm_infobar.cc

Issue 2313253003: Rename views::MdTextButton::CreateMdButton to just Create (Closed)
Patch Set: more renames Created 4 years, 3 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/views/infobars/confirm_infobar.h" 5 #include "chrome/browser/ui/views/infobars/confirm_infobar.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 66
67 void ConfirmInfoBar::ViewHierarchyChanged( 67 void ConfirmInfoBar::ViewHierarchyChanged(
68 const ViewHierarchyChangedDetails& details) { 68 const ViewHierarchyChangedDetails& details) {
69 if (details.is_add && details.child == this && (label_ == nullptr)) { 69 if (details.is_add && details.child == this && (label_ == nullptr)) {
70 ConfirmInfoBarDelegate* delegate = GetDelegate(); 70 ConfirmInfoBarDelegate* delegate = GetDelegate();
71 label_ = CreateLabel(delegate->GetMessageText()); 71 label_ = CreateLabel(delegate->GetMessageText());
72 AddViewToContentArea(label_); 72 AddViewToContentArea(label_);
73 73
74 if (delegate->GetButtons() & ConfirmInfoBarDelegate::BUTTON_OK) { 74 if (delegate->GetButtons() & ConfirmInfoBarDelegate::BUTTON_OK) {
75 if (ui::MaterialDesignController::IsModeMaterial()) { 75 if (ui::MaterialDesignController::IsModeMaterial()) {
76 views::MdTextButton* button = views::MdTextButton::CreateMdButton( 76 views::MdTextButton* button = views::MdTextButton::Create(
77 this, delegate->GetButtonLabel(ConfirmInfoBarDelegate::BUTTON_OK)); 77 this, delegate->GetButtonLabel(ConfirmInfoBarDelegate::BUTTON_OK));
78 button->SetCallToAction(true); 78 button->SetCallToAction(true);
79 ok_button_ = button; 79 ok_button_ = button;
80 } else { 80 } else {
81 ok_button_ = CreateTextButton( 81 ok_button_ = CreateTextButton(
82 this, delegate->GetButtonLabel(ConfirmInfoBarDelegate::BUTTON_OK)); 82 this, delegate->GetButtonLabel(ConfirmInfoBarDelegate::BUTTON_OK));
83 } 83 }
84 if (delegate->OKButtonTriggersUACPrompt()) { 84 if (delegate->OKButtonTriggersUACPrompt()) {
85 elevation_icon_setter_.reset(new ElevationIconSetter( 85 elevation_icon_setter_.reset(new ElevationIconSetter(
86 ok_button_, 86 ok_button_,
87 base::Bind(&ConfirmInfoBar::Layout, base::Unretained(this)))); 87 base::Bind(&ConfirmInfoBar::Layout, base::Unretained(this))));
88 } 88 }
89 AddViewToContentArea(ok_button_); 89 AddViewToContentArea(ok_button_);
90 ok_button_->SizeToPreferredSize(); 90 ok_button_->SizeToPreferredSize();
91 } 91 }
92 92
93 if (delegate->GetButtons() & ConfirmInfoBarDelegate::BUTTON_CANCEL) { 93 if (delegate->GetButtons() & ConfirmInfoBarDelegate::BUTTON_CANCEL) {
94 if (ui::MaterialDesignController::IsModeMaterial()) { 94 if (ui::MaterialDesignController::IsModeMaterial()) {
95 views::MdTextButton* button = views::MdTextButton::CreateMdButton( 95 views::MdTextButton* button = views::MdTextButton::Create(
96 this, 96 this,
97 delegate->GetButtonLabel(ConfirmInfoBarDelegate::BUTTON_CANCEL)); 97 delegate->GetButtonLabel(ConfirmInfoBarDelegate::BUTTON_CANCEL));
98 if (delegate->GetButtons() == ConfirmInfoBarDelegate::BUTTON_CANCEL) { 98 if (delegate->GetButtons() == ConfirmInfoBarDelegate::BUTTON_CANCEL) {
99 // Apply CTA only if the cancel button is the only button. 99 // Apply CTA only if the cancel button is the only button.
100 button->SetCallToAction(true); 100 button->SetCallToAction(true);
101 } else { 101 } else {
102 // Otherwise set the bg color to white and the text color to black. 102 // Otherwise set the bg color to white and the text color to black.
103 // TODO(estade): These should be removed and moved into the native 103 // TODO(estade): These should be removed and moved into the native
104 // theme. Also, infobars should always use the normal (non-incognito) 104 // theme. Also, infobars should always use the normal (non-incognito)
105 // native theme. 105 // native theme.
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 } 160 }
161 161
162 int ConfirmInfoBar::NonLabelWidth() const { 162 int ConfirmInfoBar::NonLabelWidth() const {
163 int width = (label_->text().empty() || (!ok_button_ && !cancel_button_)) ? 163 int width = (label_->text().empty() || (!ok_button_ && !cancel_button_)) ?
164 0 : kEndOfLabelSpacing; 164 0 : kEndOfLabelSpacing;
165 if (ok_button_) 165 if (ok_button_)
166 width += ok_button_->width() + (cancel_button_ ? kButtonButtonSpacing : 0); 166 width += ok_button_->width() + (cancel_button_ ? kButtonButtonSpacing : 0);
167 width += cancel_button_ ? cancel_button_->width() : 0; 167 width += cancel_button_ ? cancel_button_->width() : 0;
168 return width + ((link_->text().empty() || !width) ? 0 : kEndOfLabelSpacing); 168 return width + ((link_->text().empty() || !width) ? 0 : kEndOfLabelSpacing);
169 } 169 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/download/download_shelf_view.cc ('k') | content/shell/browser/shell_views.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698