Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 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.content.Intent; |
Michael Kolb | 4bf7971 | 2011-07-14 14:18:12 -0700 | [diff] [blame] | 20 | import android.view.Menu; |
Michael Kolb | 1acef69 | 2011-03-08 14:12:06 -0800 | [diff] [blame] | 21 | import android.view.MenuItem; |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 22 | import android.webkit.WebView; |
| 23 | |
Michael Kolb | 4bf7971 | 2011-07-14 14:18:12 -0700 | [diff] [blame] | 24 | import com.android.browser.UI.DropdownChangeListener; |
| 25 | |
Michael Kolb | 1bf2313 | 2010-11-19 12:55:12 -0800 | [diff] [blame] | 26 | import java.util.List; |
| 27 | |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 28 | |
| 29 | /** |
| 30 | * UI aspect of the controller |
| 31 | */ |
John Reck | d3e4d5b | 2011-07-13 15:48:43 -0700 | [diff] [blame^] | 32 | public interface UiController { |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 33 | |
| 34 | UI getUi(); |
| 35 | |
| 36 | WebView getCurrentWebView(); |
| 37 | |
| 38 | WebView getCurrentTopWebView(); |
| 39 | |
John Reck | ef654f1 | 2011-07-12 16:42:08 -0700 | [diff] [blame] | 40 | Tab getCurrentTab(); |
| 41 | |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 42 | TabControl getTabControl(); |
| 43 | |
Michael Kolb | 1bf2313 | 2010-11-19 12:55:12 -0800 | [diff] [blame] | 44 | List<Tab> getTabs(); |
| 45 | |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 46 | Tab openTabToHomePage(); |
| 47 | |
Michael Kolb | 519d228 | 2011-05-09 17:03:19 -0700 | [diff] [blame] | 48 | Tab openIncognitoTab(); |
| 49 | |
Michael Kolb | 7bcafde | 2011-05-09 13:55:59 -0700 | [diff] [blame] | 50 | Tab openTab(String url, boolean incognito, boolean setActive, |
| 51 | boolean useCurrent); |
Michael Kolb | a4261fd | 2011-05-05 11:27:37 -0700 | [diff] [blame] | 52 | |
Michael Kolb | f205560 | 2011-04-09 17:20:03 -0700 | [diff] [blame] | 53 | void setActiveTab(Tab tab); |
| 54 | |
Michael Kolb | c831b63 | 2011-05-11 09:30:34 -0700 | [diff] [blame] | 55 | boolean switchToTab(Tab tab); |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 56 | |
| 57 | void closeCurrentTab(); |
| 58 | |
| 59 | void closeTab(Tab tab); |
| 60 | |
| 61 | void stopLoading(); |
| 62 | |
John Reck | d3e4d5b | 2011-07-13 15:48:43 -0700 | [diff] [blame^] | 63 | Intent createBookmarkCurrentPageIntent(boolean canBeAnEdit); |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 64 | |
| 65 | void bookmarksOrHistoryPicker(boolean openHistory); |
| 66 | |
Michael Kolb | cfa3af5 | 2010-12-14 10:36:11 -0800 | [diff] [blame] | 67 | void startVoiceSearch(); |
| 68 | |
Michael Kolb | 736990c | 2011-03-20 10:01:20 -0700 | [diff] [blame] | 69 | boolean supportsVoiceSearch(); |
| 70 | |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 71 | void showVoiceSearchResults(String title); |
| 72 | |
| 73 | void editUrl(); |
| 74 | |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 75 | void handleNewIntent(Intent intent); |
| 76 | |
| 77 | boolean shouldShowErrorConsole(); |
| 78 | |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 79 | void hideCustomView(); |
| 80 | |
| 81 | void attachSubWindow(Tab tab); |
| 82 | |
| 83 | void removeSubWindow(Tab tab); |
| 84 | |
| 85 | boolean isInCustomActionMode(); |
| 86 | |
| 87 | void endActionMode(); |
| 88 | |
Michael Kolb | ba99c5d | 2010-11-29 14:57:41 -0800 | [diff] [blame] | 89 | void shareCurrentPage(); |
| 90 | |
Michael Kolb | 4bf7971 | 2011-07-14 14:18:12 -0700 | [diff] [blame] | 91 | void updateMenuState(Tab tab, Menu menu); |
| 92 | |
Narayan Kamath | 5119edd | 2011-02-23 15:49:17 +0000 | [diff] [blame] | 93 | void registerDropdownChangeListener(DropdownChangeListener d); |
Michael Kolb | 1acef69 | 2011-03-08 14:12:06 -0800 | [diff] [blame] | 94 | |
| 95 | boolean onOptionsItemSelected(MenuItem item); |
| 96 | |
John Reck | 2bc8042 | 2011-06-30 15:11:49 -0700 | [diff] [blame] | 97 | SnapshotTab createNewSnapshotTab(long snapshotId, boolean setActive); |
| 98 | |
John Reck | 71e5142 | 2011-07-01 16:49:28 -0700 | [diff] [blame] | 99 | void loadUrl(Tab tab, String url); |
| 100 | |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 101 | } |