Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(42)

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/ChromeActivity.java

Issue 2779033004: [Android] Focus/Blur contents when window focus changes (Closed)
Patch Set: Use pause/resume instead of WindowFocusChanged Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/android/javatests/src/org/chromium/chrome/browser/ContentViewFocusTest.java » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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.annotation.SuppressLint; 7 import android.annotation.SuppressLint;
8 import android.annotation.TargetApi; 8 import android.annotation.TargetApi;
9 import android.app.Activity; 9 import android.app.Activity;
10 import android.app.SearchManager; 10 import android.app.SearchManager;
(...skipping 814 matching lines...) Expand 10 before | Expand all | Expand 10 after
825 825
826 @Override 826 @Override
827 public void onResumeWithNative() { 827 public void onResumeWithNative() {
828 super.onResumeWithNative(); 828 super.onResumeWithNative();
829 markSessionResume(); 829 markSessionResume();
830 RecordUserAction.record("MobileComeToForeground"); 830 RecordUserAction.record("MobileComeToForeground");
831 831
832 if (getActivityTab() != null) { 832 if (getActivityTab() != null) {
833 LaunchMetrics.commitLaunchMetrics(getActivityTab().getWebContents()) ; 833 LaunchMetrics.commitLaunchMetrics(getActivityTab().getWebContents()) ;
834 } 834 }
835 ContentViewCore cvc = getContentViewCore();
836 if (cvc != null) cvc.onResume();
835 FeatureUtilities.setCustomTabVisible(isCustomTab()); 837 FeatureUtilities.setCustomTabVisible(isCustomTab());
836 FeatureUtilities.setIsInMultiWindowMode( 838 FeatureUtilities.setIsInMultiWindowMode(
837 MultiWindowUtils.getInstance().isInMultiWindowMode(this)); 839 MultiWindowUtils.getInstance().isInMultiWindowMode(this));
838 840
839 VideoPersister.getInstance().cleanup(this); 841 VideoPersister.getInstance().cleanup(this);
840 VrShellDelegate.maybeRegisterVREntryHook(this); 842 VrShellDelegate.maybeRegisterVREntryHook(this);
841 } 843 }
842 844
843 @Override 845 @Override
844 protected void onUserLeaveHint() { 846 protected void onUserLeaveHint() {
845 super.onUserLeaveHint(); 847 super.onUserLeaveHint();
846 VideoPersister.getInstance().attemptPersist(this); 848 VideoPersister.getInstance().attemptPersist(this);
847 } 849 }
848 850
849 @Override 851 @Override
850 public void onPauseWithNative() { 852 public void onPauseWithNative() {
851 RecordUserAction.record("MobileGoToBackground"); 853 RecordUserAction.record("MobileGoToBackground");
852 Tab tab = getActivityTab(); 854 Tab tab = getActivityTab();
853 if (tab != null) { 855 if (tab != null) getTabContentManager().cacheTabThumbnail(tab);
854 getTabContentManager().cacheTabThumbnail(tab); 856 ContentViewCore cvc = getContentViewCore();
855 } 857 if (cvc != null) cvc.onPause();
856 VrShellDelegate.maybeUnregisterVREntryHook(this); 858 VrShellDelegate.maybeUnregisterVREntryHook(this);
857 markSessionEnd(); 859 markSessionEnd();
858 super.onPauseWithNative(); 860 super.onPauseWithNative();
859 } 861 }
860 862
861 @Override 863 @Override
862 public void onStopWithNative() { 864 public void onStopWithNative() {
863 Tab tab = getActivityTab(); 865 Tab tab = getActivityTab();
864 if (tab != null && !hasWindowFocus()) tab.onActivityHidden(); 866 if (tab != null && !hasWindowFocus()) tab.onActivityHidden();
865 if (mAppMenuHandler != null) mAppMenuHandler.hideAppMenu(); 867 if (mAppMenuHandler != null) mAppMenuHandler.hideAppMenu();
(...skipping 1300 matching lines...) Expand 10 before | Expand all | Expand 10 after
2166 * draw over VR contents should be hidden in this call. 2168 * draw over VR contents should be hidden in this call.
2167 */ 2169 */
2168 public void onEnterVR() {} 2170 public void onEnterVR() {}
2169 2171
2170 /** 2172 /**
2171 * Called when VR mode using this activity is exited. Any state set for VR s hould be restored 2173 * Called when VR mode using this activity is exited. Any state set for VR s hould be restored
2172 * in this call, including showing 2D UI that was hidden. 2174 * in this call, including showing 2D UI that was hidden.
2173 */ 2175 */
2174 public void onExitVR() {} 2176 public void onExitVR() {}
2175 } 2177 }
OLDNEW
« no previous file with comments | « no previous file | chrome/android/javatests/src/org/chromium/chrome/browser/ContentViewFocusTest.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698