About proxySettingsChanged,  is kind like a callback.  How about setProxy ?



Regards,
Xing

From: Crosswalk-dev [mailto:crosswalk-dev-boun...@lists.crosswalk-project.org] 
On Behalf Of Wei, Xiaosong
Sent: Monday, April 25, 2016 2:57 PM
To: Fu, Junwei <junwei...@intel.com>; crosswalk-dev@lists.crosswalk-project.org
Subject: Re: [Crosswalk-dev] [Android] Intent to Implement: Support proxy in 
Crosswalk

LGTM!

From: Crosswalk-dev [mailto:crosswalk-dev-boun...@lists.crosswalk-project.org] 
On Behalf Of Fu, Junwei
Sent: Friday, April 22, 2016 9:39 AM
To: 
crosswalk-dev@lists.crosswalk-project.org<mailto:crosswalk-dev@lists.crosswalk-project.org>
Subject: [Crosswalk-dev] [Android] Intent to Implement: Support proxy in 
Crosswalk

Description:
A requirement from an important customer who want to forward web resources with 
proxy in Crosswalk. The usage of proxy in video/audio is different from other 
web resources.
For video/audio:
Crosswalk for android will call android system services named 
android.widget.MediaPlayer to handle video/audio, unfortunately MediaPlayer API 
doesn't provide a ready-to-use method for proxy setting at the moment, but 
there is a possible workaround in 
http://stackoverflow.com/questions/10627278/how-to-set-proxy-on-mediaplayer   
that a local server socket need to be setup to listen the request from 
MediaPlayer, download the media contents with httpClient and feed those streams 
 to MediaPlayer.
So I intent to implement the new API in XWalkResourceClient to intercept normal 
playing video/audio
@Override
/**
     @param View The XWalkViewInternal that is initiating the callback
     @param  mediaPalyer the android system services
     @param context the context to use when resolving the Uri
     @param uri the Content URI of data you want to play
     @param header the headers to be sent together with the request for the 
data Note that the cross domain redirection is allowed by default
     @return True if want to play itself, otherwise return false
*/
    public boolean shouldOverrideResourceLoading(XWalkView view,
            MediaPlayer mediaPlayer, Context context, Uri uri, Map<String, 
String> headers) {
   }
Related feature: XWALK-6770

For other web resources such as images, text resources:
Crosswalk for android will update proxy when a PROXY_CHANGE intent is received, 
but it's need system permission to send the broadcast, there is also a 
workaround with reflecting the incompatible api in 
http://stackoverflow.com/questions/19979578/android-webview-set-proxy-programatically-kitkat
 , but it's too complex to maintain those codes,
So I intent to implement the new API in XWalkView to set proxy for images/text 
resources
/**
     @param host proxy host
     @param  port proxy port
     @param pacUrl  the PAC script at the specified URL.
     @param exclusionList Hosts to exclude using the proxy on connections for. 
These hosts can use wildcards such as *.example.com.
*/
   public void proxySettingsChanged(String host, int port, String pacUrl, 
String[] exclusionList)
Related feature: XWALK-6769

Target release: Crosswalk-20

Implementation details:
shouldOverrideResourceLoading API:
Chromium upstream code need to add a new param in 
net/proxy/proxy_config_service_android.cc
public static class ResourceLoadingFilter {
         public boolean shouldOverrideResourceLoading(
-                MediaPlayer mediaPlayer, Context context, Uri uri) {
+                MediaPlayer mediaPlayer, Context context, Uri uri, Map<String, 
String> headers) {
             return false;
         }
     }
Then XWalk repo will export the api to XWalkResourceClient.

proxySettingsChanged API:
Chromium upstream code need to add an new API in 
net/proxy/proxy_config_service_android.cc
+void ProxyConfigServiceAndroid::ProxySettingsChangedTo(
+    const std::string& host,
+    int port,
+    const std::string& pac_url,
+    const std::vector<std::string>& exclusion_list) {
+  delegate_->ProxySettingsChangedTo(host, port, pac_url, exclusion_list);
+}
Then XWalk repo will export the api to XWalkView.

Thanks,
Junwei

_______________________________________________
Crosswalk-dev mailing list
Crosswalk-dev@lists.crosswalk-project.org
https://lists.crosswalk-project.org/mailman/listinfo/crosswalk-dev

Reply via email to