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

Unified Diff: content/public/android/java/src/org/chromium/content/browser/ContentView.java

Issue 10832104: Start upstreaming accessibility. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address Dan's Nits Created 8 years, 5 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 | « no previous file | content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/public/android/java/src/org/chromium/content/browser/ContentView.java
diff --git a/content/public/android/java/src/org/chromium/content/browser/ContentView.java b/content/public/android/java/src/org/chromium/content/browser/ContentView.java
index d8501eca97a660ddfc9f8de42ed088a101fe0d50..6e796fa7d9d5c02abbc852f88db1d9249bff4987 100644
--- a/content/public/android/java/src/org/chromium/content/browser/ContentView.java
+++ b/content/public/android/java/src/org/chromium/content/browser/ContentView.java
@@ -7,13 +7,18 @@ package org.chromium.content.browser;
import android.content.Context;
import android.content.res.Configuration;
import android.graphics.Canvas;
+import android.os.Build;
import android.util.AttributeSet;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.View;
+import android.view.accessibility.AccessibilityEvent;
+import android.view.accessibility.AccessibilityNodeInfo;
import android.webkit.DownloadListener;
import android.widget.FrameLayout;
+import org.chromium.content.browser.ContentViewCore;
+
/**
* The containing view for {@link ContentViewCore} that exists in the Android UI hierarchy and
* exposes the various {@link View} functionality to it.
@@ -94,21 +99,55 @@ public class ContentView extends FrameLayout implements ContentViewCore.Internal
private ContentViewCore mContentViewCore;
- public ContentView(Context context, int nativeWebContents, int personality) {
- this(context, nativeWebContents, null, android.R.attr.webViewStyle, personality);
+ /**
+ * Creates an instance of a ContentView.
+ * @param context The Context the view is running in, through which it can
+ * access the current theme, resources, etc.
+ * @param nativeWebContents A pointer to the native web contents.
+ * @param personality One of {@link #PERSONALITY_CHROME} or {@link #PERSONALITY_VIEW}.
+ * @return A ContentView instance.
+ */
+ public static ContentView newInstance(Context context, int nativeWebContents, int personality) {
+ return newInstance(context, nativeWebContents, null, android.R.attr.webViewStyle,
+ personality);
}
- public ContentView(Context context, int nativeWebContents, AttributeSet attrs) {
+ /**
+ * Creates an instance of a ContentView.
+ * @param context The Context the view is running in, through which it can
+ * access the current theme, resources, etc.
+ * @param nativeWebContents A pointer to the native web contents.
+ * @param attrs The attributes of the XML tag that is inflating the view.
+ * @return A ContentView instance.
+ */
+ public static ContentView newInstance(Context context, int nativeWebContents,
+ AttributeSet attrs) {
// TODO(klobag): use the WebViewStyle as the default style for now. It enables scrollbar.
// When ContentView is moved to framework, we can define its own style in the res.
- this(context, nativeWebContents, attrs, android.R.attr.webViewStyle);
+ return newInstance(context, nativeWebContents, attrs, android.R.attr.webViewStyle);
+ }
+
+ /**
+ * Creates an instance of a ContentView.
+ * @param context The Context the view is running in, through which it can
+ * access the current theme, resources, etc.
+ * @param nativeWebContents A pointer to the native web contents.
+ * @param attrs The attributes of the XML tag that is inflating the view.
+ * @param defStyle The default style to apply to this view.
+ * @return A ContentView instance.
+ */
+ public static ContentView newInstance(Context context, int nativeWebContents,
+ AttributeSet attrs, int defStyle) {
+ return newInstance(context, nativeWebContents, attrs, defStyle, PERSONALITY_VIEW);
}
- public ContentView(Context context, int nativeWebContents, AttributeSet attrs, int defStyle) {
- this(context, nativeWebContents, attrs, defStyle, PERSONALITY_VIEW);
+ private static ContentView newInstance(Context context, int nativeWebContents,
+ AttributeSet attrs, int defStyle, int personality) {
+ // TODO(dtrainor): Upstream JellyBean version of AccessibilityInjector when SDK is 16.
+ return new ContentView(context, nativeWebContents, attrs, defStyle, personality);
}
- private ContentView(Context context, int nativeWebContents, AttributeSet attrs, int defStyle,
+ protected ContentView(Context context, int nativeWebContents, AttributeSet attrs, int defStyle,
int personality) {
super(context, attrs, defStyle);
@@ -320,6 +359,34 @@ public class ContentView extends FrameLayout implements ContentViewCore.Internal
}
/**
+ * This method should be called when the containing activity is paused.
+ **/
+ public void onActivityPause() {
+ mContentViewCore.onActivityPause();
+ }
+
+ /**
+ * This method should be called when the containing activity is resumed.
+ **/
+ public void onActivityResume() {
+ mContentViewCore.onActivityResume();
+ }
+
+ /**
+ * To be called when the ContentView is shown.
+ **/
+ public void onShow() {
+ mContentViewCore.onShow();
+ }
+
+ /**
+ * To be called when the ContentView is hidden.
+ **/
+ public void onHide() {
+ mContentViewCore.onHide();
+ }
+
+ /**
* Return the ContentSettings object used to control the settings for this
* WebView.
*
@@ -363,6 +430,30 @@ public class ContentView extends FrameLayout implements ContentViewCore.Internal
return super.awakenScrollBars();
}
+ @Override
+ public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
+ super.onInitializeAccessibilityNodeInfo(info);
+ mContentViewCore.onInitializeAccessibilityNodeInfo(info);
+ }
+
+ @Override
+ public void onInitializeAccessibilityEvent(AccessibilityEvent event) {
+ super.onInitializeAccessibilityEvent(event);
+ mContentViewCore.onInitializeAccessibilityEvent(event);
+ }
+
+ @Override
+ protected void onAttachedToWindow() {
+ super.onAttachedToWindow();
+ mContentViewCore.onAttachedToWindow();
+ }
+
+ @Override
+ protected void onDetachedFromWindow() {
+ super.onDetachedFromWindow();
+ mContentViewCore.onDetachedFromWindow();
+ }
+
void updateMultiTouchZoomSupport() {
mContentViewCore.updateMultiTouchZoomSupport();
}
« no previous file with comments | « no previous file | content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698