chromium/ios/chrome/browser/download/ui_bundled/pass_kit_coordinator.h

// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef IOS_CHROME_BROWSER_DOWNLOAD_UI_BUNDLED_PASS_KIT_COORDINATOR_H_
#define IOS_CHROME_BROWSER_DOWNLOAD_UI_BUNDLED_PASS_KIT_COORDINATOR_H_

#import <PassKit/PassKit.h>

#import "ios/chrome/browser/shared/coordinator/chrome_coordinator/chrome_coordinator.h"

// Key of the UMA Download.IOSPresentAddPassesDialogResult histogram. Exposed
// only for testing.
extern const char kUmaPresentAddPassesDialogResult[];

// Enum for the Download.IOSPresentAddPassesDialogResult UMA histogram
// to report the results of the add passes dialog presentation. The presentation
// can be successful or unsuccessful if another view controller is currently
// presented. Unsuccessful presentation is a bug and if the number of
// unsuccessful presentations is high, it means that Chrome has to queue the
// dialogs to present those dialogs for every downloaded pkpass (PassKit file).
// Currently Chrome simply ignores the download if the dialog is already
// presented. Exposed only for testing.
// Note: This enum is used to back an UMA histogram, and should be treated as
// append-only.
enum class PresentAddPassesDialogResult {
  // The dialog was sucessesfully presented.
  kSuccessful = 0,
  // The dialog cannot be presented, because another PKAddPassesViewController
  // is already presented.
  kAnotherAddPassesViewControllerIsPresented = 1,
  // The dialog cannot be presented, because another view controller is already
  // presented. Does not include items already counted in the more specific
  // bucket (kAnotherAddPassesViewControllerIsPresented).
  kAnotherViewControllerIsPresented = 2,
  kCount
};

// Coordinates presentation of "Add pkpass UI" and "failed to add pkpass UI".
@interface PassKitCoordinator : ChromeCoordinator

// If the PKPass is a valid pass, then the coordinator will present the "Add
// pkpass UI". Otherwise, the coordinator will present the "failed to add
// pkpass UI". Is set to null when the stop method is called.
@property(nonatomic) NSArray<PKPass*>* passes;

@end

#endif  // IOS_CHROME_BROWSER_DOWNLOAD_UI_BUNDLED_PASS_KIT_COORDINATOR_H_