Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / content / public / android / java / src / org / chromium / content / browser / DeviceUtils.java
index f472dc9..0f72233 100644 (file)
@@ -8,6 +8,7 @@ import android.content.Context;
 
 import org.chromium.base.CommandLine;
 import org.chromium.content.common.ContentSwitches;
+import org.chromium.ui.base.DeviceFormFactor;
 
 /**
  * A utility class that has helper methods for device configuration.
@@ -15,23 +16,13 @@ import org.chromium.content.common.ContentSwitches;
 public class DeviceUtils {
 
     /**
-     * The minimum width that would classify the device as a tablet.
-     */
-    private static final int MINIMUM_TABLET_WIDTH_DP = 600;
-
-    private static Boolean sIsTablet = null;
-
-    /**
      * @param context Android's context
      * @return        Whether the app is should treat the device as a tablet for layout.
      */
+    // TODO(tedchoc): Transition all call sites to use DeviceFormFactor directly.  Then
+    //                remove this method.
     public static boolean isTablet(Context context) {
-        if (sIsTablet == null) {
-            int minimumScreenWidthDp = context.getResources().getConfiguration().
-                    smallestScreenWidthDp;
-            sIsTablet = minimumScreenWidthDp >= MINIMUM_TABLET_WIDTH_DP;
-        }
-        return sIsTablet;
+        return DeviceFormFactor.isTablet(context);
     }
 
     /**
@@ -39,9 +30,7 @@ public class DeviceUtils {
      * @param context The context for the caller activity.
      */
     public static void addDeviceSpecificUserAgentSwitch(Context context) {
-        if (isTablet(context)) {
-            CommandLine.getInstance().appendSwitch(ContentSwitches.TABLET_UI);
-        } else {
+        if (!isTablet(context)) {
             CommandLine.getInstance().appendSwitch(ContentSwitches.USE_MOBILE_UA);
         }
     }