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(views::View* parent) |
91 : parent_(parent), | |
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 |
104 private: | 106 private: |
105 // Overridden from ui::ImplicitAnimationObserver: | 107 // Overridden from ui::ImplicitAnimationObserver: |
106 virtual void OnImplicitAnimationsCompleted() OVERRIDE { | 108 virtual void OnImplicitAnimationsCompleted() OVERRIDE { |
107 if (target_) { | 109 if (target_) { |
108 target_->SetVisible(false); | 110 target_->SetVisible(false); |
109 target_ = NULL; | 111 target_ = NULL; |
112 | |
113 // Should update the background by invoking SchedulePaint(). | |
114 parent_->SchedulePaint(); | |
xiyuan
2014/01/15 01:22:05
Think we should use app_list_view_->GetBubbleFrame
Jun Mukai
2014/01/15 02:03:44
Done.
| |
110 } | 115 } |
111 } | 116 } |
112 | 117 |
118 views::View* parent_; | |
113 views::View* target_; | 119 views::View* target_; |
114 | 120 |
115 DISALLOW_COPY_AND_ASSIGN(HideViewAnimationObserver); | 121 DISALLOW_COPY_AND_ASSIGN(HideViewAnimationObserver); |
116 }; | 122 }; |
117 | 123 |
118 //////////////////////////////////////////////////////////////////////////////// | 124 //////////////////////////////////////////////////////////////////////////////// |
119 // AppListView: | 125 // AppListView: |
120 | 126 |
121 AppListView::AppListView(AppListViewDelegate* delegate) | 127 AppListView::AppListView(AppListViewDelegate* delegate) |
122 : delegate_(delegate), | 128 : delegate_(delegate), |
123 app_list_main_view_(NULL), | 129 app_list_main_view_(NULL), |
124 signin_view_(NULL), | 130 signin_view_(NULL), |
125 speech_view_(NULL), | 131 speech_view_(NULL), |
126 animation_observer_(new HideViewAnimationObserver()) { | 132 animation_observer_(new HideViewAnimationObserver(this)) { |
127 CHECK(delegate); | 133 CHECK(delegate); |
128 | 134 |
129 delegate_->AddObserver(this); | 135 delegate_->AddObserver(this); |
130 delegate_->GetSpeechUI()->AddObserver(this); | 136 delegate_->GetSpeechUI()->AddObserver(this); |
131 } | 137 } |
132 | 138 |
133 AppListView::~AppListView() { | 139 AppListView::~AppListView() { |
134 delegate_->GetSpeechUI()->RemoveObserver(this); | 140 delegate_->GetSpeechUI()->RemoveObserver(this); |
135 delegate_->RemoveObserver(this); | 141 delegate_->RemoveObserver(this); |
136 animation_observer_.reset(); | 142 animation_observer_.reset(); |
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
470 speech_view_->layer()->SetTransform(speech_transform); | 476 speech_view_->layer()->SetTransform(speech_transform); |
471 } | 477 } |
472 | 478 |
473 if (recognizing) | 479 if (recognizing) |
474 speech_view_->SetVisible(true); | 480 speech_view_->SetVisible(true); |
475 else | 481 else |
476 app_list_main_view_->SetVisible(true); | 482 app_list_main_view_->SetVisible(true); |
477 #else | 483 #else |
478 speech_view_->SetVisible(recognizing); | 484 speech_view_->SetVisible(recognizing); |
479 app_list_main_view_->SetVisible(!recognizing); | 485 app_list_main_view_->SetVisible(!recognizing); |
480 #endif | |
481 | 486 |
482 // Needs to schedule paint of AppListView itself, to repaint the background. | 487 // Needs to schedule paint of AppListView itself, to repaint the background. |
483 SchedulePaint(); | 488 SchedulePaint(); |
xiyuan
2014/01/15 01:22:05
Let's use GetBubbleFrameView()->SchedulePaint() in
Jun Mukai
2014/01/15 02:03:44
Done.
| |
489 #endif | |
484 } | 490 } |
485 | 491 |
486 } // namespace app_list | 492 } // namespace app_list |
OLD | NEW |