Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(89)

Unified Diff: chrome/browser/ui/views/location_bar/location_bar_container.cc

Issue 10907038: alternate ntp: clip middle omnibox when resizing browser window (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: re-implement fix Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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);

Powered by Google App Engine
This is Rietveld 408576698