]> khamidou — GitHub mirrors - electron.git/commitdiff
Fix code style formatting
authorFrank Hale <frankhale@gmail.com>
Tue, 11 Nov 2014 18:33:15 +0000 (13:33 -0500)
committerFrank Hale <frankhale@gmail.com>
Tue, 11 Nov 2014 18:33:15 +0000 (13:33 -0500)
- 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
atom/browser/api/lib/web-contents.coffee

index cf40de96e488ea3a22a5e0b539dd3ad67c61968f..8bb6a358169c1d0a4fd86acfd5571f72572fabf8 100644 (file)
@@ -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;
index e22d5e01c2b7bc6f293a6df1b63adf0809a66953..a0c8a00e7c524ed788311c5e3b34c748e035ceb2 100644 (file)
@@ -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 =