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

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: Fix stuffup Created 5 years, 8 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 8c0cc94409b52a35d711baebc9192fead2f6bac9..311120c05df1e407436b1894c6cfa26ebf4a0a47 100644
--- a/chrome/browser/ui/views/location_bar/location_bar_view.cc
+++ b/chrome/browser/ui/views/location_bar/location_bar_view.cc
@@ -141,6 +141,7 @@ LocationBarView::LocationBarView(Browser* browser,
manage_passwords_icon_view_(NULL),
translate_icon_view_(NULL),
star_view_(NULL),
+ size_animation_(this),
is_popup_mode_(is_popup_mode),
show_focus_rect_(false),
template_url_service_(NULL),
@@ -303,6 +304,8 @@ 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(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::UpdateLocationBarVisibility(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) {
@@ -1297,6 +1314,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() {
« no previous file with comments | « chrome/browser/ui/views/location_bar/location_bar_view.h ('k') | chrome/browser/ui/views/toolbar/toolbar_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698