diff --git a/mozilla/plugin/oji/MRJ/plugin/Source/MRJContext.cp b/mozilla/plugin/oji/MRJ/plugin/Source/MRJContext.cp index 3588527a047..033df821529 100644 --- a/mozilla/plugin/oji/MRJ/plugin/Source/MRJContext.cp +++ b/mozilla/plugin/oji/MRJ/plugin/Source/MRJContext.cp @@ -769,6 +769,38 @@ Boolean MRJContext::appletLoaded() return (mViewer != NULL); } +void MRJContext::setProxyInfoForURL(char * url, JMProxyType proxyType) +{ + /* + * We then call 'nsIPluginManager2::FindProxyForURL' which will return + * proxy information which we can parse and set via JMSetProxyInfo. + */ + + char * result = NULL; + + thePluginManager2->FindProxyForURL(url, &result); + if (result != NULL) { + JMProxyInfo proxyInfo; + + /* See if a proxy was specified */ + if (strcmp("DIRECT", result)) { + int index = 0; + int length = strlen(result); + + proxyInfo.useProxy = true; + result = strchr(result, ' '); + for (index = 0; *result != ':' && index < length; result++, index++) { + proxyInfo.proxyHost[index] = *result; + } + proxyInfo.proxyHost[index] = '\0'; + result++; + proxyInfo.proxyPort = atoi(result); + JMSetProxyInfo(mSessionRef, proxyType, &proxyInfo); + } + } +} + + Boolean MRJContext::loadApplet() { static JMAppletSecurity security = { @@ -787,6 +819,18 @@ Boolean MRJContext::loadApplet() }; OSStatus status; + /* Added by Mark: */ + /* + * Set proxy info + * It is only set if the new enhanced Plugin Manager exists. + */ + if (thePluginManager2 != NULL) { + /* Sample URL's to use for getting the HTTP proxy and FTP proxy */ + setProxyInfoForURL("http://www.mozilla.org", eHTTPProxy); + setProxyInfoForURL("ftp://ftp.mozilla.org", eFTPProxy); + } + /* End set proxy info code */ + status = ::JMNewAppletViewer(&mViewer, mContext, mLocator, 0, &security, &callbacks, this); if (status == noErr) { diff --git a/mozilla/plugin/oji/MRJ/plugin/Source/MRJContext.h b/mozilla/plugin/oji/MRJ/plugin/Source/MRJContext.h index f59eb080637..0ffc5a59c20 100644 --- a/mozilla/plugin/oji/MRJ/plugin/Source/MRJContext.h +++ b/mozilla/plugin/oji/MRJ/plugin/Source/MRJContext.h @@ -37,7 +37,7 @@ // Instance state information about the plugin. // // *Developers*: Use this struct to hold per-instance -// information that youšll need in the +// information that youźll need in the // various functions in this file. // @@ -58,6 +58,7 @@ public: Boolean createContext(); JMAWTContextRef getContextRef(); + void setProxyInfoForURL(char * url, JMProxyType proxyType); Boolean appletLoaded(); Boolean loadApplet(); Boolean isActive();