| 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/ash_switches.h" | 7 #include "ash/ash_switches.h" |
| 8 #include "ash/launcher/launcher.h" | 8 #include "ash/launcher/launcher.h" |
| 9 #include "ash/root_window_controller.h" | 9 #include "ash/root_window_controller.h" |
| 10 #include "ash/screen_ash.h" | 10 #include "ash/screen_ash.h" |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 // deactivating now we ensure there is no activation change when the | 156 // deactivating now we ensure there is no activation change when the |
| 157 // animation completes and any menus stay open. | 157 // animation completes and any menus stay open. |
| 158 if (!visible) | 158 if (!visible) |
| 159 view_->GetWidget()->Deactivate(); | 159 view_->GetWidget()->Deactivate(); |
| 160 ScheduleAnimation(); | 160 ScheduleAnimation(); |
| 161 } else if (is_visible_) { | 161 } else if (is_visible_) { |
| 162 // AppListModel and AppListViewDelegate are owned by AppListView. They | 162 // AppListModel and AppListViewDelegate are owned by AppListView. They |
| 163 // will be released with AppListView on close. | 163 // will be released with AppListView on close. |
| 164 app_list::AppListView* view = new app_list::AppListView( | 164 app_list::AppListView* view = new app_list::AppListView( |
| 165 Shell::GetInstance()->delegate()->CreateAppListViewDelegate()); | 165 Shell::GetInstance()->delegate()->CreateAppListViewDelegate()); |
| 166 aura::RootWindow* root_window = window->GetRootWindow(); | 166 aura::Window* root_window = window->GetRootWindow(); |
| 167 aura::Window* container = GetRootWindowController(root_window)-> | 167 aura::Window* container = GetRootWindowController(root_window)-> |
| 168 GetContainer(kShellWindowId_AppListContainer); | 168 GetContainer(kShellWindowId_AppListContainer); |
| 169 if (ash::switches::UseAlternateShelfLayout()) { | 169 if (ash::switches::UseAlternateShelfLayout()) { |
| 170 gfx::Rect applist_button_bounds = Launcher::ForWindow(container)-> | 170 gfx::Rect applist_button_bounds = Launcher::ForWindow(container)-> |
| 171 GetAppListButtonView()->GetBoundsInScreen(); | 171 GetAppListButtonView()->GetBoundsInScreen(); |
| 172 // We need the location of the button within the local screen. | 172 // We need the location of the button within the local screen. |
| 173 applist_button_bounds = ash::ScreenAsh::ConvertRectFromScreen( | 173 applist_button_bounds = ash::ScreenAsh::ConvertRectFromScreen( |
| 174 root_window, | 174 root_window, |
| 175 applist_button_bounds); | 175 applist_button_bounds); |
| 176 view->InitAsBubbleAttachedToAnchor( | 176 view->InitAsBubbleAttachedToAnchor( |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 362 | 362 |
| 363 void AppListController::OnWidgetDestroying(views::Widget* widget) { | 363 void AppListController::OnWidgetDestroying(views::Widget* widget) { |
| 364 DCHECK(view_->GetWidget() == widget); | 364 DCHECK(view_->GetWidget() == widget); |
| 365 if (is_visible_) | 365 if (is_visible_) |
| 366 SetVisible(false, widget->GetNativeView()); | 366 SetVisible(false, widget->GetNativeView()); |
| 367 ResetView(); | 367 ResetView(); |
| 368 } | 368 } |
| 369 | 369 |
| 370 //////////////////////////////////////////////////////////////////////////////// | 370 //////////////////////////////////////////////////////////////////////////////// |
| 371 // AppListController, ShellObserver implementation: | 371 // AppListController, ShellObserver implementation: |
| 372 void AppListController::OnShelfAlignmentChanged(aura::RootWindow* root_window) { | 372 void AppListController::OnShelfAlignmentChanged(aura::Window* root_window) { |
| 373 if (view_) | 373 if (view_) |
| 374 view_->SetBubbleArrow(GetBubbleArrow(view_->GetWidget()->GetNativeView())); | 374 view_->SetBubbleArrow(GetBubbleArrow(view_->GetWidget()->GetNativeView())); |
| 375 } | 375 } |
| 376 | 376 |
| 377 //////////////////////////////////////////////////////////////////////////////// | 377 //////////////////////////////////////////////////////////////////////////////// |
| 378 // AppListController, LauncherIconObserver implementation: | 378 // AppListController, LauncherIconObserver implementation: |
| 379 | 379 |
| 380 void AppListController::OnLauncherIconPositionsChanged() { | 380 void AppListController::OnLauncherIconPositionsChanged() { |
| 381 UpdateBounds(); | 381 UpdateBounds(); |
| 382 } | 382 } |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 426 should_snap_back_ = false; | 426 should_snap_back_ = false; |
| 427 ui::ScopedLayerAnimationSettings animation(widget_animator); | 427 ui::ScopedLayerAnimationSettings animation(widget_animator); |
| 428 animation.SetTransitionDuration(base::TimeDelta::FromMilliseconds( | 428 animation.SetTransitionDuration(base::TimeDelta::FromMilliseconds( |
| 429 app_list::kOverscrollPageTransitionDurationMs)); | 429 app_list::kOverscrollPageTransitionDurationMs)); |
| 430 widget->SetBounds(view_bounds_); | 430 widget->SetBounds(view_bounds_); |
| 431 } | 431 } |
| 432 } | 432 } |
| 433 | 433 |
| 434 } // namespace internal | 434 } // namespace internal |
| 435 } // namespace ash | 435 } // namespace ash |
| OLD | NEW |