| 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_SHELF_SHELF_CONTROLLER_H_ | 5 #ifndef ASH_SHELF_SHELF_CONTROLLER_H_ |
| 6 #define ASH_SHELF_SHELF_CONTROLLER_H_ | 6 #define ASH_SHELF_SHELF_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 class ShelfController : public mojom::ShelfController { | 24 class ShelfController : public mojom::ShelfController { |
| 25 public: | 25 public: |
| 26 ShelfController(); | 26 ShelfController(); |
| 27 ~ShelfController() override; | 27 ~ShelfController() override; |
| 28 | 28 |
| 29 // Binds the mojom::ShelfController interface request to this object. | 29 // Binds the mojom::ShelfController interface request to this object. |
| 30 void BindRequest(mojom::ShelfControllerRequest request); | 30 void BindRequest(mojom::ShelfControllerRequest request); |
| 31 | 31 |
| 32 ShelfModel* model() { return &model_; } | 32 ShelfModel* model() { return &model_; } |
| 33 | 33 |
| 34 const std::map<std::string, ShelfID>& app_id_to_shelf_id() { | |
| 35 return app_id_to_shelf_id_; | |
| 36 } | |
| 37 | |
| 38 const std::map<ShelfID, std::string>& shelf_id_to_app_id() { | |
| 39 return shelf_id_to_app_id_; | |
| 40 } | |
| 41 | |
| 42 // Functions used to notify mojom::ShelfObserver instances of changes. | 34 // Functions used to notify mojom::ShelfObserver instances of changes. |
| 43 void NotifyShelfCreated(WmShelf* shelf); | 35 void NotifyShelfCreated(WmShelf* shelf); |
| 44 void NotifyShelfAlignmentChanged(WmShelf* shelf); | 36 void NotifyShelfAlignmentChanged(WmShelf* shelf); |
| 45 void NotifyShelfAutoHideBehaviorChanged(WmShelf* shelf); | 37 void NotifyShelfAutoHideBehaviorChanged(WmShelf* shelf); |
| 46 | 38 |
| 47 // mojom::Shelf: | 39 // mojom::Shelf: |
| 48 void AddObserver(mojom::ShelfObserverAssociatedPtrInfo observer) override; | 40 void AddObserver(mojom::ShelfObserverAssociatedPtrInfo observer) override; |
| 49 void SetAlignment(ShelfAlignment alignment, int64_t display_id) override; | 41 void SetAlignment(ShelfAlignment alignment, int64_t display_id) override; |
| 50 void SetAutoHideBehavior(ShelfAutoHideBehavior auto_hide, | 42 void SetAutoHideBehavior(ShelfAutoHideBehavior auto_hide, |
| 51 int64_t display_id) override; | 43 int64_t display_id) override; |
| 52 void PinItem(const ShelfItem& item, | 44 void PinItem(const ShelfItem& item, |
| 53 mojom::ShelfItemDelegateAssociatedPtrInfo delegate) override; | 45 mojom::ShelfItemDelegateAssociatedPtrInfo delegate) override; |
| 54 void UnpinItem(const std::string& app_id) override; | 46 void UnpinItem(const std::string& app_id) override; |
| 55 void SetItemImage(const std::string& app_id, const SkBitmap& image) override; | 47 void SetItemImage(const std::string& app_id, const SkBitmap& image) override; |
| 56 | 48 |
| 57 private: | 49 private: |
| 58 // The shelf model shared by all shelf instances. | 50 // The shelf model shared by all shelf instances. |
| 59 ShelfModel model_; | 51 ShelfModel model_; |
| 60 | 52 |
| 61 // Bindings for the ShelfController interface. | 53 // Bindings for the ShelfController interface. |
| 62 mojo::BindingSet<mojom::ShelfController> bindings_; | 54 mojo::BindingSet<mojom::ShelfController> bindings_; |
| 63 | 55 |
| 64 // The set of shelf observers notified about shelf state and settings changes. | 56 // The set of shelf observers notified about shelf state and settings changes. |
| 65 mojo::AssociatedInterfacePtrSet<mojom::ShelfObserver> observers_; | 57 mojo::AssociatedInterfacePtrSet<mojom::ShelfObserver> observers_; |
| 66 | 58 |
| 67 // Mappings between application and shelf ids. | |
| 68 std::map<std::string, ShelfID> app_id_to_shelf_id_; | |
| 69 std::map<ShelfID, std::string> shelf_id_to_app_id_; | |
| 70 | |
| 71 DISALLOW_COPY_AND_ASSIGN(ShelfController); | 59 DISALLOW_COPY_AND_ASSIGN(ShelfController); |
| 72 }; | 60 }; |
| 73 | 61 |
| 74 } // namespace ash | 62 } // namespace ash |
| 75 | 63 |
| 76 #endif // ASH_SHELF_SHELF_CONTROLLER_H_ | 64 #endif // ASH_SHELF_SHELF_CONTROLLER_H_ |
| OLD | NEW |