| 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 |
| 11 #include "base/bind.h" | 11 #include "base/bind.h" |
| 12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
| 15 #include "base/message_loop/message_loop.h" | 15 #include "base/threading/thread_task_runner_handle.h" |
| 16 #include "chrome/browser/first_run/first_run.h" | 16 #include "chrome/browser/first_run/first_run.h" |
| 17 #include "chrome/browser/infobars/infobar_service.h" | 17 #include "chrome/browser/infobars/infobar_service.h" |
| 18 #import "chrome/browser/mac/keystone_glue.h" | 18 #import "chrome/browser/mac/keystone_glue.h" |
| 19 #include "chrome/browser/profiles/profile.h" | 19 #include "chrome/browser/profiles/profile.h" |
| 20 #include "chrome/browser/ui/browser.h" | 20 #include "chrome/browser/ui/browser.h" |
| 21 #include "chrome/browser/ui/cocoa/last_active_browser_cocoa.h" | 21 #include "chrome/browser/ui/cocoa/last_active_browser_cocoa.h" |
| 22 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 22 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 23 #include "chrome/common/chrome_switches.h" | 23 #include "chrome/common/chrome_switches.h" |
| 24 #include "chrome/common/pref_names.h" | 24 #include "chrome/common/pref_names.h" |
| 25 #include "chrome/grit/chromium_strings.h" | 25 #include "chrome/grit/chromium_strings.h" |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 } | 91 } |
| 92 | 92 |
| 93 KeystonePromotionInfoBarDelegate::KeystonePromotionInfoBarDelegate( | 93 KeystonePromotionInfoBarDelegate::KeystonePromotionInfoBarDelegate( |
| 94 PrefService* prefs) | 94 PrefService* prefs) |
| 95 : ConfirmInfoBarDelegate(), | 95 : ConfirmInfoBarDelegate(), |
| 96 prefs_(prefs), | 96 prefs_(prefs), |
| 97 can_expire_(false), | 97 can_expire_(false), |
| 98 weak_ptr_factory_(this) { | 98 weak_ptr_factory_(this) { |
| 99 const base::TimeDelta kCanExpireOnNavigationAfterDelay = | 99 const base::TimeDelta kCanExpireOnNavigationAfterDelay = |
| 100 base::TimeDelta::FromSeconds(8); | 100 base::TimeDelta::FromSeconds(8); |
| 101 base::MessageLoop::current()->PostDelayedTask(FROM_HERE, | 101 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
| 102 base::Bind(&KeystonePromotionInfoBarDelegate::SetCanExpire, | 102 FROM_HERE, base::Bind(&KeystonePromotionInfoBarDelegate::SetCanExpire, |
| 103 weak_ptr_factory_.GetWeakPtr()), | 103 weak_ptr_factory_.GetWeakPtr()), |
| 104 kCanExpireOnNavigationAfterDelay); | 104 kCanExpireOnNavigationAfterDelay); |
| 105 } | 105 } |
| 106 | 106 |
| 107 KeystonePromotionInfoBarDelegate::~KeystonePromotionInfoBarDelegate() { | 107 KeystonePromotionInfoBarDelegate::~KeystonePromotionInfoBarDelegate() { |
| 108 } | 108 } |
| 109 | 109 |
| 110 infobars::InfoBarDelegate::InfoBarIdentifier | 110 infobars::InfoBarDelegate::InfoBarIdentifier |
| 111 KeystonePromotionInfoBarDelegate::GetIdentifier() const { | 111 KeystonePromotionInfoBarDelegate::GetIdentifier() const { |
| 112 return KEYSTONE_PROMOTION_INFOBAR_DELEGATE; | 112 return KEYSTONE_PROMOTION_INFOBAR_DELEGATE; |
| 113 } | 113 } |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 | 225 |
| 226 @end // @implementation KeystonePromotionInfoBar | 226 @end // @implementation KeystonePromotionInfoBar |
| 227 | 227 |
| 228 // static | 228 // static |
| 229 void KeystoneInfoBar::PromotionInfoBar(Profile* profile) { | 229 void KeystoneInfoBar::PromotionInfoBar(Profile* profile) { |
| 230 KeystonePromotionInfoBar* promotionInfoBar = | 230 KeystonePromotionInfoBar* promotionInfoBar = |
| 231 [[[KeystonePromotionInfoBar alloc] init] autorelease]; | 231 [[[KeystonePromotionInfoBar alloc] init] autorelease]; |
| 232 | 232 |
| 233 [promotionInfoBar checkAndShowInfoBarForProfile:profile]; | 233 [promotionInfoBar checkAndShowInfoBarForProfile:profile]; |
| 234 } | 234 } |
| OLD | NEW |