1 // Copyright 2013 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.
5 package org.chromium.chrome.browser.infobar;
7 import android.content.Context;
10 * Functions needed to display an InfoBar UI.
12 public interface InfoBarView {
14 * Prepare the InfoBar for display and adding InfoBar-specific controls to the layout.
15 * @param layout Layout containing all of the controls.
17 public void createContent(InfoBarLayout layout);
20 * Returns the message indicating what the InfoBar is informing or asking the user about.
21 * @param context Context to pull the string from.
22 * @return The string to display.
24 public CharSequence getMessageText(Context context);
27 * Returns text to display on the primary button indicating that some action will be taken.
28 * Setting this to null prevents the button from being created.
29 * @param context Context to pull the string from.
30 * @return The string to display.
32 public String getPrimaryButtonText(Context context);
35 * Returns text to display on the secondary button, typically indicating that some action will
38 * Example text includes "Cancel" or "Nope". Setting this to null prevents the button from
39 * being created. It is illegal to have a secondary button without a primary button.
41 * @param context Context to pull the string from.
42 * @return The string to display.
44 public String getSecondaryButtonText(Context context);
47 * Take some action related to the link being clicked.
49 public void onLinkClicked();
52 * Take some action related to the close button being clicked.
54 public void onCloseButtonClicked();
57 * Performs some action related to either the primary or secondary button being pressed.
58 * @param isPrimaryButton True if the primary button was clicked, false otherwise.
60 public void onButtonClicked(boolean isPrimaryButton);
63 * Sets whether or not controls for this View should be clickable.
64 * @param state If set to false, controls cannot be clicked and will be grayed out.
66 public void setControlsEnabled(boolean state);