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

Unified Diff: ios/chrome/browser/ui/util/transparent_link_button.h

Issue 2580333003: Upstream Chrome on iOS source code [10/11]. (Closed)
Patch Set: Created 4 years 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 side-by-side diff with in-line comments
Download patch
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_
« no previous file with comments | « ios/chrome/browser/ui/util/top_view_controller.mm ('k') | ios/chrome/browser/ui/util/transparent_link_button.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698