Add BrowserWindow.restart() to restart renderer process.

This commit is contained in:
Cheng Zhao 2013-05-28 16:01:44 +08:00
parent 39bd56af4c
commit 9cf890bb61
4 changed files with 16 additions and 1 deletions

View file

@ -14,6 +14,9 @@ BrowserWindow::toggleDevTools = ->
@openDevTools()
v8Util.setHiddenValue this, 'devtoolsOpened', true
BrowserWindow::restart = ->
@loadUrl(@getUrl())
BrowserWindow.getFocusedWindow = ->
windows = objectsRegistry.getAllWindows()
return window for window in windows when window.isFocused()

View file

@ -38,6 +38,14 @@ void AtomBrowserClient::OverrideWebkitPrefs(
prefs->enable_scroll_animator = false;
}
bool AtomBrowserClient::ShouldSwapProcessesForNavigation(
content::SiteInstance* site_instance,
const GURL& current_url,
const GURL& new_url) {
// Restart renderer process if navigating to the same url.
return current_url == new_url;
}
brightray::BrowserMainParts* AtomBrowserClient::OverrideCreateBrowserMainParts(
const content::MainFunctionParams&) {
return new AtomBrowserMainParts;

View file

@ -18,6 +18,10 @@ class AtomBrowserClient : public brightray::BrowserClient {
virtual void OverrideWebkitPrefs(content::RenderViewHost* render_view_host,
const GURL& url,
webkit_glue::WebPreferences* prefs) OVERRIDE;
virtual bool ShouldSwapProcessesForNavigation(
content::SiteInstance* site_instance,
const GURL& current_url,
const GURL& new_url) OVERRIDE;
private:
virtual brightray::BrowserMainParts* OverrideCreateBrowserMainParts(

2
vendor/brightray vendored

@ -1 +1 @@
Subproject commit 6b9c1b6761ff164173e4f7fdebc478af99e411e5
Subproject commit e2c74cd6631fa7289e36e34f5c6e286bb1e961c2