1 // Copyright 2013 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.
5 #ifndef IOS_PUBLIC_PROVIDER_CHROME_BROWSER_UI_INFOBAR_VIEW_PROTOCOL_H_
6 #define IOS_PUBLIC_PROVIDER_CHROME_BROWSER_UI_INFOBAR_VIEW_PROTOCOL_H_
8 #import <Foundation/Foundation.h>
11 class InfoBarViewDelegate
;
14 // Interface for setting up the infobar's widgets.
15 @protocol InfoBarViewProtocol
16 // How much of infobar is visible. The infobar is only partly visible during
17 // showing/hiding animation.
18 @
property(nonatomic
, assign
) CGFloat visibleHeight
;
20 // The designated initializer.
21 - (instancetype
)initWithFrame
:(CGRect
)frame
22 delegate
:(InfoBarViewDelegate
*)delegate
;
24 // Stops propagating events to delegate.
25 - (void)resetDelegate
;
27 // TODO(jif): rename methods from add* to set*. crbug.com/302582
28 // Adds a dismiss button subview.
29 - (void)addCloseButtonWithTag
:(NSInteger
)tag
34 - (void)addLeftIcon
:(UIImage
*)image
;
36 // Adds transparent icon of size |imageSize| as placeholder during the time when
37 // the icon is being downloaded.
38 - (void)addPlaceholderTransparentIcon
:(CGSize
const&)imageSize
;
40 // Adds an icon subview with rounded corners and a shadow.
41 - (void)addLeftIconWithRoundedCornersAndShadow
:(UIImage
*)image
;
43 // Creates a new string from |string| that is interpreted as a link by
44 // |addLabel:|. |tag| must not be 0.
45 + (NSString
*)stringAsLink
:(NSString
*)string tag
:(NSUInteger
)tag
;
47 // Adds a message to the infobar that optionaly contains links initialized with
49 - (void)addLabel
:(NSString
*)label
;
51 // Adds a message to the infobar that optionaly contains links initialized with
52 // |stringAsLink:|. |action| is called on |target| when a link is clicked.
53 - (void)addLabel
:(NSString
*)label target
:(id
)target action
:(SEL
)action
;
55 // Adds two buttons to the infobar. Button1 is the primary action of the infobar
56 // and in Material Design mode is shown with bold colors to reflect this role.
57 - (void)addButton1
:(NSString
*)title1
59 button2
:(NSString
*)title2
64 // Adds a button to the infobar.
65 - (void)addButton
:(NSString
*)title
70 // Adds to the infobar a switch and an adjacent label.
71 - (void)addSwitchWithLabel
:(NSString
*)label
79 #endif // IOS_PUBLIC_PROVIDER_CHROME_BROWSER_UI_INFOBAR_VIEW_PROTOCOL_H_