Skip to content
This repository has been archived by the owner on Apr 3, 2020. It is now read-only.

Commit

Permalink
[Android] Stop using org.apache.http classes in AccessibilityInjector.
Browse files Browse the repository at this point in the history
As part of the efforts to stop depending on external packages in the
code, replace usage of org.apache.http classes with an implementation
that only uses apache.net.Uri.

This allows us to drop the dependency on the legacy_http_client target
and end up having to bundle org.apache.http.legacy.jar into
xwalk_core_library.jar.

Not upstreamable, as the code in question was removed upstream when they
dropped support for ICS.

BUG=XWALK-5092
  • Loading branch information
Raphael Kubo da Costa authored and Mrunal Kapade committed Nov 20, 2015
1 parent b6447eb commit 15a9171
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 14 deletions.
1 change: 0 additions & 1 deletion content/content.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,6 @@
'dependencies': [
'java_set_jni_headers',
'motionevent_jni_headers',
'../third_party/android_tools/android_tools.gyp:legacy_http_javalib',
],
'includes': [ 'content_jni.gypi' ],
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import android.accessibilityservice.AccessibilityServiceInfo;
import android.content.Context;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Vibrator;
Expand All @@ -15,17 +16,13 @@
import android.view.accessibility.AccessibilityManager;
import android.view.accessibility.AccessibilityNodeInfo;

import org.apache.http.NameValuePair;
import org.apache.http.client.utils.URLEncodedUtils;
import org.chromium.base.CommandLine;
import org.chromium.content.browser.ContentViewCore;
import org.chromium.content.browser.JavascriptInterface;
import org.chromium.content.common.ContentSwitches;
import org.json.JSONException;
import org.json.JSONObject;

import java.net.URI;
import java.net.URISyntaxException;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
Expand Down Expand Up @@ -305,16 +302,11 @@ private int getAxsUrlParameterValue() {
}

try {
List<NameValuePair> params = URLEncodedUtils.parse(
new URI(mContentViewCore.getWebContents().getUrl()), null);

for (NameValuePair param : params) {
if ("axs".equals(param.getName())) {
return Integer.parseInt(param.getValue());
}
Uri uri = Uri.parse(mContentViewCore.getWebContents().getUrl());
String axs = uri.getQueryParameter("axs");
if (axs != null) {
return Integer.parseInt(axs);
}
} catch (URISyntaxException ex) {
// Intentional no-op.
} catch (NumberFormatException ex) {
// Intentional no-op.
} catch (IllegalArgumentException ex) {
Expand Down

0 comments on commit 15a9171

Please sign in to comment.