- add sources.
[platform/framework/web/crosswalk.git] / src / chrome / android / java / src / org / chromium / chrome / browser / infobar / InfoBarView.java
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.
4
5 package org.chromium.chrome.browser.infobar;
6
7 import android.content.Context;
8
9 /**
10  * Functions needed to display an InfoBar UI.
11  */
12 public interface InfoBarView {
13     /**
14      * Prepare the InfoBar for display and adding InfoBar-specific controls to the layout.
15      * @param layout Layout containing all of the controls.
16      */
17     public void createContent(InfoBarLayout layout);
18
19     /**
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.
23      */
24     public CharSequence getMessageText(Context context);
25
26     /**
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.
31      */
32     public String getPrimaryButtonText(Context context);
33
34     /**
35      * Returns text to display on the secondary button, typically indicating that some action will
36      * not be taken.
37      *
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.
40      *
41      * @param context Context to pull the string from.
42      * @return The string to display.
43      */
44     public String getSecondaryButtonText(Context context);
45
46     /**
47      * Take some action related to the link being clicked.
48      */
49     public void onLinkClicked();
50
51     /**
52      * Take some action related to the close button being clicked.
53      */
54     public void onCloseButtonClicked();
55
56     /**
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.
59      */
60     public void onButtonClicked(boolean isPrimaryButton);
61
62     /**
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.
65      */
66     public void setControlsEnabled(boolean state);
67 }