summaryrefslogtreecommitdiffstats
path: root/ui/android
diff options
context:
space:
mode:
authoraurimas@chromium.org <aurimas@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-10 20:37:10 +0000
committeraurimas@chromium.org <aurimas@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-10 20:37:10 +0000
commit4dbdfb634f504f8bcf11b6b666d0ebe840622c3d (patch)
treeb3f9a69bbd9e0d4a42cdcc79bc7a61c043461e5a /ui/android
parent58439653132d1e509f45306bed9197c16540f972 (diff)
downloadchromium_src-4dbdfb634f504f8bcf11b6b666d0ebe840622c3d.zip
chromium_src-4dbdfb634f504f8bcf11b6b666d0ebe840622c3d.tar.gz
chromium_src-4dbdfb634f504f8bcf11b6b666d0ebe840622c3d.tar.bz2
Revert of https://chromiumcodereview.appspot.com/109483012/
Reason for revert: Failed to apply TBR=newt@chromium.org NOTREECHECKS=true NOTRY=true Review URL: https://codereview.chromium.org/111973003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@239838 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/android')
-rw-r--r--ui/android/java/src/org/chromium/ui/ColorPickerDialog.java11
-rw-r--r--ui/android/java/src/org/chromium/ui/ColorPickerSimple.java49
-rw-r--r--ui/android/java/src/org/chromium/ui/ColorSuggestionListAdapter.java4
-rw-r--r--ui/android/java/src/org/chromium/ui/OnColorChangedListener.java1
-rw-r--r--ui/android/java/src/org/chromium/ui/UiUtils.java4
-rw-r--r--ui/android/java/src/org/chromium/ui/autofill/AutofillDividerDrawable.java2
-rw-r--r--ui/android/java/src/org/chromium/ui/autofill/AutofillListAdapter.java1
-rw-r--r--ui/android/java/src/org/chromium/ui/autofill/AutofillPopup.java2
-rw-r--r--ui/android/java/src/org/chromium/ui/base/Clipboard.java2
-rw-r--r--ui/android/java/src/org/chromium/ui/base/LocalizationUtils.java2
-rw-r--r--ui/android/java/src/org/chromium/ui/base/SelectFileDialog.java4
-rw-r--r--ui/android/java/src/org/chromium/ui/base/ViewAndroid.java2
-rw-r--r--ui/android/java/src/org/chromium/ui/base/ViewAndroidDelegate.java2
-rw-r--r--ui/android/java/src/org/chromium/ui/base/WindowAndroid.java6
-rw-r--r--ui/android/java/src/org/chromium/ui/gfx/BitmapHelper.java5
-rw-r--r--ui/android/java/src/org/chromium/ui/gfx/DeviceDisplayInfo.java297
-rw-r--r--ui/android/java/src/org/chromium/ui/gl/SurfaceTextureListener.java2
-rw-r--r--ui/android/java/src/org/chromium/ui/gl/SurfaceTexturePlatformWrapper.java4
18 files changed, 200 insertions, 200 deletions
diff --git a/ui/android/java/src/org/chromium/ui/ColorPickerDialog.java b/ui/android/java/src/org/chromium/ui/ColorPickerDialog.java
index f6d3ace..ca4d245 100644
--- a/ui/android/java/src/org/chromium/ui/ColorPickerDialog.java
+++ b/ui/android/java/src/org/chromium/ui/ColorPickerDialog.java
@@ -1,4 +1,4 @@
-// Copyright 2012 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 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.
@@ -35,6 +35,7 @@ public class ColorPickerDialog extends AlertDialog implements OnColorChangedList
/**
* @param context The context the dialog is to run in.
+ * @param theme The theme to display the dialog in.
* @param listener The object to notify when the color is set.
* @param color The initial color to set.
* @param suggestions The list of suggestions.
@@ -151,7 +152,9 @@ public class ColorPickerDialog extends AlertDialog implements OnColorChangedList
* Tries to notify any listeners that the color has been set.
*/
private void tryNotifyColorSet(int color) {
- if (mListener != null) mListener.onColorChanged(color);
+ if (mListener != null) {
+ mListener.onColorChanged(color);
+ }
}
/**
@@ -160,6 +163,8 @@ public class ColorPickerDialog extends AlertDialog implements OnColorChangedList
*/
private void updateCurrentColor(int color) {
mCurrentColor = color;
- if (mCurrentColorView != null) mCurrentColorView.setBackgroundColor(color);
+ if (mCurrentColorView != null) {
+ mCurrentColorView.setBackgroundColor(color);
+ }
}
}
diff --git a/ui/android/java/src/org/chromium/ui/ColorPickerSimple.java b/ui/android/java/src/org/chromium/ui/ColorPickerSimple.java
index 69b880e..d3ca34f 100644
--- a/ui/android/java/src/org/chromium/ui/ColorPickerSimple.java
+++ b/ui/android/java/src/org/chromium/ui/ColorPickerSimple.java
@@ -1,7 +1,6 @@
// 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.ui;
import android.content.Context;
@@ -19,27 +18,25 @@ public class ColorPickerSimple extends ListView implements OnColorSuggestionClic
private OnColorChangedListener mOnColorChangedListener;
- private static final int[] DEFAULT_COLORS = {
- Color.RED,
- Color.CYAN,
- Color.BLUE,
- Color.GREEN,
- Color.MAGENTA,
- Color.YELLOW,
- Color.BLACK,
- Color.WHITE
- };
+ private static final int[] DEFAULT_COLORS = { Color.RED,
+ Color.CYAN,
+ Color.BLUE,
+ Color.GREEN,
+ Color.MAGENTA,
+ Color.YELLOW,
+ Color.BLACK,
+ Color.WHITE
+ };
- private static final int[] DEFAULT_COLOR_LABEL_IDS = {
- R.string.color_picker_button_red,
- R.string.color_picker_button_cyan,
- R.string.color_picker_button_blue,
- R.string.color_picker_button_green,
- R.string.color_picker_button_magenta,
- R.string.color_picker_button_yellow,
- R.string.color_picker_button_black,
- R.string.color_picker_button_white
- };
+ private static final int[] DEFAULT_COLOR_LABEL_IDS = { R.string.color_picker_button_red,
+ R.string.color_picker_button_cyan,
+ R.string.color_picker_button_blue,
+ R.string.color_picker_button_green,
+ R.string.color_picker_button_magenta,
+ R.string.color_picker_button_yellow,
+ R.string.color_picker_button_black,
+ R.string.color_picker_button_white
+ };
public ColorPickerSimple(Context context) {
super(context);
@@ -68,13 +65,15 @@ public class ColorPickerSimple extends ListView implements OnColorSuggestionClic
if (suggestions == null) {
suggestions = new ColorSuggestion[DEFAULT_COLORS.length];
for (int i = 0; i < suggestions.length; ++i) {
- suggestions[i] = new ColorSuggestion(DEFAULT_COLORS[i],
- getContext().getString(DEFAULT_COLOR_LABEL_IDS[i]));
+ suggestions[i] =
+ new ColorSuggestion(
+ DEFAULT_COLORS[i],
+ getContext().getString(DEFAULT_COLOR_LABEL_IDS[i]));
}
}
- ColorSuggestionListAdapter adapter = new ColorSuggestionListAdapter(
- getContext(), suggestions);
+ ColorSuggestionListAdapter adapter = new ColorSuggestionListAdapter(getContext(),
+ suggestions);
adapter.setOnColorSuggestionClickListener(this);
setAdapter(adapter);
}
diff --git a/ui/android/java/src/org/chromium/ui/ColorSuggestionListAdapter.java b/ui/android/java/src/org/chromium/ui/ColorSuggestionListAdapter.java
index b237acb..0d0e8be 100644
--- a/ui/android/java/src/org/chromium/ui/ColorSuggestionListAdapter.java
+++ b/ui/android/java/src/org/chromium/ui/ColorSuggestionListAdapter.java
@@ -38,7 +38,7 @@ public class ColorSuggestionListAdapter extends BaseAdapter implements View.OnCl
void onColorSuggestionClick(ColorSuggestion suggestion);
}
- private static final int COLORS_PER_ROW = 4;
+ private final static int COLORS_PER_ROW = 4;
ColorSuggestionListAdapter(Context context, ColorSuggestion[] suggestions) {
mContext = context;
@@ -96,7 +96,7 @@ public class ColorSuggestionListAdapter extends BaseAdapter implements View.OnCl
public View getView(int position, View convertView, ViewGroup parent) {
LinearLayout layout;
if (convertView != null && convertView instanceof LinearLayout) {
- layout = (LinearLayout) convertView;
+ layout = (LinearLayout) convertView;
} else {
layout = new LinearLayout(mContext);
layout.setLayoutParams(new AbsListView.LayoutParams(
diff --git a/ui/android/java/src/org/chromium/ui/OnColorChangedListener.java b/ui/android/java/src/org/chromium/ui/OnColorChangedListener.java
index c4847fa..4caa3cf 100644
--- a/ui/android/java/src/org/chromium/ui/OnColorChangedListener.java
+++ b/ui/android/java/src/org/chromium/ui/OnColorChangedListener.java
@@ -1,7 +1,6 @@
// 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.ui;
/**
diff --git a/ui/android/java/src/org/chromium/ui/UiUtils.java b/ui/android/java/src/org/chromium/ui/UiUtils.java
index c9c7c0c..c11d9e3 100644
--- a/ui/android/java/src/org/chromium/ui/UiUtils.java
+++ b/ui/android/java/src/org/chromium/ui/UiUtils.java
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright (c) 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.
@@ -28,7 +28,7 @@ public class UiUtils {
}
/** The minimum size of the bottom margin below the app to detect a keyboard. */
- private static final float KEYBOARD_DETECT_BOTTOM_THRESHOLD_DP = 100;
+ private static float KEYBOARD_DETECT_BOTTOM_THRESHOLD_DP = 100;
/**
* Shows the software keyboard if necessary.
diff --git a/ui/android/java/src/org/chromium/ui/autofill/AutofillDividerDrawable.java b/ui/android/java/src/org/chromium/ui/autofill/AutofillDividerDrawable.java
index 9aa88e8..b6f6c32 100644
--- a/ui/android/java/src/org/chromium/ui/autofill/AutofillDividerDrawable.java
+++ b/ui/android/java/src/org/chromium/ui/autofill/AutofillDividerDrawable.java
@@ -11,7 +11,7 @@ import android.graphics.PixelFormat;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
-class AutofillDividerDrawable extends Drawable {
+public class AutofillDividerDrawable extends Drawable {
private Paint mPaint;
private Rect mDividerRect;
diff --git a/ui/android/java/src/org/chromium/ui/autofill/AutofillListAdapter.java b/ui/android/java/src/org/chromium/ui/autofill/AutofillListAdapter.java
index 94608af..4ddb959 100644
--- a/ui/android/java/src/org/chromium/ui/autofill/AutofillListAdapter.java
+++ b/ui/android/java/src/org/chromium/ui/autofill/AutofillListAdapter.java
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
package org.chromium.ui.autofill;
import android.content.Context;
diff --git a/ui/android/java/src/org/chromium/ui/autofill/AutofillPopup.java b/ui/android/java/src/org/chromium/ui/autofill/AutofillPopup.java
index af6951c..0d372e7 100644
--- a/ui/android/java/src/org/chromium/ui/autofill/AutofillPopup.java
+++ b/ui/android/java/src/org/chromium/ui/autofill/AutofillPopup.java
@@ -81,7 +81,7 @@ public class AutofillPopup extends ListPopupWindow implements AdapterView.OnItem
AutofillPopupDelegate autofillCallback) {
super(context, null, 0, R.style.AutofillPopupWindow);
mContext = context;
- mViewAndroidDelegate = viewAndroidDelegate;
+ mViewAndroidDelegate = viewAndroidDelegate ;
mAutofillCallback = autofillCallback;
setOnItemClickListener(this);
diff --git a/ui/android/java/src/org/chromium/ui/base/Clipboard.java b/ui/android/java/src/org/chromium/ui/base/Clipboard.java
index aaa500e..48a541e 100644
--- a/ui/android/java/src/org/chromium/ui/base/Clipboard.java
+++ b/ui/android/java/src/org/chromium/ui/base/Clipboard.java
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright (c) 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.
diff --git a/ui/android/java/src/org/chromium/ui/base/LocalizationUtils.java b/ui/android/java/src/org/chromium/ui/base/LocalizationUtils.java
index 839a860..1095b64 100644
--- a/ui/android/java/src/org/chromium/ui/base/LocalizationUtils.java
+++ b/ui/android/java/src/org/chromium/ui/base/LocalizationUtils.java
@@ -1,4 +1,4 @@
-// Copyright 2012 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 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.
diff --git a/ui/android/java/src/org/chromium/ui/base/SelectFileDialog.java b/ui/android/java/src/org/chromium/ui/base/SelectFileDialog.java
index 6d85a35..c6fd1e4 100644
--- a/ui/android/java/src/org/chromium/ui/base/SelectFileDialog.java
+++ b/ui/android/java/src/org/chromium/ui/base/SelectFileDialog.java
@@ -1,4 +1,4 @@
-// Copyright 2012 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 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.
@@ -191,7 +191,7 @@ class SelectFileDialog implements WindowAndroid.IntentCallback{
}
private boolean shouldShowImageTypes() {
- return shouldShowTypes(ALL_IMAGE_TYPES, IMAGE_TYPE);
+ return shouldShowTypes(ALL_IMAGE_TYPES,IMAGE_TYPE);
}
private boolean shouldShowVideoTypes() {
diff --git a/ui/android/java/src/org/chromium/ui/base/ViewAndroid.java b/ui/android/java/src/org/chromium/ui/base/ViewAndroid.java
index c765a56..9f48026 100644
--- a/ui/android/java/src/org/chromium/ui/base/ViewAndroid.java
+++ b/ui/android/java/src/org/chromium/ui/base/ViewAndroid.java
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright (c) 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.
diff --git a/ui/android/java/src/org/chromium/ui/base/ViewAndroidDelegate.java b/ui/android/java/src/org/chromium/ui/base/ViewAndroidDelegate.java
index 6d3694c..34d280a 100644
--- a/ui/android/java/src/org/chromium/ui/base/ViewAndroidDelegate.java
+++ b/ui/android/java/src/org/chromium/ui/base/ViewAndroidDelegate.java
@@ -1,4 +1,4 @@
-// Copyright 2012 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 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.
diff --git a/ui/android/java/src/org/chromium/ui/base/WindowAndroid.java b/ui/android/java/src/org/chromium/ui/base/WindowAndroid.java
index 44469e5..6996694 100644
--- a/ui/android/java/src/org/chromium/ui/base/WindowAndroid.java
+++ b/ui/android/java/src/org/chromium/ui/base/WindowAndroid.java
@@ -1,4 +1,4 @@
-// Copyright 2012 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 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.
@@ -35,7 +35,7 @@ public class WindowAndroid {
protected HashMap<Integer, String> mIntentErrors;
/**
- * @param context The application context.
+ * @param context, the application context..
*/
public WindowAndroid(Context context) {
assert context == context.getApplicationContext();
@@ -175,7 +175,7 @@ public class WindowAndroid {
/**
* Tests that an activity is available to handle the passed in intent.
- * @param intent The intent to check.
+ * @param Intent the intent to check.
* @return True if an activity is available to process this intent when started, meaning that
* Context.startActivity will not throw ActivityNotFoundException.
*/
diff --git a/ui/android/java/src/org/chromium/ui/gfx/BitmapHelper.java b/ui/android/java/src/org/chromium/ui/gfx/BitmapHelper.java
index 913890223..7d78b52d 100644
--- a/ui/android/java/src/org/chromium/ui/gfx/BitmapHelper.java
+++ b/ui/android/java/src/org/chromium/ui/gfx/BitmapHelper.java
@@ -1,4 +1,4 @@
-// Copyright 2012 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 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.
@@ -11,9 +11,6 @@ import android.graphics.BitmapFactory;
import org.chromium.base.CalledByNative;
import org.chromium.base.JNINamespace;
-/**
- * Helper class to decode and sample down bitmap resources.
- */
@JNINamespace("gfx")
public class BitmapHelper {
@CalledByNative
diff --git a/ui/android/java/src/org/chromium/ui/gfx/DeviceDisplayInfo.java b/ui/android/java/src/org/chromium/ui/gfx/DeviceDisplayInfo.java
index 188c405c..4cfe1a1 100644
--- a/ui/android/java/src/org/chromium/ui/gfx/DeviceDisplayInfo.java
+++ b/ui/android/java/src/org/chromium/ui/gfx/DeviceDisplayInfo.java
@@ -1,4 +1,4 @@
-// Copyright 2012 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 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.
@@ -27,153 +27,152 @@ import org.chromium.base.JNINamespace;
public class DeviceDisplayInfo {
- private final Context mAppContext;
- private final WindowManager mWinManager;
-
- private DeviceDisplayInfo(Context context) {
- mAppContext = context.getApplicationContext();
- mWinManager = (WindowManager) mAppContext.getSystemService(Context.WINDOW_SERVICE);
- }
-
- /**
- * @return Display height in physical pixels.
- */
- @CalledByNative
- public int getDisplayHeight() {
- return getMetrics().heightPixels;
- }
-
- /**
- * @return Display width in physical pixels.
- */
- @CalledByNative
- public int getDisplayWidth() {
- return getMetrics().widthPixels;
- }
-
- @SuppressWarnings("deprecation")
- private int getPixelFormat() {
- if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1) {
- return getDisplay().getPixelFormat();
- }
- // JellyBean MR1 and later always uses RGBA_8888.
- return PixelFormat.RGBA_8888;
- }
-
- /**
- * @return Bits per pixel.
- */
- @CalledByNative
- public int getBitsPerPixel() {
- int format = getPixelFormat();
- PixelFormat info = new PixelFormat();
- PixelFormat.getPixelFormatInfo(format, info);
- return info.bitsPerPixel;
- }
-
- /**
- * @return Bits per component.
- */
- @SuppressWarnings("deprecation")
- @CalledByNative
- public int getBitsPerComponent() {
- int format = getPixelFormat();
- switch (format) {
- case PixelFormat.RGBA_4444:
- return 4;
-
- case PixelFormat.RGBA_5551:
- return 5;
-
- case PixelFormat.RGBA_8888:
- case PixelFormat.RGBX_8888:
- case PixelFormat.RGB_888:
- return 8;
-
- case PixelFormat.RGB_332:
- return 2;
-
- case PixelFormat.RGB_565:
- return 5;
-
- // Non-RGB formats.
- case PixelFormat.A_8:
- case PixelFormat.LA_88:
- case PixelFormat.L_8:
- return 0;
-
- // Unknown format. Use 8 as a sensible default.
- default:
- return 8;
- }
- }
-
- /**
- * @return A scaling factor for the Density Independent Pixel unit. 1.0 is
- * 160dpi, 0.75 is 120dpi, 2.0 is 320dpi.
- */
- @CalledByNative
- public double getDIPScale() {
- return getMetrics().density;
- }
-
- /**
- * @return Smallest screen size in density-independent pixels that the
- * application will see, regardless of orientation.
- */
- @CalledByNative
- private int getSmallestDIPWidth() {
- return mAppContext.getResources().getConfiguration().smallestScreenWidthDp;
- }
-
- private void registerListener() {
- mAppContext.registerComponentCallbacks(
- new ComponentCallbacks() {
- @Override
- public void onConfigurationChanged(Configuration configuration) {
- updateNativeSharedDisplayInfo();
- }
-
- @Override
- public void onLowMemory() {
- }
- });
- }
-
- private void updateNativeSharedDisplayInfo() {
- nativeUpdateSharedDeviceDisplayInfo(getDisplayHeight(),
- getDisplayWidth(), getBitsPerPixel(), getBitsPerComponent(),
- getDIPScale(), getSmallestDIPWidth());
- }
-
- private Display getDisplay() {
- return mWinManager.getDefaultDisplay();
- }
-
- private DisplayMetrics getMetrics() {
- return mAppContext.getResources().getDisplayMetrics();
- }
-
- /**
- * Creates DeviceDisplayInfo for a given Context.
- *
- * @param context A context to use.
- * @return DeviceDisplayInfo associated with a given Context.
- */
- public static DeviceDisplayInfo create(Context context) {
- return new DeviceDisplayInfo(context);
- }
-
- @CalledByNative
- private static DeviceDisplayInfo createWithListener(Context context) {
- DeviceDisplayInfo deviceDisplayInfo = new DeviceDisplayInfo(context);
- deviceDisplayInfo.registerListener();
- return deviceDisplayInfo;
- }
-
- private native void nativeUpdateSharedDeviceDisplayInfo(int displayHeight,
- int displayWidth, int bitsPerPixel,
- int bitsPerComponent, double dipScale,
- int smallestDIPWidth);
+ private final Context mAppContext;
+ private final WindowManager mWinManager;
+
+ private DeviceDisplayInfo(Context context) {
+ mAppContext = context.getApplicationContext();
+ mWinManager = (WindowManager) mAppContext.getSystemService(Context.WINDOW_SERVICE);
+ }
+
+ /**
+ * @return Display height in physical pixels.
+ */
+ @CalledByNative
+ public int getDisplayHeight() {
+ return getMetrics().heightPixels;
+ }
+
+ /**
+ * @return Display width in physical pixels.
+ */
+ @CalledByNative
+ public int getDisplayWidth() {
+ return getMetrics().widthPixels;
+ }
+
+ @SuppressWarnings("deprecation")
+ private int getPixelFormat() {
+ if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1) {
+ return getDisplay().getPixelFormat();
+ }
+ // JellyBean MR1 and later always uses RGBA_8888.
+ return PixelFormat.RGBA_8888;
+ }
+
+ /**
+ * @return Bits per pixel.
+ */
+ @CalledByNative
+ public int getBitsPerPixel() {
+ int format = getPixelFormat();
+ PixelFormat info = new PixelFormat();
+ PixelFormat.getPixelFormatInfo(format, info);
+ return info.bitsPerPixel;
+ }
+
+ /**
+ * @return Bits per component.
+ */
+ @SuppressWarnings("deprecation")
+ @CalledByNative
+ public int getBitsPerComponent() {
+ int format = getPixelFormat();
+ switch (format) {
+ case PixelFormat.RGBA_4444:
+ return 4;
+
+ case PixelFormat.RGBA_5551:
+ return 5;
+
+ case PixelFormat.RGBA_8888:
+ case PixelFormat.RGBX_8888:
+ case PixelFormat.RGB_888:
+ return 8;
+
+ case PixelFormat.RGB_332:
+ return 2;
+
+ case PixelFormat.RGB_565:
+ return 5;
+
+ // Non-RGB formats.
+ case PixelFormat.A_8:
+ case PixelFormat.LA_88:
+ case PixelFormat.L_8:
+ return 0;
+
+ // Unknown format. Use 8 as a sensible default.
+ default:
+ return 8;
+ }
+ }
+
+ /**
+ * @return A scaling factor for the Density Independent Pixel unit.
+ * 1.0 is 160dpi, 0.75 is 120dpi, 2.0 is 320dpi.
+ */
+ @CalledByNative
+ public double getDIPScale() {
+ return getMetrics().density;
+ }
+
+ /**
+ * @return Smallest screen size in density-independent pixels that the
+ * application will see, regardless of orientation.
+ */
+ @CalledByNative
+ private int getSmallestDIPWidth() {
+ return mAppContext.getResources().getConfiguration().smallestScreenWidthDp;
+ }
+
+ private void registerListener() {
+ mAppContext.registerComponentCallbacks(
+ new ComponentCallbacks() {
+ @Override
+ public void onConfigurationChanged(Configuration configuration) {
+ updateNativeSharedDisplayInfo();
+ }
+
+ @Override
+ public void onLowMemory() {
+ }
+ });
+ }
+
+ private void updateNativeSharedDisplayInfo() {
+ nativeUpdateSharedDeviceDisplayInfo(getDisplayHeight(),
+ getDisplayWidth(), getBitsPerPixel(), getBitsPerComponent(),
+ getDIPScale(), getSmallestDIPWidth());
+ }
+
+ private Display getDisplay() {
+ return mWinManager.getDefaultDisplay();
+ }
+
+ private DisplayMetrics getMetrics() {
+ return mAppContext.getResources().getDisplayMetrics();
+ }
+
+ /**
+ * Creates DeviceDisplayInfo for a given Context.
+ * @param context A context to use.
+ * @return DeviceDisplayInfo associated with a given Context.
+ */
+ public static DeviceDisplayInfo create(Context context) {
+ return new DeviceDisplayInfo(context);
+ }
+
+ @CalledByNative
+ private static DeviceDisplayInfo createWithListener(Context context) {
+ DeviceDisplayInfo deviceDisplayInfo = new DeviceDisplayInfo(context);
+ deviceDisplayInfo.registerListener();
+ return deviceDisplayInfo;
+ }
+
+ private native void nativeUpdateSharedDeviceDisplayInfo(int displayHeight,
+ int displayWidth, int bitsPerPixel,
+ int bitsPerComponent, double dipScale,
+ int smallestDIPWidth);
}
diff --git a/ui/android/java/src/org/chromium/ui/gl/SurfaceTextureListener.java b/ui/android/java/src/org/chromium/ui/gl/SurfaceTextureListener.java
index bc57e1f..6e2d6fe 100644
--- a/ui/android/java/src/org/chromium/ui/gl/SurfaceTextureListener.java
+++ b/ui/android/java/src/org/chromium/ui/gl/SurfaceTextureListener.java
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright (c) 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.
diff --git a/ui/android/java/src/org/chromium/ui/gl/SurfaceTexturePlatformWrapper.java b/ui/android/java/src/org/chromium/ui/gl/SurfaceTexturePlatformWrapper.java
index 53d3303..5e46760 100644
--- a/ui/android/java/src/org/chromium/ui/gl/SurfaceTexturePlatformWrapper.java
+++ b/ui/android/java/src/org/chromium/ui/gl/SurfaceTexturePlatformWrapper.java
@@ -34,8 +34,8 @@ class SurfaceTexturePlatformWrapper {
@CalledByNative
private static void setFrameAvailableCallback(SurfaceTexture surfaceTexture,
long nativeSurfaceTextureListener) {
- surfaceTexture.setOnFrameAvailableListener(
- new SurfaceTextureListener(nativeSurfaceTextureListener));
+ surfaceTexture.setOnFrameAvailableListener(
+ new SurfaceTextureListener(nativeSurfaceTextureListener));
}
@CalledByNative