| 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 "base/message_loop.h" | 7 #include "base/message_loop.h" |
| 8 #include "chrome/browser/ui/view_ids.h" | 8 #include "chrome/browser/ui/view_ids.h" |
| 9 #include "chrome/browser/ui/views/infobars/infobar_view.h" | 9 #include "chrome/browser/ui/views/infobars/infobar_view.h" |
| 10 #include "grit/generated_resources.h" | 10 #include "grit/generated_resources.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 // of the delegate). | 25 // of the delegate). |
| 26 int total_height; | 26 int total_height; |
| 27 GetVerticalOverlap(&total_height); | 27 GetVerticalOverlap(&total_height); |
| 28 return gfx::Size(0, total_height); | 28 return gfx::Size(0, total_height); |
| 29 } | 29 } |
| 30 | 30 |
| 31 void InfoBarContainerView::Layout() { | 31 void InfoBarContainerView::Layout() { |
| 32 int top = GetVerticalOverlap(NULL); | 32 int top = GetVerticalOverlap(NULL); |
| 33 | 33 |
| 34 for (int i = 0; i < child_count(); ++i) { | 34 for (int i = 0; i < child_count(); ++i) { |
| 35 InfoBarView* child = static_cast<InfoBarView*>(GetChildViewAt(i)); | 35 InfoBarView* child = static_cast<InfoBarView*>(child_at(i)); |
| 36 top -= child->arrow_height(); | 36 top -= child->arrow_height(); |
| 37 int child_height = child->total_height(); | 37 int child_height = child->total_height(); |
| 38 child->SetBounds(0, top, width(), child_height); | 38 child->SetBounds(0, top, width(), child_height); |
| 39 top += child_height; | 39 top += child_height; |
| 40 } | 40 } |
| 41 } | 41 } |
| 42 | 42 |
| 43 void InfoBarContainerView::GetAccessibleState(ui::AccessibleViewState* state) { | 43 void InfoBarContainerView::GetAccessibleState(ui::AccessibleViewState* state) { |
| 44 state->role = ui::AccessibilityTypes::ROLE_GROUPING; | 44 state->role = ui::AccessibilityTypes::ROLE_GROUPING; |
| 45 state->name = l10n_util::GetStringUTF16(IDS_ACCNAME_INFOBAR_CONTAINER); | 45 state->name = l10n_util::GetStringUTF16(IDS_ACCNAME_INFOBAR_CONTAINER); |
| 46 } | 46 } |
| 47 | 47 |
| 48 void InfoBarContainerView::PlatformSpecificAddInfoBar(InfoBar* infobar, | 48 void InfoBarContainerView::PlatformSpecificAddInfoBar(InfoBar* infobar, |
| 49 size_t position) { | 49 size_t position) { |
| 50 AddChildViewAt(static_cast<InfoBarView*>(infobar), | 50 AddChildViewAt(static_cast<InfoBarView*>(infobar), |
| 51 static_cast<int>(position)); | 51 static_cast<int>(position)); |
| 52 } | 52 } |
| 53 | 53 |
| 54 void InfoBarContainerView::PlatformSpecificRemoveInfoBar(InfoBar* infobar) { | 54 void InfoBarContainerView::PlatformSpecificRemoveInfoBar(InfoBar* infobar) { |
| 55 RemoveChildView(static_cast<InfoBarView*>(infobar)); | 55 RemoveChildView(static_cast<InfoBarView*>(infobar)); |
| 56 MessageLoop::current()->DeleteSoon(FROM_HERE, infobar); | 56 MessageLoop::current()->DeleteSoon(FROM_HERE, infobar); |
| 57 } | 57 } |
| OLD | NEW |