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> | 8 #include <map> |
9 | 9 |
10 #include "ash/shelf/shelf_delegate.h" | 10 #include "ash/shelf/shelf_delegate.h" |
11 #include "mash/shelf/public/interfaces/shelf.mojom.h" | |
11 #include "mash/wm/public/interfaces/user_window_controller.mojom.h" | 12 #include "mash/wm/public/interfaces/user_window_controller.mojom.h" |
12 #include "mojo/public/cpp/bindings/binding.h" | 13 #include "mojo/public/cpp/bindings/binding.h" |
14 #include "mojo/public/cpp/bindings/interface_ptr_set.h" | |
13 | 15 |
14 namespace ash { | 16 namespace ash { |
15 | 17 |
16 class ShelfModel; | 18 class ShelfModel; |
17 | 19 |
18 namespace sysui { | 20 namespace sysui { |
19 | 21 |
20 class ShelfDelegateMus : public ShelfDelegate, | 22 class ShelfDelegateMus : public ShelfDelegate, |
23 public mash::shelf::mojom::Shelf, | |
James Cook
2016/04/06 04:29:52
optional drive-by comment: I find it kind of confu
msw
2016/04/07 20:34:57
ShelfController (or ShelfManager) sgtm, otherwise
| |
21 public mash::wm::mojom::UserWindowObserver { | 24 public mash::wm::mojom::UserWindowObserver { |
22 public: | 25 public: |
23 explicit ShelfDelegateMus(ShelfModel* model); | 26 explicit ShelfDelegateMus(ShelfModel* model); |
24 ~ShelfDelegateMus() override; | 27 ~ShelfDelegateMus() override; |
25 | 28 |
26 private: | 29 private: |
27 // ShelfDelegate: | 30 // ShelfDelegate: |
28 void OnShelfCreated(Shelf* shelf) override; | 31 void OnShelfCreated(ash::Shelf* shelf) override; |
29 void OnShelfDestroyed(Shelf* shelf) override; | 32 void OnShelfDestroyed(ash::Shelf* shelf) override; |
30 void OnShelfAlignmentChanged(Shelf* shelf) override; | 33 void OnShelfAlignmentChanged(ash::Shelf* shelf) override; |
31 void OnShelfAutoHideBehaviorChanged(Shelf* shelf) override; | 34 void OnShelfAutoHideBehaviorChanged(ash::Shelf* shelf) override; |
32 ShelfID GetShelfIDForAppID(const std::string& app_id) override; | 35 ShelfID GetShelfIDForAppID(const std::string& app_id) override; |
33 bool HasShelfIDToAppIDMapping(ShelfID id) const override; | 36 bool HasShelfIDToAppIDMapping(ShelfID id) const override; |
34 const std::string& GetAppIDForShelfID(ShelfID id) override; | 37 const std::string& GetAppIDForShelfID(ShelfID id) override; |
35 void PinAppWithID(const std::string& app_id) override; | 38 void PinAppWithID(const std::string& app_id) override; |
36 bool IsAppPinned(const std::string& app_id) override; | 39 bool IsAppPinned(const std::string& app_id) override; |
37 void UnpinAppWithID(const std::string& app_id) override; | 40 void UnpinAppWithID(const std::string& app_id) override; |
38 | 41 |
42 // mash::shelf::mojom::Shelf: | |
43 void AddObserver(mash::shelf::mojom::ShelfObserverPtr observer) override; | |
44 void SetAlignment(mash::shelf::mojom::Alignment alignment) override; | |
45 void SetAutoHideBehavior( | |
46 mash::shelf::mojom::AutoHideBehavior auto_hide) override; | |
47 void AddItem(mash::shelf::mojom::ShelfItemPtr item, | |
48 mash::shelf::mojom::ShelfItemDelegatePtr delegate) override; | |
49 void RemoveItem(const mojo::String& id) override; | |
50 | |
39 // mash::wm::mojom::UserWindowObserver: | 51 // mash::wm::mojom::UserWindowObserver: |
40 void OnUserWindowObserverAdded( | 52 void OnUserWindowObserverAdded( |
41 mojo::Array<mash::wm::mojom::UserWindowPtr> user_windows) override; | 53 mojo::Array<mash::wm::mojom::UserWindowPtr> user_windows) override; |
42 void OnUserWindowAdded(mash::wm::mojom::UserWindowPtr user_window) override; | 54 void OnUserWindowAdded(mash::wm::mojom::UserWindowPtr user_window) override; |
43 void OnUserWindowRemoved(uint32_t window_id) override; | 55 void OnUserWindowRemoved(uint32_t window_id) override; |
44 void OnUserWindowTitleChanged(uint32_t window_id, | 56 void OnUserWindowTitleChanged(uint32_t window_id, |
45 const mojo::String& window_title) override; | 57 const mojo::String& window_title) override; |
46 void OnUserWindowAppIconChanged(uint32_t window_id, | 58 void OnUserWindowAppIconChanged(uint32_t window_id, |
47 mojo::Array<uint8_t> app_icon) override; | 59 mojo::Array<uint8_t> app_icon) override; |
48 void OnUserWindowFocusChanged(uint32_t window_id, bool has_focus) override; | 60 void OnUserWindowFocusChanged(uint32_t window_id, bool has_focus) override; |
49 | 61 |
50 ShelfModel* model_; | 62 ShelfModel* model_; |
51 | 63 |
64 mojo::InterfacePtrSet<mash::shelf::mojom::ShelfObserver> observers_; | |
65 | |
52 mash::wm::mojom::UserWindowControllerPtr user_window_controller_; | 66 mash::wm::mojom::UserWindowControllerPtr user_window_controller_; |
53 mojo::Binding<mash::wm::mojom::UserWindowObserver> binding_; | 67 mojo::Binding<mash::wm::mojom::UserWindowObserver> binding_; |
54 std::map<uint32_t, ShelfID> window_id_to_shelf_id_; | 68 std::map<uint32_t, ShelfID> window_id_to_shelf_id_; |
55 | 69 |
70 std::map<std::string, ShelfID> app_id_to_shelf_id_; | |
71 | |
56 DISALLOW_COPY_AND_ASSIGN(ShelfDelegateMus); | 72 DISALLOW_COPY_AND_ASSIGN(ShelfDelegateMus); |
57 }; | 73 }; |
58 | 74 |
59 } // namespace sysui | 75 } // namespace sysui |
60 } // namespace ash | 76 } // namespace ash |
61 | 77 |
62 #endif // ASH_MUS_SHELF_DELEGATE_MUS_H_ | 78 #endif // ASH_MUS_SHELF_DELEGATE_MUS_H_ |
OLD | NEW |