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

Unified Diff: chrome/browser/ui/panels/panel_bounds_animation.cc

Issue 2263863002: Remove implementation of Panels on OSes other than ChromeOS. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: CR feedback Created 4 years, 4 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
« no previous file with comments | « chrome/browser/ui/panels/panel_bounds_animation.h ('k') | chrome/browser/ui/panels/panel_browsertest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/panels/panel_bounds_animation.cc
diff --git a/chrome/browser/ui/panels/panel_bounds_animation.cc b/chrome/browser/ui/panels/panel_bounds_animation.cc
deleted file mode 100644
index b596f84170f791e52ffc2a290c8f549cf49582dd..0000000000000000000000000000000000000000
--- a/chrome/browser/ui/panels/panel_bounds_animation.cc
+++ /dev/null
@@ -1,81 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/ui/panels/panel_bounds_animation.h"
-
-#include "chrome/browser/ui/panels/panel.h"
-#include "chrome/browser/ui/panels/panel_manager.h"
-
-namespace {
-
-// These values are experimental and subjective.
-const int kDefaultFramerateHz = 50;
-const int kSetBoundsAnimationMs = 180;
-const int kSetBoundsAnimationBigMinimizeMs = 1500;
-
-}
-
-PanelBoundsAnimation::PanelBoundsAnimation(gfx::AnimationDelegate* target,
- Panel* panel,
- const gfx::Rect& initial_bounds,
- const gfx::Rect& final_bounds)
- : gfx::LinearAnimation(kDefaultFramerateHz, target),
- panel_(panel),
- for_big_minimize_(false),
- animation_stop_to_show_titlebar_(0) {
- // Detect animation that happens when expansion state is set to MINIMIZED
- // and there is relatively big portion of the panel to hide from view.
- // Initialize animation differently in this case, using fast-pause-slow
- // method, see below for more details.
- int duration = kSetBoundsAnimationMs;
- if (initial_bounds.height() > final_bounds.height() &&
- panel_->expansion_state() == Panel::MINIMIZED) {
- double hidden_title_height =
- panel_->TitleOnlyHeight() - final_bounds.height();
- double distance_y = initial_bounds.height() - final_bounds.height();
- animation_stop_to_show_titlebar_ = 1.0 - hidden_title_height / distance_y;
- if (animation_stop_to_show_titlebar_ > 0.7) { // Relatively big movement.
- for_big_minimize_ = true;
- duration = kSetBoundsAnimationBigMinimizeMs;
- }
- }
- SetDuration(PanelManager::AdjustTimeInterval(duration));
-}
-
-PanelBoundsAnimation::~PanelBoundsAnimation() {
-}
-
-double PanelBoundsAnimation::GetCurrentValue() const {
- return ComputeAnimationValue(gfx::LinearAnimation::GetCurrentValue(),
- for_big_minimize_,
- animation_stop_to_show_titlebar_);
-}
-
-double PanelBoundsAnimation::ComputeAnimationValue(double progress,
- bool for_big_minimize, double animation_stop_to_show_titlebar) {
- if (!for_big_minimize) {
- // Cubic easing out.
- double value = 1.0 - progress;
- return 1.0 - value * value * value;
- }
-
- // Minimize animation is done in 3 steps:
- // 1. Quickly (0 -> 0.15) make only titlebar visible.
- // 2. Freeze for a little bit (0.15->0.6), just showing titlebar.
- // 3. Slowly minimize to thin strip (0.6->1.0)
- const double kProgressAtFreezeStart = 0.15;
- const double kProgressAtFreezeEnd = 0.6;
- double value;
- if (progress <= kProgressAtFreezeStart) {
- value = animation_stop_to_show_titlebar *
- (progress / kProgressAtFreezeStart);
- } else if (progress <= kProgressAtFreezeEnd) {
- value = animation_stop_to_show_titlebar;
- } else {
- value = animation_stop_to_show_titlebar +
- (1.0 - animation_stop_to_show_titlebar) *
- ((progress - kProgressAtFreezeEnd) / (1.0 - kProgressAtFreezeEnd));
- }
- return value;
-}
« no previous file with comments | « chrome/browser/ui/panels/panel_bounds_animation.h ('k') | chrome/browser/ui/panels/panel_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698