Pass user agent along like http referrer and set user agent in C++

This commit is contained in:
Paul Betts 2015-05-05 21:01:41 -07:00
parent 4a8d7c1819
commit e4d90f747f
3 changed files with 14 additions and 6 deletions

View file

@ -158,13 +158,14 @@ class SrcAttribute extends WebViewAttribute
return
# Navigate to |this.src|.
opts = {}
httpreferrer = @webViewImpl.attributes[webViewConstants.ATTRIBUTE_HTTPREFERRER].getValue()
urlOptions = if httpreferrer then {httpreferrer} else {}
if httpreferrer then opts.httpreferrer = httpreferrer
useragent = @webViewImpl.attributes[webViewConstants.ATTRIBUTE_HTTPREFERRER].getValue()
useragent = @webViewImpl.attributes[webViewConstants.ATTRIBUTE_USERAGENT].getValue()
if useragent then opts.useragent = useragent
guestContents = remote.getGuestWebContents(@webViewImpl.guestInstanceId)
guestContents.setUserAgent(guestContents) if guestContents
guestContents.loadUrl @getValue(), urlOptions
# Attribute specifies HTTP referrer.
@ -175,7 +176,7 @@ class HttpReferrerAttribute extends WebViewAttribute
# Attribute specifies HTTP referrer.
class UserAgentAttribute extends WebViewAttribute
constructor: (webViewImpl) ->
super webViewConstants.ATTRIBUTE_HTTPREFERRER, webViewImpl
super webViewConstants.ATTRIBUTE_USERAGENT, webViewImpl
# Attribute that set preload script.
class PreloadAttribute extends WebViewAttribute