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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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, |
| 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/14 22:37:36
It would be nice to include some of Terry's explan
Evan Stade
2016/03/14 23:12:46
I've tried to improve the comment (and match betwe
Peter Kasting
2016/03/14 23:14:29
Right, when I said "base class declaration" that's
| |
| 76 return rect.bottom() >= GetVerticalOverlap(nullptr); | 74 return rect.bottom() >= GetVerticalOverlap(nullptr); |
| 77 } | 75 } |
| OLD | NEW |