Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_container_view.h" | 5 #include "chrome/browser/ui/views/infobars/infobar_container_view.h" |
| 6 | 6 |
| 7 #include "chrome/browser/ui/view_ids.h" | 7 #include "chrome/browser/ui/view_ids.h" |
| 8 #include "chrome/browser/ui/views/infobars/infobar_view.h" | 8 #include "chrome/browser/ui/views/infobars/infobar_view.h" |
| 9 #include "chrome/grit/generated_resources.h" | 9 #include "chrome/grit/generated_resources.h" |
| 10 #include "ui/accessibility/ax_view_state.h" | 10 #include "ui/accessibility/ax_view_state.h" |
| 11 #include "ui/base/l10n/l10n_util.h" | 11 #include "ui/base/l10n/l10n_util.h" |
| 12 #include "ui/views/view_targeter.h" | 12 #include "ui/views/view_targeter.h" |
| 13 | 13 |
| 14 // static | 14 // static |
| 15 const char InfoBarContainerView::kViewClassName[] = "InfoBarContainerView"; | 15 const char InfoBarContainerView::kViewClassName[] = "InfoBarContainerView"; |
| 16 | 16 |
| 17 InfoBarContainerView::InfoBarContainerView(Delegate* delegate) | 17 InfoBarContainerView::InfoBarContainerView(Delegate* delegate) |
| 18 : infobars::InfoBarContainer(delegate) { | 18 : infobars::InfoBarContainer(delegate) { |
| 19 set_id(VIEW_ID_INFO_BAR_CONTAINER); | 19 set_id(VIEW_ID_INFO_BAR_CONTAINER); |
| 20 SetEventTargeter(make_scoped_ptr(new views::ViewTargeter(this))); | 20 SetEventTargeter(make_scoped_ptr(new views::ViewTargeter(this))); |
| 21 SetPaintToLayer(true); | |
| 22 layer()->SetFillsBoundsOpaquely(false); | |
| 23 } | 21 } |
| 24 | 22 |
| 25 InfoBarContainerView::~InfoBarContainerView() { | 23 InfoBarContainerView::~InfoBarContainerView() { |
| 26 RemoveAllInfoBarsForDestruction(); | 24 RemoveAllInfoBarsForDestruction(); |
| 27 } | 25 } |
| 28 | 26 |
| 29 gfx::Size InfoBarContainerView::GetPreferredSize() const { | 27 gfx::Size InfoBarContainerView::GetPreferredSize() const { |
| 30 int total_height; | 28 int total_height; |
| 31 GetVerticalOverlap(&total_height); | 29 GetVerticalOverlap(&total_height); |
| 32 gfx::Size size(0, total_height); | 30 gfx::Size size(0, total_height); |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 61 size_t position) { | 59 size_t position) { |
| 62 AddChildViewAt(static_cast<InfoBarView*>(infobar), | 60 AddChildViewAt(static_cast<InfoBarView*>(infobar), |
| 63 static_cast<int>(position)); | 61 static_cast<int>(position)); |
| 64 } | 62 } |
| 65 | 63 |
| 66 void InfoBarContainerView::PlatformSpecificRemoveInfoBar( | 64 void InfoBarContainerView::PlatformSpecificRemoveInfoBar( |
| 67 infobars::InfoBar* infobar) { | 65 infobars::InfoBar* infobar) { |
| 68 RemoveChildView(static_cast<InfoBarView*>(infobar)); | 66 RemoveChildView(static_cast<InfoBarView*>(infobar)); |
| 69 } | 67 } |
| 70 | 68 |
| 71 bool InfoBarContainerView::DoesIntersectRect(const View* target, | 69 bool InfoBarContainerView::DoesIntersectRect(const View* target, |
|
Evan Stade
2016/03/08 00:54:04
it seems it's necessary to keep this as well as ad
| |
| 72 const gfx::Rect& rect) const { | 70 const gfx::Rect& rect) const { |
| 73 DCHECK_EQ(this, target); | 71 DCHECK_EQ(this, target); |
| 74 // Don't handle events on the vertical overlap portion of the view (the | 72 // Don't handle events on the vertical overlap portion of the view (the |
| 75 // vertical space occupied by the arrow). | 73 // vertical space occupied by the arrow). |
|
Peter Kasting
2016/03/08 01:08:17
Add to this comment to describe why we want to rej
Evan Stade
2016/03/08 01:43:29
Done.
| |
| 76 return rect.bottom() >= GetVerticalOverlap(nullptr); | 74 return rect.CenterPoint().y() >= GetVerticalOverlap(nullptr); |
|
Peter Kasting
2016/03/08 01:08:17
Why did this have to be changed?
I'm getting incr
Evan Stade
2016/03/08 01:43:29
It did not have to be part of this CL. It's somewh
tdanderson
2016/03/14 17:53:03
You should leave this as rect.bottom() (explained
| |
| 77 } | 75 } |
| OLD | NEW |