summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/chromium_http/support.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'media/libstagefright/chromium_http/support.cpp')
-rw-r--r--media/libstagefright/chromium_http/support.cpp39
1 files changed, 37 insertions, 2 deletions
diff --git a/media/libstagefright/chromium_http/support.cpp b/media/libstagefright/chromium_http/support.cpp
index 832e86d..741cb1d 100644
--- a/media/libstagefright/chromium_http/support.cpp
+++ b/media/libstagefright/chromium_http/support.cpp
@@ -44,7 +44,7 @@ namespace android {
static Mutex gNetworkThreadLock;
static base::Thread *gNetworkThread = NULL;
-static scoped_refptr<net::URLRequestContext> gReqContext;
+static scoped_refptr<SfRequestContext> gReqContext;
static scoped_ptr<net::NetworkChangeNotifier> gNetworkChangeNotifier;
bool logMessageHandler(
@@ -169,8 +169,10 @@ SfRequestContext::SfRequestContext() {
set_ssl_config_service(
net::SSLConfigService::CreateSystemSSLConfigService());
+ mProxyConfigService = new net::ProxyConfigServiceAndroid;
+
set_proxy_service(net::ProxyService::CreateWithoutProxyResolver(
- new net::ProxyConfigServiceAndroid, net_log()));
+ mProxyConfigService, net_log()));
set_http_transaction_factory(new net::HttpCache(
host_resolver(),
@@ -191,6 +193,31 @@ const std::string &SfRequestContext::GetUserAgent(const GURL &url) const {
return mUserAgent;
}
+status_t SfRequestContext::updateProxyConfig(
+ const char *host, int32_t port, const char *exclusionList) {
+ Mutex::Autolock autoLock(mProxyConfigLock);
+
+ if (host == NULL || *host == '\0') {
+ MY_LOGV("updateProxyConfig NULL");
+
+ std::string proxy;
+ std::string exList;
+ mProxyConfigService->UpdateProxySettings(proxy, exList);
+ } else {
+#if !defined(LOG_NDEBUG) || LOG_NDEBUG == 0
+ LOG_PRI(ANDROID_LOG_VERBOSE, LOG_TAG,
+ "updateProxyConfig %s:%d, exclude '%s'",
+ host, port, exclusionList);
+#endif
+
+ std::string proxy = StringPrintf("%s:%d", host, port).c_str();
+ std::string exList = exclusionList;
+ mProxyConfigService->UpdateProxySettings(proxy, exList);
+ }
+
+ return OK;
+}
+
////////////////////////////////////////////////////////////////////////////////
SfNetworkLibrary::SfNetworkLibrary() {}
@@ -219,6 +246,14 @@ SfDelegate::~SfDelegate() {
CHECK(mURLRequest == NULL);
}
+// static
+status_t SfDelegate::UpdateProxyConfig(
+ const char *host, int32_t port, const char *exclusionList) {
+ InitializeNetworkThreadIfNecessary();
+
+ return gReqContext->updateProxyConfig(host, port, exclusionList);
+}
+
void SfDelegate::setOwner(ChromiumHTTPDataSource *owner) {
mOwner = owner;
}