Commit bb15587b authored by Donn Denman's avatar Donn Denman Committed by Commit Bot

[TTS] Cleanup in ContextualSearchManager.java.

Minor cleanup of stale TODOs and other cruft in
ContextualSearchManager.java.

BUG=635567, 607127

Change-Id: If71b43ef07f0e2aaaa581b9481765b6ae551d315
Reviewed-on: https://chromium-review.googlesource.com/1100976Reviewed-by: default avatarMatthew Jones <mdjones@chromium.org>
Commit-Queue: Donn Denman <donnd@chromium.org>
Cr-Commit-Position: refs/heads/master@{#567486}
parent 375da054
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
package org.chromium.chrome.browser.contextualsearch; package org.chromium.chrome.browser.contextualsearch;
import android.annotation.SuppressLint;
import android.os.Handler; import android.os.Handler;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.text.TextUtils; import android.text.TextUtils;
...@@ -140,7 +139,6 @@ public class ContextualSearchManager ...@@ -140,7 +139,6 @@ public class ContextualSearchManager
private boolean mDidStartLoadingResolvedSearchRequest; private boolean mDidStartLoadingResolvedSearchRequest;
private long mLoadedSearchUrlTimeMs; private long mLoadedSearchUrlTimeMs;
// TODO(donnd): consider changing this member's name to indicate "opened" instead of "seen".
private boolean mWereSearchResultsSeen; private boolean mWereSearchResultsSeen;
private boolean mWereInfoBarsHidden; private boolean mWereInfoBarsHidden;
private boolean mDidPromoteSearchNavigation; private boolean mDidPromoteSearchNavigation;
...@@ -168,9 +166,6 @@ public class ContextualSearchManager ...@@ -168,9 +166,6 @@ public class ContextualSearchManager
*/ */
private boolean mIsPromotingToTab; private boolean mIsPromotingToTab;
// TODO(pedrosimonetti): also store selected text, surroundings, url, bounding rect of selected
// text, and make sure that all states are cleared when starting a new contextual search to
// avoid having the values in a funky state.
private ContextualSearchRequest mSearchRequest; private ContextualSearchRequest mSearchRequest;
private ContextualSearchRequest mLastSearchRequestLoaded; private ContextualSearchRequest mLastSearchRequestLoaded;
...@@ -188,7 +183,7 @@ public class ContextualSearchManager ...@@ -188,7 +183,7 @@ public class ContextualSearchManager
private boolean mDoSuppressContextualSearchForSmartSelection; private boolean mDoSuppressContextualSearchForSmartSelection;
/** /**
* The delegate that is responsible for promoting a {@link ContentViewCore} to a {@link Tab} * The delegate that is responsible for promoting a {@link WebContents} to a {@link Tab}
* when necessary. * when necessary.
*/ */
public interface ContextualSearchTabPromotionDelegate { public interface ContextualSearchTabPromotionDelegate {
...@@ -203,7 +198,7 @@ public class ContextualSearchManager ...@@ -203,7 +198,7 @@ public class ContextualSearchManager
* Constructs the manager for the given activity, and will attach views to the given parent. * Constructs the manager for the given activity, and will attach views to the given parent.
* @param activity The {@code ChromeActivity} in use. * @param activity The {@code ChromeActivity} in use.
* @param tabPromotionDelegate The {@link ContextualSearchTabPromotionDelegate} that is * @param tabPromotionDelegate The {@link ContextualSearchTabPromotionDelegate} that is
* responsible for building tabs from contextual search {@link ContentViewCore}s. * responsible for building tabs from contextual search {@link WebContents}.
*/ */
public ContextualSearchManager( public ContextualSearchManager(
ChromeActivity activity, ContextualSearchTabPromotionDelegate tabPromotionDelegate) { ChromeActivity activity, ContextualSearchTabPromotionDelegate tabPromotionDelegate) {
...@@ -505,8 +500,6 @@ public class ContextualSearchManager ...@@ -505,8 +500,6 @@ public class ContextualSearchManager
mSearchPanel.setDidSearchInvolvePromo(); mSearchPanel.setDidSearchInvolvePromo();
} }
// TODO(donnd): If there was a previously ongoing contextual search, we should ensure
// it's registered as closed.
mSearchPanel.requestPanelShow(stateChangeReason); mSearchPanel.requestPanelShow(stateChangeReason);
assert mSelectionController.getSelectionType() != SelectionType.UNDETERMINED; assert mSelectionController.getSelectionType() != SelectionType.UNDETERMINED;
...@@ -678,7 +671,6 @@ public class ContextualSearchManager ...@@ -678,7 +671,6 @@ public class ContextualSearchManager
quickActionCategory); quickActionCategory);
} }
@SuppressLint("StringFormatMatches")
@Override @Override
public void handleSearchTermResolutionResponse(boolean isNetworkUnavailable, int responseCode, public void handleSearchTermResolutionResponse(boolean isNetworkUnavailable, int responseCode,
String searchTerm, String displayText, String alternateTerm, String mid, String searchTerm, String displayText, String alternateTerm, String mid,
...@@ -701,7 +693,6 @@ public class ContextualSearchManager ...@@ -701,7 +693,6 @@ public class ContextualSearchManager
message = mSelectionController.getSelectedText(); message = mSelectionController.getSelectedText();
doLiteralSearch = true; doLiteralSearch = true;
} else { } else {
// TODO(crbug.com/635567): Fix lint properly.
message = mActivity.getResources().getString( message = mActivity.getResources().getString(
R.string.contextual_search_error, responseCode); R.string.contextual_search_error, responseCode);
doLiteralSearch = true; doLiteralSearch = true;
...@@ -807,8 +798,7 @@ public class ContextualSearchManager ...@@ -807,8 +798,7 @@ public class ContextualSearchManager
// TODO(donnd): If the user taps on a word and quickly after that taps on the // TODO(donnd): If the user taps on a word and quickly after that taps on the
// peeking Search Bar, the Search Content View will not be displayed. It seems that // peeking Search Bar, the Search Content View will not be displayed. It seems that
// calling WebContents.onShow() while it's being created has no effect. Need // calling WebContents.onShow() while it's being created has no effect.
// to coordinate with Chrome-Android folks to come up with a proper fix for this.
// For now, we force the ContentView to be displayed by calling onShow() again // For now, we force the ContentView to be displayed by calling onShow() again
// when a URL is being loaded. See: crbug.com/398206 // when a URL is being loaded. See: crbug.com/398206
if (mSearchPanel.isContentShowing() && getSearchPanelWebContents() != null) { if (mSearchPanel.isContentShowing() && getSearchPanelWebContents() != null) {
...@@ -933,10 +923,6 @@ public class ContextualSearchManager ...@@ -933,10 +923,6 @@ public class ContextualSearchManager
@Override @Override
public String getTranslateServiceTargetLanguage() { public String getTranslateServiceTargetLanguage() {
// TODO(donnd): remove once issue 607127 has been resolved.
if (mNativeContextualSearchManagerPtr == 0) {
throw new RuntimeException("mNativeContextualSearchManagerPtr is 0!");
}
return nativeGetTargetLanguage(mNativeContextualSearchManagerPtr); return nativeGetTargetLanguage(mNativeContextualSearchManagerPtr);
} }
...@@ -1019,7 +1005,6 @@ public class ContextualSearchManager ...@@ -1019,7 +1005,6 @@ public class ContextualSearchManager
@Override @Override
public void onContentViewCreated() { public void onContentViewCreated() {
// TODO(mdjones): Move SearchContentViewDelegate ownership to panel.
nativeEnableContextualSearchJsApiForWebContents( nativeEnableContextualSearchJsApiForWebContents(
mNativeContextualSearchManagerPtr, getSearchPanelWebContents()); mNativeContextualSearchManagerPtr, getSearchPanelWebContents());
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment