OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef IOS_CHROME_TODAY_EXTENSION_FOOTER_LABEL_H_ |
| 6 #define IOS_CHROME_TODAY_EXTENSION_FOOTER_LABEL_H_ |
| 7 |
| 8 #import <CoreGraphics/CoreGraphics.h> |
| 9 #import <Foundation/Foundation.h> |
| 10 #import <UIKit/UIKit.h> |
| 11 |
| 12 #import <base/ios/block_types.h> |
| 13 |
| 14 // IDs of the different footer labels that can be displayed. |
| 15 enum FooterLabel { |
| 16 NO_FOOTER_LABEL, |
| 17 PW_BT_OFF_FOOTER_LABEL, |
| 18 PW_IS_ON_FOOTER_LABEL, |
| 19 PW_IS_OFF_FOOTER_LABEL, |
| 20 PW_OPTIN_DIALOG, |
| 21 PW_SCANNING_FOOTER_LABEL, |
| 22 FOOTER_LABEL_COUNT, |
| 23 }; |
| 24 |
| 25 typedef void (^LearnMoreBlock)(void); |
| 26 typedef void (^EnableDisableBlock)(void); |
| 27 |
| 28 // Protocol that all footer labels must implement to make layout of today |
| 29 // extension possible. |
| 30 @protocol FooterLabel<NSObject> |
| 31 |
| 32 // Computes the size needed to display the footer label with the given |width|. |
| 33 - (CGFloat)heightForWidth:(CGFloat)width; |
| 34 |
| 35 // The view containing the footer label. |
| 36 - (UIView*)view; |
| 37 |
| 38 @end |
| 39 |
| 40 // Generic class for footer label. This label can contain one link (delimited |
| 41 // by BEGIN_LINK and END_LINK in label string) and a button (if buttonString and |
| 42 // buttonBlock are both non nil). |
| 43 @interface SimpleFooterLabel : NSObject<FooterLabel> |
| 44 |
| 45 - (instancetype)initWithLabelString:(NSString*)labelString |
| 46 buttonString:(NSString*)buttonString |
| 47 linkBlock:(ProceduralBlock)linkBlock |
| 48 buttonBlock:(ProceduralBlock)buttonBlock; |
| 49 |
| 50 @end |
| 51 |
| 52 // The footer label displaying information that physical web is on. |
| 53 // Contains a learn more link and a disable button. |
| 54 @interface PWIsOnFooterLabel : SimpleFooterLabel |
| 55 |
| 56 - (instancetype)initWithLearnMoreBlock:(LearnMoreBlock)learnMore |
| 57 turnOffBlock:(EnableDisableBlock)turnOffBlock; |
| 58 |
| 59 @end |
| 60 |
| 61 // The footer label displaying information that physical web is off. |
| 62 // Contains a learn more link and an enable button. |
| 63 @interface PWIsOffFooterLabel : SimpleFooterLabel |
| 64 |
| 65 - (instancetype)initWithLearnMoreBlock:(LearnMoreBlock)learnMore |
| 66 turnOnBlock:(EnableDisableBlock)turnOnBlock; |
| 67 |
| 68 @end |
| 69 |
| 70 // The footer label displaying information that physical web is scanning. |
| 71 // Contains a learn more link and a disable button. |
| 72 @interface PWScanningFooterLabel : SimpleFooterLabel |
| 73 |
| 74 - (instancetype)initWithLearnMoreBlock:(LearnMoreBlock)learnMore |
| 75 turnOffBlock:(EnableDisableBlock)turnOffBlock; |
| 76 |
| 77 @end |
| 78 |
| 79 // The footer label displaying information that Bluetooth is off. |
| 80 @interface PWBTOffFooterLabel : SimpleFooterLabel |
| 81 |
| 82 - (instancetype)initWithLearnMoreBlock:(LearnMoreBlock)learnMore; |
| 83 |
| 84 @end |
| 85 |
| 86 #endif // IOS_CHROME_TODAY_EXTENSION_FOOTER_LABEL_H_ |
OLD | NEW |