Chromium Code Reviews| Index: chrome/browser/ui/views/location_bar/location_bar_container.cc |
| diff --git a/chrome/browser/ui/views/location_bar/location_bar_container.cc b/chrome/browser/ui/views/location_bar/location_bar_container.cc |
| index f66f46456c04f38af326f20ee3bcbf59ff318890..87f61a325350d6fa9d060f78d63426779dc75b38 100644 |
| --- a/chrome/browser/ui/views/location_bar/location_bar_container.cc |
| +++ b/chrome/browser/ui/views/location_bar/location_bar_container.cc |
| @@ -32,7 +32,6 @@ LocationBarContainer::LocationBarContainer(views::View* parent, |
| view_parent_->set_background( |
| views::Background::CreateSolidBackground(GetBackgroundColor())); |
| } |
| - SetLayoutManager(new views::FillLayout); |
| } |
| LocationBarContainer::~LocationBarContainer() { |
| @@ -59,6 +58,16 @@ gfx::Rect LocationBarContainer::GetTargetBounds() { |
| return animator_.GetTargetBounds(this); |
| } |
| +void LocationBarContainer::SetBoundsForContainerAndView( |
|
sky
2012/09/12 21:07:31
Why doesn't SetBounds do what you want here?
kuan
2012/09/12 21:33:04
u're right, i don't need to SetBounds for location
|
| + const gfx::Rect& location_bar_container_bounds, |
| + const gfx::Size& location_bar_view_size) { |
| + SetBoundsRect(location_bar_container_bounds); |
| + DCHECK(location_bar_view_); |
| + location_bar_view_->SetBounds(0, 0, location_bar_view_size.width(), |
| + location_bar_view_size.height()); |
| + location_bar_view_size_ = location_bar_view_size; |
| +} |
| + |
| std::string LocationBarContainer::GetClassName() const { |
| return "browser/ui/views/location_bar/LocationBarContainer"; |
| } |
| @@ -67,6 +76,20 @@ gfx::Size LocationBarContainer::GetPreferredSize() { |
| return location_bar_view_->GetPreferredSize(); |
| } |
| +void LocationBarContainer::Layout() { |
| + // If we're animating, |location_bar_view_| fully fills out the entire |
| + // container's target bounds. Otherwise, its bounds is what was last set via |
| + // |SetBoundsForContainerAndView|. |
| + if (IsAnimating()) { |
| + gfx::Rect target_bounds = GetTargetBounds(); |
| + location_bar_view_->SetBounds(0, 0, target_bounds.width(), |
| + target_bounds.height()); |
| + } else { |
| + location_bar_view_->SetBounds(0, 0, location_bar_view_size_.width(), |
| + location_bar_view_size_.height()); |
| + } |
| +} |
| + |
| bool LocationBarContainer::SkipDefaultKeyEventProcessing( |
| const ui::KeyEvent& event) { |
| return location_bar_view_->SkipDefaultKeyEventProcessing(event); |