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

Unified Diff: ios/chrome/browser/payments/payment_request_selector_view_controller_data_source.h

Issue 2805273002: [Payment Request] Selector view controller (Closed)
Patch Set: Created 3 years, 8 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/payments/payment_request_selector_view_controller_data_source.h
diff --git a/ios/chrome/browser/payments/payment_request_selector_view_controller_data_source.h b/ios/chrome/browser/payments/payment_request_selector_view_controller_data_source.h
new file mode 100644
index 0000000000000000000000000000000000000000..c081018a5ff6da52e959fb9e7f74053806d29007
--- /dev/null
+++ b/ios/chrome/browser/payments/payment_request_selector_view_controller_data_source.h
@@ -0,0 +1,53 @@
+// Copyright 2017 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_PAYMENTS_PAYMENT_REQUEST_SELECTOR_VIEW_CONTROLLER_DATA_SOURCE_H_
+#define IOS_CHROME_BROWSER_PAYMENTS_PAYMENT_REQUEST_SELECTOR_VIEW_CONTROLLER_DATA_SOURCE_H_
+
+#import <Foundation/Foundation.h>
+
+#import "ios/chrome/browser/ui/collection_view/cells/collection_view_item.h"
+#import "ios/chrome/browser/ui/collection_view/collection_view_model.h"
+
+// These are the item types implementations of this protocol must use for the
+// header item and the selectable items respectively.
+const NSInteger kItemTypeHeaderItem = kItemTypeEnumZero;
gambard 2017/04/10 09:47:35 We usually prefer the type to be defined only in t
+const NSInteger kItemTypeSelectableItem = kItemTypeHeaderItem + 1;
+
+// The possible states the view controller can be in.
gambard 2017/04/10 09:47:35 I am not sure those are the states of the view con
Moe 2017/04/10 17:53:49 Done.
+typedef NS_ENUM(NSUInteger, PaymentRequestSelectorViewControllerState) {
+ // The view controller is in normal state.
+ PaymentRequestSelectorViewControllerStateNormal,
+ // The view controller is in pending state.
+ PaymentRequestSelectorViewControllerStatePending,
+ // The view controller is in error state.
+ PaymentRequestSelectorViewControllerStateError,
+};
+
+// The data source for the PaymentRequestSelectorViewController. The data
+// source provides the UI models for the PaymentRequestSelectorViewController
+// to display and keeps track of the selected UI model, if any.
+@protocol PaymentRequestSelectorViewControllerDataSource<NSObject>
+
+// The current state of the view controller.
+@property(nonatomic, assign) PaymentRequestSelectorViewControllerState state;
gambard 2017/04/10 09:47:35 I would mark them as readonly.
Moe 2017/04/10 17:53:50 Done.
+
+// Index for the currently selected item or NSUIntegerMax if there is none.
+@property(nonatomic, assign) NSUInteger selectedItemIndex;
+
+// The header item to display in the collection, if any.
+- (CollectionViewItem*)headerItem;
+
+// The selectable items to display in the collection.
+- (NSArray<CollectionViewItem*>*)selectableItems;
+
+// The selectable item at |index| in the collection.
+- (CollectionViewItem*)selectableItemAtIndex:(NSUInteger)index;
+
+// Title for the add button. if nil, no add button should be displayed.
+- (NSString*)addButtonTitle;
+
+@end
+
+#endif // IOS_CHROME_BROWSER_PAYMENTS_PAYMENT_REQUEST_SELECTOR_VIEW_CONTROLLER_DATA_SOURCE_H_

Powered by Google App Engine
This is Rietveld 408576698