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

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

Issue 1614513002: Refactor Contextual Search base classes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more renaming Created 4 years, 11 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/OverlayPanelBase.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/contextualsearch/ContextualSearchPanelBase.java b/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/OverlayPanelBase.java
similarity index 96%
rename from chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/contextualsearch/ContextualSearchPanelBase.java
rename to chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/OverlayPanelBase.java
index 169332824bae784ed7d1dcc4511d5cbd5481f7d3..d343fa81fdd084c84002da020a7a267eb72244c7 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/contextualsearch/ContextualSearchPanelBase.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/OverlayPanelBase.java
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-package org.chromium.chrome.browser.compositor.bottombar.contextualsearch;
+package org.chromium.chrome.browser.compositor.bottombar;
import android.content.Context;
import android.graphics.Color;
@@ -16,6 +16,7 @@ import org.chromium.base.VisibleForTesting;
import org.chromium.chrome.R;
import org.chromium.chrome.browser.compositor.bottombar.OverlayPanel.PanelState;
import org.chromium.chrome.browser.compositor.bottombar.OverlayPanel.StateChangeReason;
+import org.chromium.chrome.browser.compositor.bottombar.contextualsearch.ContextualSearchOptOutPromo;
import org.chromium.chrome.browser.compositor.bottombar.contextualsearch.ContextualSearchOptOutPromo.ContextualSearchPromoHost;
import org.chromium.chrome.browser.preferences.PreferencesLauncher;
import org.chromium.chrome.browser.preferences.privacy.ContextualSearchPreferenceFragment;
@@ -28,9 +29,9 @@ import java.util.HashMap;
import java.util.Map;
/**
- * Base abstract class for the Contextual Search Panel.
+ * Base abstract class for the Overlay Panel.
*/
-abstract class ContextualSearchPanelBase implements ContextualSearchPromoHost {
+abstract class OverlayPanelBase implements ContextualSearchPromoHost {
Donn Denman 2016/01/20 23:59:39 This seems strange: that something as general as t
mdjones 2016/01/21 00:14:09 Yeah, there are still quite a few things that need
/**
* The side padding of Search Bar icons in dps.
*/
@@ -173,7 +174,7 @@ abstract class ContextualSearchPanelBase implements ContextualSearchPromoHost {
protected final Context mContext;
/**
- * The current state of the Contextual Search Panel.
+ * The current state of the Overlay Panel.
*/
private PanelState mPanelState = PanelState.UNDEFINED;
@@ -197,7 +198,7 @@ abstract class ContextualSearchPanelBase implements ContextualSearchPromoHost {
/**
* @param context The current Android {@link Context}.
*/
- public ContextualSearchPanelBase(Context context) {
+ public OverlayPanelBase(Context context) {
mContext = context;
}
@@ -206,7 +207,7 @@ abstract class ContextualSearchPanelBase implements ContextualSearchPromoHost {
// ============================================================================================
/**
- * Animates the Contextual Search Panel to its closed state.
+ * Animates the Overlay Panel to its closed state.
* @param reason The reason for the change of panel state.
* @param animate If the panel should animate closed.
*/
@@ -239,7 +240,7 @@ abstract class ContextualSearchPanelBase implements ContextualSearchPromoHost {
protected abstract float getTopControlsOffsetDp();
// ============================================================================================
- // General methods from Contextual Search Manager
+ // General methods from requiring an Activity
Theresa 2016/01/21 00:39:02 The previous comment doesn't make sense (since thi
mdjones 2016/01/21 02:30:14 Done.
// ============================================================================================
/**
@@ -325,7 +326,7 @@ abstract class ContextualSearchPanelBase implements ContextualSearchPromoHost {
}
/**
- * @return The current width of the Contextual Search Panel.
+ * @return The current width of the Overlay Panel.
*/
protected float calculateSearchPanelWidth() {
Theresa 2016/01/21 00:39:02 rename to calculateOverlayPanelWidth?
mdjones 2016/01/21 02:30:14 Done.
return isFullscreenSizePanel() ? getFullscreenWidth() : SMALL_PANEL_WIDTH_DP;
@@ -387,21 +388,21 @@ abstract class ContextualSearchPanelBase implements ContextualSearchPromoHost {
}
/**
- * @return The maximum height of the Contextual Search Panel in dps.
+ * @return The maximum height of the Overlay Panel in dps.
*/
public float getMaximumHeight() {
return mMaximumHeight;
}
/**
- * @return The maximum width of the Contextual Search Panel in pixels.
+ * @return The maximum width of the Overlay Panel in pixels.
*/
public int getMaximumWidthPx() {
return Math.round(mMaximumWidth / mPxToDp);
}
/**
- * @return The maximum height of the Contextual Search Panel in pixels.
+ * @return The maximum height of the Overlay Panel in pixels.
*/
public int getMaximumHeightPx() {
return Math.round(mMaximumHeight / mPxToDp);
@@ -442,7 +443,7 @@ abstract class ContextualSearchPanelBase implements ContextualSearchPromoHost {
// --------------------------------------------------------------------------------------------
/**
- * @param height The height of the Contextual Search Panel to be set.
+ * @param height The height of the Overlay Panel to be set.
*/
@VisibleForTesting
public void setHeightForTesting(float height) {
@@ -450,7 +451,7 @@ abstract class ContextualSearchPanelBase implements ContextualSearchPromoHost {
}
/**
- * @param offsetY The vertical offset of the Contextual Search Panel to be
+ * @param offsetY The vertical offset of the Overlay Panel to be
* set.
*/
@VisibleForTesting
@@ -468,7 +469,7 @@ abstract class ContextualSearchPanelBase implements ContextualSearchPromoHost {
}
/**
- * @param searchBarHeight The height of the Contextual Search Bar to be set.
+ * @param searchBarHeight The height of the Overlay Bar to be set.
*/
@VisibleForTesting
public void setSearchBarHeightForTesting(float searchBarHeight) {
Theresa 2016/01/21 00:39:02 Ideally this method & param would get renamed to s
mdjones 2016/01/21 02:30:14 Done.
@@ -485,7 +486,7 @@ abstract class ContextualSearchPanelBase implements ContextualSearchPromoHost {
}
// --------------------------------------------------------------------------------------------
- // Contextual Search Panel states
+ // Overlay Panel states
// --------------------------------------------------------------------------------------------
private float mOffsetX;
@@ -494,28 +495,28 @@ abstract class ContextualSearchPanelBase implements ContextualSearchPromoHost {
private boolean mIsMaximized;
/**
- * @return The vertical offset of the Contextual Search Panel.
+ * @return The vertical offset of the Overlay Panel.
*/
public float getOffsetX() {
return mOffsetX;
}
/**
- * @return The vertical offset of the Contextual Search Panel.
+ * @return The vertical offset of the Overlay Panel.
*/
public float getOffsetY() {
return mOffsetY;
}
/**
- * @return The width of the Contextual Search Panel in dps.
+ * @return The width of the Overlay Panel in dps.
*/
public float getWidth() {
return mMaximumWidth;
}
/**
- * @return The height of the Contextual Search Panel in dps.
+ * @return The height of the Overlay Panel in dps.
*/
public float getHeight() {
return mHeight;
@@ -529,7 +530,7 @@ abstract class ContextualSearchPanelBase implements ContextualSearchPromoHost {
}
// --------------------------------------------------------------------------------------------
- // Contextual Search Bar states
+ // Panel Bar states
// --------------------------------------------------------------------------------------------
private float mSearchBarMarginSide;
private float mSearchBarHeight;
@@ -545,14 +546,14 @@ abstract class ContextualSearchPanelBase implements ContextualSearchPromoHost {
private float mCloseIconWidth;
/**
- * @return The side margin of the Contextual Search Bar.
+ * @return The side margin of the Bar.
*/
public float getSearchBarMarginSide() {
return mSearchBarMarginSide;
}
/**
- * @return The height of the Contextual Search Bar.
+ * @return The height of the Bar.
*/
public float getSearchBarHeight() {
return mSearchBarHeight;
@@ -831,7 +832,7 @@ abstract class ContextualSearchPanelBase implements ContextualSearchPromoHost {
getControlContainerHeightResource()) * mPxToDp;
mSearchBarHeightPeeking = mContext.getResources().getDimension(
- R.dimen.contextual_search_bar_height) * mPxToDp;
+ R.dimen.overlay_panel_bar_height) * mPxToDp;
mSearchBarHeightMaximized = mContext.getResources().getDimension(
R.dimen.toolbar_height_no_shadow) * mPxToDp;
mSearchBarHeightExpanded =
@@ -951,7 +952,7 @@ abstract class ContextualSearchPanelBase implements ContextualSearchPromoHost {
/**
* Updates the UI state for a given |height|.
*
- * @param height The Contextual Search Panel height.
+ * @param height The Overlay Panel height.
*/
private void updatePanelForHeight(float height) {
PanelState endState = findLargestPanelStateFromHeight(height);
@@ -972,7 +973,7 @@ abstract class ContextualSearchPanelBase implements ContextualSearchPromoHost {
/**
* Updates the Panel size information.
*
- * @param height The Contextual Search Panel height.
+ * @param height The Overlay Panel height.
* @param endState The final state of transition being executed.
* @param percentage The completion percentage of the transition.
*/
@@ -1015,12 +1016,11 @@ abstract class ContextualSearchPanelBase implements ContextualSearchPromoHost {
}
/**
- * Gets the state completion percentage, taking into consideration the
- * |height| of the Contextual Search Panel, and the initial and final
- * states. A completion of 0 means the Panel is in the initial state and a
- * completion of 1 means the Panel is in the final state.
+ * Gets the state completion percentage, taking into consideration the |height| of the Overlay
+ * Panel, and the initial and final states. A completion of 0 means the Panel is in the initial
+ * state and a completion of 1 means the Panel is in the final state.
*
- * @param height The height of the Contextual Search Panel.
+ * @param height The height of the Overlay Panel.
* @param startState The initial state of the Panel.
* @param endState The final state of the Panel.
* @return The completion percentage.

Powered by Google App Engine
This is Rietveld 408576698