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/views/frame/browser_view.h" | 5 #include "chrome/browser/ui/views/frame/browser_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 1426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1437 if (!browser_->tab_strip_model()->closing_all() && GetWidget()->IsActive() && | 1437 if (!browser_->tab_strip_model()->closing_all() && GetWidget()->IsActive() && |
1438 GetWidget()->IsVisible()) { | 1438 GetWidget()->IsVisible()) { |
1439 // We only restore focus if our window is visible, to avoid invoking blur | 1439 // We only restore focus if our window is visible, to avoid invoking blur |
1440 // handlers when we are eventually shown. | 1440 // handlers when we are eventually shown. |
1441 new_contents->GetView()->RestoreFocus(); | 1441 new_contents->GetView()->RestoreFocus(); |
1442 } | 1442 } |
1443 | 1443 |
1444 // Update all the UI bits. | 1444 // Update all the UI bits. |
1445 UpdateTitleBar(); | 1445 UpdateTitleBar(); |
1446 | 1446 |
1447 // No need to update Toolbar because it's already updated in | 1447 // Let the browser do any necessary handling. This must be called after |
1448 // browser.cc. | 1448 // changing focus above, so that when the toolbar (and thus omnibox) is |
| 1449 // updated, the correct view already has focus; changing focus after restoring |
| 1450 // omnibox state can overwrite important bits of state. See comments in |
| 1451 // OmniboxViewViews::OnTabChanged(). |
| 1452 browser_->OnActiveTabChanged(old_contents, new_contents, index, reason); |
1449 } | 1453 } |
1450 | 1454 |
1451 void BrowserView::TabStripEmpty() { | 1455 void BrowserView::TabStripEmpty() { |
1452 // Make sure all optional UI is removed before we are destroyed, otherwise | 1456 // Make sure all optional UI is removed before we are destroyed, otherwise |
1453 // there will be consequences (since our view hierarchy will still have | 1457 // there will be consequences (since our view hierarchy will still have |
1454 // references to freed views). | 1458 // references to freed views). |
1455 UpdateUIForContents(NULL); | 1459 UpdateUIForContents(NULL); |
1456 } | 1460 } |
1457 | 1461 |
1458 /////////////////////////////////////////////////////////////////////////////// | 1462 /////////////////////////////////////////////////////////////////////////////// |
(...skipping 1219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2678 // The +1 in the next line creates a 1-px gap between icon and arrow tip. | 2682 // The +1 in the next line creates a 1-px gap between icon and arrow tip. |
2679 gfx::Point icon_bottom(0, location_icon_view->GetImageBounds().bottom() - | 2683 gfx::Point icon_bottom(0, location_icon_view->GetImageBounds().bottom() - |
2680 LocationBarView::kIconInternalPadding + 1); | 2684 LocationBarView::kIconInternalPadding + 1); |
2681 ConvertPointToTarget(location_icon_view, this, &icon_bottom); | 2685 ConvertPointToTarget(location_icon_view, this, &icon_bottom); |
2682 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(NULL)); | 2686 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(NULL)); |
2683 ConvertPointToTarget(infobar_container_, this, &infobar_top); | 2687 ConvertPointToTarget(infobar_container_, this, &infobar_top); |
2684 top_arrow_height = infobar_top.y() - icon_bottom.y(); | 2688 top_arrow_height = infobar_top.y() - icon_bottom.y(); |
2685 } | 2689 } |
2686 return top_arrow_height; | 2690 return top_arrow_height; |
2687 } | 2691 } |
OLD | NEW |