| OLD | NEW |
| 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 Browser* browser = chrome::GetLastActiveBrowser(); | 75 Browser* browser = chrome::GetLastActiveBrowser(); |
| 76 if (!browser) | 76 if (!browser) |
| 77 return; | 77 return; |
| 78 content::WebContents* webContents = | 78 content::WebContents* webContents = |
| 79 browser->tab_strip_model()->GetActiveWebContents(); | 79 browser->tab_strip_model()->GetActiveWebContents(); |
| 80 if (!webContents) | 80 if (!webContents) |
| 81 return; | 81 return; |
| 82 InfoBarService* infobar_service = | 82 InfoBarService* infobar_service = |
| 83 InfoBarService::FromWebContents(webContents); | 83 InfoBarService::FromWebContents(webContents); |
| 84 infobar_service->AddInfoBar(ConfirmInfoBarDelegate::CreateInfoBar( | 84 infobar_service->AddInfoBar(ConfirmInfoBarDelegate::CreateInfoBar( |
| 85 infobar_service, |
| 85 scoped_ptr<ConfirmInfoBarDelegate>(new KeystonePromotionInfoBarDelegate( | 86 scoped_ptr<ConfirmInfoBarDelegate>(new KeystonePromotionInfoBarDelegate( |
| 86 Profile::FromBrowserContext( | 87 Profile::FromBrowserContext( |
| 87 webContents->GetBrowserContext())->GetPrefs())))); | 88 webContents->GetBrowserContext())->GetPrefs())))); |
| 88 } | 89 } |
| 89 | 90 |
| 90 KeystonePromotionInfoBarDelegate::KeystonePromotionInfoBarDelegate( | 91 KeystonePromotionInfoBarDelegate::KeystonePromotionInfoBarDelegate( |
| 91 PrefService* prefs) | 92 PrefService* prefs) |
| 92 : ConfirmInfoBarDelegate(), | 93 : ConfirmInfoBarDelegate(), |
| 93 prefs_(prefs), | 94 prefs_(prefs), |
| 94 can_expire_(false), | 95 can_expire_(false), |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 | 218 |
| 218 @end // @implementation KeystonePromotionInfoBar | 219 @end // @implementation KeystonePromotionInfoBar |
| 219 | 220 |
| 220 // static | 221 // static |
| 221 void KeystoneInfoBar::PromotionInfoBar(Profile* profile) { | 222 void KeystoneInfoBar::PromotionInfoBar(Profile* profile) { |
| 222 KeystonePromotionInfoBar* promotionInfoBar = | 223 KeystonePromotionInfoBar* promotionInfoBar = |
| 223 [[[KeystonePromotionInfoBar alloc] init] autorelease]; | 224 [[[KeystonePromotionInfoBar alloc] init] autorelease]; |
| 224 | 225 |
| 225 [promotionInfoBar checkAndShowInfoBarForProfile:profile]; | 226 [promotionInfoBar checkAndShowInfoBarForProfile:profile]; |
| 226 } | 227 } |
| OLD | NEW |