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

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

Issue 1036173002: Animate showing / hiding the location bar for bookmark apps. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Feedback Created 5 years, 9 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_view.cc
diff --git a/chrome/browser/ui/views/location_bar/location_bar_view.cc b/chrome/browser/ui/views/location_bar/location_bar_view.cc
index f5b111730951225a1c484bbe324921baf2720f9e..b2a7303f95278cae0a387304ddd111feb34de1a2 100644
--- a/chrome/browser/ui/views/location_bar/location_bar_view.cc
+++ b/chrome/browser/ui/views/location_bar/location_bar_view.cc
@@ -303,6 +303,9 @@ void LocationBarView::Init() {
// Initialize the location entry. We do this to avoid a black flash which is
// visible when the location entry has just been initialized.
Update(NULL);
+
+ size_animation_.reset(new gfx::SlideAnimation(this));
+ size_animation_->Reset(1);
}
bool LocationBarView::IsInitialized() const {
@@ -526,6 +529,8 @@ gfx::Size LocationBarView::GetPreferredSize() const {
if (!IsInitialized())
return min_size;
+ min_size.set_height(min_size.height() * size_animation_->GetCurrentValue());
+
// Compute width of omnibox-leading content.
const int horizontal_edge_thickness = GetHorizontalEdgeThickness();
int leading_width = horizontal_edge_thickness;
@@ -1064,6 +1069,18 @@ void LocationBarView::UpdateBookmarkStarVisibility() {
}
}
+void LocationBarView::UpdateLocationBarState(bool visible, bool animate) {
+ if (!animate) {
+ size_animation_->Reset(visible ? 1 : 0);
+ return;
+ }
+
+ if (visible)
+ size_animation_->Show();
+ else
+ size_animation_->Hide();
+}
+
bool LocationBarView::ShowPageActionPopup(
const extensions::Extension* extension,
bool grant_tab_permissions) {
@@ -1294,6 +1311,16 @@ bool LocationBarView::CanStartDragForView(View* sender,
}
////////////////////////////////////////////////////////////////////////////////
+// LocationBarView, private gfx::AnimationDelegate implementation:
+void LocationBarView::AnimationProgressed(const gfx::Animation* animation) {
+ browser_->window()->ToolbarSizeChanged(true);
+}
+
+void LocationBarView::AnimationEnded(const gfx::Animation* animation) {
+ browser_->window()->ToolbarSizeChanged(false);
+}
+
+////////////////////////////////////////////////////////////////////////////////
// LocationBarView, private OmniboxEditController implementation:
void LocationBarView::OnChanged() {

Powered by Google App Engine
This is Rietveld 408576698