OLD | NEW |
---|---|
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
8 #include "chrome/browser/tab_contents/infobar_delegate.h" | 8 #include "chrome/browser/tab_contents/infobar_delegate.h" |
9 #include "chrome/browser/tab_contents/tab_contents.h" | 9 #include "chrome/browser/tab_contents/tab_contents.h" |
10 #include "chrome/browser/view_ids.h" | 10 #include "chrome/browser/view_ids.h" |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
97 // InfoBarContainer, NotificationObserver implementation: ---------------------- | 97 // InfoBarContainer, NotificationObserver implementation: ---------------------- |
98 | 98 |
99 void InfoBarContainer::Observe(NotificationType type, | 99 void InfoBarContainer::Observe(NotificationType type, |
100 const NotificationSource& source, | 100 const NotificationSource& source, |
101 const NotificationDetails& details) { | 101 const NotificationDetails& details) { |
102 if (type == NotificationType::TAB_CONTENTS_INFOBAR_ADDED) { | 102 if (type == NotificationType::TAB_CONTENTS_INFOBAR_ADDED) { |
103 AddInfoBar(Details<InfoBarDelegate>(details).ptr(), true); // animated | 103 AddInfoBar(Details<InfoBarDelegate>(details).ptr(), true); // animated |
104 } else if (type == NotificationType::TAB_CONTENTS_INFOBAR_REMOVED) { | 104 } else if (type == NotificationType::TAB_CONTENTS_INFOBAR_REMOVED) { |
105 RemoveInfoBar(Details<InfoBarDelegate>(details).ptr(), true); // animated | 105 RemoveInfoBar(Details<InfoBarDelegate>(details).ptr(), true); // animated |
106 } else if (type == NotificationType::TAB_CONTENTS_INFOBAR_REPLACED) { | 106 } else if (type == NotificationType::TAB_CONTENTS_INFOBAR_REPLACED) { |
107 std::pair<InfoBarDelegate*, InfoBarDelegate*>* delegates = | 107 typedef std::pair<InfoBarDelegate*, InfoBarDelegate*> Delegates; |
tfarina
2010/11/10 13:11:57
Was this change really necessary? What is wrong wi
| |
108 Details<std::pair<InfoBarDelegate*, InfoBarDelegate*> >(details).ptr(); | 108 Delegates* delegates = Details<Delegates>(details).ptr(); |
109 ReplaceInfoBar(delegates->first, delegates->second); | 109 ReplaceInfoBar(delegates->first, delegates->second); |
110 } else { | 110 } else { |
111 NOTREACHED(); | 111 NOTREACHED(); |
112 } | 112 } |
113 } | 113 } |
114 | 114 |
115 // InfoBarContainer, private: -------------------------------------------------- | 115 // InfoBarContainer, private: -------------------------------------------------- |
116 | 116 |
117 void InfoBarContainer::UpdateInfoBars() { | 117 void InfoBarContainer::UpdateInfoBars() { |
118 for (int i = 0; i < tab_contents_->infobar_delegate_count(); ++i) { | 118 for (int i = 0; i < tab_contents_->infobar_delegate_count(); ++i) { |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
155 break; | 155 break; |
156 } | 156 } |
157 } | 157 } |
158 } | 158 } |
159 | 159 |
160 void InfoBarContainer::ReplaceInfoBar(InfoBarDelegate* old_delegate, | 160 void InfoBarContainer::ReplaceInfoBar(InfoBarDelegate* old_delegate, |
161 InfoBarDelegate* new_delegate) { | 161 InfoBarDelegate* new_delegate) { |
162 RemoveInfoBar(old_delegate, false); // no animation | 162 RemoveInfoBar(old_delegate, false); // no animation |
163 AddInfoBar(new_delegate, false); // no animation | 163 AddInfoBar(new_delegate, false); // no animation |
164 } | 164 } |
OLD | NEW |