| 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 "grit/generated_resources.h" | 9 #include "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 | 12 |
| 13 // static | 13 // static |
| 14 const char InfoBarContainerView::kViewClassName[] = "InfoBarContainerView"; | 14 const char InfoBarContainerView::kViewClassName[] = "InfoBarContainerView"; |
| 15 | 15 |
| 16 InfoBarContainerView::InfoBarContainerView(Delegate* delegate) | 16 InfoBarContainerView::InfoBarContainerView(Delegate* delegate) |
| 17 : infobars::InfoBarContainer(delegate) { | 17 : infobars::InfoBarContainer(delegate) { |
| 18 set_id(VIEW_ID_INFO_BAR_CONTAINER); | 18 set_id(VIEW_ID_INFO_BAR_CONTAINER); |
| 19 } | 19 } |
| 20 | 20 |
| 21 InfoBarContainerView::~InfoBarContainerView() { | 21 InfoBarContainerView::~InfoBarContainerView() { |
| 22 RemoveAllInfoBarsForDestruction(); | 22 RemoveAllInfoBarsForDestruction(); |
| 23 } | 23 } |
| 24 | 24 |
| 25 gfx::Size InfoBarContainerView::GetPreferredSize() { | 25 gfx::Size InfoBarContainerView::GetPreferredSize() const { |
| 26 int total_height; | 26 int total_height; |
| 27 GetVerticalOverlap(&total_height); | 27 GetVerticalOverlap(&total_height); |
| 28 gfx::Size size(0, total_height); | 28 gfx::Size size(0, total_height); |
| 29 for (int i = 0; i < child_count(); ++i) | 29 for (int i = 0; i < child_count(); ++i) |
| 30 size.SetToMax(gfx::Size(child_at(i)->GetPreferredSize().width(), 0)); | 30 size.SetToMax(gfx::Size(child_at(i)->GetPreferredSize().width(), 0)); |
| 31 return size; | 31 return size; |
| 32 } | 32 } |
| 33 | 33 |
| 34 const char* InfoBarContainerView::GetClassName() const { | 34 const char* InfoBarContainerView::GetClassName() const { |
| 35 return kViewClassName; | 35 return kViewClassName; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 56 infobars::InfoBar* infobar, | 56 infobars::InfoBar* infobar, |
| 57 size_t position) { | 57 size_t position) { |
| 58 AddChildViewAt(static_cast<InfoBarView*>(infobar), | 58 AddChildViewAt(static_cast<InfoBarView*>(infobar), |
| 59 static_cast<int>(position)); | 59 static_cast<int>(position)); |
| 60 } | 60 } |
| 61 | 61 |
| 62 void InfoBarContainerView::PlatformSpecificRemoveInfoBar( | 62 void InfoBarContainerView::PlatformSpecificRemoveInfoBar( |
| 63 infobars::InfoBar* infobar) { | 63 infobars::InfoBar* infobar) { |
| 64 RemoveChildView(static_cast<InfoBarView*>(infobar)); | 64 RemoveChildView(static_cast<InfoBarView*>(infobar)); |
| 65 } | 65 } |
| OLD | NEW |