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