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_COMMON_SHELF_SHELF_CONTROLLER_H_ | |
6 #define ASH_COMMON_SHELF_SHELF_CONTROLLER_H_ | |
7 | |
8 #include <map> | |
9 #include <string> | |
10 | |
11 #include "ash/common/shelf/shelf_item_types.h" | |
12 #include "ash/common/shelf/shelf_model.h" | |
13 #include "ash/public/cpp/shelf_types.h" | |
14 #include "ash/public/interfaces/shelf.mojom.h" | |
15 #include "mojo/public/cpp/bindings/binding_set.h" | |
16 #include "mojo/public/cpp/bindings/interface_ptr_set.h" | |
17 | |
18 namespace ash { | |
19 | |
20 class WmShelf; | |
21 | |
22 // Used by chrome to observe and manage the per-display ash shelf instances. | |
sky
2016/10/07 16:10:17
This comment is confusing as it implies this code
msw
2016/10/07 22:45:57
Done.
| |
23 class ShelfController : public mojom::ShelfController { | |
24 public: | |
25 ShelfController(); | |
26 ~ShelfController() override; | |
27 | |
28 // Binds the mojom::ShelfController interface request to this object. | |
29 void BindRequest(mojom::ShelfControllerRequest request); | |
30 | |
31 ShelfModel* model() { return &model_; } | |
32 | |
33 const std::map<std::string, ShelfID>& app_id_to_shelf_id() { | |
34 return app_id_to_shelf_id_; | |
35 } | |
36 | |
37 const std::map<ShelfID, std::string>& shelf_id_to_app_id() { | |
38 return shelf_id_to_app_id_; | |
39 } | |
40 | |
41 // Functions used to notify mojom::ShelfObserver instances of changes. | |
42 void NotifyShelfCreated(WmShelf* shelf); | |
43 void NotifyShelfAlignmentChanged(WmShelf* shelf); | |
44 void NotifyShelfAutoHideBehaviorChanged(WmShelf* shelf); | |
45 | |
46 // mojom::Shelf: | |
47 void AddObserver(mojom::ShelfObserverAssociatedPtrInfo observer) override; | |
48 void SetAlignment(ShelfAlignment alignment, int64_t display_id) override; | |
49 void SetAutoHideBehavior(ShelfAutoHideBehavior auto_hide, | |
50 int64_t display_id) override; | |
51 void PinItem(mojom::ShelfItemPtr item, | |
52 mojom::ShelfItemDelegateAssociatedPtrInfo delegate) override; | |
53 void UnpinItem(const std::string& app_id) override; | |
54 void SetItemImage(const std::string& app_id, const SkBitmap& image) override; | |
55 | |
56 private: | |
57 // The shelf model shared by all shelf instances. | |
58 ShelfModel model_; | |
59 | |
60 // Bindings for the ShelfController interface. | |
61 mojo::BindingSet<mojom::ShelfController> bindings_; | |
62 | |
63 // The set of shelf observers notified about shelf state and settings changes. | |
64 mojo::AssociatedInterfacePtrSet<mojom::ShelfObserver> observers_; | |
65 | |
66 // Mappings between application and shelf ids. | |
67 std::map<std::string, ShelfID> app_id_to_shelf_id_; | |
68 std::map<ShelfID, std::string> shelf_id_to_app_id_; | |
69 | |
70 DISALLOW_COPY_AND_ASSIGN(ShelfController); | |
71 }; | |
72 | |
73 } // namespace ash | |
74 | |
75 #endif // ASH_COMMON_SHELF_SHELF_CONTROLLER_H_ | |
OLD | NEW |