summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/android/testshell/java/src/org/chromium/chrome/testshell/ChromiumTestShellActivity.java4
-rw-r--r--chrome/android/testshell/res/values/strings.xml6
-rw-r--r--content/public/android/java/src/org/chromium/content/browser/ContentView.java7
-rw-r--r--content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java47
-rw-r--r--content/public/android/java/src/org/chromium/content/browser/ZoomManager.java7
5 files changed, 47 insertions, 24 deletions
diff --git a/chrome/android/testshell/java/src/org/chromium/chrome/testshell/ChromiumTestShellActivity.java b/chrome/android/testshell/java/src/org/chromium/chrome/testshell/ChromiumTestShellActivity.java
index 5887a69..26c1fc0 100644
--- a/chrome/android/testshell/java/src/org/chromium/chrome/testshell/ChromiumTestShellActivity.java
+++ b/chrome/android/testshell/java/src/org/chromium/chrome/testshell/ChromiumTestShellActivity.java
@@ -118,10 +118,14 @@ public class ChromiumTestShellActivity extends Activity {
private void initializeContentViewResources() {
AppResource.DIMENSION_LINK_PREVIEW_OVERLAY_RADIUS = R.dimen.link_preview_overlay_radius;
+ AppResource.DRAWABLE_ICON_ACTION_BAR_SHARE = R.drawable.ic_menu_share_holo_light;
+ AppResource.DRAWABLE_ICON_ACTION_BAR_WEB_SEARCH = R.drawable.ic_menu_search_holo_light;
AppResource.DRAWABLE_LINK_PREVIEW_POPUP_OVERLAY = R.drawable.popup_zoomer_overlay;
AppResource.ID_AUTOFILL_LABEL = R.id.autofill_label;
AppResource.ID_AUTOFILL_NAME = R.id.autofill_name;
AppResource.LAYOUT_AUTOFILL_TEXT = R.layout.autofill_text;
+ AppResource.STRING_ACTION_BAR_SHARE = R.string.action_bar_share;
+ AppResource.STRING_ACTION_BAR_WEB_SEARCH = R.string.action_bar_search;
AppResource.STRING_CONTENT_VIEW_CONTENT_DESCRIPTION = R.string.accessibility_content_view;
AppResource.STRING_MEDIA_PLAYER_MESSAGE_PLAYBACK_ERROR =
R.string.media_player_error_text_invalid_progressive_playback;
diff --git a/chrome/android/testshell/res/values/strings.xml b/chrome/android/testshell/res/values/strings.xml
index c90029e..a25a193 100644
--- a/chrome/android/testshell/res/values/strings.xml
+++ b/chrome/android/testshell/res/values/strings.xml
@@ -7,11 +7,13 @@
-->
<resources>
-
<string name="url_hint">Type URL Here</string>
-
<string name="accessibility_content_view">Web View</string>
+ <!-- Action Bar -->
+ <string name="action_bar_share">Share</string>
+ <string name="action_bar_search">Search</string>
+
<!-- Media Player -->
<string name="media_player_error_title">Cannot play video</string>
<string name="media_player_error_text_invalid_progressive_playback">
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 55616a7..8291363 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
@@ -105,7 +105,6 @@ public class ContentView extends FrameLayout implements ContentViewCore.Internal
* @param context Context used to obtain the application context.
* @param maxRendererProcesses Same as ContentView.enableMultiProcess()
* @return Whether the process actually needed to be initialized (false if already running).
- * @hide Only used by the platform browser.
*/
public static boolean initChromiumBrowserProcess(Context context, int maxRendererProcesses) {
return ContentViewCore.initChromiumBrowserProcess(context, maxRendererProcesses);
@@ -697,6 +696,12 @@ public class ContentView extends FrameLayout implements ContentViewCore.Internal
mContentViewCore.onDetachedFromWindow();
}
+ @Override
+ protected void onVisibilityChanged(View changedView, int visibility) {
+ super.onVisibilityChanged(changedView, visibility);
+ mContentViewCore.onVisibilityChanged(changedView, visibility);
+ }
+
void updateMultiTouchZoomSupport() {
mContentViewCore.updateMultiTouchZoomSupport();
}
diff --git a/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java b/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java
index ec30a2e..1cb057f 100644
--- a/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java
+++ b/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java
@@ -192,11 +192,7 @@ public class ContentViewCore implements MotionEventDelegate {
private boolean mHasSelection;
private String mLastSelectedText;
private boolean mSelectionEditable;
- // TODO(http://code.google.com/p/chromium/issues/detail?id=136704): Register
- // the necessary resources in ContentViewActivity so we can create an action
- // bar for text editing.
- // private ActionMode mActionMode;
- private boolean mActionBarVisible; // Remove this when mActionMode is upstreamed.
+ private ActionMode mActionMode;
// Delegate that will handle GET downloads, and be notified of completion of POST downloads.
private ContentViewDownloadDelegate mDownloadDelegate;
@@ -279,6 +275,11 @@ public class ContentViewCore implements MotionEventDelegate {
public ContentViewCore(Context context, int personality) {
mContext = context;
+ // All application resources must be registered by the time the content view is created.
+ // This should be omitted in final release builds where assertions are disabled.
+ // TODO(leandrogracia): re-enable this as soon as crbug.com/136704 is fixed.
+ // assert AppResource.verifyResourceRegistration();
+
WeakContext.initializeWeakContext(context);
// By default, ContentView will initialize single process mode. The call to
// initContentViewProcess below is ignored if either the ContentView host called
@@ -944,7 +945,6 @@ public class ContentViewCore implements MotionEventDelegate {
*
* @return an id that is passed along in the asynchronous onJavaScriptEvaluationResult callback
* @throws IllegalStateException If the ContentView has been destroyed.
- * @hide
*/
public int evaluateJavaScript(String script) throws IllegalStateException {
checkIsAlive();
@@ -1016,13 +1016,13 @@ public class ContentViewCore implements MotionEventDelegate {
private void hidePopupDialog() {
SelectPopupDialog.hide(this);
+ hideHandles();
+ hideSelectActionBar();
}
void hideSelectActionBar() {
- if (mActionBarVisible) {
- mActionBarVisible = false;
- mImeAdapter.unselect();
- getContentViewClient().onContextualActionBarHidden();
+ if (mActionMode != null) {
+ mActionMode.finish();
}
}
@@ -1042,9 +1042,20 @@ public class ContentViewCore implements MotionEventDelegate {
setAccessibilityState(false);
}
+ /**
+ * @see View#onVisibilityChanged(android.view.View, int)
+ */
+ public void onVisibilityChanged(View changedView, int visibility) {
+ if (visibility != View.VISIBLE) {
+ if (mContentSettings.supportZoom()) {
+ mZoomManager.dismissZoomPicker();
+ }
+ }
+ }
+
@CalledByNative
private void onWebPreferencesUpdated() {
- // TODO(nileshagrawal): Implement this.
+ mContentSettings.syncSettings();
}
/**
@@ -1372,7 +1383,6 @@ public class ContentViewCore implements MotionEventDelegate {
private void handleTapOrPress(
long timeMs, int x, int y, boolean isLongPress, boolean showPress) {
- //TODO(yusufo):Upstream the rest of the bits about handlerControllers.
if (!mContainerView.isFocused()) mContainerView.requestFocus();
if (!mPopupZoomer.isShowing()) mPopupZoomer.setLastTouch(x, y);
@@ -1387,6 +1397,7 @@ public class ContentViewCore implements MotionEventDelegate {
if (!showPress && mNativeContentViewCore != 0) {
nativeShowPressState(mNativeContentViewCore, timeMs, x, y);
}
+ if (mSelectionEditable) getInsertionHandleController().allowAutomaticShowing();
if (mNativeContentViewCore != 0) {
nativeSingleTap(mNativeContentViewCore, timeMs, x, y, false);
}
@@ -1545,14 +1556,6 @@ public class ContentViewCore implements MotionEventDelegate {
}
private void showSelectActionBar() {
- if (!mActionBarVisible) {
- mActionBarVisible = true;
- getContentViewClient().onContextualActionBarShown();
- }
-
-// TODO(http://code.google.com/p/chromium/issues/detail?id=136704): Uncomment
-// this code when we have the resources needed to create the action bar.
-/*
if (mActionMode != null) {
mActionMode.invalidate();
return;
@@ -1607,7 +1610,6 @@ public class ContentViewCore implements MotionEventDelegate {
} else {
getContentViewClient().onContextualActionBarShown();
}
-*/
}
public boolean getUseDesktopUserAgent() {
@@ -1666,6 +1668,7 @@ public class ContentViewCore implements MotionEventDelegate {
mNativePageScaleFactor = scale;
mPopupZoomer.hide(true);
+ updateHandleScreenPositions();
mZoomManager.updateZoomControls();
}
@@ -1690,6 +1693,8 @@ public class ContentViewCore implements MotionEventDelegate {
mSelectionEditable = (textInputType != ImeAdapter.sTextInputTypeNone);
+ if (mActionMode != null) mActionMode.invalidate();
+
mImeAdapter.attachAndShowIfNeeded(nativeImeAdapterAndroid, textInputType,
text, showImeIfNeeded);
diff --git a/content/public/android/java/src/org/chromium/content/browser/ZoomManager.java b/content/public/android/java/src/org/chromium/content/browser/ZoomManager.java
index e632f2c..1aabd0f 100644
--- a/content/public/android/java/src/org/chromium/content/browser/ZoomManager.java
+++ b/content/public/android/java/src/org/chromium/content/browser/ZoomManager.java
@@ -109,6 +109,13 @@ class ZoomManager {
}
}
+ void dismissZoomPicker() {
+ ZoomButtonsController zoomControls = getZoomControls();
+ if (zoomControls != null && zoomControls.isVisible()) {
+ zoomControls.setVisible(false);
+ }
+ }
+
boolean isMultiTouchZoomSupported() {
return !mMultiTouchListener.getPermanentlyIgnoreDetectorEvents();
}