| 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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 Browser* browser = chrome::GetLastActiveBrowser(); | 77 Browser* browser = chrome::GetLastActiveBrowser(); |
| 78 if (!browser) | 78 if (!browser) |
| 79 return; | 79 return; |
| 80 content::WebContents* webContents = | 80 content::WebContents* webContents = |
| 81 browser->tab_strip_model()->GetActiveWebContents(); | 81 browser->tab_strip_model()->GetActiveWebContents(); |
| 82 if (!webContents) | 82 if (!webContents) |
| 83 return; | 83 return; |
| 84 InfoBarService* infobar_service = | 84 InfoBarService* infobar_service = |
| 85 InfoBarService::FromWebContents(webContents); | 85 InfoBarService::FromWebContents(webContents); |
| 86 infobar_service->AddInfoBar(infobar_service->CreateConfirmInfoBar( | 86 infobar_service->AddInfoBar(infobar_service->CreateConfirmInfoBar( |
| 87 scoped_ptr<ConfirmInfoBarDelegate>(new KeystonePromotionInfoBarDelegate( | 87 std::unique_ptr<ConfirmInfoBarDelegate>( |
| 88 Profile::FromBrowserContext( | 88 new KeystonePromotionInfoBarDelegate( |
| 89 webContents->GetBrowserContext())->GetPrefs())))); | 89 Profile::FromBrowserContext(webContents->GetBrowserContext()) |
| 90 ->GetPrefs())))); |
| 90 } | 91 } |
| 91 | 92 |
| 92 KeystonePromotionInfoBarDelegate::KeystonePromotionInfoBarDelegate( | 93 KeystonePromotionInfoBarDelegate::KeystonePromotionInfoBarDelegate( |
| 93 PrefService* prefs) | 94 PrefService* prefs) |
| 94 : ConfirmInfoBarDelegate(), | 95 : ConfirmInfoBarDelegate(), |
| 95 prefs_(prefs), | 96 prefs_(prefs), |
| 96 can_expire_(false), | 97 can_expire_(false), |
| 97 weak_ptr_factory_(this) { | 98 weak_ptr_factory_(this) { |
| 98 const base::TimeDelta kCanExpireOnNavigationAfterDelay = | 99 const base::TimeDelta kCanExpireOnNavigationAfterDelay = |
| 99 base::TimeDelta::FromSeconds(8); | 100 base::TimeDelta::FromSeconds(8); |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 | 225 |
| 225 @end // @implementation KeystonePromotionInfoBar | 226 @end // @implementation KeystonePromotionInfoBar |
| 226 | 227 |
| 227 // static | 228 // static |
| 228 void KeystoneInfoBar::PromotionInfoBar(Profile* profile) { | 229 void KeystoneInfoBar::PromotionInfoBar(Profile* profile) { |
| 229 KeystonePromotionInfoBar* promotionInfoBar = | 230 KeystonePromotionInfoBar* promotionInfoBar = |
| 230 [[[KeystonePromotionInfoBar alloc] init] autorelease]; | 231 [[[KeystonePromotionInfoBar alloc] init] autorelease]; |
| 231 | 232 |
| 232 [promotionInfoBar checkAndShowInfoBarForProfile:profile]; | 233 [promotionInfoBar checkAndShowInfoBarForProfile:profile]; |
| 233 } | 234 } |
| OLD | NEW |