| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/shelf/shelf.h" | 5 #include "ash/common/shelf/shelf.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 | 9 |
| 10 #include "ash/aura/wm_window_aura.h" | |
| 11 #include "ash/common/shelf/shelf_delegate.h" | 10 #include "ash/common/shelf/shelf_delegate.h" |
| 12 #include "ash/common/shelf/shelf_item_delegate.h" | 11 #include "ash/common/shelf/shelf_item_delegate.h" |
| 12 #include "ash/common/shelf/shelf_layout_manager.h" |
| 13 #include "ash/common/shelf/shelf_model.h" | 13 #include "ash/common/shelf/shelf_model.h" |
| 14 #include "ash/common/shelf/shelf_navigator.h" | 14 #include "ash/common/shelf/shelf_navigator.h" |
| 15 #include "ash/common/shelf/shelf_view.h" | 15 #include "ash/common/shelf/shelf_view.h" |
| 16 #include "ash/common/shelf/wm_shelf.h" |
| 16 #include "ash/common/shell_window_ids.h" | 17 #include "ash/common/shell_window_ids.h" |
| 17 #include "ash/common/wm_lookup.h" | 18 #include "ash/common/wm_lookup.h" |
| 19 #include "ash/common/wm_root_window_controller.h" |
| 18 #include "ash/common/wm_shell.h" | 20 #include "ash/common/wm_shell.h" |
| 21 #include "ash/common/wm_window.h" |
| 19 #include "ash/common/wm_window_property.h" | 22 #include "ash/common/wm_window_property.h" |
| 20 #include "ash/root_window_controller.h" | |
| 21 #include "ash/shelf/shelf_layout_manager.h" | |
| 22 #include "ui/aura/window.h" | |
| 23 #include "ui/compositor/layer.h" | 23 #include "ui/compositor/layer.h" |
| 24 #include "ui/gfx/canvas.h" | 24 #include "ui/gfx/canvas.h" |
| 25 #include "ui/gfx/image/image.h" | 25 #include "ui/gfx/image/image.h" |
| 26 #include "ui/gfx/image/image_skia_operations.h" | 26 #include "ui/gfx/image/image_skia_operations.h" |
| 27 #include "ui/gfx/skbitmap_operations.h" | 27 #include "ui/gfx/skbitmap_operations.h" |
| 28 #include "ui/views/accessible_pane_view.h" | 28 #include "ui/views/accessible_pane_view.h" |
| 29 #include "ui/views/widget/widget.h" | 29 #include "ui/views/widget/widget.h" |
| 30 #include "ui/views/widget/widget_delegate.h" | 30 #include "ui/views/widget/widget_delegate.h" |
| 31 #include "ui/wm/public/activation_client.h" | 31 #include "ui/wm/public/activation_client.h" |
| 32 | 32 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 47 Shelf::~Shelf() { | 47 Shelf::~Shelf() { |
| 48 WmShell::Get()->shelf_delegate()->OnShelfDestroyed(this); | 48 WmShell::Get()->shelf_delegate()->OnShelfDestroyed(this); |
| 49 } | 49 } |
| 50 | 50 |
| 51 // static | 51 // static |
| 52 Shelf* Shelf::ForPrimaryDisplay() { | 52 Shelf* Shelf::ForPrimaryDisplay() { |
| 53 return Shelf::ForWindow(WmShell::Get()->GetPrimaryRootWindow()); | 53 return Shelf::ForWindow(WmShell::Get()->GetPrimaryRootWindow()); |
| 54 } | 54 } |
| 55 | 55 |
| 56 // static | 56 // static |
| 57 Shelf* Shelf::ForWindow(const WmWindow* window) { | 57 Shelf* Shelf::ForWindow(WmWindow* window) { |
| 58 const aura::Window* aura_window = WmWindowAura::GetAuraWindow(window); | 58 return window->GetRootWindowController()->GetShelf()->shelf(); |
| 59 ShelfWidget* shelf_widget = | |
| 60 RootWindowController::ForWindow(aura_window)->shelf_widget(); | |
| 61 return shelf_widget ? shelf_widget->shelf() : nullptr; | |
| 62 } | 59 } |
| 63 | 60 |
| 64 void Shelf::SetAlignment(ShelfAlignment alignment) { | 61 void Shelf::SetAlignment(ShelfAlignment alignment) { |
| 65 if (alignment_ == alignment) | 62 if (alignment_ == alignment) |
| 66 return; | 63 return; |
| 67 | 64 |
| 68 if (shelf_locking_manager_.is_locked() && | 65 if (shelf_locking_manager_.is_locked() && |
| 69 alignment != SHELF_ALIGNMENT_BOTTOM_LOCKED) { | 66 alignment != SHELF_ALIGNMENT_BOTTOM_LOCKED) { |
| 70 shelf_locking_manager_.set_stored_alignment(alignment); | 67 shelf_locking_manager_.set_stored_alignment(alignment); |
| 71 return; | 68 return; |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 | 168 |
| 172 app_list::ApplicationDragAndDropHost* Shelf::GetDragAndDropHostForAppList() { | 169 app_list::ApplicationDragAndDropHost* Shelf::GetDragAndDropHostForAppList() { |
| 173 return shelf_view_; | 170 return shelf_view_; |
| 174 } | 171 } |
| 175 | 172 |
| 176 void Shelf::UpdateShelfItemBackground(int alpha) { | 173 void Shelf::UpdateShelfItemBackground(int alpha) { |
| 177 shelf_view_->UpdateShelfItemBackground(alpha); | 174 shelf_view_->UpdateShelfItemBackground(alpha); |
| 178 } | 175 } |
| 179 | 176 |
| 180 } // namespace ash | 177 } // namespace ash |
| OLD | NEW |