Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 package org.chromium.chrome.browser; | 5 package org.chromium.chrome.browser; |
| 6 | 6 |
| 7 import android.app.Activity; | 7 import android.app.Activity; |
| 8 import android.content.Context; | 8 import android.content.Context; |
| 9 import android.graphics.Bitmap; | 9 import android.graphics.Bitmap; |
| 10 import android.graphics.Color; | 10 import android.graphics.Color; |
| 11 import android.os.Handler; | |
| 11 import android.text.TextUtils; | 12 import android.text.TextUtils; |
| 12 import android.util.Log; | 13 import android.util.Log; |
| 13 import android.view.ContextMenu; | 14 import android.view.ContextMenu; |
| 14 import android.view.View; | 15 import android.view.View; |
| 15 import android.view.View.OnClickListener; | 16 import android.view.View.OnClickListener; |
| 16 import android.view.ViewGroup; | 17 import android.view.ViewGroup; |
| 17 import android.view.ViewGroup.LayoutParams; | 18 import android.view.ViewGroup.LayoutParams; |
| 18 import android.widget.FrameLayout; | 19 import android.widget.FrameLayout; |
| 19 | 20 |
| 20 import org.chromium.base.CalledByNative; | 21 import org.chromium.base.CalledByNative; |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 264 private float mPreviousFullscreenTopControlsOffsetY = Float.NaN; | 265 private float mPreviousFullscreenTopControlsOffsetY = Float.NaN; |
| 265 private float mPreviousFullscreenContentOffsetY = Float.NaN; | 266 private float mPreviousFullscreenContentOffsetY = Float.NaN; |
| 266 private float mPreviousFullscreenOverdrawBottomHeight = Float.NaN; | 267 private float mPreviousFullscreenOverdrawBottomHeight = Float.NaN; |
| 267 private int mFullscreenHungRendererToken = FullscreenManager.INVALID_TOKEN; | 268 private int mFullscreenHungRendererToken = FullscreenManager.INVALID_TOKEN; |
| 268 | 269 |
| 269 /** | 270 /** |
| 270 * Reference to the current sadTabView if one is defined. | 271 * Reference to the current sadTabView if one is defined. |
| 271 */ | 272 */ |
| 272 private View mSadTabView; | 273 private View mSadTabView; |
| 273 | 274 |
| 275 private boolean mStarted; | |
| 276 | |
| 274 /** | 277 /** |
| 275 * A default {@link ChromeContextMenuItemDelegate} that supports some of the context menu | 278 * A default {@link ChromeContextMenuItemDelegate} that supports some of the context menu |
| 276 * functionality. | 279 * functionality. |
| 277 */ | 280 */ |
| 278 protected class TabChromeContextMenuItemDelegate | 281 protected class TabChromeContextMenuItemDelegate |
| 279 extends EmptyChromeContextMenuItemDelegate { | 282 extends EmptyChromeContextMenuItemDelegate { |
| 280 private final Clipboard mClipboard; | 283 private final Clipboard mClipboard; |
| 281 | 284 |
| 282 /** | 285 /** |
| 283 * Builds a {@link TabChromeContextMenuItemDelegate} instance. | 286 * Builds a {@link TabChromeContextMenuItemDelegate} instance. |
| (...skipping 774 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1058 // We can't set a null client, but we should clear references to the last one. | 1061 // We can't set a null client, but we should clear references to the last one. |
| 1059 mContentViewCore.setContentViewClient(new ContentViewClient()); | 1062 mContentViewCore.setContentViewClient(new ContentViewClient()); |
| 1060 } | 1063 } |
| 1061 } | 1064 } |
| 1062 | 1065 |
| 1063 /** | 1066 /** |
| 1064 * Called on the foreground tab when the Activity showing the Tab gets start ed. This is called | 1067 * Called on the foreground tab when the Activity showing the Tab gets start ed. This is called |
| 1065 * on both cold and warm starts. | 1068 * on both cold and warm starts. |
| 1066 */ | 1069 */ |
| 1067 public void onActivityStart() { | 1070 public void onActivityStart() { |
| 1071 mStarted = true; | |
| 1068 show(TabSelectionType.FROM_USER); | 1072 show(TabSelectionType.FROM_USER); |
| 1069 | 1073 |
| 1070 // When resuming the activity, force an update to the fullscreen state t o ensure a | 1074 // When resuming the activity, force an update to the fullscreen state t o ensure a |
| 1071 // subactivity did not change the fullscreen configuration of this Chrom eTab's renderer in | 1075 // subactivity did not change the fullscreen configuration of this Chrom eTab's renderer in |
| 1072 // the case where it was shared (i.e. via an EmbedContentViewActivity). | 1076 // the case where it was shared (i.e. via an EmbedContentViewActivity). |
| 1073 updateFullscreenEnabledState(); | 1077 updateFullscreenEnabledState(); |
| 1074 } | 1078 } |
| 1075 | 1079 |
| 1076 /** | 1080 /** |
| 1077 * Called on the foreground tab when the Activity is stopped. | 1081 * Called on the foreground tab when the Activity is stopped. |
| 1078 */ | 1082 */ |
| 1079 public void onActivityStop() { | 1083 public void onActivityStop() { |
| 1080 hide(); | 1084 // Delay hiding in order to avoid a white flicker in closing an activity . |
| 1085 mStarted = false; | |
| 1086 final Handler handler = new Handler(); | |
| 1087 handler.postDelayed(new Runnable() { | |
| 1088 @Override | |
| 1089 public void run() { | |
| 1090 if (!mStarted) hide(); | |
| 1091 } | |
| 1092 }, 500); | |
|
David Trainor- moved to gerrit
2015/01/09 18:07:52
Does this only happen on L and above? Should we o
| |
| 1081 } | 1093 } |
| 1082 | 1094 |
| 1083 /** | 1095 /** |
| 1084 * Prepares the tab to be shown. This method is supposed to be called before the tab is | 1096 * Prepares the tab to be shown. This method is supposed to be called before the tab is |
| 1085 * displayed. It restores the ContentView if it is not available after the c old start and | 1097 * displayed. It restores the ContentView if it is not available after the c old start and |
| 1086 * reloads the tab if its renderer has crashed. | 1098 * reloads the tab if its renderer has crashed. |
| 1087 * @param type Specifies how the tab was selected. | 1099 * @param type Specifies how the tab was selected. |
| 1088 */ | 1100 */ |
| 1089 public final void show(TabSelectionType type) { | 1101 public final void show(TabSelectionType type) { |
| 1090 try { | 1102 try { |
| (...skipping 1262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2353 String title); | 2365 String title); |
| 2354 private native boolean nativePrint(long nativeTabAndroid); | 2366 private native boolean nativePrint(long nativeTabAndroid); |
| 2355 private native Bitmap nativeGetFavicon(long nativeTabAndroid); | 2367 private native Bitmap nativeGetFavicon(long nativeTabAndroid); |
| 2356 private native void nativeCreateHistoricalTab(long nativeTabAndroid); | 2368 private native void nativeCreateHistoricalTab(long nativeTabAndroid); |
| 2357 private native void nativeUpdateTopControlsState( | 2369 private native void nativeUpdateTopControlsState( |
| 2358 long nativeTabAndroid, int constraints, int current, boolean animate ); | 2370 long nativeTabAndroid, int constraints, int current, boolean animate ); |
| 2359 private native void nativeSearchByImageInNewTabAsync(long nativeTabAndroid); | 2371 private native void nativeSearchByImageInNewTabAsync(long nativeTabAndroid); |
| 2360 private native void nativeSetInterceptNavigationDelegate(long nativeTabAndro id, | 2372 private native void nativeSetInterceptNavigationDelegate(long nativeTabAndro id, |
| 2361 InterceptNavigationDelegate delegate); | 2373 InterceptNavigationDelegate delegate); |
| 2362 } | 2374 } |
| OLD | NEW |