Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(141)

Side by Side Diff: chrome/browser/ui/cocoa/keystone_infobar_delegate.mm

Issue 1520543004: Add method for identifying different InfoBars (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Nit again Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 45
46 private: 46 private:
47 explicit KeystonePromotionInfoBarDelegate(PrefService* prefs); 47 explicit KeystonePromotionInfoBarDelegate(PrefService* prefs);
48 ~KeystonePromotionInfoBarDelegate() override; 48 ~KeystonePromotionInfoBarDelegate() override;
49 49
50 // Sets this info bar to be able to expire. Called a predetermined amount 50 // Sets this info bar to be able to expire. Called a predetermined amount
51 // of time after this object is created. 51 // of time after this object is created.
52 void SetCanExpire() { can_expire_ = true; } 52 void SetCanExpire() { can_expire_ = true; }
53 53
54 // ConfirmInfoBarDelegate 54 // ConfirmInfoBarDelegate
55 infobars::InfoBarDelegate::InfoBarIdentifier GetIdentifier() const override;
55 int GetIconId() const override; 56 int GetIconId() const override;
56 bool ShouldExpire(const NavigationDetails& details) const override; 57 bool ShouldExpire(const NavigationDetails& details) const override;
57 base::string16 GetMessageText() const override; 58 base::string16 GetMessageText() const override;
58 base::string16 GetButtonLabel(InfoBarButton button) const override; 59 base::string16 GetButtonLabel(InfoBarButton button) const override;
59 bool Accept() override; 60 bool Accept() override;
60 bool Cancel() override; 61 bool Cancel() override;
61 62
62 // The prefs to use. 63 // The prefs to use.
63 PrefService* prefs_; // weak 64 PrefService* prefs_; // weak
64 65
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 base::TimeDelta::FromSeconds(8); 99 base::TimeDelta::FromSeconds(8);
99 base::MessageLoop::current()->PostDelayedTask(FROM_HERE, 100 base::MessageLoop::current()->PostDelayedTask(FROM_HERE,
100 base::Bind(&KeystonePromotionInfoBarDelegate::SetCanExpire, 101 base::Bind(&KeystonePromotionInfoBarDelegate::SetCanExpire,
101 weak_ptr_factory_.GetWeakPtr()), 102 weak_ptr_factory_.GetWeakPtr()),
102 kCanExpireOnNavigationAfterDelay); 103 kCanExpireOnNavigationAfterDelay);
103 } 104 }
104 105
105 KeystonePromotionInfoBarDelegate::~KeystonePromotionInfoBarDelegate() { 106 KeystonePromotionInfoBarDelegate::~KeystonePromotionInfoBarDelegate() {
106 } 107 }
107 108
109 infobars::InfoBarDelegate::InfoBarIdentifier
110 KeystonePromotionInfoBarDelegate::GetIdentifier() const {
111 return KEYSTONE_PROMOTION_INFOBAR_DELEGATE;
112 }
113
108 int KeystonePromotionInfoBarDelegate::GetIconId() const { 114 int KeystonePromotionInfoBarDelegate::GetIconId() const {
109 return IDR_PRODUCT_LOGO_32; 115 return IDR_PRODUCT_LOGO_32;
110 } 116 }
111 117
112 bool KeystonePromotionInfoBarDelegate::ShouldExpire( 118 bool KeystonePromotionInfoBarDelegate::ShouldExpire(
113 const NavigationDetails& details) const { 119 const NavigationDetails& details) const {
114 return can_expire_ && ConfirmInfoBarDelegate::ShouldExpire(details); 120 return can_expire_ && ConfirmInfoBarDelegate::ShouldExpire(details);
115 } 121 }
116 122
117 base::string16 KeystonePromotionInfoBarDelegate::GetMessageText() const { 123 base::string16 KeystonePromotionInfoBarDelegate::GetMessageText() const {
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 224
219 @end // @implementation KeystonePromotionInfoBar 225 @end // @implementation KeystonePromotionInfoBar
220 226
221 // static 227 // static
222 void KeystoneInfoBar::PromotionInfoBar(Profile* profile) { 228 void KeystoneInfoBar::PromotionInfoBar(Profile* profile) {
223 KeystonePromotionInfoBar* promotionInfoBar = 229 KeystonePromotionInfoBar* promotionInfoBar =
224 [[[KeystonePromotionInfoBar alloc] init] autorelease]; 230 [[[KeystonePromotionInfoBar alloc] init] autorelease];
225 231
226 [promotionInfoBar checkAndShowInfoBarForProfile:profile]; 232 [promotionInfoBar checkAndShowInfoBarForProfile:profile];
227 } 233 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698