| OLD | NEW |
| 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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 this, | 89 this, |
| 90 delegate->GetButtonLabel(ConfirmInfoBarDelegate::BUTTON_CANCEL)); | 90 delegate->GetButtonLabel(ConfirmInfoBarDelegate::BUTTON_CANCEL)); |
| 91 if (delegate->GetButtons() == ConfirmInfoBarDelegate::BUTTON_CANCEL) { | 91 if (delegate->GetButtons() == ConfirmInfoBarDelegate::BUTTON_CANCEL) { |
| 92 // Apply prominent styling only if the cancel button is the only button. | 92 // Apply prominent styling only if the cancel button is the only button. |
| 93 cancel_button_->SetProminent(true); | 93 cancel_button_->SetProminent(true); |
| 94 } else { | 94 } else { |
| 95 // Otherwise set the bg color to white and the text color to black. | 95 // Otherwise set the bg color to white and the text color to black. |
| 96 // TODO(estade): These should be removed and moved into the native | 96 // TODO(estade): These should be removed and moved into the native |
| 97 // theme. Also, infobars should always use the normal (non-incognito) | 97 // theme. Also, infobars should always use the normal (non-incognito) |
| 98 // native theme. | 98 // native theme. |
| 99 cancel_button_->set_bg_color_override(SK_ColorWHITE); | 99 cancel_button_->SetBgColorOverride(SK_ColorWHITE); |
| 100 cancel_button_->SetEnabledTextColors(kTextColor); | 100 cancel_button_->SetEnabledTextColors(kTextColor); |
| 101 } | 101 } |
| 102 AddViewToContentArea(cancel_button_); | 102 AddViewToContentArea(cancel_button_); |
| 103 cancel_button_->SizeToPreferredSize(); | 103 cancel_button_->SizeToPreferredSize(); |
| 104 } | 104 } |
| 105 | 105 |
| 106 base::string16 link_text(delegate->GetLinkText()); | 106 base::string16 link_text(delegate->GetLinkText()); |
| 107 link_ = CreateLink(link_text, this); | 107 link_ = CreateLink(link_text, this); |
| 108 AddViewToContentArea(link_); | 108 AddViewToContentArea(link_); |
| 109 } | 109 } |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 } | 147 } |
| 148 | 148 |
| 149 int ConfirmInfoBar::NonLabelWidth() const { | 149 int ConfirmInfoBar::NonLabelWidth() const { |
| 150 int width = (label_->text().empty() || (!ok_button_ && !cancel_button_)) ? | 150 int width = (label_->text().empty() || (!ok_button_ && !cancel_button_)) ? |
| 151 0 : kEndOfLabelSpacing; | 151 0 : kEndOfLabelSpacing; |
| 152 if (ok_button_) | 152 if (ok_button_) |
| 153 width += ok_button_->width() + (cancel_button_ ? kButtonButtonSpacing : 0); | 153 width += ok_button_->width() + (cancel_button_ ? kButtonButtonSpacing : 0); |
| 154 width += cancel_button_ ? cancel_button_->width() : 0; | 154 width += cancel_button_ ? cancel_button_->width() : 0; |
| 155 return width + ((link_->text().empty() || !width) ? 0 : kEndOfLabelSpacing); | 155 return width + ((link_->text().empty() || !width) ? 0 : kEndOfLabelSpacing); |
| 156 } | 156 } |
| OLD | NEW |