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

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

Issue 2536223003: Refactor ContentViewClient (3/6) (Closed)
Patch Set: removed getDesiredMeasureSpec Created 4 years 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/OverlayPanelContent.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/OverlayPanelContent.java b/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/OverlayPanelContent.java
index f87b9849a850f895594cb76c04d912d8b4c0db92..0e0ec9a0d2f8ee1cc001a718c029478798d2102c 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/OverlayPanelContent.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/OverlayPanelContent.java
@@ -21,7 +21,6 @@ import org.chromium.components.navigation_interception.NavigationParams;
import org.chromium.components.web_contents_delegate_android.WebContentsDelegateAndroid;
import org.chromium.content.browser.ContentVideoViewEmbedder;
import org.chromium.content.browser.ContentView;
-import org.chromium.content.browser.ContentViewClient;
import org.chromium.content.browser.ContentViewCore;
import org.chromium.content_public.browser.LoadUrlParams;
import org.chromium.content_public.browser.WebContents;
@@ -72,9 +71,6 @@ public class OverlayPanelContent {
/** Whether the content view is currently being displayed. */
private boolean mIsContentViewShowing;
- /** The ContentViewCore responsible for displaying content. */
- private ContentViewClient mContentViewClient;
-
/** The observer used by this object to inform implementers of different events. */
private OverlayContentDelegate mContentDelegate;
@@ -88,6 +84,10 @@ public class OverlayPanelContent {
// java layer. Otherwise, the instance could be garbage-collected unexpectedly.
private InterceptNavigationDelegate mInterceptNavigationDelegate;
+ /** The desired size of the {@link ContentView} associated with this panel content. */
+ private int mContentViewWidth;
+ private int mContentViewHeight;
+
// ============================================================================================
// InterceptNavigationDelegateImpl
// ============================================================================================
@@ -199,6 +199,17 @@ public class OverlayPanelContent {
}
/**
+ * Set the desired size of the underlying {@link ContentView}. This is determined
+ * by the {@link OverlayPanel} before the creation of the content view.
+ * @param width The width of the content view.
+ * @param height The height of the content view.
+ */
+ void setContentViewSize(int width, int height) {
+ mContentViewWidth = width;
+ mContentViewHeight = height;
+ }
+
+ /**
* Makes the content visible, causing it to be rendered.
*/
public void showContent() {
@@ -228,13 +239,10 @@ public class OverlayPanelContent {
mContentViewCore = createContentViewCore(mActivity);
- if (mContentViewClient == null) {
- mContentViewClient = new ContentViewClient();
- }
-
- mContentViewCore.setContentViewClient(mContentViewClient);
-
ContentView cv = ContentView.createContentView(mActivity, mContentViewCore);
+ if (mContentViewWidth != 0 && mContentViewHeight != 0) {
+ cv.setDesiredSize(mContentViewWidth, mContentViewHeight);
+ }
// Creates an initially hidden WebContents which gets shown when the panel is opened.
WebContents panelWebContents = WebContentsFactory.createWebContents(false, true);
@@ -428,17 +436,6 @@ public class OverlayPanelContent {
}
/**
- * Set a ContentViewClient for this panel to use (will be reused for each new ContentViewCore).
- * @param viewClient The ContentViewClient to use.
- */
- public void setContentViewClient(ContentViewClient viewClient) {
- mContentViewClient = viewClient;
- if (mContentViewCore != null) {
- mContentViewCore.setContentViewClient(mContentViewClient);
- }
- }
-
- /**
* @return true if the ContentViewCore is visible on the page.
*/
public boolean isContentShowing() {

Powered by Google App Engine
This is Rietveld 408576698