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

Commit

Permalink
[Android] Support the feature of proxy in Crosswalk
Browse files Browse the repository at this point in the history
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, but it’s too complex to maintain those codes, so
implement the new API in XWalkView to set proxy for images/text resources.

BUG=XWALK-6769
  • Loading branch information
fujunwei committed Jun 28, 2016
1 parent d3001c4 commit 44ebfe9
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 3 deletions.
8 changes: 8 additions & 0 deletions net/proxy/proxy_config_service_android.cc
Original file line number Diff line number Diff line change
Expand Up @@ -411,4 +411,12 @@ void ProxyConfigServiceAndroid::ProxySettingsChanged() {
delegate_->ProxySettingsChanged();
}

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);
}

} // namespace net
10 changes: 7 additions & 3 deletions net/proxy/proxy_config_service_android.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#define NET_PROXY_PROXY_CONFIG_SERVICE_ANDROID_H_

#include <string>
#include <vector>

#include "base/android/jni_android.h"
#include "base/callback_forward.h"
Expand Down Expand Up @@ -78,6 +79,12 @@ class NET_EXPORT ProxyConfigServiceAndroid : public ProxyConfigService {
void RemoveObserver(Observer* observer) override;
ConfigAvailability GetLatestProxyConfig(ProxyConfig* config) override;

void ProxySettingsChanged();
void ProxySettingsChangedTo(const std::string& host,
int port,
const std::string& pac_url,
const std::vector<std::string>& exclusion_list);

private:
friend class ProxyConfigServiceAndroidTestBase;
class Delegate;
Expand All @@ -88,9 +95,6 @@ class NET_EXPORT ProxyConfigServiceAndroid : public ProxyConfigService {
const scoped_refptr<base::SequencedTaskRunner>& jni_task_runner,
GetPropertyCallback get_property_callback);

// For tests.
void ProxySettingsChanged();

scoped_refptr<Delegate> delegate_;

DISALLOW_COPY_AND_ASSIGN(ProxyConfigServiceAndroid);
Expand Down
5 changes: 5 additions & 0 deletions net/proxy/proxy_service.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1475,6 +1475,11 @@ ProxyService::State ProxyService::ResetProxyConfig(bool reset_fetched_config) {
return previous_state;
}

ProxyConfigService* ProxyService::GetProxyConfigService() const {
DCHECK(CalledOnValidThread());
return config_service_.get();
}

void ProxyService::ResetConfigService(
scoped_ptr<ProxyConfigService> new_proxy_config_service) {
DCHECK(CalledOnValidThread());
Expand Down
1 change: 1 addition & 0 deletions net/proxy/proxy_service.h
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ class NET_EXPORT ProxyService : public NetworkChangeNotifier::IPAddressObserver,
// ResolveProxy calls.
void ResetConfigService(
scoped_ptr<ProxyConfigService> new_proxy_config_service);
ProxyConfigService* GetProxyConfigService() const;

// Returns the last configuration fetched from ProxyConfigService.
const ProxyConfig& fetched_config() {
Expand Down

0 comments on commit 44ebfe9

Please sign in to comment.