| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/ui/views/new_back_shortcut_bubble.h" | 5 #include "chrome/browser/ui/views/new_back_shortcut_bubble.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 animation_->Show(); | 78 animation_->Show(); |
| 79 | 79 |
| 80 // Wait a few seconds before hiding. | 80 // Wait a few seconds before hiding. |
| 81 hide_timeout_.Start(FROM_HERE, | 81 hide_timeout_.Start(FROM_HERE, |
| 82 base::TimeDelta::FromMilliseconds(kShowDurationMs), this, | 82 base::TimeDelta::FromMilliseconds(kShowDurationMs), this, |
| 83 &NewBackShortcutBubble::OnTimerElapsed); | 83 &NewBackShortcutBubble::OnTimerElapsed); |
| 84 } | 84 } |
| 85 | 85 |
| 86 void NewBackShortcutBubble::AnimationProgressed( | 86 void NewBackShortcutBubble::AnimationProgressed( |
| 87 const gfx::Animation* animation) { | 87 const gfx::Animation* animation) { |
| 88 int opacity = animation_->CurrentValueBetween(0, 255); | 88 float opacity = static_cast<float>(animation_->CurrentValueBetween(0.0, 1.0)); |
| 89 if (opacity == 0) { | 89 if (opacity == 0) { |
| 90 popup_->Hide(); | 90 popup_->Hide(); |
| 91 } else { | 91 } else { |
| 92 if (!popup_->IsVisible()) | 92 if (!popup_->IsVisible()) |
| 93 popup_->Show(); | 93 popup_->Show(); |
| 94 | 94 |
| 95 popup_->SetOpacity(opacity); | 95 popup_->SetOpacity(opacity); |
| 96 } | 96 } |
| 97 } | 97 } |
| 98 | 98 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 109 int desired_top = kPopupTopPx - view_->border()->GetInsets().top(); | 109 int desired_top = kPopupTopPx - view_->border()->GetInsets().top(); |
| 110 int y = widget_bounds.y() + desired_top; | 110 int y = widget_bounds.y() + desired_top; |
| 111 return gfx::Rect(gfx::Point(x, y), size); | 111 return gfx::Rect(gfx::Point(x, y), size); |
| 112 } | 112 } |
| 113 | 113 |
| 114 void NewBackShortcutBubble::OnTimerElapsed() { | 114 void NewBackShortcutBubble::OnTimerElapsed() { |
| 115 // Hide the bubble. | 115 // Hide the bubble. |
| 116 animation_->SetSlideDuration(kSlideOutDurationMs); | 116 animation_->SetSlideDuration(kSlideOutDurationMs); |
| 117 animation_->Hide(); | 117 animation_->Hide(); |
| 118 } | 118 } |
| OLD | NEW |