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

Unified Diff: ui/compositor/layer_animator.cc

Issue 11280188: Fix focus loss on partial lock. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fixes after review Created 8 years, 1 month 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
« ash/wm/workspace/workspace_animations.cc ('K') | « ui/compositor/layer_animator.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/compositor/layer_animator.cc
diff --git a/ui/compositor/layer_animator.cc b/ui/compositor/layer_animator.cc
index a6fcd7da224a9652803421f4f82ce9ab0ebd958e..cc58b3efc102e3c024d6a068ce71151fdc2ebb9b 100644
--- a/ui/compositor/layer_animator.cc
+++ b/ui/compositor/layer_animator.cc
@@ -45,6 +45,41 @@ ui::AnimationContainer* GetAnimationContainer() {
return container;
}
+class SuccessCallbackAnimationObserver : public LayerAnimationObserver {
+ public:
+ SuccessCallbackAnimationObserver(base::Closure callback)
+ : callback_(callback),
+ num_attached_sequences_(0) {
+ }
+
+ virtual void OnLayerAnimationEnded(LayerAnimationSequence* sequence) {
Daniel Erat 2012/11/27 19:03:27 nit: add OVERRIDE to all overridden methods, along
Denis Kuznetsov (DE-MUC) 2012/11/28 15:41:46 Done.
+ callback_.Run();
+ callback_.Reset();
+ }
+
+ virtual void OnLayerAnimationAborted(
+ LayerAnimationSequence* sequence) {}
+
+ virtual void OnLayerAnimationScheduled(
+ LayerAnimationSequence* sequence) {}
+
+ private:
+ virtual void OnAttachedToSequence(LayerAnimationSequence* sequence) {
+ num_attached_sequences_++;
+ }
+
+ virtual void OnDetachedFromSequence(LayerAnimationSequence* sequence) {
+ num_attached_sequences_--;
+ if (num_attached_sequences_ == 0)
+ delete this;
+ }
+
+ base::Closure callback_;
+ int num_attached_sequences_;
+
+ DISALLOW_COPY_AND_ASSIGN(SuccessCallbackAnimationObserver);
+};
+
} // namespace
// static
@@ -258,6 +293,28 @@ void LayerAnimator::SchedulePauseForProperties(
properties_to_pause, duration)));
}
+void LayerAnimator::SetCompletionCallbackForProperties(
+ base::Closure& callback,
+ LayerAnimationElement::AnimatableProperty property,
+ ...) {
+ ui::LayerAnimationElement::AnimatableProperties properties_to_pause;
+ va_list marker;
+ va_start(marker, property);
+ for (int p = static_cast<int>(property); p != -1; p = va_arg(marker, int)) {
+ properties_to_pause.insert(
+ static_cast<LayerAnimationElement::AnimatableProperty>(p));
+ }
+ va_end(marker);
+
+ ui::LayerAnimationSequence* sequence = new ui::LayerAnimationSequence(
+ ui::LayerAnimationElement::CreatePauseElement(
+ properties_to_pause, base::TimeDelta()));
+
+ sequence->AddObserver(new SuccessCallbackAnimationObserver(callback));
+
+ ScheduleAnimation(sequence);
+}
+
bool LayerAnimator::IsAnimatingProperty(
LayerAnimationElement::AnimatableProperty property) const {
for (AnimationQueue::const_iterator queue_iter = animation_queue_.begin();
@@ -540,7 +597,7 @@ void LayerAnimator::ImmediatelySetNewTarget(LayerAnimationSequence* sequence) {
if (!weak_sequence_ptr)
return;
- ProgressAnimation(sequence, sequence->duration());
+ ProgressAnimationToEnd(sequence);
if (!weak_sequence_ptr)
return;
« ash/wm/workspace/workspace_animations.cc ('K') | « ui/compositor/layer_animator.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698