Skip to content

Commit

Permalink
update to use new webcontents delegate methods
Browse files Browse the repository at this point in the history
  • Loading branch information
loc committed Mar 19, 2020
1 parent 7ab5285 commit f1b212c
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 16 deletions.
25 changes: 15 additions & 10 deletions shell/browser/api/electron_api_web_contents.cc
Expand Up @@ -648,23 +648,28 @@ void WebContents::WebContentsCreated(content::WebContents* source_contents,
tracker->frame_name = frame_name;
}

bool WebContents::ShouldCreateWebContents(
content::WebContents* web_contents,
content::RenderFrameHost* opener,
bool WebContents::IsWebContentsCreationOverridden(
content::SiteInstance* source_site_instance,
int32_t route_id,
int32_t main_frame_route_id,
int32_t main_frame_widget_route_id,
content::mojom::WindowContainerType window_container_type,
const GURL& opener_url,
const std::string& frame_name,
const GURL& target_url) {
if (Emit("-will-add-new-contents", target_url, frame_name)) {
return true;
}
return false;
}

content::WebContents* WebContents::CreateCustomWebContents(
content::RenderFrameHost* opener,
content::SiteInstance* source_site_instance,
bool is_new_browsing_instance,
const GURL& opener_url,
const std::string& frame_name,
const GURL& target_url,
const std::string& partition_id,
content::SessionStorageNamespace* session_storage_namespace) {
if (Emit("-will-add-new-contents", target_url, frame_name)) {
return false;
}
return true;
return nullptr;
}

void WebContents::AddNewContents(
Expand Down
14 changes: 8 additions & 6 deletions shell/browser/api/electron_api_web_contents.h
Expand Up @@ -364,16 +364,18 @@ class WebContents : public mate::TrackableObject<WebContents>,
const base::string16& message,
int32_t line_no,
const base::string16& source_id) override;
bool ShouldCreateWebContents(
content::WebContents* web_contents,
content::RenderFrameHost* opener,
bool IsWebContentsCreationOverridden(
content::SiteInstance* source_site_instance,
int32_t route_id,
int32_t main_frame_route_id,
int32_t main_frame_widget_route_id,
content::mojom::WindowContainerType window_container_type,
const GURL& opener_url,
const std::string& frame_name,
const GURL& target_url) override;
content::WebContents* CreateCustomWebContents(
content::RenderFrameHost* opener,
content::SiteInstance* source_site_instance,
bool is_new_browsing_instance,
const GURL& opener_url,
const std::string& frame_name,
const GURL& target_url,
const std::string& partition_id,
content::SessionStorageNamespace* session_storage_namespace) override;
Expand Down

0 comments on commit f1b212c

Please sign in to comment.