Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(111)

Side by Side Diff: chrome/android/java_staging/src/org/chromium/chrome/browser/toolbar/Toolbar.java

Issue 1141283003: Upstream oodles of Chrome for Android code into Chromium. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: final patch? Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2015 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;
6
7 import android.graphics.Bitmap;
8 import android.graphics.Rect;
9 import android.view.View;
10 import android.view.View.OnClickListener;
11
12 import org.chromium.chrome.browser.appmenu.AppMenuButtonHelper;
13 import org.chromium.chrome.browser.compositor.Invalidator;
14 import org.chromium.chrome.browser.omnibox.LocationBar;
15
16 /**
17 * An interface for other classes to interact with Toolbar Layout. Other than fo r testing purposes
18 * this interface should be used rather than {@link ToolbarLayout} and extending classes.
19 */
20 public interface Toolbar {
21
22 /**
23 * Initialize the external dependencies required for view interaction.
24 * @param toolbarDataProvider The provider for toolbar data.
25 * @param tabController The controller that handles interactions with the tab.
26 * @param appMenuButtonHelper The helper for managing menu button interactio ns.
27 */
28 void initialize(ToolbarDataProvider toolbarDataProvider,
29 ToolbarTabController tabController, AppMenuButtonHelper appMenuButto nHelper);
30
31 /**
32 * Sets the {@link Invalidator} that will be called when the toolbar attempt s to invalidate the
33 * drawing surface. This will give the object that registers as the host fo r the
34 * {@link Invalidator} a chance to defer the actual invalidate to sync drawi ng.
35 * @param invalidator An {@link Invalidator} instance.
36 */
37 void setPaintInvalidator(Invalidator invalidator);
38
39 /**
40 * Adds a custom action button to the {@link Toolbar} if it is supported.
41 * @param buttonSource The {@link Bitmap} resource to use as the source for the button.
42 * @param listener The {@link OnClickListener} to use for clicks to the butt on.
43 */
44 void addCustomActionButton(Bitmap buttonSource, OnClickListener listener);
45
46 /**
47 * Sets the OnClickListener that will be notified when the TabSwitcher butto n is pressed.
48 * @param listener The callback that will be notified when the TabSwitcher b utton is pressed.
49 */
50 void setOnTabSwitcherClickHandler(OnClickListener listener);
51
52 /**
53 * Sets the OnClickListener that will be notified when the New Tab button is pressed.
54 * @param listener The callback that will be notified when the New Tab butto n is pressed.
55 */
56 void setOnNewTabClickHandler(OnClickListener listener);
57
58 /**
59 * Sets the OnClickListener that will be notified when the bookmark button i s pressed.
60 * @param listener The callback that will be notified when the bookmark butt on is pressed.
61 */
62 void setBookmarkClickHandler(OnClickListener listener);
63
64 /**
65 * Sets the OnClickListener to notify when the back button is pressed in hos ted mode.
66 * @param listener The callback that will be notified when the back button i s pressed.
67 */
68 void setHostedBackClickHandler(OnClickListener listener);
69
70 /**
71 * Calculates the {@link Rect} that represents the content area of the locat ion bar. This
72 * rect will be relative to the toolbar.
73 * @param outRect The Rect that represents the content area of the location bar.
74 */
75 void getLocationBarContentRect(Rect outRect);
76
77 /**
78 * @return Whether any swipe gestures should be ignored for the current Tool bar state.
79 */
80 boolean shouldIgnoreSwipeGesture();
81
82 /**
83 * Returns the elapsed realtime in ms of the time at which first draw for th e toolbar occurred.
84 */
85 long getFirstDrawTime();
86
87 /**
88 * Finish any toolbar animations.
89 */
90 void finishAnimations();
91
92 /**
93 * @return {@link LocationBar} object this {@link Toolbar} contains.
94 */
95 LocationBar getLocationBar();
96
97 // TODO(yusufo): Move the below calls to a separate interface about texture capture.
98 /**
99 * Calculate the relative position wrt to the given container view.
100 * @param containerView The container view to be used.
101 * @param position The position array to be used for returning the calculate d position.
102 */
103 void getPositionRelativeToContainer(View containerView, int[] position);
104
105 /**
106 * Sets whether or not the toolbar should draw as if it's being captured for a snapshot
107 * texture. In this mode it will only draw the toolbar in it's normal state (no TabSwitcher
108 * or animations).
109 * @param textureMode Whether or not to be in texture capture mode.
110 */
111 void setTextureCaptureMode(boolean textureMode);
112
113 /**
114 * @return Whether a dirty check for invalidation makes sense at this time.
115 */
116 boolean isReadyForTextureCapture();
117 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698