| 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 <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 child_container_(new views::View()), | 82 child_container_(new views::View()), |
| 83 icon_(nullptr), | 83 icon_(nullptr), |
| 84 close_button_(nullptr) { | 84 close_button_(nullptr) { |
| 85 set_owned_by_client(); // InfoBar deletes itself at the appropriate time. | 85 set_owned_by_client(); // InfoBar deletes itself at the appropriate time. |
| 86 set_background( | 86 set_background( |
| 87 new InfoBarBackground(infobars::InfoBar::delegate()->GetInfoBarType())); | 87 new InfoBarBackground(infobars::InfoBar::delegate()->GetInfoBarType())); |
| 88 SetEventTargeter(make_scoped_ptr(new views::ViewTargeter(this))); | 88 SetEventTargeter(make_scoped_ptr(new views::ViewTargeter(this))); |
| 89 | 89 |
| 90 AddChildView(child_container_); | 90 AddChildView(child_container_); |
| 91 | 91 |
| 92 SetPaintToLayer(true); |
| 93 layer()->SetFillsBoundsOpaquely(false); |
| 94 |
| 92 if (ui::MaterialDesignController::IsModeMaterial()) { | 95 if (ui::MaterialDesignController::IsModeMaterial()) { |
| 93 SetPaintToLayer(true); | |
| 94 layer()->SetFillsBoundsOpaquely(false); | |
| 95 | |
| 96 child_container_->SetPaintToLayer(true); | 96 child_container_->SetPaintToLayer(true); |
| 97 child_container_->layer()->SetMasksToBounds(true); | 97 child_container_->layer()->SetMasksToBounds(true); |
| 98 // Since MD doesn't use a gradient, we can set a solid bg color. | 98 // Since MD doesn't use a gradient, we can set a solid bg color. |
| 99 child_container_->set_background( | 99 child_container_->set_background( |
| 100 views::Background::CreateSolidBackground(infobars::InfoBar::GetTopColor( | 100 views::Background::CreateSolidBackground(infobars::InfoBar::GetTopColor( |
| 101 infobars::InfoBar::delegate()->GetInfoBarType()))); | 101 infobars::InfoBar::delegate()->GetInfoBarType()))); |
| 102 } | 102 } |
| 103 } | 103 } |
| 104 | 104 |
| 105 InfoBarView::~InfoBarView() { | 105 InfoBarView::~InfoBarView() { |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 431 } | 431 } |
| 432 | 432 |
| 433 bool InfoBarView::DoesIntersectRect(const View* target, | 433 bool InfoBarView::DoesIntersectRect(const View* target, |
| 434 const gfx::Rect& rect) const { | 434 const gfx::Rect& rect) const { |
| 435 DCHECK_EQ(this, target); | 435 DCHECK_EQ(this, target); |
| 436 // Only events that intersect the portion below the arrow are interesting. | 436 // Only events that intersect the portion below the arrow are interesting. |
| 437 gfx::Rect non_arrow_bounds = GetLocalBounds(); | 437 gfx::Rect non_arrow_bounds = GetLocalBounds(); |
| 438 non_arrow_bounds.Inset(0, arrow_height(), 0, 0); | 438 non_arrow_bounds.Inset(0, arrow_height(), 0, 0); |
| 439 return rect.Intersects(non_arrow_bounds); | 439 return rect.Intersects(non_arrow_bounds); |
| 440 } | 440 } |
| OLD | NEW |