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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/infobar/InfoBarControlLayout.java

Issue 2019573002: Permissions: Allow control of individual requests in media permission infobars (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Bracket nit Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: chrome/android/java/src/org/chromium/chrome/browser/infobar/InfoBarControlLayout.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/infobar/InfoBarControlLayout.java b/chrome/android/java/src/org/chromium/chrome/browser/infobar/InfoBarControlLayout.java
index 49aaf9b518c8899d3986287d84d622677b112a95..93a585e750556d5ff699316283c5b3b561615864 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/infobar/InfoBarControlLayout.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/infobar/InfoBarControlLayout.java
@@ -273,12 +273,12 @@ public final class InfoBarControlLayout extends ViewGroup {
* If an icon is not provided, the ImageView that would normally show it is hidden.
*
* @param iconResourceId ID of the drawable to use for the icon.
+ * @param iconColorId ID of the tint color for the icon, or 0 for default.
* @param primaryMessage Message to display for the toggle.
* @param secondaryMessage Additional descriptive text for the toggle. May be null.
- * @param iconColorId ID of the tint color for the icon, or 0 for default.
*/
- public View addIcon(int iconResourceId, CharSequence primaryMessage,
- CharSequence secondaryMessage, int iconColorId) {
+ public View addIcon(int iconResourceId, int iconColorId, CharSequence primaryMessage,
+ CharSequence secondaryMessage) {
LinearLayout layout = (LinearLayout) LayoutInflater.from(getContext()).inflate(
R.layout.infobar_control_icon_with_description, this, false);
addView(layout, new ControlLayoutParams());
@@ -314,12 +314,13 @@ public final class InfoBarControlLayout extends ViewGroup {
* If an icon is not provided, the ImageView that would normally show it is hidden.
*
* @param iconResourceId ID of the drawable to use for the icon, or 0 to hide the ImageView.
+ * @param iconColorId ID of the tint color for the icon, or 0 for default.
* @param toggleMessage Message to display for the toggle.
* @param toggleId ID to use for the toggle.
* @param isChecked Whether the toggle should start off checked.
*/
- public View addSwitch(
- int iconResourceId, CharSequence toggleMessage, int toggleId, boolean isChecked) {
+ public View addSwitch(int iconResourceId, int iconColorId, CharSequence toggleMessage,
+ int toggleId, boolean isChecked) {
LinearLayout switchLayout = (LinearLayout) LayoutInflater.from(getContext()).inflate(
R.layout.infobar_control_toggle, this, false);
addView(switchLayout, new ControlLayoutParams());
@@ -329,6 +330,10 @@ public final class InfoBarControlLayout extends ViewGroup {
switchLayout.removeView(iconView);
} else {
iconView.setImageResource(iconResourceId);
+ if (iconColorId != 0) {
+ iconView.setColorFilter(
+ ApiCompatibilityUtils.getColor(getResources(), iconColorId));
+ }
}
TextView messageView = (TextView) switchLayout.findViewById(R.id.control_message);

Powered by Google App Engine
This is Rietveld 408576698