1 // Copyright 2019 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.toolbar.top;
6 
7 import android.graphics.drawable.Drawable;
8 import android.view.View;
9 
10 import org.chromium.chrome.browser.tabmodel.IncognitoStateProvider;
11 import org.chromium.ui.modelutil.PropertyKey;
12 import org.chromium.ui.modelutil.PropertyModel;
13 
14 /** List of the start surface toolbar properties. */
15 class StartSurfaceToolbarProperties {
StartSurfaceToolbarProperties()16     private StartSurfaceToolbarProperties() {}
17 
18     public static final PropertyModel
19             .WritableObjectPropertyKey<IncognitoStateProvider> INCOGNITO_STATE_PROVIDER =
20             new PropertyModel.WritableObjectPropertyKey<IncognitoStateProvider>();
21     public static final PropertyModel
22             .WritableObjectPropertyKey<View.OnClickListener> NEW_TAB_CLICK_HANDLER =
23             new PropertyModel.WritableObjectPropertyKey<View.OnClickListener>();
24     public static final PropertyModel
25             .WritableObjectPropertyKey<View.OnClickListener> IDENTITY_DISC_CLICK_HANDLER =
26             new PropertyModel.WritableObjectPropertyKey<View.OnClickListener>();
27     public static final PropertyModel.WritableObjectPropertyKey<Drawable> IDENTITY_DISC_IMAGE =
28             new PropertyModel.WritableObjectPropertyKey<Drawable>(false);
29     public static final PropertyModel.WritableIntPropertyKey IDENTITY_DISC_DESCRIPTION =
30             new PropertyModel.WritableIntPropertyKey();
31     public static final PropertyModel.WritableBooleanPropertyKey IDENTITY_DISC_IS_VISIBLE =
32             new PropertyModel.WritableBooleanPropertyKey();
33     public static final PropertyModel.WritableBooleanPropertyKey IS_VISIBLE =
34             new PropertyModel.WritableBooleanPropertyKey();
35     public static final PropertyModel.WritableBooleanPropertyKey IN_START_SURFACE_MODE =
36             new PropertyModel.WritableBooleanPropertyKey();
37     public static final PropertyModel.WritableBooleanPropertyKey LOGO_IS_VISIBLE =
38             new PropertyModel.WritableBooleanPropertyKey();
39     public static final PropertyModel.WritableBooleanPropertyKey IS_INCOGNITO =
40             new PropertyModel.WritableBooleanPropertyKey();
41     public static final PropertyModel.WritableBooleanPropertyKey ACCESSIBILITY_ENABLED =
42             new PropertyModel.WritableBooleanPropertyKey();
43     public static final PropertyModel.WritableBooleanPropertyKey MENU_IS_VISIBLE =
44             new PropertyModel.WritableBooleanPropertyKey();
45     public static final PropertyModel.WritableBooleanPropertyKey NEW_TAB_BUTTON_IS_VISIBLE =
46             new PropertyModel.WritableBooleanPropertyKey();
47     public static final PropertyModel.WritableBooleanPropertyKey BUTTONS_CLICKABLE =
48             new PropertyModel.WritableBooleanPropertyKey();
49     public static final PropertyModel.WritableBooleanPropertyKey NEW_TAB_BUTTON_HIGHLIGHT =
50             new PropertyModel.WritableBooleanPropertyKey();
51 
52     /** When set to true, move identity disc to the start of the toolbar. Can only set to true. */
53     public static final PropertyModel.WritableBooleanPropertyKey IDENTITY_DISC_AT_START =
54             new PropertyModel.WritableBooleanPropertyKey();
55 
56     /**
57      * This is a hacky workaround for {@link IncognitoSwitchProperties#IS_VISIBLE}.
58      * TODO(crbug.com/1042997): control the visibility through IncognitoSwitchCoordinator.
59      */
60     public static final PropertyModel.WritableObjectPropertyKey INCOGNITO_SWITCHER_VISIBLE =
61             new PropertyModel.WritableObjectPropertyKey(true);
62     /**
63      * When set to true, move New Tab Button to the start of the toolbar, and move the Incognito
64      * switcher to the center. Can only set to true.
65      */
66     public static final PropertyModel.WritableBooleanPropertyKey NEW_TAB_BUTTON_AT_START =
67             new PropertyModel.WritableBooleanPropertyKey();
68 
69     public static final PropertyModel.WritableFloatPropertyKey TRANSLATION_Y =
70             new PropertyModel.WritableFloatPropertyKey();
71 
72     public static final PropertyKey[] ALL_KEYS =
73             new PropertyKey[] {NEW_TAB_CLICK_HANDLER, IS_VISIBLE, LOGO_IS_VISIBLE, IS_INCOGNITO,
74                     INCOGNITO_STATE_PROVIDER, ACCESSIBILITY_ENABLED, MENU_IS_VISIBLE,
75                     NEW_TAB_BUTTON_IS_VISIBLE, BUTTONS_CLICKABLE, IDENTITY_DISC_AT_START,
76                     INCOGNITO_SWITCHER_VISIBLE, NEW_TAB_BUTTON_AT_START, IDENTITY_DISC_IS_VISIBLE,
77                     IDENTITY_DISC_CLICK_HANDLER, IDENTITY_DISC_IMAGE, IDENTITY_DISC_DESCRIPTION,
78                     IN_START_SURFACE_MODE, NEW_TAB_BUTTON_HIGHLIGHT, TRANSLATION_Y};
79 }
80