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

Side by Side Diff: chrome/browser/infobars/infobar_tab_helper.cc

Issue 8698016: Remove InfoBarDelegate::InfoBarClosed(), delete InfoBars directly. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Cancelling changes. Created 9 years 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) 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/infobars/infobar_tab_helper.h" 5 #include "chrome/browser/infobars/infobar_tab_helper.h"
6 6
7 #include "chrome/browser/infobars/infobar.h" 7 #include "chrome/browser/infobars/infobar.h"
8 #include "chrome/browser/infobars/infobar_delegate.h" 8 #include "chrome/browser/infobars/infobar_delegate.h"
9 #include "chrome/browser/tab_contents/insecure_content_infobar_delegate.h" 9 #include "chrome/browser/tab_contents/insecure_content_infobar_delegate.h"
10 #include "chrome/common/chrome_notification_types.h" 10 #include "chrome/common/chrome_notification_types.h"
(...skipping 12 matching lines...) Expand all
23 // we guarantee that we'll delete all delegates before we do anything else. 23 // we guarantee that we'll delete all delegates before we do anything else.
24 // 24 //
25 // TODO(pkasting): If there is no InfoBarContainer, this leaks all the 25 // TODO(pkasting): If there is no InfoBarContainer, this leaks all the
26 // InfoBarDelegates. This will be fixed once we call CloseSoon() directly on 26 // InfoBarDelegates. This will be fixed once we call CloseSoon() directly on
27 // Infobars. 27 // Infobars.
28 RemoveAllInfoBars(false); 28 RemoveAllInfoBars(false);
29 } 29 }
30 30
31 void InfoBarTabHelper::AddInfoBar(InfoBarDelegate* delegate) { 31 void InfoBarTabHelper::AddInfoBar(InfoBarDelegate* delegate) {
32 if (!infobars_enabled_) { 32 if (!infobars_enabled_) {
33 delegate->InfoBarClosed(); 33 delete delegate;
34 return; 34 return;
35 } 35 }
36 36
37 for (size_t i = 0; i < infobars_.size(); ++i) { 37 for (size_t i = 0; i < infobars_.size(); ++i) {
38 if (GetInfoBarDelegateAt(i)->EqualsDelegate(delegate)) { 38 if (GetInfoBarDelegateAt(i)->EqualsDelegate(delegate)) {
39 delegate->InfoBarClosed(); 39 delete delegate;
40 return; 40 return;
41 } 41 }
42 } 42 }
43 43
44 // TODO(pkasting): Consider removing InfoBarTabHelper arg from delegate 44 // TODO(pkasting): Consider removing InfoBarTabHelper arg from delegate
45 // constructors and instead using a setter from here. 45 // constructors and instead using a setter from here.
46 infobars_.push_back(delegate); 46 infobars_.push_back(delegate);
47 content::NotificationService::current()->Notify( 47 content::NotificationService::current()->Notify(
48 chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_ADDED, 48 chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_ADDED,
49 content::Source<InfoBarTabHelper>(this), 49 content::Source<InfoBarTabHelper>(this),
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 if (delegate->ShouldExpire(committed_details)) 190 if (delegate->ShouldExpire(committed_details))
191 RemoveInfoBar(delegate); 191 RemoveInfoBar(delegate);
192 } 192 }
193 193
194 break; 194 break;
195 } 195 }
196 default: 196 default:
197 NOTREACHED(); 197 NOTREACHED();
198 } 198 }
199 } 199 }
OLDNEW
« no previous file with comments | « chrome/browser/infobars/infobar_delegate.cc ('k') | chrome/browser/tab_contents/confirm_infobar_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698