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 #ifndef ASH_SYSUI_SHELF_DELEGATE_MUS_H_ | 5 #ifndef ASH_SYSUI_SHELF_DELEGATE_MUS_H_ |
6 #define ASH_SYSUI_SHELF_DELEGATE_MUS_H_ | 6 #define ASH_SYSUI_SHELF_DELEGATE_MUS_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "ash/common/shelf/shelf_delegate.h" | 10 #include "ash/common/shelf/shelf_delegate.h" |
11 #include "ash/public/interfaces/shelf_layout.mojom.h" | |
12 #include "ash/public/interfaces/user_window_controller.mojom.h" | |
13 #include "mash/shelf/public/interfaces/shelf.mojom.h" | 11 #include "mash/shelf/public/interfaces/shelf.mojom.h" |
14 #include "mojo/public/cpp/bindings/binding.h" | 12 #include "mojo/public/cpp/bindings/binding.h" |
15 #include "mojo/public/cpp/bindings/interface_ptr_set.h" | 13 #include "mojo/public/cpp/bindings/interface_ptr_set.h" |
16 | 14 |
17 namespace ash { | 15 namespace ash { |
18 | 16 |
19 class ShelfModel; | 17 class ShelfModel; |
20 | 18 |
21 namespace sysui { | 19 namespace sysui { |
22 | 20 |
23 // Manages communication between the ash_sysui shelf, the window manager, and | 21 // Manages communication between the mash shelf and the browser. |
24 // the browser. | 22 // TODO(mash): Support ShelfController in mojo:ash and remove this sysui impl. |
25 class ShelfDelegateMus : public ShelfDelegate, | 23 class ShelfDelegateMus : public ShelfDelegate, |
26 public mash::shelf::mojom::ShelfController, | 24 public mash::shelf::mojom::ShelfController { |
27 public ash::mojom::UserWindowObserver { | |
28 public: | 25 public: |
29 explicit ShelfDelegateMus(ShelfModel* model); | 26 explicit ShelfDelegateMus(ShelfModel* model); |
30 ~ShelfDelegateMus() override; | 27 ~ShelfDelegateMus() override; |
31 | 28 |
32 private: | 29 private: |
33 // ShelfDelegate: | 30 // ShelfDelegate: |
34 void OnShelfCreated(Shelf* shelf) override; | 31 void OnShelfCreated(Shelf* shelf) override; |
35 void OnShelfDestroyed(Shelf* shelf) override; | 32 void OnShelfDestroyed(Shelf* shelf) override; |
36 void OnShelfAlignmentChanged(Shelf* shelf) override; | 33 void OnShelfAlignmentChanged(Shelf* shelf) override; |
37 void OnShelfAutoHideBehaviorChanged(Shelf* shelf) override; | 34 void OnShelfAutoHideBehaviorChanged(Shelf* shelf) override; |
(...skipping 11 matching lines...) Expand all Loading... |
49 mash::shelf::mojom::ShelfObserverAssociatedPtrInfo observer) override; | 46 mash::shelf::mojom::ShelfObserverAssociatedPtrInfo observer) override; |
50 void SetAlignment(mash::shelf::mojom::Alignment alignment) override; | 47 void SetAlignment(mash::shelf::mojom::Alignment alignment) override; |
51 void SetAutoHideBehavior( | 48 void SetAutoHideBehavior( |
52 mash::shelf::mojom::AutoHideBehavior auto_hide) override; | 49 mash::shelf::mojom::AutoHideBehavior auto_hide) override; |
53 void PinItem( | 50 void PinItem( |
54 mash::shelf::mojom::ShelfItemPtr item, | 51 mash::shelf::mojom::ShelfItemPtr item, |
55 mash::shelf::mojom::ShelfItemDelegateAssociatedPtrInfo delegate) override; | 52 mash::shelf::mojom::ShelfItemDelegateAssociatedPtrInfo delegate) override; |
56 void UnpinItem(const mojo::String& app_id) override; | 53 void UnpinItem(const mojo::String& app_id) override; |
57 void SetItemImage(const mojo::String& app_id, const SkBitmap& image) override; | 54 void SetItemImage(const mojo::String& app_id, const SkBitmap& image) override; |
58 | 55 |
59 // ash::mojom::UserWindowObserver: | 56 // Set the Mus window preferred sizes. |
60 void OnUserWindowObserverAdded( | |
61 mojo::Array<ash::mojom::UserWindowPtr> user_windows) override; | |
62 void OnUserWindowAdded(ash::mojom::UserWindowPtr user_window) override; | |
63 void OnUserWindowRemoved(uint32_t window_id) override; | |
64 void OnUserWindowTitleChanged(uint32_t window_id, | |
65 const mojo::String& window_title) override; | |
66 void OnUserWindowAppIconChanged(uint32_t window_id, | |
67 mojo::Array<uint8_t> app_icon) override; | |
68 void OnUserWindowFocusChanged(uint32_t window_id, bool has_focus) override; | |
69 | |
70 // Set the Mus window preferred sizes, needed by mash::wm::ShelfLayout. | |
71 void SetShelfPreferredSizes(Shelf* shelf); | 57 void SetShelfPreferredSizes(Shelf* shelf); |
72 | 58 |
73 ShelfModel* model_; | 59 ShelfModel* model_; |
74 | 60 |
75 mojo::AssociatedInterfacePtrSet<mash::shelf::mojom::ShelfObserver> observers_; | 61 mojo::AssociatedInterfacePtrSet<mash::shelf::mojom::ShelfObserver> observers_; |
76 | 62 |
77 ash::mojom::ShelfLayoutPtr shelf_layout_; | |
78 ash::mojom::UserWindowControllerPtr user_window_controller_; | |
79 mojo::Binding<ash::mojom::UserWindowObserver> binding_; | |
80 std::map<uint32_t, ShelfID> window_id_to_shelf_id_; | 63 std::map<uint32_t, ShelfID> window_id_to_shelf_id_; |
81 | 64 |
82 std::map<std::string, ShelfID> app_id_to_shelf_id_; | 65 std::map<std::string, ShelfID> app_id_to_shelf_id_; |
83 std::map<ShelfID, std::string> shelf_id_to_app_id_; | 66 std::map<ShelfID, std::string> shelf_id_to_app_id_; |
84 | 67 |
85 DISALLOW_COPY_AND_ASSIGN(ShelfDelegateMus); | 68 DISALLOW_COPY_AND_ASSIGN(ShelfDelegateMus); |
86 }; | 69 }; |
87 | 70 |
88 } // namespace sysui | 71 } // namespace sysui |
89 } // namespace ash | 72 } // namespace ash |
90 | 73 |
91 #endif // ASH_SYSUI_SHELF_DELEGATE_MUS_H_ | 74 #endif // ASH_SYSUI_SHELF_DELEGATE_MUS_H_ |
OLD | NEW |