1 // Copyright 2018 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 package org.chromium.ui.modaldialog; 6 7 import androidx.annotation.IntDef; 8 9 import java.lang.annotation.Retention; 10 import java.lang.annotation.RetentionPolicy; 11 12 @IntDef({DialogDismissalCause.UNKNOWN, DialogDismissalCause.POSITIVE_BUTTON_CLICKED, 13 DialogDismissalCause.NEGATIVE_BUTTON_CLICKED, DialogDismissalCause.ACTION_ON_CONTENT, 14 DialogDismissalCause.DISMISSED_BY_NATIVE, 15 DialogDismissalCause.NAVIGATE_BACK_OR_TOUCH_OUTSIDE, DialogDismissalCause.TAB_SWITCHED, 16 DialogDismissalCause.TAB_DESTROYED, DialogDismissalCause.ACTIVITY_DESTROYED, 17 DialogDismissalCause.NOT_ATTACHED_TO_WINDOW, DialogDismissalCause.NAVIGATE}) 18 @Retention(RetentionPolicy.SOURCE) 19 public @interface DialogDismissalCause { 20 // Please do not remove or change the order of the existing values, and add new value at the end 21 // of the enum. Dismissal causes that are fully controlled by clients (i.e. are not used inside 22 // the dialog manager or the dialog presenters) are marked "Controlled by client" on comments. 23 24 /** No specified reason for the dialog dismissal. */ 25 int UNKNOWN = 0; 26 /** Controlled by client: Positive button (e.g. OK button) is clicked by the user. */ 27 int POSITIVE_BUTTON_CLICKED = 1; 28 /** Controlled by client: Negative button (e.g. Cancel button) is clicked by the user. */ 29 int NEGATIVE_BUTTON_CLICKED = 2; 30 /** Controlled by client: Action taken on the dialog content triggers the dialog dismissal. */ 31 int ACTION_ON_CONTENT = 3; 32 /** Controlled by client: Dialog is dismissed by native c++ objects. */ 33 int DISMISSED_BY_NATIVE = 4; 34 /** User clicks the navigate back button or touches the scrim outside the dialog. */ 35 int NAVIGATE_BACK_OR_TOUCH_OUTSIDE = 5; 36 /** User switches away the tab associated with the dialog. */ 37 int TAB_SWITCHED = 6; 38 /** The Tab associated with the dialog is destroyed. */ 39 int TAB_DESTROYED = 7; 40 /** The activity associated with the dialog is destroyed. */ 41 int ACTIVITY_DESTROYED = 8; 42 /** The content view of the activity associated with the dialog is not attached to window. */ 43 int NOT_ATTACHED_TO_WINDOW = 9; 44 /** User has navigated, e.g. by typing a URL in the location bar. */ 45 int NAVIGATE = 10; 46 } 47