Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

new option 'new-instance' in gui.Window.open()

Setting the option to 'true' starts a new renderer process
and Node instance. Fix #306
  • Loading branch information...
commit 6b4e9d8f2bb9b495945ac8d53f912be8643cab02 1 parent 8389aec
@rogerwang rogerwang authored
View
19 src/api/dispatcher_host.cc
@@ -32,10 +32,13 @@
#include "content/nw/src/api/shell/shell.h"
#include "content/nw/src/api/tray/tray.h"
#include "content/nw/src/api/window/window.h"
+#include "content/nw/src/common/shell_switches.h"
+#include "content/nw/src/shell_browser_context.h"
#include "content/nw/src/nw_shell.h"
#include "content/public/browser/render_process_host.h"
using content::WebContents;
+using content::ShellBrowserContext;
namespace api {
@@ -200,16 +203,21 @@ void DispatcherHost::OnCreateShell(const std::string& url,
int* routing_id) {
WebContents* base_web_contents =
content::Shell::FromRenderViewHost(render_view_host())->web_contents();
+ ShellBrowserContext* browser_context =
+ static_cast<ShellBrowserContext*>(base_web_contents->GetBrowserContext());
+ scoped_ptr<base::DictionaryValue> new_manifest(manifest.DeepCopy());
+ bool new_renderer = false;
+ if (new_manifest->GetBoolean(switches::kmNewInstance,
+ &new_renderer) && new_renderer)
+ browser_context->set_pinning_renderer(false);
+
WebContents::CreateParams create_params(
- base_web_contents->GetBrowserContext(),
+ browser_context,
base_web_contents->GetSiteInstance());
WebContents* web_contents = content::WebContentsImpl::CreateWithOpener(
create_params,
static_cast<content::WebContentsImpl*>(base_web_contents));
-
- scoped_ptr<base::DictionaryValue> new_manifest(manifest.DeepCopy());
-
new content::Shell(web_contents, new_manifest.get());
web_contents->GetController().LoadURL(
GURL(url),
@@ -217,6 +225,9 @@ void DispatcherHost::OnCreateShell(const std::string& url,
content::PAGE_TRANSITION_TYPED,
std::string());
+ if (new_renderer)
+ browser_context->set_pinning_renderer(true);
+
*routing_id = web_contents->GetRoutingID();
}
View
2  src/common/shell_switches.cc
@@ -92,4 +92,6 @@ const char kmUserAgent[] = "user-agent";
// rules to turn on Node for remote pages
const char kmRemotePages[] = "node-remote";
+const char kmNewInstance[] = "new-instance";
+
} // namespace switches
View
1  src/common/shell_switches.h
@@ -52,6 +52,7 @@ extern const char kmPlugin[];
extern const char kmPageCache[];
extern const char kmUserAgent[];
extern const char kmRemotePages[];
+extern const char kmNewInstance[];
} // namespace switches
#endif // CONTENT_NW_SRC_SHELL_SWITCHES_H_
Please sign in to comment.
Something went wrong with that request. Please try again.