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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/contextualsearch/ContextualSearchPanel.java

Issue 1219133003: Contextual Search UI changes for custom tabs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: RTL support Created 5 years, 5 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/compositor/bottombar/contextualsearch/ContextualSearchPanel.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/contextualsearch/ContextualSearchPanel.java b/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/contextualsearch/ContextualSearchPanel.java
index 16b0ce0348d24201cc7586e16bee99558dd0d450..da1ef542196482ec3ea9243d03365d6c0b1a5670 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/contextualsearch/ContextualSearchPanel.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/contextualsearch/ContextualSearchPanel.java
@@ -7,7 +7,6 @@ package org.chromium.chrome.browser.compositor.bottombar.contextualsearch;
import android.content.Context;
import android.os.Handler;
-import org.chromium.chrome.browser.compositor.bottombar.contextualsearch.ContextualSearchPanel.StateChangeReason;
import org.chromium.chrome.browser.compositor.layouts.LayoutUpdateHost;
import org.chromium.chrome.browser.contextualsearch.ContextualSearchManagementDelegate;
@@ -48,7 +47,8 @@ public class ContextualSearchPanel extends ContextualSearchPanelAnimation
SWIPE,
FLING,
OPTIN,
- OPTOUT;
+ OPTOUT,
+ CLOSE_BUTTON;
}
/**
@@ -243,7 +243,11 @@ public class ContextualSearchPanel extends ContextualSearchPanelAnimation
} else if (isExpanded()) {
peekPanel(StateChangeReason.SEARCH_BAR_TAP);
} else if (isMaximized()) {
- mManagementDelegate.promoteToTab(true);
+ if (!isCloseIconVisible()) {
Theresa 2015/07/07 23:18:54 Check ContextualSearchPanelFeatures.isSearchTermRe
pedro (no code reviews) 2015/07/08 00:43:46 Yes.
Theresa 2015/07/08 21:04:59 Done.
+ mManagementDelegate.promoteToTab(true);
+ } else if (isCoordinateInsideCloseButton(x, y)) {
Theresa 2015/07/07 23:18:54 Check ContextualSearchPanelFeatures.isCloseButtonA
pedro (no code reviews) 2015/07/08 00:43:47 Exactly.
Theresa 2015/07/08 21:04:59 Done.
+ closePanel(StateChangeReason.CLOSE_BUTTON, true);
+ }
}
}
}
@@ -285,6 +289,17 @@ public class ContextualSearchPanel extends ContextualSearchPanelAnimation
}
/**
+ * @param x The x coordinate in dp.
+ * @param y The y coordinate in dp.
+ * @return Whether the given |x| |y| coordinate is inside the close button.
+ */
+ private boolean isCoordinateInsideCloseButton(float x, float y) {
+ boolean isInY = y >= getCloseIconY() && y <= (getCloseIconY() + getCloseIconWidth());
+ boolean isInX = x >= getCloseIconX() && x <= (getCloseIconX() + getCloseIconWidth());
+ return isInY && isInX;
+ }
+
+ /**
* @return Whether the Panel is in its expanded state.
*/
protected boolean isExpanded() {

Powered by Google App Engine
This is Rietveld 408576698