| 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" |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 | 138 |
| 139 aura::Window* AppListController::GetWindow() { | 139 aura::Window* AppListController::GetWindow() { |
| 140 return is_visible_ && view_ ? view_->GetWidget()->GetNativeWindow() : NULL; | 140 return is_visible_ && view_ ? view_->GetWidget()->GetNativeWindow() : NULL; |
| 141 } | 141 } |
| 142 | 142 |
| 143 //////////////////////////////////////////////////////////////////////////////// | 143 //////////////////////////////////////////////////////////////////////////////// |
| 144 // AppListController, private: | 144 // AppListController, private: |
| 145 | 145 |
| 146 void AppListController::SetView(app_list::AppListView* view) { | 146 void AppListController::SetView(app_list::AppListView* view) { |
| 147 DCHECK(view_ == NULL); | 147 DCHECK(view_ == NULL); |
| 148 DCHECK(is_visible_); |
| 148 | 149 |
| 149 if (is_visible_) { | 150 view_ = view; |
| 150 view_ = view; | 151 views::Widget* widget = view_->GetWidget(); |
| 151 views::Widget* widget = view_->GetWidget(); | 152 widget->AddObserver(this); |
| 152 widget->AddObserver(this); | 153 Shell::GetInstance()->AddPreTargetHandler(this); |
| 153 Shell::GetInstance()->AddPreTargetHandler(this); | 154 Launcher::ForWindow(GetWindow())->AddIconObserver(this); |
| 154 Launcher::ForWindow(GetWindow())->AddIconObserver(this); | 155 widget->GetNativeView()->GetRootWindow()->AddRootWindowObserver(this); |
| 155 widget->GetNativeView()->GetRootWindow()->AddRootWindowObserver(this); | 156 aura::client::GetFocusClient(widget->GetNativeView())->AddObserver(this); |
| 156 aura::client::GetFocusClient(widget->GetNativeView())->AddObserver(this); | |
| 157 widget->SetOpacity(0); | |
| 158 ScheduleAnimation(); | |
| 159 | 157 |
| 160 view_->GetWidget()->Show(); | 158 view_->ShowWhenReady(); |
| 161 } else { | |
| 162 view->GetWidget()->Close(); | |
| 163 } | |
| 164 } | 159 } |
| 165 | 160 |
| 166 void AppListController::ResetView() { | 161 void AppListController::ResetView() { |
| 167 if (!view_) | 162 if (!view_) |
| 168 return; | 163 return; |
| 169 | 164 |
| 170 views::Widget* widget = view_->GetWidget(); | 165 views::Widget* widget = view_->GetWidget(); |
| 171 widget->RemoveObserver(this); | 166 widget->RemoveObserver(this); |
| 172 GetLayer(widget)->GetAnimator()->RemoveObserver(this); | 167 GetLayer(widget)->GetAnimator()->RemoveObserver(this); |
| 173 Shell::GetInstance()->RemovePreTargetHandler(this); | 168 Shell::GetInstance()->RemovePreTargetHandler(this); |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 should_snap_back_ = false; | 342 should_snap_back_ = false; |
| 348 ui::ScopedLayerAnimationSettings animation(widget_animator); | 343 ui::ScopedLayerAnimationSettings animation(widget_animator); |
| 349 animation.SetTransitionDuration(base::TimeDelta::FromMilliseconds( | 344 animation.SetTransitionDuration(base::TimeDelta::FromMilliseconds( |
| 350 app_list::kOverscrollPageTransitionDurationMs)); | 345 app_list::kOverscrollPageTransitionDurationMs)); |
| 351 widget->SetBounds(view_bounds_); | 346 widget->SetBounds(view_bounds_); |
| 352 } | 347 } |
| 353 } | 348 } |
| 354 | 349 |
| 355 } // namespace internal | 350 } // namespace internal |
| 356 } // namespace ash | 351 } // namespace ash |
| OLD | NEW |