Add support for setting http referrer
- Add url option to specify the http referrer - Add httpReferrer attribute to webview NOTE: This is still not complete. Some love has to be done to guest-view-manager.coffee and very likely the function calls called createGuest and to the code that uses them.
This commit is contained in:
parent
fea5559fbc
commit
f56d1ea7b4
6 changed files with 61 additions and 16 deletions
|
@ -286,8 +286,14 @@ bool WebContents::IsAlive() const {
|
|||
return web_contents() != NULL;
|
||||
}
|
||||
|
||||
void WebContents::LoadURL(const GURL& url) {
|
||||
void WebContents::LoadURL(const GURL& url, const mate::Dictionary& options) {
|
||||
content::NavigationController::LoadURLParams params(url);
|
||||
|
||||
base::string16 http_referrer_;
|
||||
|
||||
if(options.Get("httpReferrer", &http_referrer_))
|
||||
params.referrer = content::Referrer(GURL(http_referrer_).GetAsReferrer(), blink::WebReferrerPolicyDefault);
|
||||
|
||||
params.transition_type = content::PAGE_TRANSITION_TYPED;
|
||||
params.override_user_agent = content::NavigationController::UA_OVERRIDE_TRUE;
|
||||
web_contents()->GetController().LoadURLWithParams(params);
|
||||
|
@ -313,15 +319,15 @@ void WebContents::Stop() {
|
|||
web_contents()->Stop();
|
||||
}
|
||||
|
||||
void WebContents::Reload() {
|
||||
void WebContents::Reload(const mate::Dictionary& options) {
|
||||
// Navigating to a URL would always restart the renderer process, we want this
|
||||
// because normal reloading will break our node integration.
|
||||
// This is done by AtomBrowserClient::ShouldSwapProcessesForNavigation.
|
||||
LoadURL(GetURL());
|
||||
LoadURL(GetURL(), options);
|
||||
}
|
||||
|
||||
void WebContents::ReloadIgnoringCache() {
|
||||
Reload();
|
||||
void WebContents::ReloadIgnoringCache(const mate::Dictionary& options) {
|
||||
Reload(options);
|
||||
}
|
||||
|
||||
bool WebContents::CanGoBack() const {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue