| 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 | 80 |
| 81 InfoBarView::InfoBarView(std::unique_ptr<infobars::InfoBarDelegate> delegate) | 81 InfoBarView::InfoBarView(std::unique_ptr<infobars::InfoBarDelegate> delegate) |
| 82 : infobars::InfoBar(std::move(delegate)), | 82 : infobars::InfoBar(std::move(delegate)), |
| 83 views::ExternalFocusTracker(this, nullptr), | 83 views::ExternalFocusTracker(this, nullptr), |
| 84 child_container_(new views::View()), | 84 child_container_(new views::View()), |
| 85 icon_(nullptr), | 85 icon_(nullptr), |
| 86 close_button_(nullptr) { | 86 close_button_(nullptr) { |
| 87 set_owned_by_client(); // InfoBar deletes itself at the appropriate time. | 87 set_owned_by_client(); // InfoBar deletes itself at the appropriate time. |
| 88 set_background( | 88 set_background( |
| 89 new InfoBarBackground(infobars::InfoBar::delegate()->GetInfoBarType())); | 89 new InfoBarBackground(infobars::InfoBar::delegate()->GetInfoBarType())); |
| 90 SetEventTargeter(base::WrapUnique(new views::ViewTargeter(this))); | 90 SetEventTargeter(base::MakeUnique<views::ViewTargeter>(this)); |
| 91 | 91 |
| 92 AddChildView(child_container_); | 92 AddChildView(child_container_); |
| 93 | 93 |
| 94 SetPaintToLayer(true); | 94 SetPaintToLayer(true); |
| 95 layer()->SetFillsBoundsOpaquely(false); | 95 layer()->SetFillsBoundsOpaquely(false); |
| 96 | 96 |
| 97 if (ui::MaterialDesignController::IsModeMaterial()) { | 97 if (ui::MaterialDesignController::IsModeMaterial()) { |
| 98 child_container_->SetPaintToLayer(true); | 98 child_container_->SetPaintToLayer(true); |
| 99 child_container_->layer()->SetMasksToBounds(true); | 99 child_container_->layer()->SetMasksToBounds(true); |
| 100 // Since MD doesn't use a gradient, we can set a solid bg color. | 100 // Since MD doesn't use a gradient, we can set a solid bg color. |
| (...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 427 } | 427 } |
| 428 | 428 |
| 429 bool InfoBarView::DoesIntersectRect(const View* target, | 429 bool InfoBarView::DoesIntersectRect(const View* target, |
| 430 const gfx::Rect& rect) const { | 430 const gfx::Rect& rect) const { |
| 431 DCHECK_EQ(this, target); | 431 DCHECK_EQ(this, target); |
| 432 // Only events that intersect the portion below the arrow are interesting. | 432 // Only events that intersect the portion below the arrow are interesting. |
| 433 gfx::Rect non_arrow_bounds = GetLocalBounds(); | 433 gfx::Rect non_arrow_bounds = GetLocalBounds(); |
| 434 non_arrow_bounds.Inset(0, arrow_height(), 0, 0); | 434 non_arrow_bounds.Inset(0, arrow_height(), 0, 0); |
| 435 return rect.Intersects(non_arrow_bounds); | 435 return rect.Intersects(non_arrow_bounds); |
| 436 } | 436 } |
| OLD | NEW |