| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/aura_shell/app_list.h" | 5 #include "ui/aura_shell/app_list.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "ui/aura/event.h" | 8 #include "ui/aura/event.h" |
| 9 #include "ui/aura/window.h" | 9 #include "ui/aura/window.h" |
| 10 #include "ui/aura_shell/shell.h" | 10 #include "ui/aura_shell/shell.h" |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 // AppList, private: | 75 // AppList, private: |
| 76 | 76 |
| 77 void AppList::SetWidget(views::Widget* widget) { | 77 void AppList::SetWidget(views::Widget* widget) { |
| 78 DCHECK(widget_ == NULL); | 78 DCHECK(widget_ == NULL); |
| 79 set_widget_factory_.InvalidateWeakPtrs(); | 79 set_widget_factory_.InvalidateWeakPtrs(); |
| 80 | 80 |
| 81 if (is_visible_) { | 81 if (is_visible_) { |
| 82 widget_ = widget; | 82 widget_ = widget; |
| 83 widget_->AddObserver(this); | 83 widget_->AddObserver(this); |
| 84 GetLayer(widget_)->GetAnimator()->AddObserver(this); | 84 GetLayer(widget_)->GetAnimator()->AddObserver(this); |
| 85 Shell::GetInstance()->AddDesktopEventFilter(this); | 85 Shell::GetInstance()->AddRootWindowEventFilter(this); |
| 86 | 86 |
| 87 widget_->SetBounds(GetPreferredBounds(false)); | 87 widget_->SetBounds(GetPreferredBounds(false)); |
| 88 widget_->SetOpacity(0); | 88 widget_->SetOpacity(0); |
| 89 ScheduleAnimation(); | 89 ScheduleAnimation(); |
| 90 | 90 |
| 91 widget_->Show(); | 91 widget_->Show(); |
| 92 } else { | 92 } else { |
| 93 widget->Close(); | 93 widget->Close(); |
| 94 } | 94 } |
| 95 } | 95 } |
| 96 | 96 |
| 97 void AppList::ResetWidget() { | 97 void AppList::ResetWidget() { |
| 98 if (!widget_) | 98 if (!widget_) |
| 99 return; | 99 return; |
| 100 | 100 |
| 101 widget_->RemoveObserver(this); | 101 widget_->RemoveObserver(this); |
| 102 GetLayer(widget_)->GetAnimator()->RemoveObserver(this); | 102 GetLayer(widget_)->GetAnimator()->RemoveObserver(this); |
| 103 Shell::GetInstance()->RemoveDesktopEventFilter(this); | 103 Shell::GetInstance()->RemoveRootWindowEventFilter(this); |
| 104 widget_ = NULL; | 104 widget_ = NULL; |
| 105 } | 105 } |
| 106 | 106 |
| 107 void AppList::ScheduleAnimation() { | 107 void AppList::ScheduleAnimation() { |
| 108 ui::Layer* layer = GetLayer(widget_); | 108 ui::Layer* layer = GetLayer(widget_); |
| 109 ui::LayerAnimator::ScopedSettings app_list_animation(layer->GetAnimator()); | 109 ui::LayerAnimator::ScopedSettings app_list_animation(layer->GetAnimator()); |
| 110 layer->SetBounds(GetPreferredBounds(is_visible_)); | 110 layer->SetBounds(GetPreferredBounds(is_visible_)); |
| 111 layer->SetOpacity(is_visible_ ? 1.0 : 0.0); | 111 layer->SetOpacity(is_visible_ ? 1.0 : 0.0); |
| 112 | 112 |
| 113 ui::Layer* default_container_layer = Shell::GetInstance()->GetContainer( | 113 ui::Layer* default_container_layer = Shell::GetInstance()->GetContainer( |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 } | 168 } |
| 169 | 169 |
| 170 void AppList::OnWidgetActivationChanged(views::Widget* widget, bool active) { | 170 void AppList::OnWidgetActivationChanged(views::Widget* widget, bool active) { |
| 171 DCHECK(widget_ == widget); | 171 DCHECK(widget_ == widget); |
| 172 if (widget_ && is_visible_ && !active) | 172 if (widget_ && is_visible_ && !active) |
| 173 SetVisible(false); | 173 SetVisible(false); |
| 174 } | 174 } |
| 175 | 175 |
| 176 } // namespace internal | 176 } // namespace internal |
| 177 } // namespace aura_shell | 177 } // namespace aura_shell |
| OLD | NEW |