Index: ios/chrome/browser/ui/util/transparent_link_button.h |
diff --git a/ios/chrome/browser/ui/util/transparent_link_button.h b/ios/chrome/browser/ui/util/transparent_link_button.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..2566b5836649abc54b14a203574f96daaed3a1d5 |
--- /dev/null |
+++ b/ios/chrome/browser/ui/util/transparent_link_button.h |
@@ -0,0 +1,45 @@ |
+// Copyright 2015 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef IOS_CHROME_BROWSER_UI_UTIL_TRANSPARENT_LINK_BUTTON_H_ |
+#define IOS_CHROME_BROWSER_UI_UTIL_TRANSPARENT_LINK_BUTTON_H_ |
+ |
+#import <UIKit/UIKit.h> |
+ |
+class GURL; |
+ |
+// Minumum height and width for a link's tappable area. On touch-down events, |
+// the portion of the button directly on top of the link text will be |
+// highlighted with a gray overlay. |
+extern const CGFloat kLinkTapAreaMinimum; |
+ |
+// Transparent button that is overlaid on link portions of text. |
+@interface TransparentLinkButton : UIButton |
+ |
+// TransparentLinkButtons must be created via |+buttonsForLinkFrames:URL:|. |
+- (instancetype)init NS_UNAVAILABLE; |
+- (instancetype)initWithCoder:(NSCoder*)coder NS_UNAVAILABLE; |
+- (instancetype)initWithFrame:(CGRect)frame NS_UNAVAILABLE; |
+ |
+// Creates TransparentLinkButtons with |URL| for each NSValue-wrapped CGRect in |
+// |linkFrames| and returns them in an NSArray. The links returned by this |
+// function will be styled such that their touch-down styling will be shared. |
+// Only the first button in the array will be accessible, and |label| will be |
+// set as its accessibility label. This is done to ensure that VoiceOver mode |
+// does not have multiple accessibility elements with the same accessibility |
+// label and the same action. |
++ (NSArray*)buttonsForLinkFrames:(NSArray*)linkFrames |
+ URL:(const GURL&)URL |
+ accessibilityLabel:(NSString*)label; |
+ |
+// The URL passed upon initialization. |
+@property(nonatomic, readonly) GURL URL; |
+ |
+// If set to YES, updates the button's background to a semi-opaque color to |
+// verify the button's location over the text. The default is NO. |
+@property(nonatomic, assign, getter=isDebug) BOOL debug; |
+ |
+@end |
+ |
+#endif // IOS_CHROME_BROWSER_UI_UTIL_TRANSPARENT_LINK_BUTTON_H_ |