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

Side by Side Diff: chrome/browser/ui/browser.cc

Issue 2624373002: Don't focus the location bar for NTP navigations in non-selected tabs. (Closed)
Patch Set: Fix nits Created 3 years, 11 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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/ui/browser_focus_uitest.cc » ('j') | 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 1533 matching lines...) Expand 10 before | Expand all | Expand 10 after
1544 if (IsFastTabUnloadEnabled()) { 1544 if (IsFastTabUnloadEnabled()) {
1545 *proceed_to_fire_unload = 1545 *proceed_to_fire_unload =
1546 fast_unload_controller_->BeforeUnloadFired(web_contents, proceed); 1546 fast_unload_controller_->BeforeUnloadFired(web_contents, proceed);
1547 } else { 1547 } else {
1548 *proceed_to_fire_unload = 1548 *proceed_to_fire_unload =
1549 unload_controller_->BeforeUnloadFired(web_contents, proceed); 1549 unload_controller_->BeforeUnloadFired(web_contents, proceed);
1550 } 1550 }
1551 } 1551 }
1552 1552
1553 bool Browser::ShouldFocusLocationBarByDefault(WebContents* source) { 1553 bool Browser::ShouldFocusLocationBarByDefault(WebContents* source) {
1554 // Navigations in background tabs shouldn't change the focus state of the
1555 // omnibox, since it's associated with the foreground tab.
1556 if (source != tab_strip_model_->GetActiveWebContents())
1557 return false;
1558
1554 const content::NavigationEntry* entry = 1559 const content::NavigationEntry* entry =
1555 source->GetController().GetActiveEntry(); 1560 source->GetController().GetActiveEntry();
1556 if (entry) { 1561 if (entry) {
1557 const GURL& url = entry->GetURL(); 1562 const GURL& url = entry->GetURL();
1558 const GURL& virtual_url = entry->GetVirtualURL(); 1563 const GURL& virtual_url = entry->GetVirtualURL();
1559 if ((url.SchemeIs(content::kChromeUIScheme) && 1564 if ((url.SchemeIs(content::kChromeUIScheme) &&
1560 url.host_piece() == chrome::kChromeUINewTabHost) || 1565 url.host_piece() == chrome::kChromeUINewTabHost) ||
1561 (virtual_url.SchemeIs(content::kChromeUIScheme) && 1566 (virtual_url.SchemeIs(content::kChromeUIScheme) &&
1562 virtual_url.host_piece() == chrome::kChromeUINewTabHost)) { 1567 virtual_url.host_piece() == chrome::kChromeUINewTabHost)) {
1563 return true; 1568 return true;
(...skipping 1016 matching lines...) Expand 10 before | Expand all | Expand 10 after
2580 // new window later, thus we need to navigate the window now. 2585 // new window later, thus we need to navigate the window now.
2581 if (contents) { 2586 if (contents) {
2582 contents->web_contents()->GetController().LoadURL( 2587 contents->web_contents()->GetController().LoadURL(
2583 target_url, content::Referrer(), ui::PAGE_TRANSITION_LINK, 2588 target_url, content::Referrer(), ui::PAGE_TRANSITION_LINK,
2584 std::string()); // No extra headers. 2589 std::string()); // No extra headers.
2585 } 2590 }
2586 } 2591 }
2587 2592
2588 return contents != NULL; 2593 return contents != NULL;
2589 } 2594 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/browser_focus_uitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698