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

Unified Diff: chrome/android/java_staging/src/org/chromium/chrome/browser/webapps/WebappManagedActivity.java

Issue 1206673003: Merge java_staging/src into java/src. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: chrome/android/java_staging/src/org/chromium/chrome/browser/webapps/WebappManagedActivity.java
diff --git a/chrome/android/java_staging/src/org/chromium/chrome/browser/webapps/WebappManagedActivity.java b/chrome/android/java_staging/src/org/chromium/chrome/browser/webapps/WebappManagedActivity.java
deleted file mode 100644
index 13798645afd2f6e947b93ad1d0c87495ef619cf3..0000000000000000000000000000000000000000
--- a/chrome/android/java_staging/src/org/chromium/chrome/browser/webapps/WebappManagedActivity.java
+++ /dev/null
@@ -1,56 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-package org.chromium.chrome.browser.webapps;
-
-import java.io.File;
-
-/**
- * Type of WebappActivity that has the ability to swap out the webapp it is currently showing for a
- * new one. This is necessary on Android versions older than L because the framework had no way of
- * allowing multiple instances of an Activity to be launched and show up as different tasks.
- * Anything extending this class must be named WebappActivity0, WebappActivity1, etc.
- */
-public abstract class WebappManagedActivity extends WebappActivity {
- private final int mActivityIndex;
-
- public WebappManagedActivity() {
- mActivityIndex = getActivityIndex();
- }
-
- @Override
- public void onStartWithNative() {
- super.onStartWithNative();
-
- if (!isFinishing()) {
- markActivityUsed();
- }
- }
-
- @Override
- protected File getActivityDirectory() {
- return WebappDirectoryManager.getWebappDirectory(String.valueOf(mActivityIndex));
- }
-
- /**
- * Marks that this WebappActivity is recently used to prevent other webapps from using it.
- */
- private void markActivityUsed() {
- ActivityAssigner.instance(this).markActivityUsed(mActivityIndex, getWebappInfo().id());
- }
-
- /**
- * Pulls out the index of the WebappActivity subclass that is being used.
- * e.g. WebappActivity0.getActivityIndex() will return 0.
- * @return The index corresponding to this WebappActivity.
- */
- private int getActivityIndex() {
- // Cull out the activity index from the class name.
- String baseClassName = WebappActivity.class.getSimpleName();
- String className = this.getClass().getSimpleName();
- assert className.matches("^" + baseClassName + "[0-9]+$");
- String indexString = className.substring(baseClassName.length());
- return Integer.parseInt(indexString);
- }
-}

Powered by Google App Engine
This is Rietveld 408576698