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

Side by Side Diff: ios/chrome/browser/ui/util/label_link_controller.h

Issue 2828743002: LabelObserver is no longer retained by the label (Closed)
Patch Set: Address comments Created 3 years, 8 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 2015 The Chromium Authors. All rights reserved. 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 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_UTIL_LABEL_LINK_CONTROLLER_H_ 5 #ifndef IOS_CHROME_BROWSER_UI_UTIL_LABEL_LINK_CONTROLLER_H_
6 #define IOS_CHROME_BROWSER_UI_UTIL_LABEL_LINK_CONTROLLER_H_ 6 #define IOS_CHROME_BROWSER_UI_UTIL_LABEL_LINK_CONTROLLER_H_
7 7
8 #import <UIKit/UIKit.h> 8 #import <UIKit/UIKit.h>
9 #include "ios/chrome/browser/procedural_block_types.h" 9 #include "ios/chrome/browser/procedural_block_types.h"
10 10
(...skipping 27 matching lines...) Expand all
38 @property(nonatomic, assign) UIColor* linkColor; 38 @property(nonatomic, assign) UIColor* linkColor;
39 39
40 // Sets the link underline style for any defined links, updating the controlled 40 // Sets the link underline style for any defined links, updating the controlled
41 // label's attributed text accordingly. 41 // label's attributed text accordingly.
42 @property(nonatomic, assign) NSUnderlineStyle linkUnderlineStyle; 42 @property(nonatomic, assign) NSUnderlineStyle linkUnderlineStyle;
43 43
44 // Sets the link font for any defined links, updating the controlled label's 44 // Sets the link font for any defined links, updating the controlled label's
45 // attributed text accordingly. 45 // attributed text accordingly.
46 @property(nonatomic, retain) UIFont* linkFont; 46 @property(nonatomic, retain) UIFont* linkFont;
47 47
48 // Creates a new controller for |label|, whose lifetime is expected to exceed 48 // Creates a new controller for |label|, keeping a strong reference. |action| is
49 // that of the receiver. |action| is the block called for any tapped link. 49 // the block called for any tapped link.
50 - (instancetype)initWithLabel:(UILabel*)label 50 - (instancetype)initWithLabel:(UILabel*)label
51 action:(ProceduralBlockWithURL)action; 51 action:(ProceduralBlockWithURL)action;
52 52
53 // Adds a link to the controlled label at |range| in the label's text, which 53 // Adds a link to the controlled label at |range| in the label's text, which
54 // will call the receiver's action block when tapped, passing in |url|. 54 // will call the receiver's action block when tapped, passing in |url|.
55 - (void)addLinkWithRange:(NSRange)range url:(GURL)url; 55 - (void)addLinkWithRange:(NSRange)range url:(GURL)url;
56 56
57 @end 57 @end
58 58
59 @interface LabelLinkController (Testing) 59 @interface LabelLinkController (Testing)
60 60
61 // Testing interface for LabelLinkController. 61 // Testing interface for LabelLinkController.
62 62
63 // This is the class that will be instantiated to do text mapping; by default 63 // This is the class that will be instantiated to do text mapping; by default
64 // it is CoreTextMapper, but tests can assign to this property to do dependency 64 // it is CoreTextMapper, but tests can assign to this property to do dependency
65 // injection. 65 // injection.
66 @property(nonatomic, assign) Class textMapperClass; 66 @property(nonatomic, assign) Class textMapperClass;
67 // Returns the tap rects generated by the controller that are associated with 67 // Returns the tap rects generated by the controller that are associated with
68 // |url|. 68 // |url|.
69 - (NSArray*)tapRectsForURL:(GURL)url; 69 - (NSArray*)tapRectsForURL:(GURL)url;
70 // Simulates a tap in the controlled label at |point|. No touch events are 70 // Simulates a tap in the controlled label at |point|. No touch events are
71 // generated, but |action| should be invoked if |point| is inside a tap rect. 71 // generated, but |action| should be invoked if |point| is inside a tap rect.
72 - (void)tapLabelAtPoint:(CGPoint)point; 72 - (void)tapLabelAtPoint:(CGPoint)point;
73 73
74 @end 74 @end
75 75
76 #endif // IOS_CHROME_BROWSER_UI_UTIL_LABEL_LINK_CONTROLLER_H_ 76 #endif // IOS_CHROME_BROWSER_UI_UTIL_LABEL_LINK_CONTROLLER_H_
OLDNEW
« no previous file with comments | « ios/chrome/browser/ui/util/CRUILabel+AttributeUtils_unittest.mm ('k') | ios/chrome/browser/ui/util/label_link_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698