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

Unified Diff: chrome/browser/ui/browser.cc

Issue 2443383002: When unblocking a WebContents, don't bring it to the front if it is not already. (Closed)
Patch Set: Created 4 years, 2 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/browser.cc
diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc
index 4c02948d4ae9543a60c89f9fa0b97db30fb0ee48..79b54b81ddc2717badc753bc6495677852bd3c9e 100644
--- a/chrome/browser/ui/browser.cc
+++ b/chrome/browser/ui/browser.cc
@@ -1900,7 +1900,13 @@ void Browser::SetWebContentsBlocked(content::WebContents* web_contents,
return;
}
tab_strip_model_->SetTabBlocked(index, blocked);
- if (!blocked && tab_strip_model_->GetActiveWebContents() == web_contents)
+
+ bool browser_active = BrowserList::GetInstance()->GetLastActive() == this;
+ bool contents_is_active =
+ tab_strip_model_->GetActiveWebContents() == web_contents;
+ // If the WebContents is foremost (the active tab in the front-most browser)
+ // and is being unblocked, focus it to make sure that input works again.
+ if (!blocked && contents_is_active && browser_active)
Lei Zhang 2016/10/24 22:43:15 Maybe return early if |blocked| is true?
Avi (use Gerrit) 2016/10/25 15:07:08 There are three conditions to focusing it; it feel
Lei Zhang 2016/10/25 17:31:43 I'm not that worried about it. I just saw it from
web_contents->Focus();
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698