OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef ASH_MUS_SHELF_DELEGATE_MUS_H_ |
| 6 #define ASH_MUS_SHELF_DELEGATE_MUS_H_ |
| 7 |
| 8 #include <map> |
| 9 #include <string> |
| 10 |
| 11 #include "ash/common/shelf/shelf_delegate.h" |
| 12 #include "ash/common/shelf/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 |
| 17 namespace ash { |
| 18 |
| 19 class ShelfModel; |
| 20 |
| 21 // Manages communication between the mash shelf and the browser. |
| 22 class ShelfDelegateMus : public ShelfDelegate, public mojom::ShelfController { |
| 23 public: |
| 24 explicit ShelfDelegateMus(ShelfModel* model); |
| 25 ~ShelfDelegateMus() override; |
| 26 |
| 27 private: |
| 28 // 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; |
| 36 bool HasShelfIDToAppIDMapping(ShelfID id) const override; |
| 37 const std::string& GetAppIDForShelfID(ShelfID id) override; |
| 38 void PinAppWithID(const std::string& app_id) override; |
| 39 bool IsAppPinned(const std::string& app_id) override; |
| 40 void UnpinAppWithID(const std::string& app_id) override; |
| 41 |
| 42 // mojom::ShelfController: |
| 43 void AddObserver(mojom::ShelfObserverAssociatedPtrInfo observer) override; |
| 44 void SetAlignment(ShelfAlignment alignment, int64_t display_id) override; |
| 45 void SetAutoHideBehavior(ShelfAutoHideBehavior auto_hide, |
| 46 int64_t display_id) override; |
| 47 void PinItem(mojom::ShelfItemPtr item, |
| 48 mojom::ShelfItemDelegateAssociatedPtrInfo delegate) override; |
| 49 void UnpinItem(const std::string& app_id) override; |
| 50 void SetItemImage(const std::string& app_id, const SkBitmap& image) override; |
| 51 |
| 52 ShelfModel* model_; |
| 53 |
| 54 mojo::AssociatedInterfacePtrSet<mojom::ShelfObserver> observers_; |
| 55 |
| 56 std::map<uint32_t, ShelfID> window_id_to_shelf_id_; |
| 57 |
| 58 std::map<std::string, ShelfID> app_id_to_shelf_id_; |
| 59 std::map<ShelfID, std::string> shelf_id_to_app_id_; |
| 60 |
| 61 DISALLOW_COPY_AND_ASSIGN(ShelfDelegateMus); |
| 62 }; |
| 63 |
| 64 } // namespace ash |
| 65 |
| 66 #endif // ASH_MUS_SHELF_DELEGATE_MUS_H_ |
OLD | NEW |