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

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

Issue 1777813002: MD - use new style of text button in infobars. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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
« no previous file with comments | « no previous file | chrome/browser/ui/views/infobars/infobar_view.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "chrome/browser/infobars/infobar_service.h" 10 #include "chrome/browser/infobars/infobar_service.h"
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 64
65 void ConfirmInfoBar::ViewHierarchyChanged( 65 void ConfirmInfoBar::ViewHierarchyChanged(
66 const ViewHierarchyChangedDetails& details) { 66 const ViewHierarchyChangedDetails& details) {
67 if (details.is_add && details.child == this && (label_ == NULL)) { 67 if (details.is_add && details.child == this && (label_ == NULL)) {
68 ConfirmInfoBarDelegate* delegate = GetDelegate(); 68 ConfirmInfoBarDelegate* delegate = GetDelegate();
69 label_ = CreateLabel(delegate->GetMessageText()); 69 label_ = CreateLabel(delegate->GetMessageText());
70 AddViewToContentArea(label_); 70 AddViewToContentArea(label_);
71 71
72 if (delegate->GetButtons() & ConfirmInfoBarDelegate::BUTTON_OK) { 72 if (delegate->GetButtons() & ConfirmInfoBarDelegate::BUTTON_OK) {
73 if (delegate->OKButtonTriggersUACPrompt()) { 73 if (delegate->OKButtonTriggersUACPrompt()) {
74 // Use a label button even in MD mode as MD buttons don't support icons. 74 // Use a label button even in MD mode as MD buttons don't support icons.
Peter Kasting 2016/03/09 07:18:10 Has this been fixed? We do still want the button
Evan Stade 2016/03/10 02:41:42 Right, good call, comment removed and code cleaned
75 views::LabelButton* ok_button = CreateLabelButton( 75 views::LabelButton* ok_button = CreateTextButton(
76 this, delegate->GetButtonLabel(ConfirmInfoBarDelegate::BUTTON_OK)); 76 this, delegate->GetButtonLabel(ConfirmInfoBarDelegate::BUTTON_OK));
77 elevation_icon_setter_.reset(new ElevationIconSetter( 77 elevation_icon_setter_.reset(new ElevationIconSetter(
78 ok_button, 78 ok_button,
79 base::Bind(&ConfirmInfoBar::Layout, base::Unretained(this)))); 79 base::Bind(&ConfirmInfoBar::Layout, base::Unretained(this))));
80 ok_button_ = ok_button; 80 ok_button_ = ok_button;
81 } else { 81 } else {
82 ok_button_ = CreateTextButton( 82 ok_button_ = CreateTextButton(
83 this, delegate->GetButtonLabel(ConfirmInfoBarDelegate::BUTTON_OK)); 83 this, delegate->GetButtonLabel(ConfirmInfoBarDelegate::BUTTON_OK));
84 } 84 }
85 AddViewToContentArea(ok_button_); 85 AddViewToContentArea(ok_button_);
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 } 138 }
139 139
140 int ConfirmInfoBar::NonLabelWidth() const { 140 int ConfirmInfoBar::NonLabelWidth() const {
141 int width = (label_->text().empty() || (!ok_button_ && !cancel_button_)) ? 141 int width = (label_->text().empty() || (!ok_button_ && !cancel_button_)) ?
142 0 : kEndOfLabelSpacing; 142 0 : kEndOfLabelSpacing;
143 if (ok_button_) 143 if (ok_button_)
144 width += ok_button_->width() + (cancel_button_ ? kButtonButtonSpacing : 0); 144 width += ok_button_->width() + (cancel_button_ ? kButtonButtonSpacing : 0);
145 width += cancel_button_ ? cancel_button_->width() : 0; 145 width += cancel_button_ ? cancel_button_->width() : 0;
146 return width + ((link_->text().empty() || !width) ? 0 : kEndOfLabelSpacing); 146 return width + ((link_->text().empty() || !width) ? 0 : kEndOfLabelSpacing);
147 } 147 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/views/infobars/infobar_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698