OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef ASH_SYSUI_SHELF_DELEGATE_MUS_H_ | |
6 #define ASH_SYSUI_SHELF_DELEGATE_MUS_H_ | |
7 | |
8 #include <map> | |
9 | |
10 #include "ash/common/shelf/shelf_delegate.h" | |
11 #include "mash/shelf/public/interfaces/shelf.mojom.h" | |
12 #include "mojo/public/cpp/bindings/binding.h" | |
13 #include "mojo/public/cpp/bindings/interface_ptr_set.h" | |
14 | |
15 namespace ash { | |
16 | |
17 class ShelfModel; | |
18 | |
19 namespace sysui { | |
20 | |
21 // Manages communication between the mash shelf and the browser. | |
22 // TODO(mash): Support ShelfController in mojo:ash and remove this sysui impl. | |
23 class ShelfDelegateMus : public ShelfDelegate, | |
24 public mash::shelf::mojom::ShelfController { | |
25 public: | |
26 explicit ShelfDelegateMus(ShelfModel* model); | |
27 ~ShelfDelegateMus() override; | |
28 | |
29 private: | |
30 // ShelfDelegate: | |
31 void OnShelfCreated(Shelf* shelf) override; | |
32 void OnShelfDestroyed(Shelf* shelf) override; | |
33 void OnShelfAlignmentChanged(Shelf* shelf) override; | |
34 void OnShelfAutoHideBehaviorChanged(Shelf* shelf) override; | |
35 void OnShelfAutoHideStateChanged(Shelf* shelf) override; | |
36 void OnShelfVisibilityStateChanged(Shelf* shelf) override; | |
37 ShelfID GetShelfIDForAppID(const std::string& app_id) override; | |
38 bool HasShelfIDToAppIDMapping(ShelfID id) const override; | |
39 const std::string& GetAppIDForShelfID(ShelfID id) override; | |
40 void PinAppWithID(const std::string& app_id) override; | |
41 bool IsAppPinned(const std::string& app_id) override; | |
42 void UnpinAppWithID(const std::string& app_id) override; | |
43 | |
44 // mash::shelf::mojom::ShelfController: | |
45 void AddObserver( | |
46 mash::shelf::mojom::ShelfObserverAssociatedPtrInfo observer) override; | |
47 void SetAlignment(mash::shelf::mojom::Alignment alignment) override; | |
48 void SetAutoHideBehavior( | |
49 mash::shelf::mojom::AutoHideBehavior auto_hide) override; | |
50 void PinItem( | |
51 mash::shelf::mojom::ShelfItemPtr item, | |
52 mash::shelf::mojom::ShelfItemDelegateAssociatedPtrInfo delegate) override; | |
53 void UnpinItem(const mojo::String& app_id) override; | |
54 void SetItemImage(const mojo::String& app_id, const SkBitmap& image) override; | |
55 | |
56 // Set the Mus window preferred sizes. | |
57 void SetShelfPreferredSizes(Shelf* shelf); | |
58 | |
59 ShelfModel* model_; | |
60 | |
61 mojo::AssociatedInterfacePtrSet<mash::shelf::mojom::ShelfObserver> observers_; | |
62 | |
63 std::map<uint32_t, ShelfID> window_id_to_shelf_id_; | |
64 | |
65 std::map<std::string, ShelfID> app_id_to_shelf_id_; | |
66 std::map<ShelfID, std::string> shelf_id_to_app_id_; | |
67 | |
68 DISALLOW_COPY_AND_ASSIGN(ShelfDelegateMus); | |
69 }; | |
70 | |
71 } // namespace sysui | |
72 } // namespace ash | |
73 | |
74 #endif // ASH_SYSUI_SHELF_DELEGATE_MUS_H_ | |
OLD | NEW |