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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 method_factory_.NewRunnableMethod( | 78 method_factory_.NewRunnableMethod( |
79 &KeystonePromotionInfoBarDelegate::SetCanExpire), | 79 &KeystonePromotionInfoBarDelegate::SetCanExpire), |
80 kCanExpireOnNavigationAfterMilliseconds); | 80 kCanExpireOnNavigationAfterMilliseconds); |
81 } | 81 } |
82 | 82 |
83 KeystonePromotionInfoBarDelegate::~KeystonePromotionInfoBarDelegate() { | 83 KeystonePromotionInfoBarDelegate::~KeystonePromotionInfoBarDelegate() { |
84 } | 84 } |
85 | 85 |
86 bool KeystonePromotionInfoBarDelegate::ShouldExpire( | 86 bool KeystonePromotionInfoBarDelegate::ShouldExpire( |
87 const NavigationController::LoadCommittedDetails& details) const { | 87 const NavigationController::LoadCommittedDetails& details) const { |
88 return can_expire_; | 88 return details.is_user_initiated_main_frame_load() && can_expire_; |
89 } | 89 } |
90 | 90 |
91 void KeystonePromotionInfoBarDelegate::InfoBarClosed() { | 91 void KeystonePromotionInfoBarDelegate::InfoBarClosed() { |
92 delete this; | 92 delete this; |
93 } | 93 } |
94 | 94 |
95 gfx::Image* KeystonePromotionInfoBarDelegate::GetIcon() const { | 95 gfx::Image* KeystonePromotionInfoBarDelegate::GetIcon() const { |
96 return &ResourceBundle::GetSharedInstance().GetNativeImageNamed( | 96 return &ResourceBundle::GetSharedInstance().GetNativeImageNamed( |
97 IDR_PRODUCT_ICON_32); | 97 IDR_PRODUCT_ICON_32); |
98 } | 98 } |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 | 211 |
212 @end // @implementation KeystonePromotionInfoBar | 212 @end // @implementation KeystonePromotionInfoBar |
213 | 213 |
214 // static | 214 // static |
215 void KeystoneInfoBar::PromotionInfoBar(Profile* profile) { | 215 void KeystoneInfoBar::PromotionInfoBar(Profile* profile) { |
216 KeystonePromotionInfoBar* promotionInfoBar = | 216 KeystonePromotionInfoBar* promotionInfoBar = |
217 [[[KeystonePromotionInfoBar alloc] init] autorelease]; | 217 [[[KeystonePromotionInfoBar alloc] init] autorelease]; |
218 | 218 |
219 [promotionInfoBar checkAndShowInfoBarForProfile:profile]; | 219 [promotionInfoBar checkAndShowInfoBarForProfile:profile]; |
220 } | 220 } |
OLD | NEW |