OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/app_list/views/app_list_view.h" | 5 #include "ui/app_list/views/app_list_view.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
9 #include "base/win/windows_version.h" | 9 #include "base/win/windows_version.h" |
10 #include "ui/app_list/app_list_constants.h" | 10 #include "ui/app_list/app_list_constants.h" |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 return false; | 80 return false; |
81 #endif | 81 #endif |
82 return true; | 82 return true; |
83 } | 83 } |
84 | 84 |
85 } // namespace | 85 } // namespace |
86 | 86 |
87 // An animation observer to hide the view at the end of the animation. | 87 // An animation observer to hide the view at the end of the animation. |
88 class HideViewAnimationObserver : public ui::ImplicitAnimationObserver { | 88 class HideViewAnimationObserver : public ui::ImplicitAnimationObserver { |
89 public: | 89 public: |
90 HideViewAnimationObserver() : target_(NULL) { | 90 HideViewAnimationObserver() |
| 91 : frame_(NULL), |
| 92 target_(NULL) { |
91 } | 93 } |
92 | 94 |
93 virtual ~HideViewAnimationObserver() { | 95 virtual ~HideViewAnimationObserver() { |
94 if (target_) | 96 if (target_) |
95 StopObservingImplicitAnimations(); | 97 StopObservingImplicitAnimations(); |
96 } | 98 } |
97 | 99 |
98 void SetTarget(views::View* target) { | 100 void SetTarget(views::View* target) { |
99 if (!target_) | 101 if (!target_) |
100 StopObservingImplicitAnimations(); | 102 StopObservingImplicitAnimations(); |
101 target_ = target; | 103 target_ = target; |
102 } | 104 } |
103 | 105 |
| 106 void set_frame(views::BubbleFrameView* frame) { frame_ = frame; } |
| 107 |
104 private: | 108 private: |
105 // Overridden from ui::ImplicitAnimationObserver: | 109 // Overridden from ui::ImplicitAnimationObserver: |
106 virtual void OnImplicitAnimationsCompleted() OVERRIDE { | 110 virtual void OnImplicitAnimationsCompleted() OVERRIDE { |
107 if (target_) { | 111 if (target_) { |
108 target_->SetVisible(false); | 112 target_->SetVisible(false); |
109 target_ = NULL; | 113 target_ = NULL; |
| 114 |
| 115 // Should update the background by invoking SchedulePaint(). |
| 116 frame_->SchedulePaint(); |
110 } | 117 } |
111 } | 118 } |
112 | 119 |
| 120 views::BubbleFrameView* frame_; |
113 views::View* target_; | 121 views::View* target_; |
114 | 122 |
115 DISALLOW_COPY_AND_ASSIGN(HideViewAnimationObserver); | 123 DISALLOW_COPY_AND_ASSIGN(HideViewAnimationObserver); |
116 }; | 124 }; |
117 | 125 |
118 //////////////////////////////////////////////////////////////////////////////// | 126 //////////////////////////////////////////////////////////////////////////////// |
119 // AppListView: | 127 // AppListView: |
120 | 128 |
121 AppListView::AppListView(AppListViewDelegate* delegate) | 129 AppListView::AppListView(AppListViewDelegate* delegate) |
122 : delegate_(delegate), | 130 : delegate_(delegate), |
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
432 | 440 |
433 bool recognizing = new_state != SPEECH_RECOGNITION_NOT_STARTED; | 441 bool recognizing = new_state != SPEECH_RECOGNITION_NOT_STARTED; |
434 // No change for this class. | 442 // No change for this class. |
435 if (speech_view_->visible() == recognizing) | 443 if (speech_view_->visible() == recognizing) |
436 return; | 444 return; |
437 | 445 |
438 if (recognizing) | 446 if (recognizing) |
439 speech_view_->Reset(); | 447 speech_view_->Reset(); |
440 | 448 |
441 #if defined(USE_AURA) | 449 #if defined(USE_AURA) |
| 450 animation_observer_->set_frame(GetBubbleFrameView()); |
442 gfx::Transform speech_transform; | 451 gfx::Transform speech_transform; |
443 speech_transform.Translate( | 452 speech_transform.Translate( |
444 0, SkFloatToMScalar(kSpeechUIAppearingPosition)); | 453 0, SkFloatToMScalar(kSpeechUIAppearingPosition)); |
445 if (recognizing) | 454 if (recognizing) |
446 speech_view_->layer()->SetTransform(speech_transform); | 455 speech_view_->layer()->SetTransform(speech_transform); |
447 | 456 |
448 { | 457 { |
449 ui::ScopedLayerAnimationSettings main_settings( | 458 ui::ScopedLayerAnimationSettings main_settings( |
450 app_list_main_view_->layer()->GetAnimator()); | 459 app_list_main_view_->layer()->GetAnimator()); |
451 if (recognizing) { | 460 if (recognizing) { |
(...skipping 18 matching lines...) Expand all Loading... |
470 speech_view_->layer()->SetTransform(speech_transform); | 479 speech_view_->layer()->SetTransform(speech_transform); |
471 } | 480 } |
472 | 481 |
473 if (recognizing) | 482 if (recognizing) |
474 speech_view_->SetVisible(true); | 483 speech_view_->SetVisible(true); |
475 else | 484 else |
476 app_list_main_view_->SetVisible(true); | 485 app_list_main_view_->SetVisible(true); |
477 #else | 486 #else |
478 speech_view_->SetVisible(recognizing); | 487 speech_view_->SetVisible(recognizing); |
479 app_list_main_view_->SetVisible(!recognizing); | 488 app_list_main_view_->SetVisible(!recognizing); |
480 #endif | |
481 | 489 |
482 // Needs to schedule paint of AppListView itself, to repaint the background. | 490 // Needs to schedule paint of AppListView itself, to repaint the background. |
483 SchedulePaint(); | 491 GetBubbleFrameView()->SchedulePaint(); |
| 492 #endif |
484 } | 493 } |
485 | 494 |
486 } // namespace app_list | 495 } // namespace app_list |
OLD | NEW |