| 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 27 matching lines...) Expand all Loading... |
| 38 const int kMaxOverScrollShift = 48; | 38 const int kMaxOverScrollShift = 48; |
| 39 | 39 |
| 40 ui::Layer* GetLayer(views::Widget* widget) { | 40 ui::Layer* GetLayer(views::Widget* widget) { |
| 41 return widget->GetNativeView()->layer(); | 41 return widget->GetNativeView()->layer(); |
| 42 } | 42 } |
| 43 | 43 |
| 44 // Gets arrow location based on shelf alignment. | 44 // Gets arrow location based on shelf alignment. |
| 45 views::BubbleBorder::ArrowLocation GetBubbleArrowLocation( | 45 views::BubbleBorder::ArrowLocation GetBubbleArrowLocation( |
| 46 aura::Window* window) { | 46 aura::Window* window) { |
| 47 DCHECK(Shell::HasInstance()); | 47 DCHECK(Shell::HasInstance()); |
| 48 ShelfAlignment shelf_alignment = Shell::GetInstance()->GetShelfAlignment( | 48 return ShelfLayoutManager::ForLauncher(window)-> |
| 49 window->GetRootWindow()); | 49 SelectValueForShelfAlignment( |
| 50 switch (shelf_alignment) { | 50 views::BubbleBorder::BOTTOM_CENTER, |
| 51 case ash::SHELF_ALIGNMENT_BOTTOM: | 51 views::BubbleBorder::LEFT_CENTER, |
| 52 return views::BubbleBorder::BOTTOM_CENTER; | 52 views::BubbleBorder::RIGHT_CENTER); |
| 53 case ash::SHELF_ALIGNMENT_LEFT: | |
| 54 return views::BubbleBorder::LEFT_CENTER; | |
| 55 case ash::SHELF_ALIGNMENT_RIGHT: | |
| 56 return views::BubbleBorder::RIGHT_CENTER; | |
| 57 default: | |
| 58 NOTREACHED() << "Unknown shelf alignment " << shelf_alignment; | |
| 59 return views::BubbleBorder::BOTTOM_CENTER; | |
| 60 } | |
| 61 } | 53 } |
| 62 | 54 |
| 63 // Offset given |rect| towards shelf. | 55 // Offset given |rect| towards shelf. |
| 64 gfx::Rect OffsetTowardsShelf(const gfx::Rect& rect, views::Widget* widget) { | 56 gfx::Rect OffsetTowardsShelf(const gfx::Rect& rect, views::Widget* widget) { |
| 65 DCHECK(Shell::HasInstance()); | 57 DCHECK(Shell::HasInstance()); |
| 66 ShelfAlignment shelf_alignment = Shell::GetInstance()->GetShelfAlignment( | 58 ShelfAlignment shelf_alignment = Shell::GetInstance()->GetShelfAlignment( |
| 67 widget->GetNativeView()->GetRootWindow()); | 59 widget->GetNativeView()->GetRootWindow()); |
| 68 gfx::Rect offseted(rect); | 60 gfx::Rect offseted(rect); |
| 69 switch (shelf_alignment) { | 61 switch (shelf_alignment) { |
| 70 case SHELF_ALIGNMENT_BOTTOM: | 62 case SHELF_ALIGNMENT_BOTTOM: |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 355 should_snap_back_ = false; | 347 should_snap_back_ = false; |
| 356 ui::ScopedLayerAnimationSettings animation(widget_animator); | 348 ui::ScopedLayerAnimationSettings animation(widget_animator); |
| 357 animation.SetTransitionDuration(base::TimeDelta::FromMilliseconds( | 349 animation.SetTransitionDuration(base::TimeDelta::FromMilliseconds( |
| 358 app_list::kOverscrollPageTransitionDurationMs)); | 350 app_list::kOverscrollPageTransitionDurationMs)); |
| 359 widget->SetBounds(view_bounds_); | 351 widget->SetBounds(view_bounds_); |
| 360 } | 352 } |
| 361 } | 353 } |
| 362 | 354 |
| 363 } // namespace internal | 355 } // namespace internal |
| 364 } // namespace ash | 356 } // namespace ash |
| OLD | NEW |