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" |
11 #include "ash/shelf/shelf_layout_manager.h" | 11 #include "ash/shelf/shelf_layout_manager.h" |
12 #include "ash/shell.h" | 12 #include "ash/shell.h" |
13 #include "ash/shell_delegate.h" | 13 #include "ash/shell_delegate.h" |
14 #include "ash/shell_window_ids.h" | 14 #include "ash/shell_window_ids.h" |
15 #include "base/command_line.h" | 15 #include "base/command_line.h" |
16 #include "ui/app_list/app_list_constants.h" | 16 #include "ui/app_list/app_list_constants.h" |
| 17 #include "ui/app_list/app_list_switches.h" |
17 #include "ui/app_list/pagination_model.h" | 18 #include "ui/app_list/pagination_model.h" |
18 #include "ui/app_list/views/app_list_view.h" | 19 #include "ui/app_list/views/app_list_view.h" |
19 #include "ui/aura/client/focus_client.h" | 20 #include "ui/aura/client/focus_client.h" |
20 #include "ui/aura/root_window.h" | 21 #include "ui/aura/root_window.h" |
21 #include "ui/aura/window.h" | 22 #include "ui/aura/window.h" |
22 #include "ui/compositor/layer.h" | 23 #include "ui/compositor/layer.h" |
23 #include "ui/compositor/scoped_layer_animation_settings.h" | 24 #include "ui/compositor/scoped_layer_animation_settings.h" |
24 #include "ui/events/event.h" | 25 #include "ui/events/event.h" |
25 #include "ui/gfx/transform_util.h" | 26 #include "ui/gfx/transform_util.h" |
26 #include "ui/views/widget/widget.h" | 27 #include "ui/views/widget/widget.h" |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 view_->GetWidget()->Deactivate(); | 160 view_->GetWidget()->Deactivate(); |
160 ScheduleAnimation(); | 161 ScheduleAnimation(); |
161 } else if (is_visible_) { | 162 } else if (is_visible_) { |
162 // AppListModel and AppListViewDelegate are owned by AppListView. They | 163 // AppListModel and AppListViewDelegate are owned by AppListView. They |
163 // will be released with AppListView on close. | 164 // will be released with AppListView on close. |
164 app_list::AppListView* view = new app_list::AppListView( | 165 app_list::AppListView* view = new app_list::AppListView( |
165 Shell::GetInstance()->delegate()->CreateAppListViewDelegate()); | 166 Shell::GetInstance()->delegate()->CreateAppListViewDelegate()); |
166 aura::Window* root_window = window->GetRootWindow(); | 167 aura::Window* root_window = window->GetRootWindow(); |
167 aura::Window* container = GetRootWindowController(root_window)-> | 168 aura::Window* container = GetRootWindowController(root_window)-> |
168 GetContainer(kShellWindowId_AppListContainer); | 169 GetContainer(kShellWindowId_AppListContainer); |
169 if (ash::switches::UseAlternateShelfLayout()) { | 170 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 171 app_list::switches::kEnableExperimentalAppList)) { |
| 172 // The experimental app list is centered over the primary display. |
| 173 view->InitAsBubbleAtFixedLocation( |
| 174 NULL, |
| 175 pagination_model_.get(), |
| 176 Shell::GetScreen()->GetPrimaryDisplay().bounds().CenterPoint(), |
| 177 views::BubbleBorder::FLOAT, |
| 178 true /* border_accepts_events */); |
| 179 } else if (ash::switches::UseAlternateShelfLayout()) { |
170 gfx::Rect applist_button_bounds = Shelf::ForWindow(container)-> | 180 gfx::Rect applist_button_bounds = Shelf::ForWindow(container)-> |
171 GetAppListButtonView()->GetBoundsInScreen(); | 181 GetAppListButtonView()->GetBoundsInScreen(); |
172 // We need the location of the button within the local screen. | 182 // We need the location of the button within the local screen. |
173 applist_button_bounds = ScreenUtil::ConvertRectFromScreen( | 183 applist_button_bounds = ScreenUtil::ConvertRectFromScreen( |
174 root_window, | 184 root_window, |
175 applist_button_bounds); | 185 applist_button_bounds); |
176 view->InitAsBubbleAttachedToAnchor( | 186 view->InitAsBubbleAttachedToAnchor( |
177 container, | 187 container, |
178 pagination_model_.get(), | 188 pagination_model_.get(), |
179 Shelf::ForWindow(container)->GetAppListButtonView(), | 189 Shelf::ForWindow(container)->GetAppListButtonView(), |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
430 should_snap_back_ = false; | 440 should_snap_back_ = false; |
431 ui::ScopedLayerAnimationSettings animation(widget_animator); | 441 ui::ScopedLayerAnimationSettings animation(widget_animator); |
432 animation.SetTransitionDuration(base::TimeDelta::FromMilliseconds( | 442 animation.SetTransitionDuration(base::TimeDelta::FromMilliseconds( |
433 app_list::kOverscrollPageTransitionDurationMs)); | 443 app_list::kOverscrollPageTransitionDurationMs)); |
434 widget->SetBounds(view_bounds_); | 444 widget->SetBounds(view_bounds_); |
435 } | 445 } |
436 } | 446 } |
437 | 447 |
438 } // namespace internal | 448 } // namespace internal |
439 } // namespace ash | 449 } // namespace ash |
OLD | NEW |