return true;
}
+bool WebContents::ShouldCreateWebContents(
+ content::WebContents* web_contents,
+ int route_id,
+ WindowContainerType window_container_type,
+ const base::string16& frame_name,
+ const GURL& target_url,
+ const std::string& partition_id,
+ content::SessionStorageNamespace* session_storage_namespace) {
+ base::ListValue args;
+ args.AppendString(target_url.spec());
+ args.AppendString(partition_id);
+ Emit("new-window", args);
+ return false;
+}
+
void WebContents::CloseContents(content::WebContents* source) {
Emit("close");
}
content::WebContents* WebContents::CreateNewGuestWindow(
const content::WebContents::CreateParams& create_params) {
- auto web_contents = content::WebContents::Create(create_params);
- // TODO Currently we just retain the web_contents on V8's heap, which will be
- // garbage collected later, we should provide a way to let users make use of
- // this WebContents.
- mate::Handle<WebContents> managed = CreateFrom(
- v8::Isolate::GetCurrent(), web_contents);
- managed->storage_.reset(web_contents);
- return web_contents;
+ NOTREACHED() << "Should not create new window from guest";
+ return nullptr;
}
void WebContents::DidAttach() {
const base::string16& message,
int32 line_no,
const base::string16& source_id) override;
+ bool ShouldCreateWebContents(
+ content::WebContents* web_contents,
+ int route_id,
+ WindowContainerType window_container_type,
+ const base::string16& frame_name,
+ const GURL& target_url,
+ const std::string& partition_id,
+ content::SessionStorageNamespace* session_storage_namespace) override;
void CloseContents(content::WebContents* source) override;
content::WebContents* OpenURLFromTab(
content::WebContents* source,
'did-stop-loading': []
'did-get-redirect-request': ['oldUrl', 'newUrl', 'isMainFrame']
'console-message': ['level', 'message', 'line', 'sourceId']
+ 'new-window': ['url', 'partitionId']
'close': []
'crashed': []
'destroyed': []