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.fullscreen; | 5 package org.chromium.chrome.browser.fullscreen; |
| 6 | 6 |
| 7 import static android.view.View.SYSTEM_UI_FLAG_FULLSCREEN; | 7 import static android.view.View.SYSTEM_UI_FLAG_FULLSCREEN; |
| 8 import static android.view.View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN; | 8 import static android.view.View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN; |
| 9 import static android.view.View.SYSTEM_UI_FLAG_LOW_PROFILE; | 9 import static android.view.View.SYSTEM_UI_FLAG_LOW_PROFILE; |
| 10 | 10 |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 131 contentView.addOnLayoutChangeListener(new OnLayoutChangeList ener() { | 131 contentView.addOnLayoutChangeListener(new OnLayoutChangeList ener() { |
| 132 @Override | 132 @Override |
| 133 public void onLayoutChange(View v, int left, int top, in t right, | 133 public void onLayoutChange(View v, int left, int top, in t right, |
| 134 int bottom, int oldLeft, int oldTop, int oldRigh t, | 134 int bottom, int oldLeft, int oldTop, int oldRigh t, |
| 135 int oldBottom) { | 135 int oldBottom) { |
| 136 sendEmptyMessageDelayed(MSG_ID_CLEAR_LAYOUT_FULLSCRE EN_FLAG, | 136 sendEmptyMessageDelayed(MSG_ID_CLEAR_LAYOUT_FULLSCRE EN_FLAG, |
| 137 CLEAR_LAYOUT_FULLSCREEN_DELAY_MS); | 137 CLEAR_LAYOUT_FULLSCREEN_DELAY_MS); |
| 138 contentView.removeOnLayoutChangeListener(this); | 138 contentView.removeOnLayoutChangeListener(this); |
| 139 } | 139 } |
| 140 }); | 140 }); |
| 141 | |
| 142 // Request a layout so the updated system visibility takes a ffect. | |
| 143 contentView.getRootView().requestLayout(); | |
|
Ted C
2017/01/17 19:30:10
Hmm...I added the case below because we weren't ge
bokan
2017/01/17 21:43:11
You mean leave the removed lines in? Having the re
Ted C
2017/01/17 22:09:45
Oh, that is rather unfortunate (and likely what yo
bokan
2017/01/17 23:35:24
Presumably because we send the MSG_ID_SET_FULLSCRE
| |
| 141 break; | 144 break; |
| 142 } | 145 } |
| 143 case MSG_ID_CLEAR_LAYOUT_FULLSCREEN_FLAG: { | 146 case MSG_ID_CLEAR_LAYOUT_FULLSCREEN_FLAG: { |
| 144 // Change this assert to simply ignoring the message to work around | 147 // Change this assert to simply ignoring the message to work around |
| 145 // http://crbug/365638 | 148 // http://crbug/365638 |
| 146 // TODO(aberent): Fix bug | 149 // TODO(aberent): Fix bug |
| 147 // assert mIsPersistentMode : "Calling after we exited fulls creen"; | 150 // assert mIsPersistentMode : "Calling after we exited fulls creen"; |
| 148 if (!fullscreenHtmlApiHandler.getPersistentFullscreenMode()) return; | 151 if (!fullscreenHtmlApiHandler.getPersistentFullscreenMode()) return; |
| 149 final ContentViewCore contentViewCore = | 152 final ContentViewCore contentViewCore = |
| 150 fullscreenHtmlApiHandler.mContentViewCoreInFullscree n; | 153 fullscreenHtmlApiHandler.mContentViewCoreInFullscree n; |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 291 if ((bottom - top) <= (oldBottom - oldTop)) return; | 294 if ((bottom - top) <= (oldBottom - oldTop)) return; |
| 292 if (mDelegate.shouldShowNotificationToast()) { | 295 if (mDelegate.shouldShowNotificationToast()) { |
| 293 showNotificationToast(); | 296 showNotificationToast(); |
| 294 } | 297 } |
| 295 contentView.removeOnLayoutChangeListener(this); | 298 contentView.removeOnLayoutChangeListener(this); |
| 296 } | 299 } |
| 297 }; | 300 }; |
| 298 contentView.addOnLayoutChangeListener(mFullscreenOnLayoutChangeListener) ; | 301 contentView.addOnLayoutChangeListener(mFullscreenOnLayoutChangeListener) ; |
| 299 contentView.setSystemUiVisibility(systemUiVisibility); | 302 contentView.setSystemUiVisibility(systemUiVisibility); |
| 300 | 303 |
| 301 // Request a layout so the updated system visibility takes affect. | |
| 302 contentView.getRootView().requestLayout(); | |
| 303 | |
| 304 mContentViewCoreInFullscreen = contentViewCore; | 304 mContentViewCoreInFullscreen = contentViewCore; |
| 305 mTabInFullscreen = tab; | 305 mTabInFullscreen = tab; |
| 306 } | 306 } |
| 307 | 307 |
| 308 /** | 308 /** |
| 309 * Create and show the fullscreen notification toast. | 309 * Create and show the fullscreen notification toast. |
| 310 */ | 310 */ |
| 311 private void showNotificationToast() { | 311 private void showNotificationToast() { |
| 312 if (mNotificationToast == null) { | 312 if (mNotificationToast == null) { |
| 313 int resId = (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) | 313 int resId = (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 364 private static int getExtraFullscreenUIFlags() { | 364 private static int getExtraFullscreenUIFlags() { |
| 365 int flags = 0; | 365 int flags = 0; |
| 366 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { | 366 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { |
| 367 flags |= View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION; | 367 flags |= View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION; |
| 368 flags |= View.SYSTEM_UI_FLAG_HIDE_NAVIGATION; | 368 flags |= View.SYSTEM_UI_FLAG_HIDE_NAVIGATION; |
| 369 flags |= View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY; | 369 flags |= View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY; |
| 370 } | 370 } |
| 371 return flags; | 371 return flags; |
| 372 } | 372 } |
| 373 } | 373 } |
| OLD | NEW |