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

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

Issue 1360873002: [Contextual Search] Prevents Panel from becoming blank if opened before resolving. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixing broken testswq Created 5 years, 3 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 bb71812ebb363c787e1bac3f578867f69c8f725e..988ecb2b0e68f2ca19d25d1188a852f89b937f11 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
@@ -455,11 +455,13 @@ public class ContextualSearchPanel extends ContextualSearchPanelAnimation
@Override
public void createNewContentView() {
- // TODO(mdjones): This should not be a public API.
- if (mContentViewCore != null) {
- mContentController.destroyContentView();
+ // If the ContentViewCore has already been created, but never used,
+ // then there's no need to create a new one.
+ if (mContentViewCore != null && !mDidLoadAnyUrl) {
+ return;
}
+ mContentController.destroyContentView();
mContentViewCore = new ContentViewCore(mActivity);
// Adds a ContentViewClient to override the default fullscreen size.
@@ -538,6 +540,8 @@ public class ContextualSearchPanel extends ContextualSearchPanelAnimation
mWebContentsObserver.destroy();
mWebContentsObserver = null;
}
+
+ getManagementDelegate().onContentViewDestroyed();
}
// This should be called last here. The setSearchContentViewVisibility method
@@ -546,15 +550,17 @@ public class ContextualSearchPanel extends ContextualSearchPanelAnimation
// the SearchContentView, it will be faster, because only the internal property
// will be changed, since there will be no need to change the visibility of the
// SearchContentView.
+ //
+ // Also, this should be called outside the block above because tests will not
+ // create a ContentView, therefore if this call is placed inside the block,
+ // it will not be called on tests, which will cause some tests to fail.
setSearchContentViewVisibility(false);
-
- getManagementDelegate().onContentViewDestroyed();
}
@Override
public void loadUrl(String url) {
- mContentController.destroyContentView();
createNewPanelContentView();
+
if (mContentViewCore != null && mContentViewCore.getWebContents() != null) {
mDidLoadAnyUrl = true;
mContentViewCore.getWebContents().getNavigationController().loadUrl(
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698