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

Side by Side 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, 1 month 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/browser.h" 5 #include "chrome/browser/ui/browser.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <string> 10 #include <string>
(...skipping 1882 matching lines...) Expand 10 before | Expand all | Expand 10 after
1893 // Browser, web_modal::WebContentsModalDialogManagerDelegate implementation: 1893 // Browser, web_modal::WebContentsModalDialogManagerDelegate implementation:
1894 1894
1895 void Browser::SetWebContentsBlocked(content::WebContents* web_contents, 1895 void Browser::SetWebContentsBlocked(content::WebContents* web_contents,
1896 bool blocked) { 1896 bool blocked) {
1897 int index = tab_strip_model_->GetIndexOfWebContents(web_contents); 1897 int index = tab_strip_model_->GetIndexOfWebContents(web_contents);
1898 if (index == TabStripModel::kNoTab) { 1898 if (index == TabStripModel::kNoTab) {
1899 NOTREACHED(); 1899 NOTREACHED();
1900 return; 1900 return;
1901 } 1901 }
1902 tab_strip_model_->SetTabBlocked(index, blocked); 1902 tab_strip_model_->SetTabBlocked(index, blocked);
1903 if (!blocked && tab_strip_model_->GetActiveWebContents() == web_contents) 1903
1904 bool browser_active = BrowserList::GetInstance()->GetLastActive() == this;
1905 bool contents_is_active =
1906 tab_strip_model_->GetActiveWebContents() == web_contents;
1907 // If the WebContents is foremost (the active tab in the front-most browser)
1908 // and is being unblocked, focus it to make sure that input works again.
1909 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
1904 web_contents->Focus(); 1910 web_contents->Focus();
1905 } 1911 }
1906 1912
1907 web_modal::WebContentsModalDialogHost* 1913 web_modal::WebContentsModalDialogHost*
1908 Browser::GetWebContentsModalDialogHost() { 1914 Browser::GetWebContentsModalDialogHost() {
1909 return window_->GetWebContentsModalDialogHost(); 1915 return window_->GetWebContentsModalDialogHost();
1910 } 1916 }
1911 1917
1912 /////////////////////////////////////////////////////////////////////////////// 1918 ///////////////////////////////////////////////////////////////////////////////
1913 // Browser, BookmarkTabHelperDelegate implementation: 1919 // Browser, BookmarkTabHelperDelegate implementation:
(...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after
2577 if (contents && !allow_js_access) { 2583 if (contents && !allow_js_access) {
2578 contents->web_contents()->GetController().LoadURL( 2584 contents->web_contents()->GetController().LoadURL(
2579 target_url, 2585 target_url,
2580 content::Referrer(), 2586 content::Referrer(),
2581 ui::PAGE_TRANSITION_LINK, 2587 ui::PAGE_TRANSITION_LINK,
2582 std::string()); // No extra headers. 2588 std::string()); // No extra headers.
2583 } 2589 }
2584 2590
2585 return contents != NULL; 2591 return contents != NULL;
2586 } 2592 }
OLDNEW
« 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