| 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 | 55 |
| 56 constexpr SkColor GetInfobarTextColor() { | 56 constexpr SkColor GetInfobarTextColor() { |
| 57 return SK_ColorBLACK; | 57 return SK_ColorBLACK; |
| 58 } | 58 } |
| 59 | 59 |
| 60 } // namespace | 60 } // namespace |
| 61 | 61 |
| 62 | 62 |
| 63 // InfoBarView ---------------------------------------------------------------- | 63 // InfoBarView ---------------------------------------------------------------- |
| 64 | 64 |
| 65 // static | |
| 66 const int InfoBarView::kButtonButtonSpacing = views::kRelatedButtonHSpacing; | |
| 67 const int InfoBarView::kEndOfLabelSpacing = views::kItemLabelSpacing; | |
| 68 const SkColor InfoBarView::kTextColor = GetInfobarTextColor(); | |
| 69 | |
| 70 InfoBarView::InfoBarView(std::unique_ptr<infobars::InfoBarDelegate> delegate) | 65 InfoBarView::InfoBarView(std::unique_ptr<infobars::InfoBarDelegate> delegate) |
| 71 : infobars::InfoBar(std::move(delegate)), | 66 : infobars::InfoBar(std::move(delegate)), |
| 72 views::ExternalFocusTracker(this, nullptr), | 67 views::ExternalFocusTracker(this, nullptr), |
| 73 child_container_(new views::View()), | 68 child_container_(new views::View()), |
| 74 icon_(nullptr), | 69 icon_(nullptr), |
| 75 close_button_(nullptr) { | 70 close_button_(nullptr) { |
| 76 set_owned_by_client(); // InfoBar deletes itself at the appropriate time. | 71 set_owned_by_client(); // InfoBar deletes itself at the appropriate time. |
| 77 set_background( | 72 set_background( |
| 78 new InfoBarBackground(infobars::InfoBar::delegate()->GetInfoBarType())); | 73 new InfoBarBackground(infobars::InfoBar::delegate()->GetInfoBarType())); |
| 79 SetEventTargeter(base::MakeUnique<views::ViewTargeter>(this)); | 74 SetEventTargeter(base::MakeUnique<views::ViewTargeter>(this)); |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 } | 302 } |
| 308 | 303 |
| 309 bool InfoBarView::DoesIntersectRect(const View* target, | 304 bool InfoBarView::DoesIntersectRect(const View* target, |
| 310 const gfx::Rect& rect) const { | 305 const gfx::Rect& rect) const { |
| 311 DCHECK_EQ(this, target); | 306 DCHECK_EQ(this, target); |
| 312 // Only events that intersect the portion below the arrow are interesting. | 307 // Only events that intersect the portion below the arrow are interesting. |
| 313 gfx::Rect non_arrow_bounds = GetLocalBounds(); | 308 gfx::Rect non_arrow_bounds = GetLocalBounds(); |
| 314 non_arrow_bounds.Inset(0, arrow_height(), 0, 0); | 309 non_arrow_bounds.Inset(0, arrow_height(), 0, 0); |
| 315 return rect.Intersects(non_arrow_bounds); | 310 return rect.Intersects(non_arrow_bounds); |
| 316 } | 311 } |
| OLD | NEW |