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 1529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1540 if (IsFastTabUnloadEnabled()) { | 1540 if (IsFastTabUnloadEnabled()) { |
1541 *proceed_to_fire_unload = | 1541 *proceed_to_fire_unload = |
1542 fast_unload_controller_->BeforeUnloadFired(web_contents, proceed); | 1542 fast_unload_controller_->BeforeUnloadFired(web_contents, proceed); |
1543 } else { | 1543 } else { |
1544 *proceed_to_fire_unload = | 1544 *proceed_to_fire_unload = |
1545 unload_controller_->BeforeUnloadFired(web_contents, proceed); | 1545 unload_controller_->BeforeUnloadFired(web_contents, proceed); |
1546 } | 1546 } |
1547 } | 1547 } |
1548 | 1548 |
1549 bool Browser::ShouldFocusLocationBarByDefault(WebContents* source) { | 1549 bool Browser::ShouldFocusLocationBarByDefault(WebContents* source) { |
| 1550 // Navigations in background tabs shouldn't change the focus state of the |
| 1551 // omnibox, since it's associated with the foreground tab. |
| 1552 if (source != tab_strip_model_->GetActiveWebContents()) |
| 1553 return false; |
| 1554 |
1550 const content::NavigationEntry* entry = | 1555 const content::NavigationEntry* entry = |
1551 source->GetController().GetActiveEntry(); | 1556 source->GetController().GetActiveEntry(); |
1552 if (entry) { | 1557 if (entry) { |
1553 const GURL& url = entry->GetURL(); | 1558 const GURL& url = entry->GetURL(); |
1554 const GURL& virtual_url = entry->GetVirtualURL(); | 1559 const GURL& virtual_url = entry->GetVirtualURL(); |
1555 if ((url.SchemeIs(content::kChromeUIScheme) && | 1560 if ((url.SchemeIs(content::kChromeUIScheme) && |
1556 url.host_piece() == chrome::kChromeUINewTabHost) || | 1561 url.host_piece() == chrome::kChromeUINewTabHost) || |
1557 (virtual_url.SchemeIs(content::kChromeUIScheme) && | 1562 (virtual_url.SchemeIs(content::kChromeUIScheme) && |
1558 virtual_url.host_piece() == chrome::kChromeUINewTabHost)) { | 1563 virtual_url.host_piece() == chrome::kChromeUINewTabHost)) { |
1559 return true; | 1564 return true; |
(...skipping 1036 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2596 if (contents && !allow_js_access) { | 2601 if (contents && !allow_js_access) { |
2597 contents->web_contents()->GetController().LoadURL( | 2602 contents->web_contents()->GetController().LoadURL( |
2598 target_url, | 2603 target_url, |
2599 content::Referrer(), | 2604 content::Referrer(), |
2600 ui::PAGE_TRANSITION_LINK, | 2605 ui::PAGE_TRANSITION_LINK, |
2601 std::string()); // No extra headers. | 2606 std::string()); // No extra headers. |
2602 } | 2607 } |
2603 | 2608 |
2604 return contents != NULL; | 2609 return contents != NULL; |
2605 } | 2610 } |
OLD | NEW |