1 /* 2 * Copyright (C) 2010 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.browser; 18 19 import android.app.Activity; 20 import android.content.Intent; 21 import android.view.Menu; 22 import android.view.MenuItem; 23 import android.webkit.WebView; 24 25 import com.android.browser.UI.ComboViews; 26 import com.android.browser.UI.DropdownChangeListener; 27 28 import java.util.List; 29 30 31 /** 32 * UI aspect of the controller 33 */ 34 public interface UiController { 35 getUi()36 UI getUi(); 37 getCurrentWebView()38 WebView getCurrentWebView(); 39 getCurrentTopWebView()40 WebView getCurrentTopWebView(); 41 getCurrentTab()42 Tab getCurrentTab(); 43 getTabControl()44 TabControl getTabControl(); 45 getTabs()46 List<Tab> getTabs(); 47 openTabToHomePage()48 Tab openTabToHomePage(); 49 openIncognitoTab()50 Tab openIncognitoTab(); 51 openTab(String url, boolean incognito, boolean setActive, boolean useCurrent)52 Tab openTab(String url, boolean incognito, boolean setActive, 53 boolean useCurrent); 54 setActiveTab(Tab tab)55 void setActiveTab(Tab tab); 56 switchToTab(Tab tab)57 boolean switchToTab(Tab tab); 58 closeCurrentTab()59 void closeCurrentTab(); 60 closeTab(Tab tab)61 void closeTab(Tab tab); 62 stopLoading()63 void stopLoading(); 64 createBookmarkCurrentPageIntent(boolean canBeAnEdit)65 Intent createBookmarkCurrentPageIntent(boolean canBeAnEdit); 66 bookmarksOrHistoryPicker(ComboViews startView)67 void bookmarksOrHistoryPicker(ComboViews startView); 68 startVoiceSearch()69 void startVoiceSearch(); 70 supportsVoiceSearch()71 boolean supportsVoiceSearch(); 72 showVoiceSearchResults(String title)73 void showVoiceSearchResults(String title); 74 editUrl()75 void editUrl(); 76 handleNewIntent(Intent intent)77 void handleNewIntent(Intent intent); 78 shouldShowErrorConsole()79 boolean shouldShowErrorConsole(); 80 hideCustomView()81 void hideCustomView(); 82 attachSubWindow(Tab tab)83 void attachSubWindow(Tab tab); 84 removeSubWindow(Tab tab)85 void removeSubWindow(Tab tab); 86 isInCustomActionMode()87 boolean isInCustomActionMode(); 88 endActionMode()89 void endActionMode(); 90 shareCurrentPage()91 void shareCurrentPage(); 92 updateMenuState(Tab tab, Menu menu)93 void updateMenuState(Tab tab, Menu menu); 94 registerDropdownChangeListener(DropdownChangeListener d)95 void registerDropdownChangeListener(DropdownChangeListener d); 96 onOptionsItemSelected(MenuItem item)97 boolean onOptionsItemSelected(MenuItem item); 98 createNewSnapshotTab(long snapshotId, boolean setActive)99 SnapshotTab createNewSnapshotTab(long snapshotId, boolean setActive); 100 loadUrl(Tab tab, String url)101 void loadUrl(Tab tab, String url); 102 setBlockEvents(boolean block)103 void setBlockEvents(boolean block); 104 getActivity()105 Activity getActivity(); 106 showPageInfo()107 void showPageInfo(); 108 109 } 110