Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1683)

Unified Diff: content/browser/web_contents/web_contents_impl.cc

Issue 10868116: Pass result of blockage across content API when new tab blocked. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/web_contents/web_contents_impl.cc
===================================================================
--- content/browser/web_contents/web_contents_impl.cc (revision 153532)
+++ content/browser/web_contents/web_contents_impl.cc (working copy)
@@ -1029,15 +1029,15 @@
return tc;
}
-void WebContentsImpl::AddNewContents(WebContents* new_contents,
+bool WebContentsImpl::AddNewContents(WebContents* new_contents,
WindowOpenDisposition disposition,
const gfx::Rect& initial_pos,
bool user_gesture) {
if (!delegate_)
- return;
+ return false;
- delegate_->AddNewContents(this, new_contents, disposition, initial_pos,
- user_gesture);
+ return delegate_->AddNewContents(
+ this, new_contents, disposition, initial_pos, user_gesture);
}
gfx::NativeView WebContentsImpl::GetContentNativeView() const {
@@ -1275,23 +1275,27 @@
pending_contents_[route_id] = new_contents;
}
+ bool not_blocked = true;
if (delegate_) {
- delegate_->WebContentsCreated(
+ not_blocked = delegate_->WebContentsCreated(
this, params.opener_frame_id, params.target_url, new_contents);
}
- if (params.opener_suppressed) {
+ if (params.opener_suppressed && not_blocked) {
// When the opener is suppressed, the original renderer cannot access the
// new window. As a result, we need to show and navigate the window here.
gfx::Rect initial_pos;
- AddNewContents(
+ not_blocked = AddNewContents(
new_contents, params.disposition, initial_pos, params.user_gesture);
- content::OpenURLParams open_params(params.target_url, content::Referrer(),
- CURRENT_TAB,
- content::PAGE_TRANSITION_LINK,
- true /* is_renderer_initiated */);
- new_contents->OpenURL(open_params);
+ if (not_blocked) {
+ content::OpenURLParams open_params(params.target_url,
+ content::Referrer(),
+ CURRENT_TAB,
+ content::PAGE_TRANSITION_LINK,
+ true /* is_renderer_initiated */);
+ new_contents->OpenURL(open_params);
+ }
}
}

Powered by Google App Engine
This is Rietveld 408576698