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.
This commit is contained in:
Frank Hale 2014-11-11 13:33:15 -05:00
parent e6830e9ac8
commit 747698fe9b
2 changed files with 10 additions and 2 deletions

View file

@ -289,10 +289,11 @@ bool WebContents::IsAlive() const {
void WebContents::LoadURL(const GURL& url, const mate::Dictionary& options) { void WebContents::LoadURL(const GURL& url, const mate::Dictionary& options) {
content::NavigationController::LoadURLParams params(url); content::NavigationController::LoadURLParams params(url);
base::string16 http_referrer_; base::string16 http_referrer;
if (options.Get("httpreferrer", &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.transition_type = content::PAGE_TRANSITION_TYPED;
params.override_user_agent = content::NavigationController::UA_OVERRIDE_TRUE; params.override_user_agent = content::NavigationController::UA_OVERRIDE_TRUE;

View file

@ -26,6 +26,13 @@ module.exports.wrap = (webContents) ->
webContents.getId = -> "#{@getProcessId()}-#{@getRoutingId()}" webContents.getId = -> "#{@getProcessId()}-#{@getRoutingId()}"
webContents.equal = (other) -> @getId() is other.getId() 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. # Translate |disposition| to string for 'new-window' event.
webContents.on '-new-window', (args..., disposition) -> webContents.on '-new-window', (args..., disposition) ->
disposition = disposition =