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

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

Issue 10830353: Introduce InfoBarTabService API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Respond to review comments, merge to LKGR Created 8 years, 4 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/api/infobars/confirm_infobar_delegate.h" 8 #include "chrome/browser/api/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_tab_helper.h" 10 #include "chrome/browser/infobars/infobar_tab_helper.h"
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 } 137 }
138 138
139 - (void)changeTabContents:(TabContents*)contents { 139 - (void)changeTabContents:(TabContents*)contents {
140 registrar_.RemoveAll(); 140 registrar_.RemoveAll();
141 [self removeAllInfoBars]; 141 [self removeAllInfoBars];
142 142
143 currentTabContents_ = contents; 143 currentTabContents_ = contents;
144 if (currentTabContents_) { 144 if (currentTabContents_) {
145 InfoBarTabHelper* infobar_helper = 145 InfoBarTabHelper* infobar_helper =
146 currentTabContents_->infobar_tab_helper(); 146 currentTabContents_->infobar_tab_helper();
147 for (size_t i = 0; i < infobar_helper->infobar_count(); ++i) { 147 for (size_t i = 0; i < infobar_helper->GetInfoBarCount(); ++i) {
148 InfoBar* infobar = infobar_helper-> 148 InfoBar* infobar = infobar_helper->
149 GetInfoBarDelegateAt(i)->CreateInfoBar(infobar_helper); 149 GetInfoBarDelegateAt(i)->CreateInfoBar(infobar_helper);
150 [self addInfoBar:infobar animate:NO]; 150 [self addInfoBar:infobar animate:NO];
151 } 151 }
152 152
153 content::Source<InfoBarTabHelper> source(infobar_helper); 153 content::Source<InfoBarTabHelper> source(infobar_helper);
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);
(...skipping 111 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