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

Unified Diff: ios/chrome/browser/infobars/infobar_picker_controller.h

Issue 2107743002: Add InfoBarPickerController for displaying a picker view from an infobar (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@update_passwords_strings
Patch Set: Delegate behavior Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: ios/chrome/browser/infobars/infobar_picker_controller.h
diff --git a/ios/chrome/browser/infobars/infobar_picker_controller.h b/ios/chrome/browser/infobars/infobar_picker_controller.h
new file mode 100644
index 0000000000000000000000000000000000000000..f2086e0df8c28875c128929ba5054f31cac825cc
--- /dev/null
+++ b/ios/chrome/browser/infobars/infobar_picker_controller.h
@@ -0,0 +1,46 @@
+// Copyright 2016 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_INFOBARS_INFOBAR_PICKER_CONTROLLER_H_
+#define IOS_CHROME_BROWSER_INFOBARS_INFOBAR_PICKER_CONTROLLER_H_
+
+#import <UIKit/UIKit.h>
+
+@class InfoBarPickerController;
+
+// Delegate protocol for InfoBarPickerController.
+@protocol InfoBarPickerControllerDelegate<NSObject>
+// Returns text for |row| in the picker.
+- (NSString*)infoBarPickerController:(InfoBarPickerController*)controller
+ textForRow:(NSInteger)row;
+// Returns the number of rows in the picker.
+- (NSInteger)infoBarPickerControllerNumberOfRows:
+ (InfoBarPickerController*)controller;
+// Returns the index of the row to be initially selected in the picker.
+- (NSInteger)infoBarPickerControllerInitialRow:
+ (InfoBarPickerController*)controller;
+@optional
+// If implemented, returns the index of the row to be disabled in the picker.
+- (NSInteger)infoBarPickerControllerDisabledRow:
+ (InfoBarPickerController*)controller;
+@end
+
+// View controller for displaying a UIPickerView topped by a UINavigationBar
+// displaying "Done" on the right and "Cancel" on the left.
+@interface InfoBarPickerController : UIViewController
marq (ping after 24h) 2016/06/30 16:10:11 Please name view controller subclasses "<something
Jackie Quinn 2016/06/30 18:00:39 Done.
+// The picker view displayed by the InfoBarPickerController.
+@property(nonatomic, retain) UIPickerView* pickerView;
+@property(nonatomic, weak) id<InfoBarPickerControllerDelegate> delegate;
+// Sets target and action for the "Done" button.
+- (void)setDoneTarget:(id)target action:(SEL)action;
+// Sets target and action for the "Cancel" button.
+- (void)setCancelTarget:(id)target action:(SEL)action;
+@end
+
+@interface InfoBarPickerController ()
+// The displayed UINavigationBar. Exposed for testing.
+@property(nonatomic, retain) UINavigationBar* navigationBar;
+@end
+
+#endif // IOS_CHROME_BROWSER_INFOBARS_INFOBAR_PICKER_CONTROLLER_H_

Powered by Google App Engine
This is Rietveld 408576698