| 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/root_window_controller.h" | 8 #include "ash/root_window_controller.h" |
| 9 #include "ash/screen_util.h" | 9 #include "ash/screen_util.h" |
| 10 #include "ash/shelf/shelf.h" | 10 #include "ash/shelf/shelf.h" |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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::Window* 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 gfx::Rect applist_button_bounds = Shelf::ForWindow(container)-> |
| 170 gfx::Rect applist_button_bounds = Shelf::ForWindow(container)-> | 170 GetAppListButtonView()->GetBoundsInScreen(); |
| 171 GetAppListButtonView()->GetBoundsInScreen(); | 171 // We need the location of the button within the local screen. |
| 172 // We need the location of the button within the local screen. | 172 applist_button_bounds = ScreenUtil::ConvertRectFromScreen( |
| 173 applist_button_bounds = ScreenUtil::ConvertRectFromScreen( | 173 root_window, |
| 174 root_window, | 174 applist_button_bounds); |
| 175 applist_button_bounds); | 175 view->InitAsBubbleAttachedToAnchor( |
| 176 view->InitAsBubbleAttachedToAnchor( | 176 container, |
| 177 container, | 177 pagination_model_.get(), |
| 178 pagination_model_.get(), | 178 Shelf::ForWindow(container)->GetAppListButtonView(), |
| 179 Shelf::ForWindow(container)->GetAppListButtonView(), | 179 GetAnchorPositionOffsetToShelf(applist_button_bounds, |
| 180 GetAnchorPositionOffsetToShelf(applist_button_bounds, | 180 Shelf::ForWindow(container)->GetAppListButtonView()-> |
| 181 Shelf::ForWindow(container)->GetAppListButtonView()-> | 181 GetWidget()), |
| 182 GetWidget()), | 182 GetBubbleArrow(container), |
| 183 GetBubbleArrow(container), | 183 true /* border_accepts_events */); |
| 184 true /* border_accepts_events */); | 184 view->SetArrowPaintType(views::BubbleBorder::PAINT_NONE); |
| 185 view->SetArrowPaintType(views::BubbleBorder::PAINT_NONE); | |
| 186 } else { | |
| 187 view->InitAsBubbleAttachedToAnchor( | |
| 188 container, | |
| 189 pagination_model_.get(), | |
| 190 Shelf::ForWindow(container)->GetAppListButtonView(), | |
| 191 gfx::Vector2d(), | |
| 192 GetBubbleArrow(container), | |
| 193 true /* border_accepts_events */); | |
| 194 } | |
| 195 SetView(view); | 185 SetView(view); |
| 196 // By setting us as DnD recipient, the app list knows that we can | 186 // By setting us as DnD recipient, the app list knows that we can |
| 197 // handle items. | 187 // handle items. |
| 198 if (!CommandLine::ForCurrentProcess()->HasSwitch( | 188 if (!CommandLine::ForCurrentProcess()->HasSwitch( |
| 199 switches::kAshDisableDragAndDropAppListToLauncher)) { | 189 switches::kAshDisableDragAndDropAppListToLauncher)) { |
| 200 SetDragAndDropHostOfCurrentAppList( | 190 SetDragAndDropHostOfCurrentAppList( |
| 201 Shelf::ForWindow(window)->GetDragAndDropHostForAppList()); | 191 Shelf::ForWindow(window)->GetDragAndDropHostForAppList()); |
| 202 } | 192 } |
| 203 } | 193 } |
| 204 // Update applist button status when app list visibility is changed. | 194 // Update applist button status when app list visibility is changed. |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 430 should_snap_back_ = false; | 420 should_snap_back_ = false; |
| 431 ui::ScopedLayerAnimationSettings animation(widget_animator); | 421 ui::ScopedLayerAnimationSettings animation(widget_animator); |
| 432 animation.SetTransitionDuration(base::TimeDelta::FromMilliseconds( | 422 animation.SetTransitionDuration(base::TimeDelta::FromMilliseconds( |
| 433 app_list::kOverscrollPageTransitionDurationMs)); | 423 app_list::kOverscrollPageTransitionDurationMs)); |
| 434 widget->SetBounds(view_bounds_); | 424 widget->SetBounds(view_bounds_); |
| 435 } | 425 } |
| 436 } | 426 } |
| 437 | 427 |
| 438 } // namespace internal | 428 } // namespace internal |
| 439 } // namespace ash | 429 } // namespace ash |
| OLD | NEW |