| 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 new InfoBarBackground(infobars::InfoBar::delegate()->GetInfoBarType())); | 78 new InfoBarBackground(infobars::InfoBar::delegate()->GetInfoBarType())); |
| 79 SetEventTargeter(base::MakeUnique<views::ViewTargeter>(this)); | 79 SetEventTargeter(base::MakeUnique<views::ViewTargeter>(this)); |
| 80 | 80 |
| 81 AddChildView(child_container_); | 81 AddChildView(child_container_); |
| 82 | 82 |
| 83 SetPaintToLayer(true); | 83 SetPaintToLayer(true); |
| 84 layer()->SetFillsBoundsOpaquely(false); | 84 layer()->SetFillsBoundsOpaquely(false); |
| 85 | 85 |
| 86 child_container_->SetPaintToLayer(true); | 86 child_container_->SetPaintToLayer(true); |
| 87 child_container_->layer()->SetMasksToBounds(true); | 87 child_container_->layer()->SetMasksToBounds(true); |
| 88 child_container_->set_background( | 88 child_container_->set_background(views::Background::CreateSolidBackground( |
| 89 views::Background::CreateSolidBackground(infobars::InfoBar::GetTopColor( | 89 infobars::InfoBar::GetBackgroundColor( |
| 90 infobars::InfoBar::delegate()->GetInfoBarType()))); | 90 infobars::InfoBar::delegate()->GetInfoBarType()))); |
| 91 } | 91 } |
| 92 | 92 |
| 93 const infobars::InfoBarContainer::Delegate* InfoBarView::container_delegate() | 93 const infobars::InfoBarContainer::Delegate* InfoBarView::container_delegate() |
| 94 const { | 94 const { |
| 95 const infobars::InfoBarContainer* infobar_container = container(); | 95 const infobars::InfoBarContainer* infobar_container = container(); |
| 96 return infobar_container ? infobar_container->delegate() : NULL; | 96 return infobar_container ? infobar_container->delegate() : NULL; |
| 97 } | 97 } |
| 98 | 98 |
| 99 InfoBarView::~InfoBarView() { | 99 InfoBarView::~InfoBarView() { |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 } | 307 } |
| 308 | 308 |
| 309 bool InfoBarView::DoesIntersectRect(const View* target, | 309 bool InfoBarView::DoesIntersectRect(const View* target, |
| 310 const gfx::Rect& rect) const { | 310 const gfx::Rect& rect) const { |
| 311 DCHECK_EQ(this, target); | 311 DCHECK_EQ(this, target); |
| 312 // Only events that intersect the portion below the arrow are interesting. | 312 // Only events that intersect the portion below the arrow are interesting. |
| 313 gfx::Rect non_arrow_bounds = GetLocalBounds(); | 313 gfx::Rect non_arrow_bounds = GetLocalBounds(); |
| 314 non_arrow_bounds.Inset(0, arrow_height(), 0, 0); | 314 non_arrow_bounds.Inset(0, arrow_height(), 0, 0); |
| 315 return rect.Intersects(non_arrow_bounds); | 315 return rect.Intersects(non_arrow_bounds); |
| 316 } | 316 } |
| OLD | NEW |