OLD | NEW |
---|---|
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/views/infobars/infobar_container.h" | 5 #include "chrome/browser/views/infobars/infobar_container.h" |
6 | 6 |
7 #include "chrome/browser/tab_contents/infobar_delegate.h" | 7 #include "chrome/browser/tab_contents/infobar_delegate.h" |
8 #include "chrome/browser/tab_contents/tab_contents.h" | 8 #include "chrome/browser/tab_contents/tab_contents.h" |
9 #include "chrome/browser/views/frame/browser_view.h" | 9 #include "chrome/browser/views/frame/browser_view.h" |
10 #include "chrome/browser/views/infobars/infobars.h" | 10 #include "chrome/browser/views/infobars/infobars.h" |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
65 void InfoBarContainer::Layout() { | 65 void InfoBarContainer::Layout() { |
66 int top = 0; | 66 int top = 0; |
67 for (int i = 0; i < GetChildViewCount(); ++i) { | 67 for (int i = 0; i < GetChildViewCount(); ++i) { |
68 views::View* child = GetChildViewAt(i); | 68 views::View* child = GetChildViewAt(i); |
69 gfx::Size ps = child->GetPreferredSize(); | 69 gfx::Size ps = child->GetPreferredSize(); |
70 child->SetBounds(0, top, width(), ps.height()); | 70 child->SetBounds(0, top, width(), ps.height()); |
71 top += ps.height(); | 71 top += ps.height(); |
72 } | 72 } |
73 } | 73 } |
74 | 74 |
75 bool InfoBarContainer::GetAccessibleName(std::wstring* name) { | |
76 if (!accessible_name_.empty()) { | |
jcampan
2009/07/14 16:44:24
Same nit as previously mentioned: DCHECK(name), na
| |
77 (*name).assign(accessible_name_); | |
78 return true; | |
79 } | |
80 return false; | |
81 } | |
82 | |
83 bool InfoBarContainer::GetAccessibleRole(AccessibilityTypes::Role* role) { | |
84 DCHECK(role); | |
85 | |
86 *role = AccessibilityTypes::ROLE_TOOLBAR; | |
87 return true; | |
88 } | |
89 | |
90 void InfoBarContainer::SetAccessibleName(const std::wstring& name) { | |
91 accessible_name_.assign(name); | |
92 } | |
93 | |
75 void InfoBarContainer::ViewHierarchyChanged(bool is_add, | 94 void InfoBarContainer::ViewHierarchyChanged(bool is_add, |
76 views::View* parent, | 95 views::View* parent, |
77 views::View* child) { | 96 views::View* child) { |
78 if (parent == this && child->GetParent() == this && browser_view_) { | 97 if (parent == this && child->GetParent() == this && browser_view_) { |
79 // An InfoBar child was added or removed. Tell the BrowserView it needs to | 98 // An InfoBar child was added or removed. Tell the BrowserView it needs to |
80 // re-layout since our preferred size will have changed. | 99 // re-layout since our preferred size will have changed. |
81 browser_view_->SelectedTabToolbarSizeChanged(false); | 100 browser_view_->SelectedTabToolbarSizeChanged(false); |
82 } | 101 } |
83 } | 102 } |
84 | 103 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
118 void InfoBarContainer::RemoveInfoBar(InfoBarDelegate* delegate) { | 137 void InfoBarContainer::RemoveInfoBar(InfoBarDelegate* delegate) { |
119 int index = 0; | 138 int index = 0; |
120 for (; index < tab_contents_->infobar_delegate_count(); ++index) { | 139 for (; index < tab_contents_->infobar_delegate_count(); ++index) { |
121 if (tab_contents_->GetInfoBarDelegateAt(index) == delegate) | 140 if (tab_contents_->GetInfoBarDelegateAt(index) == delegate) |
122 break; | 141 break; |
123 } | 142 } |
124 | 143 |
125 // The View will be removed once the Close animation completes. | 144 // The View will be removed once the Close animation completes. |
126 static_cast<InfoBar*>(GetChildViewAt(index))->AnimateClose(); | 145 static_cast<InfoBar*>(GetChildViewAt(index))->AnimateClose(); |
127 } | 146 } |
OLD | NEW |