From 747698fe9b5589222e9beeea04bcb25c6d089b3d Mon Sep 17 00:00:00 2001 From: Frank Hale Date: Tue, 11 Nov 2014 13:33:15 -0500 Subject: [PATCH] Fix code style formatting - Fix code style formatting to be <= 80 lines - Add default parameter for urlOptions to loadUrl, reload and reloadIgnoringCache functions to be compatible with old API. --- atom/browser/api/atom_api_web_contents.cc | 5 +++-- atom/browser/api/lib/web-contents.coffee | 7 +++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/atom/browser/api/atom_api_web_contents.cc b/atom/browser/api/atom_api_web_contents.cc index cf40de96e488..8bb6a358169c 100644 --- a/atom/browser/api/atom_api_web_contents.cc +++ b/atom/browser/api/atom_api_web_contents.cc @@ -289,10 +289,11 @@ bool WebContents::IsAlive() const { void WebContents::LoadURL(const GURL& url, const mate::Dictionary& options) { content::NavigationController::LoadURLParams params(url); - base::string16 http_referrer_; + base::string16 http_referrer; if (options.Get("httpreferrer", &http_referrer_)) - params.referrer = content::Referrer(GURL(http_referrer_).GetAsReferrer(), blink::WebReferrerPolicyDefault); + 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; diff --git a/atom/browser/api/lib/web-contents.coffee b/atom/browser/api/lib/web-contents.coffee index e22d5e01c2b7..a0c8a00e7c52 100644 --- a/atom/browser/api/lib/web-contents.coffee +++ b/atom/browser/api/lib/web-contents.coffee @@ -26,6 +26,13 @@ module.exports.wrap = (webContents) -> webContents.getId = -> "#{@getProcessId()}-#{@getRoutingId()}" webContents.equal = (other) -> @getId() is other.getId() + # Provide a default parameter for urlOptions to be compatible with the old + # API. + webContents::loadUrl = (url, urlOptions={}) -> loadUrl url, urlOptions + webContents::reload = (urlOptions={}) -> reload(urlOptions) + webContents::reloadIgnoringCache = (urlOptions={}) -> + reloadIgnoringCache(urlOptions) + # Translate |disposition| to string for 'new-window' event. webContents.on '-new-window', (args..., disposition) -> disposition =