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

Side by Side Diff: chrome/browser/ui/cocoa/keystone_infobar_delegate.mm

Issue 10830353: Introduce InfoBarTabService API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Respond to review comments 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/ui/cocoa/keystone_infobar_delegate.h" 5 #include "chrome/browser/ui/cocoa/keystone_infobar_delegate.h"
6 6
7 #import <AppKit/AppKit.h> 7 #import <AppKit/AppKit.h>
8 8
9 #include <string> 9 #include <string>
10 10
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 if (status != kAutoupdateRegisterFailed && 191 if (status != kAutoupdateRegisterFailed &&
192 [[KeystoneGlue defaultKeystoneGlue] needsPromotion]) { 192 [[KeystoneGlue defaultKeystoneGlue] needsPromotion]) {
193 Browser* browser = browser::GetLastActiveBrowser(); 193 Browser* browser = browser::GetLastActiveBrowser();
194 if (browser) { 194 if (browser) {
195 TabContents* tabContents = chrome::GetActiveTabContents(browser); 195 TabContents* tabContents = chrome::GetActiveTabContents(browser);
196 196
197 // Only show if no other info bars are showing, because that's how the 197 // Only show if no other info bars are showing, because that's how the
198 // default browser info bar works. 198 // default browser info bar works.
199 if (tabContents) { 199 if (tabContents) {
200 InfoBarTabHelper* infobar_helper = tabContents->infobar_tab_helper(); 200 InfoBarTabHelper* infobar_helper = tabContents->infobar_tab_helper();
201 if (infobar_helper->infobar_count() == 0) { 201 if (infobar_helper->GetInfoBarCount() == 0) {
202 infobar_helper->AddInfoBar( 202 infobar_helper->AddInfoBar(
203 new KeystonePromotionInfoBarDelegate( 203 new KeystonePromotionInfoBarDelegate(
204 infobar_helper, 204 infobar_helper,
205 tabContents->profile()->GetPrefs())); 205 tabContents->profile()->GetPrefs()));
206 } 206 }
207 } 207 }
208 } 208 }
209 } 209 }
210 210
211 [self release]; 211 [self release];
212 } 212 }
213 213
214 - (void)removeObserver { 214 - (void)removeObserver {
215 [[NSNotificationCenter defaultCenter] removeObserver:self]; 215 [[NSNotificationCenter defaultCenter] removeObserver:self];
216 } 216 }
217 217
218 @end // @implementation KeystonePromotionInfoBar 218 @end // @implementation KeystonePromotionInfoBar
219 219
220 // static 220 // static
221 void KeystoneInfoBar::PromotionInfoBar(Profile* profile) { 221 void KeystoneInfoBar::PromotionInfoBar(Profile* profile) {
222 KeystonePromotionInfoBar* promotionInfoBar = 222 KeystonePromotionInfoBar* promotionInfoBar =
223 [[[KeystonePromotionInfoBar alloc] init] autorelease]; 223 [[[KeystonePromotionInfoBar alloc] init] autorelease];
224 224
225 [promotionInfoBar checkAndShowInfoBarForProfile:profile]; 225 [promotionInfoBar checkAndShowInfoBarForProfile:profile];
226 } 226 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698