OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef IOS_CHROME_BROWSER_UI_BOOKMARKS_BOOKMARK_PROMO_CONTROLLER_H_ | 5 #ifndef IOS_CHROME_BROWSER_UI_BOOKMARKS_BOOKMARK_PROMO_CONTROLLER_H_ |
6 #define IOS_CHROME_BROWSER_UI_BOOKMARKS_BOOKMARK_PROMO_CONTROLLER_H_ | 6 #define IOS_CHROME_BROWSER_UI_BOOKMARKS_BOOKMARK_PROMO_CONTROLLER_H_ |
7 | 7 |
8 #import <UIKit/UIKit.h> | 8 #import <UIKit/UIKit.h> |
9 | 9 |
10 namespace ios { | 10 namespace ios { |
11 class ChromeBrowserState; | 11 class ChromeBrowserState; |
12 } // namespace ios | 12 } // namespace ios |
13 | 13 |
14 namespace user_prefs { | 14 namespace user_prefs { |
15 class PrefRegistrySyncable; | 15 class PrefRegistrySyncable; |
16 } // namespace user_prefs | 16 } // namespace user_prefs |
17 | 17 |
18 @protocol BookmarkPromoControllerDelegate | 18 @protocol BookmarkPromoControllerDelegate |
19 | 19 |
20 // Controls the state of the promo. | 20 // Controls the state of the promo. |
21 - (void)promoStateChanged:(BOOL)promoEnabled; | 21 - (void)promoStateChanged:(BOOL)promoEnabled; |
22 | 22 |
23 @end | 23 @end |
24 | 24 |
25 // This controller manages the display of the promo cell through its delegate | 25 // This controller manages the display of the promo cell through its delegate |
26 // and handles displaying the sign-in view controller. | 26 // and handles displaying the sign-in view controller. |
27 @interface BookmarkPromoController : NSObject | 27 @interface BookmarkPromoController : NSObject |
28 | 28 |
29 @property(nonatomic, assign) id<BookmarkPromoControllerDelegate> delegate; | 29 @property(nonatomic, weak) id<BookmarkPromoControllerDelegate> delegate; |
30 | 30 |
31 // Holds the current state of the promo. When the promo state change, it will | 31 // Holds the current state of the promo. When the promo state change, it will |
32 // call the promoStateChanged: selector on the delegate. | 32 // call the promoStateChanged: selector on the delegate. |
33 @property(nonatomic, assign) BOOL promoState; | 33 @property(nonatomic, assign) BOOL promoState; |
34 | 34 |
35 // Registers the feature preferences. | 35 // Registers the feature preferences. |
36 + (void)registerBrowserStatePrefs:(user_prefs::PrefRegistrySyncable*)registry; | 36 + (void)registerBrowserStatePrefs:(user_prefs::PrefRegistrySyncable*)registry; |
37 | 37 |
38 - (instancetype)initWithBrowserState:(ios::ChromeBrowserState*)browserState | 38 - (instancetype)initWithBrowserState:(ios::ChromeBrowserState*)browserState |
39 delegate: | 39 delegate: |
40 (id<BookmarkPromoControllerDelegate>)delegate; | 40 (id<BookmarkPromoControllerDelegate>)delegate; |
41 | 41 |
42 // Presents the sign-in UI. | 42 // Presents the sign-in UI. |
43 - (void)showSignIn; | 43 - (void)showSignIn; |
44 | 44 |
45 // Hides the promo cell. It won't be presented again on this profile. | 45 // Hides the promo cell. It won't be presented again on this profile. |
46 - (void)hidePromoCell; | 46 - (void)hidePromoCell; |
47 | 47 |
48 // Updates the promo state based on the sign-in state of the user. | 48 // Updates the promo state based on the sign-in state of the user. |
49 - (void)updatePromoState; | 49 - (void)updatePromoState; |
50 | 50 |
51 @end | 51 @end |
52 | 52 |
53 #endif // IOS_CHROME_BROWSER_UI_BOOKMARKS_BOOKMARK_PROMO_CONTROLLER_H_ | 53 #endif // IOS_CHROME_BROWSER_UI_BOOKMARKS_BOOKMARK_PROMO_CONTROLLER_H_ |
OLD | NEW |