| 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_COMMON_SHELF_SHELF_CONTROLLER_H_ | 5 #ifndef ASH_COMMON_SHELF_SHELF_CONTROLLER_H_ |
| 6 #define ASH_COMMON_SHELF_SHELF_CONTROLLER_H_ | 6 #define ASH_COMMON_SHELF_SHELF_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "ash/common/shelf/shelf_item_types.h" | |
| 12 #include "ash/common/shelf/shelf_model.h" | 11 #include "ash/common/shelf/shelf_model.h" |
| 12 #include "ash/public/cpp/shelf_item.h" |
| 13 #include "ash/public/cpp/shelf_types.h" | 13 #include "ash/public/cpp/shelf_types.h" |
| 14 #include "ash/public/interfaces/shelf.mojom.h" | 14 #include "ash/public/interfaces/shelf.mojom.h" |
| 15 #include "mojo/public/cpp/bindings/binding_set.h" | 15 #include "mojo/public/cpp/bindings/binding_set.h" |
| 16 #include "mojo/public/cpp/bindings/interface_ptr_set.h" | 16 #include "mojo/public/cpp/bindings/interface_ptr_set.h" |
| 17 | 17 |
| 18 namespace ash { | 18 namespace ash { |
| 19 | 19 |
| 20 class WmShelf; | 20 class WmShelf; |
| 21 | 21 |
| 22 // Ash's implementation of the mojom::ShelfController interface. Chrome connects | 22 // Ash's implementation of the mojom::ShelfController interface. Chrome connects |
| (...skipping 19 matching lines...) Expand all Loading... |
| 42 // Functions used to notify mojom::ShelfObserver instances of changes. | 42 // Functions used to notify mojom::ShelfObserver instances of changes. |
| 43 void NotifyShelfCreated(WmShelf* shelf); | 43 void NotifyShelfCreated(WmShelf* shelf); |
| 44 void NotifyShelfAlignmentChanged(WmShelf* shelf); | 44 void NotifyShelfAlignmentChanged(WmShelf* shelf); |
| 45 void NotifyShelfAutoHideBehaviorChanged(WmShelf* shelf); | 45 void NotifyShelfAutoHideBehaviorChanged(WmShelf* shelf); |
| 46 | 46 |
| 47 // mojom::Shelf: | 47 // mojom::Shelf: |
| 48 void AddObserver(mojom::ShelfObserverAssociatedPtrInfo observer) override; | 48 void AddObserver(mojom::ShelfObserverAssociatedPtrInfo observer) override; |
| 49 void SetAlignment(ShelfAlignment alignment, int64_t display_id) override; | 49 void SetAlignment(ShelfAlignment alignment, int64_t display_id) override; |
| 50 void SetAutoHideBehavior(ShelfAutoHideBehavior auto_hide, | 50 void SetAutoHideBehavior(ShelfAutoHideBehavior auto_hide, |
| 51 int64_t display_id) override; | 51 int64_t display_id) override; |
| 52 void PinItem(mojom::ShelfItemPtr item, | 52 void PinItem(const ShelfItem& item, |
| 53 mojom::ShelfItemDelegateAssociatedPtrInfo delegate) override; | 53 mojom::ShelfItemDelegateAssociatedPtrInfo delegate) override; |
| 54 void UnpinItem(const std::string& app_id) override; | 54 void UnpinItem(const std::string& app_id) override; |
| 55 void SetItemImage(const std::string& app_id, const SkBitmap& image) override; | 55 void SetItemImage(const std::string& app_id, const SkBitmap& image) override; |
| 56 | 56 |
| 57 private: | 57 private: |
| 58 // The shelf model shared by all shelf instances. | 58 // The shelf model shared by all shelf instances. |
| 59 ShelfModel model_; | 59 ShelfModel model_; |
| 60 | 60 |
| 61 // Bindings for the ShelfController interface. | 61 // Bindings for the ShelfController interface. |
| 62 mojo::BindingSet<mojom::ShelfController> bindings_; | 62 mojo::BindingSet<mojom::ShelfController> bindings_; |
| 63 | 63 |
| 64 // The set of shelf observers notified about shelf state and settings changes. | 64 // The set of shelf observers notified about shelf state and settings changes. |
| 65 mojo::AssociatedInterfacePtrSet<mojom::ShelfObserver> observers_; | 65 mojo::AssociatedInterfacePtrSet<mojom::ShelfObserver> observers_; |
| 66 | 66 |
| 67 // Mappings between application and shelf ids. | 67 // Mappings between application and shelf ids. |
| 68 std::map<std::string, ShelfID> app_id_to_shelf_id_; | 68 std::map<std::string, ShelfID> app_id_to_shelf_id_; |
| 69 std::map<ShelfID, std::string> shelf_id_to_app_id_; | 69 std::map<ShelfID, std::string> shelf_id_to_app_id_; |
| 70 | 70 |
| 71 DISALLOW_COPY_AND_ASSIGN(ShelfController); | 71 DISALLOW_COPY_AND_ASSIGN(ShelfController); |
| 72 }; | 72 }; |
| 73 | 73 |
| 74 } // namespace ash | 74 } // namespace ash |
| 75 | 75 |
| 76 #endif // ASH_COMMON_SHELF_SHELF_CONTROLLER_H_ | 76 #endif // ASH_COMMON_SHELF_SHELF_CONTROLLER_H_ |
| OLD | NEW |