OLD | NEW |
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 Loading... |
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 Loading... |
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 } |
OLD | NEW |