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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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() { |
83 } | 83 } |
84 | 84 |
85 bool KeystonePromotionInfoBarDelegate::ShouldExpire( | 85 bool KeystonePromotionInfoBarDelegate::ShouldExpire( |
86 const NavigationController::LoadCommittedDetails& details) const { | 86 const NavigationController::LoadCommittedDetails& details) const { |
87 return can_expire_; | 87 return details.is_user_initiated_main_frame_load() && can_expire_; |
88 } | 88 } |
89 | 89 |
90 gfx::Image* KeystonePromotionInfoBarDelegate::GetIcon() const { | 90 gfx::Image* KeystonePromotionInfoBarDelegate::GetIcon() const { |
91 return &ResourceBundle::GetSharedInstance().GetNativeImageNamed( | 91 return &ResourceBundle::GetSharedInstance().GetNativeImageNamed( |
92 IDR_PRODUCT_ICON_32); | 92 IDR_PRODUCT_ICON_32); |
93 } | 93 } |
94 | 94 |
95 string16 KeystonePromotionInfoBarDelegate::GetMessageText() const { | 95 string16 KeystonePromotionInfoBarDelegate::GetMessageText() const { |
96 return l10n_util::GetStringFUTF16(IDS_PROMOTE_INFOBAR_TEXT, | 96 return l10n_util::GetStringFUTF16(IDS_PROMOTE_INFOBAR_TEXT, |
97 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); | 97 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); |
(...skipping 108 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 |