Index: chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchManager.java |
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchManager.java b/chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchManager.java |
index 2a9088717c3690c14b6d753183becf8d4c322422..8f1080e20857067d6956c8d0fb45d368d4644cda 100644 |
--- a/chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchManager.java |
+++ b/chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchManager.java |
@@ -7,6 +7,7 @@ package org.chromium.chrome.browser.contextualsearch; |
import android.app.Activity; |
import android.os.Handler; |
import android.view.View; |
+import android.view.View.MeasureSpec; |
import android.view.ViewGroup; |
import android.view.ViewTreeObserver; |
import android.view.ViewTreeObserver.OnGlobalFocusChangeListener; |
@@ -44,6 +45,7 @@ import org.chromium.components.navigation_interception.InterceptNavigationDelega |
import org.chromium.components.navigation_interception.NavigationParams; |
import org.chromium.components.web_contents_delegate_android.WebContentsDelegateAndroid; |
import org.chromium.content.browser.ContentView; |
+import org.chromium.content.browser.ContentViewClient; |
import org.chromium.content.browser.ContentViewCore; |
import org.chromium.content.browser.ContextualSearchClient; |
import org.chromium.content_public.browser.GestureStateListener; |
@@ -849,6 +851,22 @@ public class ContextualSearchManager extends ContextualSearchObservable |
} |
mSearchContentViewCore = new ContentViewCore(mActivity); |
+ |
+ // Adds a ContentViewClient to override the default fullscreen size. |
+ mSearchContentViewCore.setContentViewClient(new ContentViewClient() { |
+ @Override |
+ public int getDesiredWidthMeasureSpec() { |
+ return MeasureSpec.makeMeasureSpec( |
+ mSearchPanelDelegate.getMaximumWidthPx(), MeasureSpec.EXACTLY); |
+ } |
+ |
+ @Override |
+ public int getDesiredHeightMeasureSpec() { |
+ return MeasureSpec.makeMeasureSpec( |
+ mSearchPanelDelegate.getMaximumHeightPx(), MeasureSpec.EXACTLY); |
David Trainor- moved to gerrit
2015/07/14 23:12:01
Just to confirm, this only means the search conten
pedro (no code reviews)
2015/07/15 00:19:16
To be clear, we we're returning the full size, inc
|
+ } |
+ }); |
+ |
ContentView cv = new ContentView(mActivity, mSearchContentViewCore); |
// Creates an initially hidden WebContents which gets shown when the panel is opened. |
mSearchContentViewCore.initialize(cv, cv, |
@@ -940,6 +958,14 @@ public class ContextualSearchManager extends ContextualSearchObservable |
* @param url The URL we are navigating to. |
*/ |
private void onExternalNavigation(String url) { |
+ // TODO(pedrosimonetti, aurimas): different values might be needed for small panel. |
+ // For now we consider the ContentView height to be fullscreen, and inform the system |
+ // that the Toolbar is always visible (from the Compositor's perspective), even though |
+ // the Toolbar and Base Page might be offset outside the screen. This means the rendere |
donnd
2015/07/14 22:24:13
typo (rendere)
pedro (no code reviews)
2015/07/15 00:19:16
Done.
|
+ // will consider the ContentView height to be the fullscreen height minus the Toolbar |
David Trainor- moved to gerrit
2015/07/14 23:12:00
This might be fixed if setting the height in getDe
pedro (no code reviews)
2015/07/15 00:19:17
We are doing that now for the non-fullscreen case
|
+ // height. |
+ mSearchContentViewCore.getWebContents().updateTopControlsState(false, true, false); |
+ |
if (!mDidPromoteSearchNavigation |
&& !BLACKLISTED_URL.equals(url) |
&& !url.startsWith(INTENT_URL_PREFIX) |