Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(471)

Side by Side Diff: chrome/browser/ui/views/infobars/infobar_container.cc

Issue 4767001: Make TabContents own its infobar delegates.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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*> DelegatePair;
108 Details<std::pair<InfoBarDelegate*, InfoBarDelegate*> >(details).ptr(); 108 DelegatePair* delegate_pair = Details<DelegatePair>(details).ptr();
109 ReplaceInfoBar(delegates->first, delegates->second); 109 ReplaceInfoBar(delegate_pair->first, delegate_pair->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) {
119 InfoBarDelegate* delegate = tab_contents_->GetInfoBarDelegateAt(i); 119 InfoBarDelegate* delegate = tab_contents_->GetInfoBarDelegateAt(i);
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698