| 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 |
| 11 #include "ash/public/cpp/shelf_item.h" | 11 #include "ash/public/cpp/shelf_item.h" |
| 12 #include "ash/public/cpp/shelf_types.h" | 12 #include "ash/public/cpp/shelf_types.h" |
| 13 #include "ash/public/interfaces/shelf.mojom.h" | 13 #include "ash/public/interfaces/shelf.mojom.h" |
| 14 #include "ash/shelf/shelf_model.h" | 14 #include "ash/shelf/shelf_model.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 Shelf; |
| 21 | 21 |
| 22 // Ash's implementation of the mojom::ShelfController interface. Chrome connects | 22 // Ash's implementation of the mojom::ShelfController interface. Chrome connects |
| 23 // to this interface to observe and manage the per-display ash shelf instances. | 23 // to this interface to observe and manage the per-display ash shelf instances. |
| 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 // Functions used to notify mojom::ShelfObserver instances of changes. | 34 // Functions used to notify mojom::ShelfObserver instances of changes. |
| 35 void NotifyShelfInitialized(WmShelf* shelf); | 35 void NotifyShelfInitialized(Shelf* shelf); |
| 36 void NotifyShelfAlignmentChanged(WmShelf* shelf); | 36 void NotifyShelfAlignmentChanged(Shelf* shelf); |
| 37 void NotifyShelfAutoHideBehaviorChanged(WmShelf* shelf); | 37 void NotifyShelfAutoHideBehaviorChanged(Shelf* shelf); |
| 38 | 38 |
| 39 // mojom::Shelf: | 39 // mojom::Shelf: |
| 40 void AddObserver(mojom::ShelfObserverAssociatedPtrInfo observer) override; | 40 void AddObserver(mojom::ShelfObserverAssociatedPtrInfo observer) override; |
| 41 void SetAlignment(ShelfAlignment alignment, int64_t display_id) override; | 41 void SetAlignment(ShelfAlignment alignment, int64_t display_id) override; |
| 42 void SetAutoHideBehavior(ShelfAutoHideBehavior auto_hide, | 42 void SetAutoHideBehavior(ShelfAutoHideBehavior auto_hide, |
| 43 int64_t display_id) override; | 43 int64_t display_id) override; |
| 44 void PinItem(const ShelfItem& item, | 44 void PinItem(const ShelfItem& item, |
| 45 mojom::ShelfItemDelegateAssociatedPtrInfo delegate) override; | 45 mojom::ShelfItemDelegateAssociatedPtrInfo delegate) override; |
| 46 void UnpinItem(const std::string& app_id) override; | 46 void UnpinItem(const std::string& app_id) override; |
| 47 void SetItemImage(const std::string& app_id, const SkBitmap& image) override; | 47 void SetItemImage(const std::string& app_id, const SkBitmap& image) override; |
| 48 | 48 |
| 49 private: | 49 private: |
| 50 // The shelf model shared by all shelf instances. | 50 // The shelf model shared by all shelf instances. |
| 51 ShelfModel model_; | 51 ShelfModel model_; |
| 52 | 52 |
| 53 // Bindings for the ShelfController interface. | 53 // Bindings for the ShelfController interface. |
| 54 mojo::BindingSet<mojom::ShelfController> bindings_; | 54 mojo::BindingSet<mojom::ShelfController> bindings_; |
| 55 | 55 |
| 56 // 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. |
| 57 mojo::AssociatedInterfacePtrSet<mojom::ShelfObserver> observers_; | 57 mojo::AssociatedInterfacePtrSet<mojom::ShelfObserver> observers_; |
| 58 | 58 |
| 59 DISALLOW_COPY_AND_ASSIGN(ShelfController); | 59 DISALLOW_COPY_AND_ASSIGN(ShelfController); |
| 60 }; | 60 }; |
| 61 | 61 |
| 62 } // namespace ash | 62 } // namespace ash |
| 63 | 63 |
| 64 #endif // ASH_SHELF_SHELF_CONTROLLER_H_ | 64 #endif // ASH_SHELF_SHELF_CONTROLLER_H_ |
| OLD | NEW |