| 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 f4d41cb777e9a3d1112fdec2a48e220099f36bc4..54461ab0d40ee3af012314d2669cefe72d0ccf68 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
|
| @@ -11,6 +11,7 @@ import android.view.ViewGroup;
|
| import android.view.ViewTreeObserver;
|
| import android.view.ViewTreeObserver.OnGlobalFocusChangeListener;
|
|
|
| +import org.chromium.base.Log;
|
| import org.chromium.base.SysUtils;
|
| import org.chromium.base.VisibleForTesting;
|
| import org.chromium.base.annotations.CalledByNative;
|
| @@ -748,6 +749,20 @@ public class ContextualSearchManager extends ContextualSearchObservable
|
| return mPolicy.isTapSupported();
|
| }
|
|
|
| + /**
|
| + * Called by the page through the CS JavaScript API to notify CS that there is
|
| + * a caption available on the current overlay.
|
| + * @param caption The caption to display.
|
| + * @param doesAnswer Whether the caption should be regarded as an answer such
|
| + * that the user may not need to open the panel, or whether the caption
|
| + * is simply informative or descriptive of the answer in the full results.
|
| + */
|
| + @CalledByNative
|
| + private void onSetCaption(String caption, boolean doesAnswer) {
|
| + // TODO(donnd): notify the UX of the caption and log doesAnswer.
|
| + Log.i(TAG, "ctxs setCaption: '" + caption + "', " + doesAnswer);
|
| + }
|
| +
|
| // ============================================================================================
|
| // Translation support
|
| // TODO(donnd): move to a separate file.
|
| @@ -990,6 +1005,13 @@ public class ContextualSearchManager extends ContextualSearchObservable
|
|
|
| @Override
|
| public void onContentViewCreated(ContentViewCore contentViewCore) {
|
| + // TODO(donnd): Consider moving to OverlayPanelContent.
|
| + if (mPolicy.shouldEnableOverlayApi()) {
|
| + // Enable the Contextual Search JavaScript API between our service and the new view.
|
| + nativeAddViewForContextualSearchApi(
|
| + mNativeContextualSearchManagerPtr, contentViewCore);
|
| + }
|
| +
|
| // TODO(mdjones): Move SearchContentViewDelegate ownership to panel.
|
| mSearchContentViewDelegate.setOverlayPanelContentViewCore(contentViewCore);
|
| }
|
| @@ -1343,4 +1365,6 @@ public class ContextualSearchManager extends ContextualSearchObservable
|
| // Don't call these directly, instead call the private methods that cache the results.
|
| private native String nativeGetTargetLanguage(long nativeContextualSearchManager);
|
| private native String nativeGetAcceptLanguages(long nativeContextualSearchManager);
|
| + private native void nativeAddViewForContextualSearchApi(
|
| + long nativeContextualSearchManager, ContentViewCore overlayContentViewCore);
|
| }
|
|
|