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

Side by Side Diff: ui/keyboard/keyboard_controller.cc

Issue 562373002: Change keyboard animation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 22 matching lines...) Expand all
33 #if defined(OS_CHROMEOS) 33 #if defined(OS_CHROMEOS)
34 #include "base/process/launch.h" 34 #include "base/process/launch.h"
35 #include "base/sys_info.h" 35 #include "base/sys_info.h"
36 #endif 36 #endif
37 37
38 namespace { 38 namespace {
39 39
40 const int kHideKeyboardDelayMs = 100; 40 const int kHideKeyboardDelayMs = 100;
41 41
42 // The virtual keyboard show/hide animation duration. 42 // The virtual keyboard show/hide animation duration.
43 const int kAnimationDurationMs = 200; 43 const int kShowAnimationDurationMs = 350;
44 const int kHideAnimationDurationMs = 100;
44 45
45 // The opacity of virtual keyboard container when show animation starts or 46 // The opacity of virtual keyboard container when show animation starts or
46 // hide animation finishes. 47 // hide animation finishes.
47 const float kAnimationStartOrAfterHideOpacity = 0.2f; 48 // TODO(rsadam@): Investigate why setting this to zero crashes.
49 const float kAnimationStartOrAfterHideOpacity = 0.01f;
48 50
49 // Event targeter for the keyboard container. 51 // Event targeter for the keyboard container.
50 class KeyboardContainerTargeter : public wm::MaskedWindowTargeter { 52 class KeyboardContainerTargeter : public wm::MaskedWindowTargeter {
51 public: 53 public:
52 KeyboardContainerTargeter(aura::Window* container, 54 KeyboardContainerTargeter(aura::Window* container,
53 keyboard::KeyboardControllerProxy* proxy) 55 keyboard::KeyboardControllerProxy* proxy)
54 : wm::MaskedWindowTargeter(container), 56 : wm::MaskedWindowTargeter(container),
55 proxy_(proxy) { 57 proxy_(proxy) {
56 } 58 }
57 59
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 set_lock_keyboard(false); 359 set_lock_keyboard(false);
358 360
359 ui::LayerAnimator* container_animator = container_->layer()->GetAnimator(); 361 ui::LayerAnimator* container_animator = container_->layer()->GetAnimator();
360 animation_observer_.reset(new CallbackAnimationObserver( 362 animation_observer_.reset(new CallbackAnimationObserver(
361 container_animator, 363 container_animator,
362 base::Bind(&KeyboardController::HideAnimationFinished, 364 base::Bind(&KeyboardController::HideAnimationFinished,
363 base::Unretained(this)))); 365 base::Unretained(this))));
364 container_animator->AddObserver(animation_observer_.get()); 366 container_animator->AddObserver(animation_observer_.get());
365 367
366 ui::ScopedLayerAnimationSettings settings(container_animator); 368 ui::ScopedLayerAnimationSettings settings(container_animator);
367 settings.SetTweenType(gfx::Tween::EASE_OUT); 369 settings.SetTweenType(gfx::Tween::FAST_OUT_LINEAR_IN);
368 settings.SetTransitionDuration( 370 settings.SetTransitionDuration(
369 base::TimeDelta::FromMilliseconds(kAnimationDurationMs)); 371 base::TimeDelta::FromMilliseconds(kHideAnimationDurationMs));
370 gfx::Transform transform; 372 gfx::Transform transform;
371 transform.Translate(0, proxy_->GetKeyboardWindow()->bounds().height()); 373 transform.Translate(0, proxy_->GetKeyboardWindow()->bounds().height());
372 container_->SetTransform(transform); 374 container_->SetTransform(transform);
373 container_->layer()->SetOpacity(kAnimationStartOrAfterHideOpacity); 375 container_->layer()->SetOpacity(kAnimationStartOrAfterHideOpacity);
374 } 376 }
375 377
376 void KeyboardController::AddObserver(KeyboardControllerObserver* observer) { 378 void KeyboardController::AddObserver(KeyboardControllerObserver* observer) {
377 observer_list_.AddObserver(observer); 379 observer_list_.AddObserver(observer);
378 } 380 }
379 381
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
535 container_animator->AddObserver(animation_observer_.get()); 537 container_animator->AddObserver(animation_observer_.get());
536 538
537 proxy_->ShowKeyboardContainer(container_.get()); 539 proxy_->ShowKeyboardContainer(container_.get());
538 540
539 { 541 {
540 // Scope the following animation settings as we don't want to animate 542 // Scope the following animation settings as we don't want to animate
541 // visibility change that triggered by a call to the base class function 543 // visibility change that triggered by a call to the base class function
542 // ShowKeyboardContainer with these settings. The container should become 544 // ShowKeyboardContainer with these settings. The container should become
543 // visible immediately. 545 // visible immediately.
544 ui::ScopedLayerAnimationSettings settings(container_animator); 546 ui::ScopedLayerAnimationSettings settings(container_animator);
545 settings.SetTweenType(gfx::Tween::EASE_IN); 547 settings.SetTweenType(gfx::Tween::LINEAR_OUT_SLOW_IN);
546 settings.SetTransitionDuration( 548 settings.SetTransitionDuration(
547 base::TimeDelta::FromMilliseconds(kAnimationDurationMs)); 549 base::TimeDelta::FromMilliseconds(kShowAnimationDurationMs));
548 container_->SetTransform(gfx::Transform()); 550 container_->SetTransform(gfx::Transform());
549 container_->layer()->SetOpacity(1.0); 551 container_->layer()->SetOpacity(1.0);
550 } 552 }
551 } 553 }
552 554
553 void KeyboardController::ResetWindowInsets() { 555 void KeyboardController::ResetWindowInsets() {
554 const gfx::Insets insets; 556 const gfx::Insets insets;
555 scoped_ptr<content::RenderWidgetHostIterator> widgets( 557 scoped_ptr<content::RenderWidgetHostIterator> widgets(
556 content::RenderWidgetHost::GetRenderWidgetHosts()); 558 content::RenderWidgetHost::GetRenderWidgetHosts());
557 while (content::RenderWidgetHost* widget = widgets->GetNextHost()) { 559 while (content::RenderWidgetHost* widget = widgets->GetNextHost()) {
(...skipping 19 matching lines...) Expand all
577 proxy_->HideKeyboardContainer(container_.get()); 579 proxy_->HideKeyboardContainer(container_.get());
578 } 580 }
579 581
580 void KeyboardController::AddBoundsChangedObserver(aura::Window* window) { 582 void KeyboardController::AddBoundsChangedObserver(aura::Window* window) {
581 aura::Window* target_window = GetFrameWindow(window); 583 aura::Window* target_window = GetFrameWindow(window);
582 if (target_window) 584 if (target_window)
583 window_bounds_observer_->AddObservedWindow(target_window); 585 window_bounds_observer_->AddObservedWindow(target_window);
584 } 586 }
585 587
586 } // namespace keyboard 588 } // namespace keyboard
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698