This repository has been archived by the owner on Apr 3, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 653
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Android] Upgrade shouldInterceptLoadRequest API
As current shouldInterceptLoadRequest misses lots of important context, shouldInterceptLoadRequest need to be upgraded to Android L style. To keep the backward compatibility, the old API still be usable. So this commit adds the following to shouldInterceptLoadRequest params: - isMainFrame - hasUserGesture - method - request headers And use WebResourceResponse to replace InterceptedRequestData, adds the following: - status code - response phrase - response headers The advantage of this implemention compared to android_webview is that it's independent of the android sdk version, which means all the Crosswalk support android verisons based application can use the new shouldInterceptLoadRequest to get the newly added context. BUG=XWALK-3934, XWALK-4255
- Loading branch information
Showing
35 changed files
with
1,019 additions
and
432 deletions.
There are no files selected for viewing
42 changes: 0 additions & 42 deletions
42
runtime/android/core_internal/src/org/xwalk/core/internal/InterceptedRequestData.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
...oid/core_internal/src/org/xwalk/core/internal/XWalkWebResourceRequestHandlerInternal.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// Copyright 2015 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.xwalk.core.internal; | ||
|
||
import android.net.Uri; | ||
|
||
import java.util.Map; | ||
|
||
@XWalkAPI(impl = XWalkWebResourceRequestInternal.class, createInternally = true) | ||
public class XWalkWebResourceRequestHandlerInternal implements XWalkWebResourceRequestInternal { | ||
private final XWalkContentsClientBridge.WebResourceRequestInner mRequest; | ||
|
||
// Never use this constructor. | ||
// It is only used in WebResourceRequestHandlerBridge. | ||
XWalkWebResourceRequestHandlerInternal() { | ||
mRequest = null; | ||
} | ||
|
||
XWalkWebResourceRequestHandlerInternal( | ||
XWalkContentsClientBridge.WebResourceRequestInner request) { | ||
mRequest = request; | ||
} | ||
|
||
@XWalkAPI | ||
public Uri getUrl() { | ||
return Uri.parse(mRequest.url); | ||
} | ||
|
||
@XWalkAPI | ||
public boolean isForMainFrame() { | ||
return mRequest.isMainFrame; | ||
} | ||
|
||
@XWalkAPI | ||
public boolean hasGesture() { | ||
return mRequest.hasUserGesture; | ||
} | ||
|
||
@XWalkAPI | ||
public String getMethod() { | ||
return mRequest.method; | ||
} | ||
|
||
@XWalkAPI | ||
public Map<String, String> getRequestHeaders() { | ||
return mRequest.requestHeaders; | ||
} | ||
} |
Oops, something went wrong.