OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/toolbar_view.h" | 5 #include "chrome/browser/ui/views/toolbar_view.h" |
6 | 6 |
7 #include "base/i18n/number_formatting.h" | 7 #include "base/i18n/number_formatting.h" |
8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
9 #include "chrome/app/chrome_command_ids.h" | 9 #include "chrome/app/chrome_command_ids.h" |
10 #include "chrome/browser/command_updater.h" | 10 #include "chrome/browser/command_updater.h" |
(...skipping 713 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
724 // ntp pages. | 724 // ntp pages. |
725 chrome::UpdateCommandEnabled(browser_, IDC_RELOAD, false); | 725 chrome::UpdateCommandEnabled(browser_, IDC_RELOAD, false); |
726 // Disable zooming for NTP mode. | 726 // Disable zooming for NTP mode. |
727 chrome::UpdateCommandEnabled(browser_, IDC_ZOOM_MINUS, false); | 727 chrome::UpdateCommandEnabled(browser_, IDC_ZOOM_MINUS, false); |
728 chrome::UpdateCommandEnabled(browser_, IDC_ZOOM_PLUS, false); | 728 chrome::UpdateCommandEnabled(browser_, IDC_ZOOM_PLUS, false); |
729 } else { | 729 } else { |
730 // Start the location bar animation. | 730 // Start the location bar animation. |
731 if (si_mode.animate && si_mode.is_search() && | 731 if (si_mode.animate && si_mode.is_search() && |
732 !location_bar_container_->IsAnimating()) { | 732 !location_bar_container_->IsAnimating()) { |
733 gfx::Point location_bar_origin(location_bar_bounds.origin()); | 733 gfx::Point location_bar_origin(location_bar_bounds.origin()); |
734 views::View::ConvertPointToView(this, location_bar_container_->parent(), | 734 views::View::ConvertPointToTarget(this, location_bar_container_->parent(), |
735 &location_bar_origin); | 735 &location_bar_origin); |
736 location_bar_container_->AnimateTo( | 736 location_bar_container_->AnimateTo( |
737 gfx::Rect(location_bar_origin, location_bar_bounds.size())); | 737 gfx::Rect(location_bar_origin, location_bar_bounds.size())); |
738 } else { | 738 } else { |
739 SetLocationBarContainerBounds(location_bar_bounds); | 739 SetLocationBarContainerBounds(location_bar_bounds); |
740 } | 740 } |
741 // Enable reload and zooming for non-NTP modes. | 741 // Enable reload and zooming for non-NTP modes. |
742 chrome::UpdateCommandEnabled(browser_, IDC_RELOAD, true); | 742 chrome::UpdateCommandEnabled(browser_, IDC_RELOAD, true); |
743 chrome::UpdateCommandEnabled(browser_, IDC_ZOOM_MINUS, true); | 743 chrome::UpdateCommandEnabled(browser_, IDC_ZOOM_MINUS, true); |
744 chrome::UpdateCommandEnabled(browser_, IDC_ZOOM_PLUS, true); | 744 chrome::UpdateCommandEnabled(browser_, IDC_ZOOM_PLUS, true); |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1004 location_bar_container_->GetPreferredSize().height()); | 1004 location_bar_container_->GetPreferredSize().height()); |
1005 } | 1005 } |
1006 | 1006 |
1007 void ToolbarView::SetLocationBarContainerBounds( | 1007 void ToolbarView::SetLocationBarContainerBounds( |
1008 const gfx::Rect& bounds) { | 1008 const gfx::Rect& bounds) { |
1009 if (location_bar_container_->IsAnimating()) | 1009 if (location_bar_container_->IsAnimating()) |
1010 return; | 1010 return; |
1011 | 1011 |
1012 // LocationBarContainer is not a child of the ToolbarView. | 1012 // LocationBarContainer is not a child of the ToolbarView. |
1013 gfx::Point origin(bounds.origin()); | 1013 gfx::Point origin(bounds.origin()); |
1014 views::View::ConvertPointToView(this, location_bar_container_->parent(), | 1014 views::View::ConvertPointToTarget(this, location_bar_container_->parent(), |
1015 &origin); | 1015 &origin); |
1016 gfx::Rect target_bounds(origin, bounds.size()); | 1016 gfx::Rect target_bounds(origin, bounds.size()); |
1017 if (location_bar_container_->GetTargetBounds() != target_bounds) { | 1017 if (location_bar_container_->GetTargetBounds() != target_bounds) { |
1018 location_bar_container_->SetInToolbar(true); | 1018 location_bar_container_->SetInToolbar(true); |
1019 location_bar_container_->SetBoundsRect(target_bounds); | 1019 location_bar_container_->SetBoundsRect(target_bounds); |
1020 } | 1020 } |
1021 } | 1021 } |
OLD | NEW |