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.h" | 5 #include "chrome/browser/ui/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/ui/views/infobars/infobar.h" | 8 #include "chrome/browser/ui/views/infobars/infobar.h" |
9 #include "content/browser/tab_contents/tab_contents.h" | 9 #include "content/browser/tab_contents/tab_contents.h" |
10 #include "content/common/notification_details.h" | 10 #include "content/common/notification_details.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 | 53 |
54 for (size_t i = 0; i < tab_contents_->infobar_count(); ++i) { | 54 for (size_t i = 0; i < tab_contents_->infobar_count(); ++i) { |
55 // As when we removed the infobars above, we prevent callbacks to | 55 // As when we removed the infobars above, we prevent callbacks to |
56 // OnInfoBarAnimated() for each infobar. | 56 // OnInfoBarAnimated() for each infobar. |
57 AddInfoBar(tab_contents_->GetInfoBarDelegateAt(i)->CreateInfoBar(), false, | 57 AddInfoBar(tab_contents_->GetInfoBarDelegateAt(i)->CreateInfoBar(), false, |
58 NO_CALLBACK); | 58 NO_CALLBACK); |
59 } | 59 } |
60 } | 60 } |
61 | 61 |
62 // Now that everything is up to date, signal the delegate to re-layout. | 62 // Now that everything is up to date, signal the delegate to re-layout. |
63 OnInfoBarAnimated(true); | 63 OnInfoBarSizeChanged(true); |
64 } | 64 } |
65 | 65 |
66 void InfoBarContainer::OnInfoBarAnimated(bool done) { | 66 void InfoBarContainer::OnInfoBarSizeChanged(bool is_animating) { |
67 if (delegate_) | 67 if (delegate_) |
68 delegate_->InfoBarContainerSizeChanged(!done); | 68 delegate_->InfoBarContainerSizeChanged(is_animating); |
69 } | 69 } |
70 | 70 |
71 void InfoBarContainer::RemoveDelegate(InfoBarDelegate* delegate) { | 71 void InfoBarContainer::RemoveDelegate(InfoBarDelegate* delegate) { |
72 tab_contents_->RemoveInfoBar(delegate); | 72 tab_contents_->RemoveInfoBar(delegate); |
73 } | 73 } |
74 | 74 |
75 void InfoBarContainer::RemoveInfoBar(InfoBar* infobar) { | 75 void InfoBarContainer::RemoveInfoBar(InfoBar* infobar) { |
76 PlatformSpecificRemoveInfoBar(infobar); | 76 PlatformSpecificRemoveInfoBar(infobar); |
77 infobars_.erase(infobar); | 77 infobars_.erase(infobar); |
78 } | 78 } |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 bool animate, | 125 bool animate, |
126 CallbackStatus callback_status) { | 126 CallbackStatus callback_status) { |
127 infobars_.insert(infobar); | 127 infobars_.insert(infobar); |
128 PlatformSpecificAddInfoBar(infobar); | 128 PlatformSpecificAddInfoBar(infobar); |
129 if (callback_status == WANT_CALLBACK) | 129 if (callback_status == WANT_CALLBACK) |
130 infobar->set_container(this); | 130 infobar->set_container(this); |
131 infobar->Show(animate); | 131 infobar->Show(animate); |
132 if (callback_status == NO_CALLBACK) | 132 if (callback_status == NO_CALLBACK) |
133 infobar->set_container(this); | 133 infobar->set_container(this); |
134 } | 134 } |
OLD | NEW |