| 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..dd4d657720dd48ae23e0a466f5198f15f561292a
|
| --- /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;
|
| +const NSInteger kItemTypeSelectableItem = kItemTypeHeaderItem + 1;
|
| +
|
| +// 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*>*)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_
|
|
|