Emit "new-window" event for dispositions other than CURRENT_TAB
This commit is contained in:
parent
77724345c4
commit
013593ccf8
6 changed files with 29 additions and 9 deletions
|
@ -90,6 +90,7 @@ bool WebContents::ShouldCreateWebContents(
|
|||
base::ListValue args;
|
||||
args.AppendString(target_url.spec());
|
||||
args.AppendString(frame_name);
|
||||
args.AppendInteger(CURRENT_TAB);
|
||||
Emit("new-window", args);
|
||||
return false;
|
||||
}
|
||||
|
@ -101,8 +102,14 @@ void WebContents::CloseContents(content::WebContents* source) {
|
|||
content::WebContents* WebContents::OpenURLFromTab(
|
||||
content::WebContents* source,
|
||||
const content::OpenURLParams& params) {
|
||||
if (params.disposition != CURRENT_TAB)
|
||||
return NULL;
|
||||
if (params.disposition != CURRENT_TAB) {
|
||||
base::ListValue args;
|
||||
args.AppendString(params.url.spec());
|
||||
args.AppendString("");
|
||||
args.AppendInteger(params.disposition);
|
||||
Emit("new-window", args);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
content::NavigationController::LoadURLParams load_url_params(params.url);
|
||||
load_url_params.referrer = params.referrer;
|
||||
|
|
|
@ -85,10 +85,12 @@ void Window::OnPageTitleUpdated(bool* prevent_default,
|
|||
|
||||
void Window::WillCreatePopupWindow(const base::string16& frame_name,
|
||||
const GURL& target_url,
|
||||
const std::string& partition_id) {
|
||||
const std::string& partition_id,
|
||||
WindowOpenDisposition disposition) {
|
||||
base::ListValue args;
|
||||
args.AppendString(target_url.spec());
|
||||
args.AppendString(frame_name);
|
||||
args.AppendInteger(disposition);
|
||||
Emit("new-window", args);
|
||||
}
|
||||
|
||||
|
|
|
@ -48,7 +48,8 @@ class Window : public mate::EventEmitter,
|
|||
const std::string& title) override;
|
||||
void WillCreatePopupWindow(const base::string16& frame_name,
|
||||
const GURL& target_url,
|
||||
const std::string& partition_id) override;
|
||||
const std::string& partition_id,
|
||||
WindowOpenDisposition disposition) override;
|
||||
void WillCloseWindow(bool* prevent_default) override;
|
||||
void OnWindowClosed() override;
|
||||
void OnWindowBlur() override;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue