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 // Focus if we're going to the NTP, but only if it's in the active tab. | |
Peter Kasting
2017/01/12 18:24:04
Nit: This might be clearer as "Navigations in back
Charlie Reis
2017/01/12 19:26:54
Done.
| |
1555 if (source != tab_strip_model_->GetActiveWebContents()) | |
1556 return false; | |
Peter Kasting
2017/01/12 18:24:04
Does this mean that, when a user switches to a now
Charlie Reis
2017/01/12 19:26:54
Yes, you're right that there's a secondary bug, an
| |
1557 | |
1554 const content::NavigationEntry* entry = | 1558 const content::NavigationEntry* entry = |
1555 source->GetController().GetActiveEntry(); | 1559 source->GetController().GetActiveEntry(); |
1556 if (entry) { | 1560 if (entry) { |
1557 const GURL& url = entry->GetURL(); | 1561 const GURL& url = entry->GetURL(); |
1558 const GURL& virtual_url = entry->GetVirtualURL(); | 1562 const GURL& virtual_url = entry->GetVirtualURL(); |
1559 if ((url.SchemeIs(content::kChromeUIScheme) && | 1563 if ((url.SchemeIs(content::kChromeUIScheme) && |
1560 url.host_piece() == chrome::kChromeUINewTabHost) || | 1564 url.host_piece() == chrome::kChromeUINewTabHost) || |
1561 (virtual_url.SchemeIs(content::kChromeUIScheme) && | 1565 (virtual_url.SchemeIs(content::kChromeUIScheme) && |
1562 virtual_url.host_piece() == chrome::kChromeUINewTabHost)) { | 1566 virtual_url.host_piece() == chrome::kChromeUINewTabHost)) { |
1563 return true; | 1567 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. | 2584 // new window later, thus we need to navigate the window now. |
2581 if (contents) { | 2585 if (contents) { |
2582 contents->web_contents()->GetController().LoadURL( | 2586 contents->web_contents()->GetController().LoadURL( |
2583 target_url, content::Referrer(), ui::PAGE_TRANSITION_LINK, | 2587 target_url, content::Referrer(), ui::PAGE_TRANSITION_LINK, |
2584 std::string()); // No extra headers. | 2588 std::string()); // No extra headers. |
2585 } | 2589 } |
2586 } | 2590 } |
2587 | 2591 |
2588 return contents != NULL; | 2592 return contents != NULL; |
2589 } | 2593 } |
OLD | NEW |