/** callback from suggestion dropdown user selected a suggestion */
 @Override
 public void onAction(String text, String extra, String source) {
   mUiController.getCurrentTopWebView().requestFocus();
   if (UrlInputView.TYPED.equals(source)) {
     String url = UrlUtils.smartUrlFilter(text, false);
     Tab t = mBaseUi.getActiveTab();
     // Only shortcut javascript URIs for now, as there is special
     // logic in UrlHandler for other schemas
     if (url != null && t != null && url.startsWith("javascript:")) {
       mUiController.loadUrl(t, url);
       setDisplayTitle(text);
       return;
     }
   }
   Intent i = new Intent();
   String action = null;
   if (UrlInputView.VOICE.equals(source)) {
     action = RecognizerResultsIntent.ACTION_VOICE_SEARCH_RESULTS;
     source = null;
   } else {
     action = Intent.ACTION_SEARCH;
   }
   i.setAction(action);
   i.putExtra(SearchManager.QUERY, text);
   if (extra != null) {
     i.putExtra(SearchManager.EXTRA_DATA_KEY, extra);
   }
   if (source != null) {
     Bundle appData = new Bundle();
     appData.putString(com.android.common.Search.SOURCE, source);
     i.putExtra(SearchManager.APP_DATA, appData);
   }
   mUiController.handleNewIntent(i);
   setDisplayTitle(text);
 }
示例#2
0
 public WebView getCurrentWebView() {
   Tab t = mBaseUi.getActiveTab();
   if (t != null) {
     return t.getWebView();
   } else {
     return null;
   }
 }
 @Override
 public void onDismiss() {
   final Tab currentTab = mBaseUi.getActiveTab();
   mBaseUi.hideTitleBar();
   post(
       new Runnable() {
         public void run() {
           clearFocus();
           if ((currentTab != null) && !mInVoiceMode) {
             setDisplayTitle(currentTab.getUrl());
           }
         }
       });
 }
示例#4
0
 private int getVisibleTitleHeight() {
   Tab tab = mBaseUi.getActiveTab();
   WebView webview = tab != null ? tab.getWebView() : null;
   return webview != null ? webview.getVisibleTitleHeight() : 0;
 }