| 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/infobar_view.h" | 5 #include "chrome/browser/ui/views/infobars/infobar_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 button->SetTextColor(views::Button::STATE_HOVERED, GetInfobarTextColor()); | 165 button->SetTextColor(views::Button::STATE_HOVERED, GetInfobarTextColor()); |
| 166 return button; | 166 return button; |
| 167 } | 167 } |
| 168 | 168 |
| 169 views::MdTextButton* InfoBarView::CreateMdTextButton( | 169 views::MdTextButton* InfoBarView::CreateMdTextButton( |
| 170 views::ButtonListener* listener, | 170 views::ButtonListener* listener, |
| 171 const base::string16& text) { | 171 const base::string16& text) { |
| 172 DCHECK(ui::MaterialDesignController::IsModeMaterial()); | 172 DCHECK(ui::MaterialDesignController::IsModeMaterial()); |
| 173 views::MdTextButton* button = | 173 views::MdTextButton* button = |
| 174 views::MdTextButton::CreateMdButton(listener, text); | 174 views::MdTextButton::CreateMdButton(listener, text); |
| 175 button->SetTextColor(views::Button::STATE_NORMAL, GetInfobarTextColor()); | 175 // TODO(estade): can we just remove this? |
| 176 button->SetTextColor(views::Button::STATE_HOVERED, GetInfobarTextColor()); | 176 button->SetEnabledTextColors(GetInfobarTextColor()); |
| 177 return button; | 177 return button; |
| 178 } | 178 } |
| 179 | 179 |
| 180 // static | 180 // static |
| 181 void InfoBarView::AssignWidths(Labels* labels, int available_width) { | 181 void InfoBarView::AssignWidths(Labels* labels, int available_width) { |
| 182 std::sort(labels->begin(), labels->end(), SortLabelsByDecreasingWidth); | 182 std::sort(labels->begin(), labels->end(), SortLabelsByDecreasingWidth); |
| 183 AssignWidthsSorted(labels, available_width); | 183 AssignWidthsSorted(labels, available_width); |
| 184 } | 184 } |
| 185 | 185 |
| 186 void InfoBarView::Layout() { | 186 void InfoBarView::Layout() { |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 436 } | 436 } |
| 437 | 437 |
| 438 bool InfoBarView::DoesIntersectRect(const View* target, | 438 bool InfoBarView::DoesIntersectRect(const View* target, |
| 439 const gfx::Rect& rect) const { | 439 const gfx::Rect& rect) const { |
| 440 DCHECK_EQ(this, target); | 440 DCHECK_EQ(this, target); |
| 441 // Only events that intersect the portion below the arrow are interesting. | 441 // Only events that intersect the portion below the arrow are interesting. |
| 442 gfx::Rect non_arrow_bounds = GetLocalBounds(); | 442 gfx::Rect non_arrow_bounds = GetLocalBounds(); |
| 443 non_arrow_bounds.Inset(0, arrow_height(), 0, 0); | 443 non_arrow_bounds.Inset(0, arrow_height(), 0, 0); |
| 444 return rect.Intersects(non_arrow_bounds); | 444 return rect.Intersects(non_arrow_bounds); |
| 445 } | 445 } |
| OLD | NEW |