blob: 46c04321b2d60c95c4c77971f1be24e6379d159e [file] [log] [blame]
Michael Kolb8233fac2010-10-26 16:08:53 -07001/*
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
17package com.android.browser;
18
John Recke1a03a32011-09-14 17:04:16 -070019import android.app.Activity;
Michael Kolb8233fac2010-10-26 16:08:53 -070020import android.content.Intent;
Michael Kolb4bf79712011-07-14 14:18:12 -070021import android.view.Menu;
Michael Kolb1acef692011-03-08 14:12:06 -080022import android.view.MenuItem;
Michael Kolb8233fac2010-10-26 16:08:53 -070023import android.webkit.WebView;
24
Michael Kolb315d5022011-10-13 12:47:11 -070025import com.android.browser.UI.ComboViews;
Michael Kolb4bf79712011-07-14 14:18:12 -070026
Michael Kolb1bf23132010-11-19 12:55:12 -080027import java.util.List;
28
Michael Kolb8233fac2010-10-26 16:08:53 -070029
30/**
31 * UI aspect of the controller
32 */
John Reckd3e4d5b2011-07-13 15:48:43 -070033public interface UiController {
Michael Kolb8233fac2010-10-26 16:08:53 -070034
35 UI getUi();
36
37 WebView getCurrentWebView();
38
39 WebView getCurrentTopWebView();
40
John Reckef654f12011-07-12 16:42:08 -070041 Tab getCurrentTab();
42
Michael Kolb8233fac2010-10-26 16:08:53 -070043 TabControl getTabControl();
44
Michael Kolb1bf23132010-11-19 12:55:12 -080045 List<Tab> getTabs();
46
Michael Kolb8233fac2010-10-26 16:08:53 -070047 Tab openTabToHomePage();
48
Michael Kolb519d2282011-05-09 17:03:19 -070049 Tab openIncognitoTab();
50
Michael Kolb7bcafde2011-05-09 13:55:59 -070051 Tab openTab(String url, boolean incognito, boolean setActive,
52 boolean useCurrent);
Michael Kolba4261fd2011-05-05 11:27:37 -070053
Michael Kolbf2055602011-04-09 17:20:03 -070054 void setActiveTab(Tab tab);
55
Michael Kolbc831b632011-05-11 09:30:34 -070056 boolean switchToTab(Tab tab);
Michael Kolb8233fac2010-10-26 16:08:53 -070057
58 void closeCurrentTab();
59
60 void closeTab(Tab tab);
61
62 void stopLoading();
63
John Reckd3e4d5b2011-07-13 15:48:43 -070064 Intent createBookmarkCurrentPageIntent(boolean canBeAnEdit);
Michael Kolb8233fac2010-10-26 16:08:53 -070065
Michael Kolb315d5022011-10-13 12:47:11 -070066 void bookmarksOrHistoryPicker(ComboViews startView);
Michael Kolb8233fac2010-10-26 16:08:53 -070067
Michael Kolb80f75082012-04-10 10:50:06 -070068 void bookmarkCurrentPage();
69
Michael Kolbcfa3af52010-12-14 10:36:11 -080070 void startVoiceSearch();
71
Michael Kolb736990c2011-03-20 10:01:20 -070072 boolean supportsVoiceSearch();
73
Michael Kolb8233fac2010-10-26 16:08:53 -070074 void showVoiceSearchResults(String title);
75
76 void editUrl();
77
Michael Kolb8233fac2010-10-26 16:08:53 -070078 void handleNewIntent(Intent intent);
79
80 boolean shouldShowErrorConsole();
81
Michael Kolb8233fac2010-10-26 16:08:53 -070082 void hideCustomView();
83
84 void attachSubWindow(Tab tab);
85
86 void removeSubWindow(Tab tab);
87
88 boolean isInCustomActionMode();
89
90 void endActionMode();
91
Michael Kolbba99c5d2010-11-29 14:57:41 -080092 void shareCurrentPage();
93
Michael Kolb4bf79712011-07-14 14:18:12 -070094 void updateMenuState(Tab tab, Menu menu);
95
Michael Kolb1acef692011-03-08 14:12:06 -080096 boolean onOptionsItemSelected(MenuItem item);
97
John Reck2bc80422011-06-30 15:11:49 -070098 SnapshotTab createNewSnapshotTab(long snapshotId, boolean setActive);
99
John Reck71e51422011-07-01 16:49:28 -0700100 void loadUrl(Tab tab, String url);
101
Michael Kolbc3af0672011-08-09 10:24:41 -0700102 void setBlockEvents(boolean block);
103
John Recke1a03a32011-09-14 17:04:16 -0700104 Activity getActivity();
105
Michael Kolb315d5022011-10-13 12:47:11 -0700106 void showPageInfo();
107
Michael Kolb80f75082012-04-10 10:50:06 -0700108 void openPreferences();
109
110 void findOnPage();
111
112 void toggleUserAgent();
113
Michael Kolb8233fac2010-10-26 16:08:53 -0700114}