1 // Copyright 2020 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.chrome.browser.omnibox;
6 
7 import androidx.annotation.IntDef;
8 
9 import java.lang.annotation.Retention;
10 import java.lang.annotation.RetentionPolicy;
11 
12 /** A means of tracking which mechanism is being used to focus the omnibox. */
13 @IntDef({OmniboxFocusReason.OMNIBOX_TAP, OmniboxFocusReason.OMNIBOX_LONG_PRESS,
14         OmniboxFocusReason.FAKE_BOX_TAP, OmniboxFocusReason.FAKE_BOX_LONG_PRESS,
15         OmniboxFocusReason.ACCELERATOR_TAP, OmniboxFocusReason.TAB_SWITCHER_OMNIBOX_TAP,
16         OmniboxFocusReason.TASKS_SURFACE_FAKE_BOX_TAP,
17         OmniboxFocusReason.TASKS_SURFACE_FAKE_BOX_LONG_PRESS,
18         OmniboxFocusReason.DEFAULT_WITH_HARDWARE_KEYBOARD, OmniboxFocusReason.SEARCH_QUERY,
19         OmniboxFocusReason.LAUNCH_NEW_INCOGNITO_TAB, OmniboxFocusReason.MENU_OR_KEYBOARD_ACTION,
20         OmniboxFocusReason.UNFOCUS, OmniboxFocusReason.QUERY_TILES_NTP_TAP})
21 @Retention(RetentionPolicy.SOURCE)
22 public @interface OmniboxFocusReason {
23     int OMNIBOX_TAP = 0;
24     int OMNIBOX_LONG_PRESS = 1;
25     int FAKE_BOX_TAP = 2;
26     int FAKE_BOX_LONG_PRESS = 3;
27     int ACCELERATOR_TAP = 4;
28     // TAB_SWITCHER_OMNIBOX_TAP has not been used anymore, keep it for record for now.
29     int TAB_SWITCHER_OMNIBOX_TAP = 5;
30     int TASKS_SURFACE_FAKE_BOX_TAP = 6;
31     int TASKS_SURFACE_FAKE_BOX_LONG_PRESS = 7;
32     int DEFAULT_WITH_HARDWARE_KEYBOARD = 8;
33     int SEARCH_QUERY = 9;
34     int LAUNCH_NEW_INCOGNITO_TAB = 10;
35     int MENU_OR_KEYBOARD_ACTION = 11;
36     int UNFOCUS = 12;
37     int QUERY_TILES_NTP_TAP = 13;
38     int NUM_ENTRIES = 14;
39 }
40