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 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 aura::Window* container = GetRootWindowController(root_window)-> | 166 aura::Window* container = GetRootWindowController(root_window)-> |
167 GetContainer(kShellWindowId_AppListContainer); | 167 GetContainer(kShellWindowId_AppListContainer); |
168 if (app_list::switches::IsExperimentalAppListPositionEnabled()) { | 168 if (app_list::switches::IsExperimentalAppListPositionEnabled()) { |
169 // The experimental app list is centered over the primary display. | 169 // The experimental app list is centered over the primary display. |
170 view->InitAsBubbleAtFixedLocation( | 170 view->InitAsBubbleAtFixedLocation( |
171 NULL, | 171 NULL, |
172 pagination_model_.get(), | 172 pagination_model_.get(), |
173 Shell::GetScreen()->GetPrimaryDisplay().bounds().CenterPoint(), | 173 Shell::GetScreen()->GetPrimaryDisplay().bounds().CenterPoint(), |
174 views::BubbleBorder::FLOAT, | 174 views::BubbleBorder::FLOAT, |
175 true /* border_accepts_events */); | 175 true /* border_accepts_events */); |
176 } else if (ash::switches::UseAlternateShelfLayout()) { | 176 } else { |
177 gfx::Rect applist_button_bounds = Shelf::ForWindow(container)-> | 177 gfx::Rect applist_button_bounds = Shelf::ForWindow(container)-> |
178 GetAppListButtonView()->GetBoundsInScreen(); | 178 GetAppListButtonView()->GetBoundsInScreen(); |
179 // We need the location of the button within the local screen. | 179 // We need the location of the button within the local screen. |
180 applist_button_bounds = ScreenUtil::ConvertRectFromScreen( | 180 applist_button_bounds = ScreenUtil::ConvertRectFromScreen( |
181 root_window, | 181 root_window, |
182 applist_button_bounds); | 182 applist_button_bounds); |
183 view->InitAsBubbleAttachedToAnchor( | 183 view->InitAsBubbleAttachedToAnchor( |
184 container, | 184 container, |
185 pagination_model_.get(), | 185 pagination_model_.get(), |
186 Shelf::ForWindow(container)->GetAppListButtonView(), | 186 Shelf::ForWindow(container)->GetAppListButtonView(), |
187 GetAnchorPositionOffsetToShelf(applist_button_bounds, | 187 GetAnchorPositionOffsetToShelf(applist_button_bounds, |
188 Shelf::ForWindow(container)->GetAppListButtonView()-> | 188 Shelf::ForWindow(container)->GetAppListButtonView()-> |
189 GetWidget()), | 189 GetWidget()), |
190 GetBubbleArrow(container), | 190 GetBubbleArrow(container), |
191 true /* border_accepts_events */); | 191 true /* border_accepts_events */); |
192 view->SetArrowPaintType(views::BubbleBorder::PAINT_NONE); | 192 view->SetArrowPaintType(views::BubbleBorder::PAINT_NONE); |
193 } else { | |
194 view->InitAsBubbleAttachedToAnchor( | |
195 container, | |
196 pagination_model_.get(), | |
197 Shelf::ForWindow(container)->GetAppListButtonView(), | |
198 gfx::Vector2d(), | |
199 GetBubbleArrow(container), | |
200 true /* border_accepts_events */); | |
201 } | 193 } |
202 SetView(view); | 194 SetView(view); |
203 // By setting us as DnD recipient, the app list knows that we can | 195 // By setting us as DnD recipient, the app list knows that we can |
204 // handle items. | 196 // handle items. |
205 SetDragAndDropHostOfCurrentAppList( | 197 SetDragAndDropHostOfCurrentAppList( |
206 Shelf::ForWindow(window)->GetDragAndDropHostForAppList()); | 198 Shelf::ForWindow(window)->GetDragAndDropHostForAppList()); |
207 } | 199 } |
208 // Update applist button status when app list visibility is changed. | 200 // Update applist button status when app list visibility is changed. |
209 Shelf::ForWindow(window)->GetAppListButtonView()->SchedulePaint(); | 201 Shelf::ForWindow(window)->GetAppListButtonView()->SchedulePaint(); |
210 } | 202 } |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
429 } else if (should_snap_back_) { | 421 } else if (should_snap_back_) { |
430 should_snap_back_ = false; | 422 should_snap_back_ = false; |
431 ui::ScopedLayerAnimationSettings animation(widget_animator); | 423 ui::ScopedLayerAnimationSettings animation(widget_animator); |
432 animation.SetTransitionDuration(base::TimeDelta::FromMilliseconds( | 424 animation.SetTransitionDuration(base::TimeDelta::FromMilliseconds( |
433 app_list::kOverscrollPageTransitionDurationMs)); | 425 app_list::kOverscrollPageTransitionDurationMs)); |
434 widget->SetBounds(view_bounds_); | 426 widget->SetBounds(view_bounds_); |
435 } | 427 } |
436 } | 428 } |
437 | 429 |
438 } // namespace ash | 430 } // namespace ash |
OLD | NEW |