| OLD | NEW |
| 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 "chrome/browser/ui/cocoa/keystone_infobar.h" | 5 #include "chrome/browser/ui/cocoa/keystone_infobar.h" |
| 6 | 6 |
| 7 #import <AppKit/AppKit.h> | 7 #import <AppKit/AppKit.h> |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 | 62 |
| 63 // Used to delay the expiration of the info bar. | 63 // Used to delay the expiration of the info bar. |
| 64 ScopedRunnableMethodFactory<KeystonePromotionInfoBarDelegate> method_factory_; | 64 ScopedRunnableMethodFactory<KeystonePromotionInfoBarDelegate> method_factory_; |
| 65 | 65 |
| 66 DISALLOW_COPY_AND_ASSIGN(KeystonePromotionInfoBarDelegate); | 66 DISALLOW_COPY_AND_ASSIGN(KeystonePromotionInfoBarDelegate); |
| 67 }; | 67 }; |
| 68 | 68 |
| 69 KeystonePromotionInfoBarDelegate::KeystonePromotionInfoBarDelegate( | 69 KeystonePromotionInfoBarDelegate::KeystonePromotionInfoBarDelegate( |
| 70 TabContents* tab_contents) | 70 TabContents* tab_contents) |
| 71 : ConfirmInfoBarDelegate(tab_contents), | 71 : ConfirmInfoBarDelegate(tab_contents), |
| 72 profile_(tab_contents->profile()), | 72 profile_(static_cast<Profile*>(tab_contents->browser_context())), |
| 73 can_expire_(false), | 73 can_expire_(false), |
| 74 ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)) { | 74 ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)) { |
| 75 const int kCanExpireOnNavigationAfterMilliseconds = 8 * 1000; | 75 const int kCanExpireOnNavigationAfterMilliseconds = 8 * 1000; |
| 76 MessageLoop::current()->PostDelayedTask(FROM_HERE, | 76 MessageLoop::current()->PostDelayedTask(FROM_HERE, |
| 77 method_factory_.NewRunnableMethod( | 77 method_factory_.NewRunnableMethod( |
| 78 &KeystonePromotionInfoBarDelegate::SetCanExpire), | 78 &KeystonePromotionInfoBarDelegate::SetCanExpire), |
| 79 kCanExpireOnNavigationAfterMilliseconds); | 79 kCanExpireOnNavigationAfterMilliseconds); |
| 80 } | 80 } |
| 81 | 81 |
| 82 KeystonePromotionInfoBarDelegate::~KeystonePromotionInfoBarDelegate() { | 82 KeystonePromotionInfoBarDelegate::~KeystonePromotionInfoBarDelegate() { |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 | 206 |
| 207 @end // @implementation KeystonePromotionInfoBar | 207 @end // @implementation KeystonePromotionInfoBar |
| 208 | 208 |
| 209 // static | 209 // static |
| 210 void KeystoneInfoBar::PromotionInfoBar(Profile* profile) { | 210 void KeystoneInfoBar::PromotionInfoBar(Profile* profile) { |
| 211 KeystonePromotionInfoBar* promotionInfoBar = | 211 KeystonePromotionInfoBar* promotionInfoBar = |
| 212 [[[KeystonePromotionInfoBar alloc] init] autorelease]; | 212 [[[KeystonePromotionInfoBar alloc] init] autorelease]; |
| 213 | 213 |
| 214 [promotionInfoBar checkAndShowInfoBarForProfile:profile]; | 214 [promotionInfoBar checkAndShowInfoBarForProfile:profile]; |
| 215 } | 215 } |
| OLD | NEW |