blob: 2bcfe354d2480b2767ebbd63df33978e362b102d [file] [log] [blame]
Michael Kolb66706532010-12-12 19:50:22 -08001/*
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
19import com.android.browser.ScrollWebView.ScrollListener;
20
Michael Kolb377ea312011-02-17 14:36:56 -080021import android.animation.Animator;
22import android.animation.Animator.AnimatorListener;
23import android.animation.ObjectAnimator;
Michael Kolb66706532010-12-12 19:50:22 -080024import android.app.ActionBar;
25import android.app.Activity;
Michael Kolb24915222011-02-24 11:38:49 -080026import android.content.pm.PackageManager;
Michael Kolbac35bdc2011-01-17 17:06:04 -080027import android.os.Bundle;
Michael Kolbba238702011-03-08 10:40:50 -080028import android.os.Handler;
Michael Kolb376b5412010-12-15 11:52:57 -080029import android.util.Log;
Michael Kolb66706532010-12-12 19:50:22 -080030import android.view.ActionMode;
Michael Kolb376b5412010-12-15 11:52:57 -080031import android.view.Gravity;
Michael Kolba4183062011-01-16 10:43:21 -080032import android.view.KeyEvent;
John Reckd73c5a22010-12-22 10:22:50 -080033import android.view.View;
34import android.webkit.WebChromeClient.CustomViewCallback;
Michael Kolb66706532010-12-12 19:50:22 -080035import android.webkit.WebView;
Michael Kolb2a56eca2011-02-25 09:45:06 -080036import android.widget.FrameLayout;
Michael Kolb66706532010-12-12 19:50:22 -080037
38import java.util.List;
39
40/**
41 * Ui for xlarge screen sizes
42 */
43public class XLargeUi extends BaseUi implements ScrollListener {
44
45 private static final String LOGTAG = "XLargeUi";
46
Michael Kolb376b5412010-12-15 11:52:57 -080047 private ActionBar mActionBar;
Michael Kolb66706532010-12-12 19:50:22 -080048 private TabBar mTabBar;
49
50 private TitleBarXLarge mTitleBar;
Michael Kolb66706532010-12-12 19:50:22 -080051
Michael Kolb376b5412010-12-15 11:52:57 -080052 private boolean mUseQuickControls;
53 private PieControl mPieControl;
Michael Kolbd72f1592011-03-03 16:30:25 -080054 private boolean mInAnimation = false;
Michael Kolbba238702011-03-08 10:40:50 -080055 private Handler mHandler;
Michael Kolb376b5412010-12-15 11:52:57 -080056
Michael Kolb66706532010-12-12 19:50:22 -080057 /**
58 * @param browser
59 * @param controller
60 */
61 public XLargeUi(Activity browser, UiController controller) {
62 super(browser, controller);
Michael Kolbba238702011-03-08 10:40:50 -080063 mHandler = new Handler();
Michael Kolb66706532010-12-12 19:50:22 -080064 mTitleBar = new TitleBarXLarge(mActivity, mUiController, this);
65 mTitleBar.setProgress(100);
Michael Kolb66706532010-12-12 19:50:22 -080066 mTabBar = new TabBar(mActivity, mUiController, this);
Michael Kolb376b5412010-12-15 11:52:57 -080067 mActionBar = mActivity.getActionBar();
John Reckb3417f02011-01-14 11:01:05 -080068 setupActionBar();
69 setUseQuickControls(BrowserSettings.getInstance().useQuickControls());
70 }
71
72 private void setupActionBar() {
73 mActionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
Michael Kolb376b5412010-12-15 11:52:57 -080074 mActionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
75 mActionBar.setCustomView(mTabBar);
John Reckb3417f02011-01-14 11:01:05 -080076 }
77
78 @Override
Michael Kolbac35bdc2011-01-17 17:06:04 -080079 public void showComboView(boolean startWithHistory, Bundle extras) {
80 super.showComboView(startWithHistory, extras);
81 if (mUseQuickControls) {
82 mActionBar.show();
83 }
84 }
85
86 @Override
John Reckb3417f02011-01-14 11:01:05 -080087 public void hideComboView() {
Michael Kolbba238702011-03-08 10:40:50 -080088 if (isComboViewShowing()) {
89 super.hideComboView();
90 // ComboView changes the action bar, set it back up to what we want
91 setupActionBar();
92 checkTabCount();
93 }
Michael Kolb376b5412010-12-15 11:52:57 -080094 }
95
96 private void setUseQuickControls(boolean useQuickControls) {
97 mUseQuickControls = useQuickControls;
Michael Kolb7cdc4902011-02-03 17:54:40 -080098 mTitleBar.setUseQuickControls(mUseQuickControls);
Michael Kolb376b5412010-12-15 11:52:57 -080099 if (useQuickControls) {
100 checkTabCount();
101 mPieControl = new PieControl(mActivity, mUiController, this);
102 mPieControl.attachToContainer(mContentView);
Michael Kolb7cdc4902011-02-03 17:54:40 -0800103 Tab tab = getActiveTab();
104 if ((tab != null) && (tab.getWebView() != null)) {
105 tab.getWebView().setEmbeddedTitleBar(null);
Michael Kolb376b5412010-12-15 11:52:57 -0800106 }
Michael Kolb7cdc4902011-02-03 17:54:40 -0800107 setTitleGravity(Gravity.BOTTOM);
Michael Kolb376b5412010-12-15 11:52:57 -0800108 } else {
109 mActivity.getActionBar().show();
110 if (mPieControl != null) {
111 mPieControl.removeFromContainer(mContentView);
112 }
Michael Kolb7cdc4902011-02-03 17:54:40 -0800113 setTitleGravity(Gravity.TOP);
Michael Kolb376b5412010-12-15 11:52:57 -0800114 WebView web = mTabControl.getCurrentWebView();
Michael Kolb7cdc4902011-02-03 17:54:40 -0800115 if (web != null) {
Michael Kolb376b5412010-12-15 11:52:57 -0800116 web.setEmbeddedTitleBar(mTitleBar);
117 }
118 }
119 mTabBar.setUseQuickControls(mUseQuickControls);
Michael Kolb376b5412010-12-15 11:52:57 -0800120 }
121
122 private void checkTabCount() {
123 if (mUseQuickControls) {
124 int n = mTabBar.getTabCount();
125 if (n >= 2) {
Michael Kolbba238702011-03-08 10:40:50 -0800126 mActionBar.show();
Michael Kolb376b5412010-12-15 11:52:57 -0800127 } else if (n == 1) {
Michael Kolbba238702011-03-08 10:40:50 -0800128 mHandler.post(new Runnable() {
129 public void run() {
130 mActionBar.hide();
131 }
132 });
Michael Kolb376b5412010-12-15 11:52:57 -0800133 }
134 }
Michael Kolb66706532010-12-12 19:50:22 -0800135 }
136
137 @Override
Narayan Kamath67b8c1b2011-03-09 20:47:52 +0000138 public void onResume() {
139 super.onResume();
140 if (!BrowserSettings.getInstance().useInstant()) {
141 mTitleBar.clearCompletions();
142 }
143 }
144
145 @Override
Michael Kolb66706532010-12-12 19:50:22 -0800146 public void onDestroy() {
Michael Kolb7cdc4902011-02-03 17:54:40 -0800147 hideTitleBar();
Michael Kolb66706532010-12-12 19:50:22 -0800148 }
149
150 // webview factory
151
152 @Override
153 public WebView createWebView(boolean privateBrowsing) {
154 // Create a new WebView
155 ScrollWebView w = new ScrollWebView(mActivity, null,
156 android.R.attr.webViewStyle, privateBrowsing);
157 initWebViewSettings(w);
158 w.setScrollListener(this);
Michael Kolb24915222011-02-24 11:38:49 -0800159 boolean supportsMultiTouch = mActivity.getPackageManager()
160 .hasSystemFeature(PackageManager.FEATURE_TOUCHSCREEN_MULTITOUCH);
161 w.getSettings().setDisplayZoomControls(!supportsMultiTouch);
Dave Burke20b6f1f2011-02-01 12:59:04 +0000162 w.setExpandedTileBounds(true); // smoother scrolling
Michael Kolb66706532010-12-12 19:50:22 -0800163 return w;
164 }
165
166 @Override
167 public WebView createSubWebView(boolean privateBrowsing) {
168 ScrollWebView web = (ScrollWebView) createWebView(privateBrowsing);
169 // no scroll listener for subview
170 web.setScrollListener(null);
171 return web;
172 }
173
174 @Override
Michael Kolb5ee018e2011-02-18 15:47:21 -0800175 public void onScroll(int visibleTitleHeight, boolean userInitiated) {
176 mTabBar.onScroll(visibleTitleHeight, userInitiated);
Michael Kolb66706532010-12-12 19:50:22 -0800177 }
178
179 void stopWebViewScrolling() {
180 ScrollWebView web = (ScrollWebView) mUiController.getCurrentWebView();
181 if (web != null) {
182 web.stopScroll();
183 }
184 }
185
186 // WebView callbacks
187
188 @Override
John Reck30c714c2010-12-16 17:30:34 -0800189 public void onProgressChanged(Tab tab) {
190 int progress = tab.getLoadProgress();
Michael Kolb66706532010-12-12 19:50:22 -0800191 mTabBar.onProgress(tab, progress);
192 if (tab.inForeground()) {
Michael Kolb7cdc4902011-02-03 17:54:40 -0800193 mTitleBar.setProgress(progress);
Michael Kolb66706532010-12-12 19:50:22 -0800194 if (progress == 100) {
Michael Kolb7cdc4902011-02-03 17:54:40 -0800195 if (!mTitleBar.isEditingUrl()) {
196 hideTitleBar();
Michael Kolbbd018d42010-12-15 15:43:39 -0800197 if (mUseQuickControls) {
Michael Kolb7cdc4902011-02-03 17:54:40 -0800198 mTitleBar.setShowProgressOnly(false);
199 setTitleGravity(Gravity.BOTTOM);
Michael Kolbbd018d42010-12-15 15:43:39 -0800200 }
Michael Kolb376b5412010-12-15 11:52:57 -0800201 }
Michael Kolb66706532010-12-12 19:50:22 -0800202 } else {
Michael Kolb7cdc4902011-02-03 17:54:40 -0800203 if (!isTitleBarShowing()) {
204 if (mUseQuickControls && !mTitleBar.isEditingUrl()) {
205 mTitleBar.setShowProgressOnly(true);
206 setTitleGravity(Gravity.TOP);
Michael Kolb376b5412010-12-15 11:52:57 -0800207 }
Michael Kolb7cdc4902011-02-03 17:54:40 -0800208 showTitleBar();
Michael Kolb376b5412010-12-15 11:52:57 -0800209 }
Michael Kolb66706532010-12-12 19:50:22 -0800210 }
211 }
212 }
213
214 @Override
215 public boolean needsRestoreAllTabs() {
216 return true;
217 }
218
219 @Override
220 public void addTab(Tab tab) {
221 mTabBar.onNewTab(tab);
Michael Kolb8814d732011-01-26 11:22:30 -0800222 }
223
224 protected void onAddTabCompleted(Tab tab) {
Michael Kolb376b5412010-12-15 11:52:57 -0800225 checkTabCount();
Michael Kolb66706532010-12-12 19:50:22 -0800226 }
227
228 @Override
Michael Kolb377ea312011-02-17 14:36:56 -0800229 public void setActiveTab(final Tab tab) {
Michael Kolbd72f1592011-03-03 16:30:25 -0800230 if (mInAnimation) return;
Michael Kolb377ea312011-02-17 14:36:56 -0800231 if ((tab != mActiveTab) && (mActiveTab != null)) {
Michael Kolbd72f1592011-03-03 16:30:25 -0800232 mInAnimation = true;
Michael Kolb377ea312011-02-17 14:36:56 -0800233 // animate between the two
234 final ScrollWebView fromWV = (ScrollWebView) mActiveTab.getWebView();
235 fromWV.setDrawCached(true);
236 fromWV.setEmbeddedTitleBar(null);
237 final ScrollWebView toWV = (ScrollWebView) tab.getWebView();
238 if (!mUseQuickControls) {
239 if (mTitleBar.getParent() == null) {
240 toWV.setEmbeddedTitleBar(mTitleBar);
241 }
242 }
243 toWV.setDrawCached(true);
244 attachTabToContentView(tab);
245 super.setActiveTab(tab, false);
246 ObjectAnimator transition = ObjectAnimator.ofFloat(
247 toWV, "alpha", 0f, 1f);
248 transition.setDuration(mActivity.getResources()
249 .getInteger(R.integer.tabFadeDuration));
250 transition.addListener(new AnimatorListener() {
251 @Override
252 public void onAnimationCancel(Animator animation) {
253 fromWV.setDrawCached(false);
254 toWV.setDrawCached(false);
255 setActiveTab(tab, false);
Michael Kolbd72f1592011-03-03 16:30:25 -0800256 mInAnimation = false;
Michael Kolb377ea312011-02-17 14:36:56 -0800257 }
258
259 @Override
260 public void onAnimationEnd(Animator animation) {
261 fromWV.setDrawCached(false);
262 toWV.setDrawCached(false);
263 setActiveTab(tab, false);
Michael Kolbd72f1592011-03-03 16:30:25 -0800264 mInAnimation = false;
Michael Kolb377ea312011-02-17 14:36:56 -0800265 }
266
267 @Override
268 public void onAnimationRepeat(Animator animation) {
269 }
270
271 @Override
272 public void onAnimationStart(Animator animation) {
273 }
274 });
275 transition.start();
276 } else {
277 super.setActiveTab(tab, true);
278 setActiveTab(tab, true);
Michael Kolb36a1dc92011-02-22 16:14:59 -0800279 }
Michael Kolb377ea312011-02-17 14:36:56 -0800280 }
281
282 @Override
283 void setActiveTab(Tab tab, boolean needsAttaching) {
Michael Kolb376b5412010-12-15 11:52:57 -0800284 ScrollWebView view = (ScrollWebView) tab.getWebView();
285 // TabControl.setCurrentTab has been called before this,
286 // so the tab is guaranteed to have a webview
287 if (view == null) {
288 Log.e(LOGTAG, "active tab with no webview detected");
289 return;
290 }
291 // Request focus on the top window.
292 if (mUseQuickControls) {
293 mPieControl.forceToTop(mContentView);
294 view.setScrollListener(null);
295 mTabBar.showTitleBarIndicator(false);
296 } else {
Michael Kolb377ea312011-02-17 14:36:56 -0800297 // check if title bar is already attached by animation
298 if (mTitleBar.getParent() == null) {
299 view.setEmbeddedTitleBar(mTitleBar);
300 }
Michael Kolb376b5412010-12-15 11:52:57 -0800301 view.setScrollListener(this);
302 }
Michael Kolb66706532010-12-12 19:50:22 -0800303 mTabBar.onSetActiveTab(tab);
Michael Kolb376b5412010-12-15 11:52:57 -0800304 if (tab.isInVoiceSearchMode()) {
305 showVoiceTitleBar(tab.getVoiceDisplayTitle());
306 } else {
307 revertVoiceTitleBar(tab);
308 }
Michael Kolb376b5412010-12-15 11:52:57 -0800309 updateLockIconToLatest(tab);
310 tab.getTopWindow().requestFocus();
Michael Kolb66706532010-12-12 19:50:22 -0800311 }
312
313 @Override
314 public void updateTabs(List<Tab> tabs) {
315 mTabBar.updateTabs(tabs);
Michael Kolb376b5412010-12-15 11:52:57 -0800316 checkTabCount();
Michael Kolb66706532010-12-12 19:50:22 -0800317 }
318
319 @Override
320 public void removeTab(Tab tab) {
321 super.removeTab(tab);
322 mTabBar.onRemoveTab(tab);
Michael Kolb8814d732011-01-26 11:22:30 -0800323 }
324
325 protected void onRemoveTabCompleted(Tab tab) {
Michael Kolb376b5412010-12-15 11:52:57 -0800326 checkTabCount();
Michael Kolb66706532010-12-12 19:50:22 -0800327 }
328
Michael Kolb376b5412010-12-15 11:52:57 -0800329 int getContentWidth() {
330 if (mContentView != null) {
331 return mContentView.getWidth();
Michael Kolb66706532010-12-12 19:50:22 -0800332 }
333 return 0;
334 }
335
Michael Kolbdc2ee1b2011-02-14 14:34:40 -0800336 @Override
337 public void editUrl(boolean clearInput) {
Michael Kolbd72ea3b2011-01-09 15:56:37 -0800338 if (mUiController.isInCustomActionMode()) {
339 mUiController.endActionMode();
340 }
Michael Kolb7cdc4902011-02-03 17:54:40 -0800341 showTitleBar();
Michael Kolbdc2ee1b2011-02-14 14:34:40 -0800342 mTitleBar.startEditingUrl(clearInput);
Michael Kolb66706532010-12-12 19:50:22 -0800343 }
344
Michael Kolb7cdc4902011-02-03 17:54:40 -0800345 void showTitleBarAndEdit() {
346 mTitleBar.setShowProgressOnly(false);
347 showTitleBar();
Michael Kolbdc2ee1b2011-02-14 14:34:40 -0800348 mTitleBar.startEditingUrl(false);
Michael Kolb7cdc4902011-02-03 17:54:40 -0800349 }
350
351 void stopEditingUrl() {
352 mTitleBar.stopEditingUrl();
353 }
354
355 @Override
356 protected void showTitleBar() {
357 if (canShowTitleBar()) {
358 if (mUseQuickControls) {
Michael Kolb7cdc4902011-02-03 17:54:40 -0800359 mContentView.addView(mTitleBar);
360 } else {
361 setTitleGravity(Gravity.TOP);
362 }
363 super.showTitleBar();
364 mTabBar.onShowTitleBar();
Michael Kolb376b5412010-12-15 11:52:57 -0800365 }
Michael Kolb376b5412010-12-15 11:52:57 -0800366 }
367
Michael Kolb66706532010-12-12 19:50:22 -0800368 @Override
Michael Kolb7cdc4902011-02-03 17:54:40 -0800369 protected void hideTitleBar() {
370 if (isTitleBarShowing()) {
Michael Kolb66706532010-12-12 19:50:22 -0800371 mTabBar.onHideTitleBar();
Michael Kolb7cdc4902011-02-03 17:54:40 -0800372 if (mUseQuickControls) {
373 mContentView.removeView(mTitleBar);
Michael Kolb2a56eca2011-02-25 09:45:06 -0800374 } else {
375 setTitleGravity(Gravity.NO_GRAVITY);
Michael Kolb7cdc4902011-02-03 17:54:40 -0800376 }
377 super.hideTitleBar();
Michael Kolb66706532010-12-12 19:50:22 -0800378 }
379 }
380
Michael Kolb5ee018e2011-02-18 15:47:21 -0800381 public boolean isEditingUrl() {
382 return mTitleBar.isEditingUrl();
383 }
384
Michael Kolb66706532010-12-12 19:50:22 -0800385 @Override
Michael Kolb7cdc4902011-02-03 17:54:40 -0800386 protected TitleBarBase getTitleBar() {
Michael Kolb66706532010-12-12 19:50:22 -0800387 return mTitleBar;
388 }
389
Michael Kolb2a56eca2011-02-25 09:45:06 -0800390 @Override
391 protected void setTitleGravity(int gravity) {
392 if (mUseQuickControls) {
393 FrameLayout.LayoutParams lp =
394 (FrameLayout.LayoutParams) mTitleBar.getLayoutParams();
395 lp.gravity = gravity;
396 mTitleBar.setLayoutParams(lp);
397 } else {
398 super.setTitleGravity(gravity);
399 }
400 }
401
Michael Kolb66706532010-12-12 19:50:22 -0800402 // action mode callbacks
403
404 @Override
405 public void onActionModeStarted(ActionMode mode) {
Michael Kolb7cdc4902011-02-03 17:54:40 -0800406 if (!mTitleBar.isEditingUrl()) {
Michael Kolb66706532010-12-12 19:50:22 -0800407 // hide the fake title bar when CAB is shown
Michael Kolb7cdc4902011-02-03 17:54:40 -0800408 hideTitleBar();
Michael Kolb66706532010-12-12 19:50:22 -0800409 }
410 }
411
412 @Override
Michael Kolb376b5412010-12-15 11:52:57 -0800413 public void onActionModeFinished(boolean inLoad) {
414 checkTabCount();
415 if (inLoad) {
416 // the titlebar was removed when the CAB was shown
417 // if the page is loading, show it again
Michael Kolb7cdc4902011-02-03 17:54:40 -0800418 mTitleBar.setShowProgressOnly(true);
419 if (!isTitleBarShowing()) {
420 setTitleGravity(Gravity.TOP);
Michael Kolb376b5412010-12-15 11:52:57 -0800421 }
Michael Kolb7cdc4902011-02-03 17:54:40 -0800422 showTitleBar();
Michael Kolb376b5412010-12-15 11:52:57 -0800423 }
424 }
425
426 @Override
Michael Kolb5a72f182011-01-13 20:35:06 -0800427 protected void updateNavigationState(Tab tab) {
428 mTitleBar.updateNavigationState(tab);
Michael Kolb5a72f182011-01-13 20:35:06 -0800429 }
430
431 @Override
John Reck30c714c2010-12-16 17:30:34 -0800432 public void setUrlTitle(Tab tab) {
433 super.setUrlTitle(tab);
434 mTabBar.onUrlAndTitle(tab, tab.getUrl(), tab.getTitle());
Michael Kolb66706532010-12-12 19:50:22 -0800435 }
436
437 // Set the favicon in the title bar.
438 @Override
John Reck30c714c2010-12-16 17:30:34 -0800439 public void setFavicon(Tab tab) {
440 super.setFavicon(tab);
441 mTabBar.onFavicon(tab, tab.getFavicon());
Michael Kolb66706532010-12-12 19:50:22 -0800442 }
443
Michael Kolbcfa3af52010-12-14 10:36:11 -0800444 @Override
445 public void showVoiceTitleBar(String title) {
446 List<String> vsresults = null;
447 if (getActiveTab() != null) {
448 vsresults = getActiveTab().getVoiceSearchResults();
449 }
Michael Kolb3a2a1642011-02-15 10:52:07 -0800450 mTitleBar.setInVoiceMode(true, vsresults);
Michael Kolbcfa3af52010-12-14 10:36:11 -0800451 mTitleBar.setDisplayTitle(title);
Michael Kolbcfa3af52010-12-14 10:36:11 -0800452 }
453
454 @Override
455 public void revertVoiceTitleBar(Tab tab) {
456 mTitleBar.setInVoiceMode(false, null);
John Reck30c714c2010-12-16 17:30:34 -0800457 String url = tab.getUrl();
Michael Kolbcfa3af52010-12-14 10:36:11 -0800458 mTitleBar.setDisplayTitle(url);
Michael Kolbcfa3af52010-12-14 10:36:11 -0800459 }
460
John Reckd73c5a22010-12-22 10:22:50 -0800461 @Override
462 public void showCustomView(View view, CustomViewCallback callback) {
463 super.showCustomView(view, callback);
464 mActivity.getActionBar().hide();
465 }
Michael Kolbcfa3af52010-12-14 10:36:11 -0800466
John Reckd73c5a22010-12-22 10:22:50 -0800467 @Override
468 public void onHideCustomView() {
469 super.onHideCustomView();
470 if (mUseQuickControls) {
471 checkTabCount();
472 } else {
473 mActivity.getActionBar().show();
474 }
475 }
Michael Kolba4183062011-01-16 10:43:21 -0800476
477 @Override
478 public boolean dispatchKey(int code, KeyEvent event) {
Michael Kolbdfe99a12011-03-08 11:45:40 -0800479 if (mActiveTab != null) {
480 WebView web = mActiveTab.getWebView();
481 if (event.getAction() == KeyEvent.ACTION_DOWN) {
482 switch (code) {
483 case KeyEvent.KEYCODE_TAB:
484 case KeyEvent.KEYCODE_DPAD_UP:
485 case KeyEvent.KEYCODE_DPAD_LEFT:
486 if ((web != null) && web.hasFocus() && !mTitleBar.hasFocus()) {
487 editUrl(false);
488 return true;
489 }
490 }
491 boolean ctrl = event.hasModifiers(KeyEvent.META_CTRL_ON);
492 if (!ctrl && isTypingKey(event) && !mTitleBar.isEditingUrl()) {
493 editUrl(true);
494 return mContentView.dispatchKeyEvent(event);
495 }
Michael Kolbdc2ee1b2011-02-14 14:34:40 -0800496 }
Michael Kolba4183062011-01-16 10:43:21 -0800497 }
498 return false;
499 }
500
Michael Kolbdc2ee1b2011-02-14 14:34:40 -0800501 private boolean isTypingKey(KeyEvent evt) {
502 return evt.getUnicodeChar() > 0;
503 }
504
505 TabBar getTabBar() {
506 return mTabBar;
507 }
508
Narayan Kamath5119edd2011-02-23 15:49:17 +0000509 @Override
510 public void registerDropdownChangeListener(DropdownChangeListener d) {
511 mTitleBar.registerDropdownChangeListener(d);
512 }
Michael Kolb0860d992011-03-07 15:26:33 -0800513
Michael Kolb66706532010-12-12 19:50:22 -0800514}