OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_controller.h" | 5 #include "ash/shelf/shelf_controller.h" |
6 | 6 |
7 #include "ash/public/interfaces/shelf.mojom.h" | 7 #include "ash/public/interfaces/shelf.mojom.h" |
8 #include "ash/root_window_controller.h" | 8 #include "ash/root_window_controller.h" |
9 #include "ash/session/session_controller.h" | 9 #include "ash/session/session_controller.h" |
10 #include "ash/shelf/app_list_shelf_item_delegate.h" | 10 #include "ash/shelf/app_list_shelf_item_delegate.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 } | 36 } |
37 | 37 |
38 ShelfController::~ShelfController() {} | 38 ShelfController::~ShelfController() {} |
39 | 39 |
40 void ShelfController::BindRequest(mojom::ShelfControllerRequest request) { | 40 void ShelfController::BindRequest(mojom::ShelfControllerRequest request) { |
41 bindings_.AddBinding(this, std::move(request)); | 41 bindings_.AddBinding(this, std::move(request)); |
42 } | 42 } |
43 | 43 |
44 void ShelfController::NotifyShelfInitialized(Shelf* shelf) { | 44 void ShelfController::NotifyShelfInitialized(Shelf* shelf) { |
45 // Notify observers, Chrome will set alignment and auto-hide from prefs. | 45 // Notify observers, Chrome will set alignment and auto-hide from prefs. |
46 int64_t display_id = shelf->GetWindow()->GetDisplayNearestWindow().id(); | 46 display::Display display = |
| 47 display::Screen::GetScreen()->GetDisplayNearestWindow(shelf->GetWindow()); |
| 48 int64_t display_id = display.id(); |
47 observers_.ForAllPtrs([display_id](mojom::ShelfObserver* observer) { | 49 observers_.ForAllPtrs([display_id](mojom::ShelfObserver* observer) { |
48 observer->OnShelfInitialized(display_id); | 50 observer->OnShelfInitialized(display_id); |
49 }); | 51 }); |
50 } | 52 } |
51 | 53 |
52 void ShelfController::NotifyShelfAlignmentChanged(Shelf* shelf) { | 54 void ShelfController::NotifyShelfAlignmentChanged(Shelf* shelf) { |
53 ShelfAlignment alignment = shelf->alignment(); | 55 ShelfAlignment alignment = shelf->alignment(); |
54 int64_t display_id = shelf->GetWindow()->GetDisplayNearestWindow().id(); | 56 display::Display display = |
| 57 display::Screen::GetScreen()->GetDisplayNearestWindow(shelf->GetWindow()); |
| 58 int64_t display_id = display.id(); |
55 observers_.ForAllPtrs( | 59 observers_.ForAllPtrs( |
56 [alignment, display_id](mojom::ShelfObserver* observer) { | 60 [alignment, display_id](mojom::ShelfObserver* observer) { |
57 observer->OnAlignmentChanged(alignment, display_id); | 61 observer->OnAlignmentChanged(alignment, display_id); |
58 }); | 62 }); |
59 } | 63 } |
60 | 64 |
61 void ShelfController::NotifyShelfAutoHideBehaviorChanged(Shelf* shelf) { | 65 void ShelfController::NotifyShelfAutoHideBehaviorChanged(Shelf* shelf) { |
62 ShelfAutoHideBehavior behavior = shelf->auto_hide_behavior(); | 66 ShelfAutoHideBehavior behavior = shelf->auto_hide_behavior(); |
63 int64_t display_id = shelf->GetWindow()->GetDisplayNearestWindow().id(); | 67 display::Display display = |
| 68 display::Screen::GetScreen()->GetDisplayNearestWindow(shelf->GetWindow()); |
| 69 int64_t display_id = display.id(); |
64 observers_.ForAllPtrs([behavior, display_id](mojom::ShelfObserver* observer) { | 70 observers_.ForAllPtrs([behavior, display_id](mojom::ShelfObserver* observer) { |
65 observer->OnAutoHideBehaviorChanged(behavior, display_id); | 71 observer->OnAutoHideBehaviorChanged(behavior, display_id); |
66 }); | 72 }); |
67 } | 73 } |
68 | 74 |
69 void ShelfController::AddObserver( | 75 void ShelfController::AddObserver( |
70 mojom::ShelfObserverAssociatedPtrInfo observer) { | 76 mojom::ShelfObserverAssociatedPtrInfo observer) { |
71 mojom::ShelfObserverAssociatedPtr observer_ptr; | 77 mojom::ShelfObserverAssociatedPtr observer_ptr; |
72 observer_ptr.Bind(std::move(observer)); | 78 observer_ptr.Bind(std::move(observer)); |
73 observers_.AddPtr(std::move(observer_ptr)); | 79 observers_.AddPtr(std::move(observer_ptr)); |
(...skipping 28 matching lines...) Expand all Loading... |
102 void ShelfController::UnpinItem(const std::string& app_id) { | 108 void ShelfController::UnpinItem(const std::string& app_id) { |
103 NOTIMPLEMENTED(); | 109 NOTIMPLEMENTED(); |
104 } | 110 } |
105 | 111 |
106 void ShelfController::SetItemImage(const std::string& app_id, | 112 void ShelfController::SetItemImage(const std::string& app_id, |
107 const SkBitmap& image) { | 113 const SkBitmap& image) { |
108 NOTIMPLEMENTED(); | 114 NOTIMPLEMENTED(); |
109 } | 115 } |
110 | 116 |
111 } // namespace ash | 117 } // namespace ash |
OLD | NEW |