| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "ui/keyboard/keyboard_controller.h" | 5 #include "ui/keyboard/keyboard_controller.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 container_animator, | 363 container_animator, |
| 364 base::Bind(&KeyboardController::HideAnimationFinished, | 364 base::Bind(&KeyboardController::HideAnimationFinished, |
| 365 base::Unretained(this)))); | 365 base::Unretained(this)))); |
| 366 container_animator->AddObserver(animation_observer_.get()); | 366 container_animator->AddObserver(animation_observer_.get()); |
| 367 | 367 |
| 368 ui::ScopedLayerAnimationSettings settings(container_animator); | 368 ui::ScopedLayerAnimationSettings settings(container_animator); |
| 369 settings.SetTweenType(gfx::Tween::FAST_OUT_LINEAR_IN); | 369 settings.SetTweenType(gfx::Tween::FAST_OUT_LINEAR_IN); |
| 370 settings.SetTransitionDuration( | 370 settings.SetTransitionDuration( |
| 371 base::TimeDelta::FromMilliseconds(kHideAnimationDurationMs)); | 371 base::TimeDelta::FromMilliseconds(kHideAnimationDurationMs)); |
| 372 gfx::Transform transform; | 372 gfx::Transform transform; |
| 373 transform.Translate(0, proxy_->GetKeyboardWindow()->bounds().height()); | 373 transform.Translate(0, kAnimationDistance); |
| 374 container_->SetTransform(transform); | 374 container_->SetTransform(transform); |
| 375 container_->layer()->SetOpacity(kAnimationStartOrAfterHideOpacity); | 375 container_->layer()->SetOpacity(kAnimationStartOrAfterHideOpacity); |
| 376 } | 376 } |
| 377 | 377 |
| 378 void KeyboardController::AddObserver(KeyboardControllerObserver* observer) { | 378 void KeyboardController::AddObserver(KeyboardControllerObserver* observer) { |
| 379 observer_list_.AddObserver(observer); | 379 observer_list_.AddObserver(observer); |
| 380 } | 380 } |
| 381 | 381 |
| 382 void KeyboardController::RemoveObserver(KeyboardControllerObserver* observer) { | 382 void KeyboardController::RemoveObserver(KeyboardControllerObserver* observer) { |
| 383 observer_list_.RemoveObserver(observer); | 383 observer_list_.RemoveObserver(observer); |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 516 !container_->layer()->GetAnimator()->is_animating()) | 516 !container_->layer()->GetAnimator()->is_animating()) |
| 517 return; | 517 return; |
| 518 | 518 |
| 519 ToggleTouchEventLogging(false); | 519 ToggleTouchEventLogging(false); |
| 520 ui::LayerAnimator* container_animator = container_->layer()->GetAnimator(); | 520 ui::LayerAnimator* container_animator = container_->layer()->GetAnimator(); |
| 521 | 521 |
| 522 // If the container is not animating, makes sure the position and opacity | 522 // If the container is not animating, makes sure the position and opacity |
| 523 // are at begin states for animation. | 523 // are at begin states for animation. |
| 524 if (!container_animator->is_animating()) { | 524 if (!container_animator->is_animating()) { |
| 525 gfx::Transform transform; | 525 gfx::Transform transform; |
| 526 transform.Translate(0, proxy_->GetKeyboardWindow()->bounds().height()); | 526 transform.Translate(0, kAnimationDistance); |
| 527 container_->SetTransform(transform); | 527 container_->SetTransform(transform); |
| 528 container_->layer()->SetOpacity(kAnimationStartOrAfterHideOpacity); | 528 container_->layer()->SetOpacity(kAnimationStartOrAfterHideOpacity); |
| 529 } | 529 } |
| 530 | 530 |
| 531 container_animator->set_preemption_strategy( | 531 container_animator->set_preemption_strategy( |
| 532 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); | 532 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); |
| 533 animation_observer_.reset(new CallbackAnimationObserver( | 533 animation_observer_.reset(new CallbackAnimationObserver( |
| 534 container_animator, | 534 container_animator, |
| 535 base::Bind(&KeyboardController::ShowAnimationFinished, | 535 base::Bind(&KeyboardController::ShowAnimationFinished, |
| 536 base::Unretained(this)))); | 536 base::Unretained(this)))); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 579 proxy_->HideKeyboardContainer(container_.get()); | 579 proxy_->HideKeyboardContainer(container_.get()); |
| 580 } | 580 } |
| 581 | 581 |
| 582 void KeyboardController::AddBoundsChangedObserver(aura::Window* window) { | 582 void KeyboardController::AddBoundsChangedObserver(aura::Window* window) { |
| 583 aura::Window* target_window = GetFrameWindow(window); | 583 aura::Window* target_window = GetFrameWindow(window); |
| 584 if (target_window) | 584 if (target_window) |
| 585 window_bounds_observer_->AddObservedWindow(target_window); | 585 window_bounds_observer_->AddObservedWindow(target_window); |
| 586 } | 586 } |
| 587 | 587 |
| 588 } // namespace keyboard | 588 } // namespace keyboard |
| OLD | NEW |