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

Side by Side Diff: chrome/browser/ui/cocoa/infobars/infobar_container_controller.mm

Issue 14241006: Eliminate InfoBarTabHelper. Make InfoBarService a concrete class. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 8 months 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 "base/logging.h" 5 #include "base/logging.h"
6 #include "base/mac/bundle_locations.h" 6 #include "base/mac/bundle_locations.h"
7 #include "base/mac/mac_util.h" 7 #include "base/mac/mac_util.h"
8 #include "chrome/browser/infobars/confirm_infobar_delegate.h" 8 #include "chrome/browser/infobars/confirm_infobar_delegate.h"
9 #include "chrome/browser/infobars/infobar.h" 9 #include "chrome/browser/infobars/infobar.h"
10 #include "chrome/browser/infobars/infobar_service.h" 10 #include "chrome/browser/infobars/infobar_service.h"
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 } 137 }
138 138
139 - (void)changeWebContents:(content::WebContents*)contents { 139 - (void)changeWebContents:(content::WebContents*)contents {
140 registrar_.RemoveAll(); 140 registrar_.RemoveAll();
141 [self removeAllInfoBars]; 141 [self removeAllInfoBars];
142 142
143 currentWebContents_ = contents; 143 currentWebContents_ = contents;
144 if (currentWebContents_) { 144 if (currentWebContents_) {
145 InfoBarService* infobarService = 145 InfoBarService* infobarService =
146 InfoBarService::FromWebContents(currentWebContents_); 146 InfoBarService::FromWebContents(currentWebContents_);
147 for (size_t i = 0; i < infobarService->GetInfoBarCount(); ++i) { 147 for (size_t i = 0; i < infobarService->infobar_count(); ++i) {
148 InfoBar* infobar = infobarService-> 148 InfoBar* infobar =
149 GetInfoBarDelegateAt(i)->CreateInfoBar(infobarService); 149 infobarService->infobar_at(i)->CreateInfoBar(infobarService);
150 [self addInfoBar:infobar animate:NO]; 150 [self addInfoBar:infobar animate:NO];
151 } 151 }
152 152
153 content::Source<InfoBarService> source(infobarService); 153 content::Source<InfoBarService> source(infobarService);
154 registrar_.Add(infoBarObserver_.get(), 154 registrar_.Add(infoBarObserver_.get(),
155 chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_ADDED, source); 155 chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_ADDED, source);
156 registrar_.Add(infoBarObserver_.get(), 156 registrar_.Add(infoBarObserver_.get(),
157 chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_REMOVED, source); 157 chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_REMOVED, source);
158 registrar_.Add(infoBarObserver_.get(), 158 registrar_.Add(infoBarObserver_.get(),
159 chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_REPLACED, source); 159 chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_REPLACED, source);
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 frame.size.width = NSWidth(containerBounds); 269 frame.size.width = NSWidth(containerBounds);
270 [view setFrame:frame]; 270 [view setFrame:frame];
271 271
272 minY += NSHeight(frame) - infobars::kTipHeight; 272 minY += NSHeight(frame) - infobars::kTipHeight;
273 } 273 }
274 274
275 [resizeDelegate_ resizeView:[self view] newHeight:[self desiredHeight]]; 275 [resizeDelegate_ resizeView:[self view] newHeight:[self desiredHeight]];
276 } 276 }
277 277
278 @end 278 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698