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