Index: content/public/android/java/src/org/chromium/content/browser/ChildProcessLauncher.java |
diff --git a/content/public/android/java/src/org/chromium/content/browser/ChildProcessLauncher.java b/content/public/android/java/src/org/chromium/content/browser/ChildProcessLauncher.java |
index eae1698e3363a4e38e8cade7ff987bec1a9a5139..e9f7beb56486d092abaf75f9d5eac6e348405a15 100644 |
--- a/content/public/android/java/src/org/chromium/content/browser/ChildProcessLauncher.java |
+++ b/content/public/android/java/src/org/chromium/content/browser/ChildProcessLauncher.java |
@@ -351,6 +351,9 @@ public class ChildProcessLauncher { |
private static Map<Pair<Integer, Integer>, Surface> sSurfaceTextureSurfaceMap = |
new ConcurrentHashMap<Pair<Integer, Integer>, Surface>(); |
+ // Whether the main application is currently brought to the foreground. |
+ private static boolean sApplicationInForeground = true; |
+ |
@VisibleForTesting |
public static void setBindingManagerForTesting(BindingManager manager) { |
sBindingManager = manager; |
@@ -433,6 +436,7 @@ public class ChildProcessLauncher { |
* Called when the embedding application is sent to background. |
*/ |
public static void onSentToBackground() { |
+ sApplicationInForeground = false; |
sBindingManager.onSentToBackground(); |
} |
@@ -440,10 +444,18 @@ public class ChildProcessLauncher { |
* Called when the embedding application is brought to foreground. |
*/ |
public static void onBroughtToForeground() { |
+ sApplicationInForeground = true; |
sBindingManager.onBroughtToForeground(); |
} |
/** |
+ * Returns whether the application is currently in the foreground. |
+ */ |
+ static boolean isApplicationInForeground() { |
+ return sApplicationInForeground; |
+ } |
+ |
+ /** |
* Should be called early in startup so the work needed to spawn the child process can be done |
* in parallel to other startup work. Must not be called on the UI thread. Spare connection is |
* created in sandboxed child process. |