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

Unified Diff: base/android/java/src/org/chromium/base/ContextTypes.java

Issue 136343002: Remove Chrome for TV code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased. Created 6 years, 11 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
« no previous file with comments | « base/android/context_types.cc ('k') | base/android/java/src/org/chromium/base/PathUtils.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/android/java/src/org/chromium/base/ContextTypes.java
diff --git a/base/android/java/src/org/chromium/base/ContextTypes.java b/base/android/java/src/org/chromium/base/ContextTypes.java
deleted file mode 100644
index ab3750d8108a4b25e0c5fe9f98b840b511fe374d..0000000000000000000000000000000000000000
--- a/base/android/java/src/org/chromium/base/ContextTypes.java
+++ /dev/null
@@ -1,96 +0,0 @@
-// Copyright 2013 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.base;
-
-import android.content.Context;
-
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-/**
- * Maintains the {@link Context}-to-"context type" mapping. The context type
- * {@code MODE_APP} is chosen for the application context associated with
- * the activity running in application mode, while {@code MODE_NORMAL} for main
- * Chromium activity.
- *
- * <p>Used as singleton instance.
- */
-public class ContextTypes {
-
- // Available context types.
- public static final int CONTEXT_TYPE_NORMAL = 1;
- public static final int CONTEXT_TYPE_WEBAPP = 2;
-
- private final Map<Context, Integer> mContextMap;
-
- private ContextTypes() {
- mContextMap = new ConcurrentHashMap<Context, Integer>();
- }
-
- private static class ContextTypesHolder {
- private static final ContextTypes INSTANCE = new ContextTypes();
- }
-
- public static ContextTypes getInstance() {
- return ContextTypesHolder.INSTANCE;
- }
-
- /**
- * Adds the mapping for the given {@link Context}.
- *
- * @param context {@link Context} in interest
- * @param type the type associated with the context
- * @throws IllegalArgumentException if type is not a valid one.
- */
- public void put(Context context, int type) throws IllegalArgumentException {
- if (type != CONTEXT_TYPE_NORMAL && type != CONTEXT_TYPE_WEBAPP) {
- throw new IllegalArgumentException("Wrong context type");
- }
- mContextMap.put(context, type);
- }
-
- /**
- * Removes the mapping for the given context.
- *
- * @param context {@link Context} in interest
- */
- public void remove(Context context) {
- mContextMap.remove(context);
- }
-
- /**
- * Returns type of the given context.
- *
- * @param context {@link Context} in interest
- * @return type associated with the context. Returns {@code MODE_NORMAL} by
- * default if the mapping for the queried context is not present.
- */
- public int getType(Context context) {
- Integer contextType = mContextMap.get(context);
- return contextType == null ? CONTEXT_TYPE_NORMAL : contextType;
- }
-
- /**
- * Returns whether activity is running in web app mode.
- *
- * @param appContext {@link Context} in interest
- * @return {@code true} when activity is running in web app mode.
- */
- @CalledByNative
- public static boolean isRunningInWebapp(Context appContext) {
- return ContextTypes.getInstance().getType(appContext)
- == CONTEXT_TYPE_WEBAPP;
- }
-
- /**
- * Checks if the mapping exists for the given context.
- *
- * @param context {@link Context} in interest
- * @return {@code true} if the mapping exists; otherwise {@code false}
- */
- public boolean contains(Context context) {
- return mContextMap.containsKey(context);
- }
-}
« no previous file with comments | « base/android/context_types.cc ('k') | base/android/java/src/org/chromium/base/PathUtils.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698