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

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

Issue 2805273002: [Payment Request] Selector view controller (Closed)
Patch Set: Addressed comments 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..028d9e892c8dc263ba43d7799812ab4bfcf648ee
--- /dev/null
+++ b/ios/chrome/browser/payments/payment_request_selector_view_controller_data_source.h
@@ -0,0 +1,50 @@
+// 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/payments/cells/payments_has_accessory_type.h"
+#import "ios/chrome/browser/ui/collection_view/cells/collection_view_item.h"
+#import "ios/chrome/browser/ui/collection_view/collection_view_model.h"
+
+// The possible states the view controller can be in.
+typedef NS_ENUM(NSUInteger, PaymentRequestSelectorState) {
+ // The view controller is in normal state.
+ PaymentRequestSelectorStateNormal,
+ // The view controller is in pending state.
+ PaymentRequestSelectorStatePending,
+ // The view controller is in error state.
+ PaymentRequestSelectorStateError,
+};
+
+// 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, readonly) PaymentRequestSelectorState state;
+
+// Index for the currently selected item or NSUIntegerMax if there is none.
+@property(nonatomic, readonly) NSUInteger selectedItemIndex;
+
+// The header item to display in the collection, if any.
+- (CollectionViewItem*)headerItem;
+
+// The selectable items to display in the collection.
+- (NSArray<CollectionViewItem<PaymentsHasAccessoryType>*>*)selectableItems;
+
+// The selectable item at |index| in the collection.
+- (CollectionViewItem<PaymentsHasAccessoryType>*)selectableItemAtIndex:
+ (NSUInteger)index;
+
+// The "Add" button item, if any.
+- (CollectionViewItem*)addButtonItem;
+
+@end
+
+#endif // IOS_CHROME_BROWSER_PAYMENTS_PAYMENT_REQUEST_SELECTOR_VIEW_CONTROLLER_DATA_SOURCE_H_

Powered by Google App Engine
This is Rietveld 408576698