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

Unified Diff: ios/chrome/browser/ui/alert_coordinator/alert_coordinator.h

Issue 2119373002: Creates coordinators for displaying alerts (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix tests Created 4 years, 5 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/ui/alert_coordinator/alert_coordinator.h
diff --git a/ios/chrome/browser/ui/alert_coordinator/alert_coordinator.h b/ios/chrome/browser/ui/alert_coordinator/alert_coordinator.h
new file mode 100644
index 0000000000000000000000000000000000000000..e03efbab9efed12357bb5977e0d3d356dadb9d34
--- /dev/null
+++ b/ios/chrome/browser/ui/alert_coordinator/alert_coordinator.h
@@ -0,0 +1,53 @@
+// 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_UI_ALERT_COORDINATOR_ALERT_COORDINATOR_H_
+#define IOS_CHROME_BROWSER_UI_ALERT_COORDINATOR_ALERT_COORDINATOR_H_
+
+#import <UIKit/UIKit.h>
+
+#include "base/ios/block_types.h"
+#import "ios/chrome/browser/chrome_coordinator.h"
+
+// A coordinator specialization for the case where the coordinator is
+// creating and managing an alert (popup or action sheet) to be displayed to the
+// user. Dismiss it with no animation.
+// The type of alert displayed depends on the init called.
+// Calling |-stop| on this coordinator destroys the current alert.
+@interface AlertCoordinator : ChromeCoordinator
+
+// Whether a cancel button has been added.
+@property(nonatomic, readonly) BOOL cancelButtonAdded;
+// Message of the alert.
+@property(nonatomic, copy) NSString* message;
+// Whether the alert is visible. This will be true after |-start| is called
+// until a subsequent |-stop|.
+@property(nonatomic, readonly, getter=isVisible) BOOL visible;
+
+- (instancetype)initWithBaseViewController:(UIViewController*)viewController
+ NS_UNAVAILABLE;
+
+// Init a coordinator for displaying a alert on this view controller. If
+// |-configureForActionSheetWithRect:popoverView:| is not called, it will be a
+// modal alert.
+- (instancetype)initWithBaseViewController:(UIViewController*)viewController
+ title:(NSString*)title
+ NS_DESIGNATED_INITIALIZER;
+
+// Call this before adding any button to change the alert to an action sheet.
+- (void)configureForActionSheetWithRect:(CGRect)rect popoverView:(UIView*)view;
+
+// Adds an item at the end of the menu. It does nothing if |visible| is true or
+// if trying to add an item with a UIAlertActionStyleCancel while
+// |cancelButtonAdded| is true.
+- (void)addItemWithTitle:(NSString*)title
+ action:(ProceduralBlock)actionBlock
+ style:(UIAlertActionStyle)style;
+
+// Returns the number of actions attached to the current alert.
+- (NSUInteger)actionsCount;
+
+@end
+
+#endif // IOS_CHROME_BROWSER_UI_ALERT_COORDINATOR_ALERT_COORDINATOR_H_
« no previous file with comments | « ios/chrome/browser/ui/alert_coordinator/OWNERS ('k') | ios/chrome/browser/ui/alert_coordinator/alert_coordinator.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698