| 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 "ash/wm/app_list_controller.h" | 5 #include "ash/wm/app_list_controller.h" |
| 6 | 6 |
| 7 #include "ash/launcher/launcher.h" | 7 #include "ash/launcher/launcher.h" |
| 8 #include "ash/root_window_controller.h" | 8 #include "ash/root_window_controller.h" |
| 9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
| 10 #include "ash/shell_delegate.h" | 10 #include "ash/shell_delegate.h" |
| 11 #include "ash/shell_window_ids.h" | 11 #include "ash/shell_window_ids.h" |
| 12 #include "ash/wm/property_util.h" | 12 #include "ash/wm/property_util.h" |
| 13 #include "ash/wm/shelf_layout_manager.h" | 13 #include "ash/wm/shelf_layout_manager.h" |
| 14 #include "ui/app_list/app_list_constants.h" | 14 #include "ui/app_list/app_list_constants.h" |
| 15 #include "ui/app_list/app_list_view.h" | 15 #include "ui/app_list/app_list_view.h" |
| 16 #include "ui/app_list/pagination_model.h" | 16 #include "ui/app_list/pagination_model.h" |
| 17 #include "ui/aura/focus_manager.h" | 17 #include "ui/aura/client/focus_client.h" |
| 18 #include "ui/aura/root_window.h" | 18 #include "ui/aura/root_window.h" |
| 19 #include "ui/aura/window.h" | 19 #include "ui/aura/window.h" |
| 20 #include "ui/base/events/event.h" | 20 #include "ui/base/events/event.h" |
| 21 #include "ui/compositor/layer.h" | 21 #include "ui/compositor/layer.h" |
| 22 #include "ui/compositor/scoped_layer_animation_settings.h" | 22 #include "ui/compositor/scoped_layer_animation_settings.h" |
| 23 #include "ui/gfx/transform_util.h" | 23 #include "ui/gfx/transform_util.h" |
| 24 #include "ui/views/widget/widget.h" | 24 #include "ui/views/widget/widget.h" |
| 25 | 25 |
| 26 namespace ash { | 26 namespace ash { |
| 27 namespace internal { | 27 namespace internal { |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 void AppListController::SetView(app_list::AppListView* view) { | 153 void AppListController::SetView(app_list::AppListView* view) { |
| 154 DCHECK(view_ == NULL); | 154 DCHECK(view_ == NULL); |
| 155 | 155 |
| 156 if (is_visible_) { | 156 if (is_visible_) { |
| 157 view_ = view; | 157 view_ = view; |
| 158 views::Widget* widget = view_->GetWidget(); | 158 views::Widget* widget = view_->GetWidget(); |
| 159 widget->AddObserver(this); | 159 widget->AddObserver(this); |
| 160 Shell::GetInstance()->AddPreTargetHandler(this); | 160 Shell::GetInstance()->AddPreTargetHandler(this); |
| 161 Launcher::ForWindow(GetWindow())->AddIconObserver(this); | 161 Launcher::ForWindow(GetWindow())->AddIconObserver(this); |
| 162 widget->GetNativeView()->GetRootWindow()->AddRootWindowObserver(this); | 162 widget->GetNativeView()->GetRootWindow()->AddRootWindowObserver(this); |
| 163 widget->GetNativeView()->GetFocusManager()->AddObserver(this); | 163 aura::client::GetFocusClient(widget->GetNativeView())->AddObserver(this); |
| 164 widget->SetOpacity(0); | 164 widget->SetOpacity(0); |
| 165 ScheduleAnimation(); | 165 ScheduleAnimation(); |
| 166 | 166 |
| 167 view_->GetWidget()->Show(); | 167 view_->GetWidget()->Show(); |
| 168 } else { | 168 } else { |
| 169 view->GetWidget()->Close(); | 169 view->GetWidget()->Close(); |
| 170 } | 170 } |
| 171 } | 171 } |
| 172 | 172 |
| 173 void AppListController::ResetView() { | 173 void AppListController::ResetView() { |
| 174 if (!view_) | 174 if (!view_) |
| 175 return; | 175 return; |
| 176 | 176 |
| 177 views::Widget* widget = view_->GetWidget(); | 177 views::Widget* widget = view_->GetWidget(); |
| 178 widget->RemoveObserver(this); | 178 widget->RemoveObserver(this); |
| 179 GetLayer(widget)->GetAnimator()->RemoveObserver(this); | 179 GetLayer(widget)->GetAnimator()->RemoveObserver(this); |
| 180 Shell::GetInstance()->RemovePreTargetHandler(this); | 180 Shell::GetInstance()->RemovePreTargetHandler(this); |
| 181 Launcher::ForWindow(GetWindow())->RemoveIconObserver(this); | 181 Launcher::ForWindow(GetWindow())->RemoveIconObserver(this); |
| 182 widget->GetNativeView()->GetRootWindow()->RemoveRootWindowObserver(this); | 182 widget->GetNativeView()->GetRootWindow()->RemoveRootWindowObserver(this); |
| 183 widget->GetNativeView()->GetFocusManager()->RemoveObserver(this); | 183 aura::client::GetFocusClient(widget->GetNativeView())->RemoveObserver(this); |
| 184 view_ = NULL; | 184 view_ = NULL; |
| 185 } | 185 } |
| 186 | 186 |
| 187 void AppListController::ScheduleAnimation() { | 187 void AppListController::ScheduleAnimation() { |
| 188 // Stop observing previous animation. | 188 // Stop observing previous animation. |
| 189 StopObservingImplicitAnimations(); | 189 StopObservingImplicitAnimations(); |
| 190 | 190 |
| 191 views::Widget* widget = view_->GetWidget(); | 191 views::Widget* widget = view_->GetWidget(); |
| 192 ui::Layer* layer = GetLayer(widget); | 192 ui::Layer* layer = GetLayer(widget); |
| 193 layer->GetAnimator()->StopAnimating(); | 193 layer->GetAnimator()->StopAnimating(); |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 355 should_snap_back_ = false; | 355 should_snap_back_ = false; |
| 356 ui::ScopedLayerAnimationSettings animation(widget_animator); | 356 ui::ScopedLayerAnimationSettings animation(widget_animator); |
| 357 animation.SetTransitionDuration(base::TimeDelta::FromMilliseconds( | 357 animation.SetTransitionDuration(base::TimeDelta::FromMilliseconds( |
| 358 app_list::kOverscrollPageTransitionDurationMs)); | 358 app_list::kOverscrollPageTransitionDurationMs)); |
| 359 widget->SetBounds(view_bounds_); | 359 widget->SetBounds(view_bounds_); |
| 360 } | 360 } |
| 361 } | 361 } |
| 362 | 362 |
| 363 } // namespace internal | 363 } // namespace internal |
| 364 } // namespace ash | 364 } // namespace ash |
| OLD | NEW |