Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(689)

Side by Side Diff: ash/mus/shelf_delegate_mus.h

Issue 1839223003: Add basic Chrome interaction with the mash shelf. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use associated interfaces for observers and item delegates. Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
13 #include "mojo/public/cpp/bindings/associated_interface_ptr_set.h"
12 #include "mojo/public/cpp/bindings/binding.h" 14 #include "mojo/public/cpp/bindings/binding.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::ShelfController,
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(Shelf* shelf) override;
29 void OnShelfDestroyed(Shelf* shelf) override; 32 void OnShelfDestroyed(Shelf* shelf) override;
30 void OnShelfAlignmentChanged(Shelf* shelf) override; 33 void OnShelfAlignmentChanged(Shelf* shelf) override;
31 void OnShelfAutoHideBehaviorChanged(Shelf* shelf) override; 34 void OnShelfAutoHideBehaviorChanged(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::ShelfController:
43 void AddObserver(
44 mash::shelf::mojom::ShelfObserverAssociatedPtrInfo observer) override;
45 void SetAlignment(mash::shelf::mojom::Alignment alignment) override;
46 void SetAutoHideBehavior(
47 mash::shelf::mojom::AutoHideBehavior auto_hide) override;
48 void AddItem(
49 mash::shelf::mojom::ShelfItemPtr item,
50 mash::shelf::mojom::ShelfItemDelegateAssociatedPtrInfo delegate) override;
51 void RemoveItem(const mojo::String& id) override;
52
39 // mash::wm::mojom::UserWindowObserver: 53 // mash::wm::mojom::UserWindowObserver:
40 void OnUserWindowObserverAdded( 54 void OnUserWindowObserverAdded(
41 mojo::Array<mash::wm::mojom::UserWindowPtr> user_windows) override; 55 mojo::Array<mash::wm::mojom::UserWindowPtr> user_windows) override;
42 void OnUserWindowAdded(mash::wm::mojom::UserWindowPtr user_window) override; 56 void OnUserWindowAdded(mash::wm::mojom::UserWindowPtr user_window) override;
43 void OnUserWindowRemoved(uint32_t window_id) override; 57 void OnUserWindowRemoved(uint32_t window_id) override;
44 void OnUserWindowTitleChanged(uint32_t window_id, 58 void OnUserWindowTitleChanged(uint32_t window_id,
45 const mojo::String& window_title) override; 59 const mojo::String& window_title) override;
46 void OnUserWindowAppIconChanged(uint32_t window_id, 60 void OnUserWindowAppIconChanged(uint32_t window_id,
47 mojo::Array<uint8_t> app_icon) override; 61 mojo::Array<uint8_t> app_icon) override;
48 void OnUserWindowFocusChanged(uint32_t window_id, bool has_focus) override; 62 void OnUserWindowFocusChanged(uint32_t window_id, bool has_focus) override;
49 63
50 ShelfModel* model_; 64 ShelfModel* model_;
51 65
66 mojo::AssociatedInterfacePtrSet<mash::shelf::mojom::ShelfObserver> observers_;
67
52 mash::wm::mojom::UserWindowControllerPtr user_window_controller_; 68 mash::wm::mojom::UserWindowControllerPtr user_window_controller_;
53 mojo::Binding<mash::wm::mojom::UserWindowObserver> binding_; 69 mojo::Binding<mash::wm::mojom::UserWindowObserver> binding_;
54 std::map<uint32_t, ShelfID> window_id_to_shelf_id_; 70 std::map<uint32_t, ShelfID> window_id_to_shelf_id_;
55 71
72 std::map<std::string, ShelfID> app_id_to_shelf_id_;
73
56 DISALLOW_COPY_AND_ASSIGN(ShelfDelegateMus); 74 DISALLOW_COPY_AND_ASSIGN(ShelfDelegateMus);
57 }; 75 };
58 76
59 } // namespace sysui 77 } // namespace sysui
60 } // namespace ash 78 } // namespace ash
61 79
62 #endif // ASH_MUS_SHELF_DELEGATE_MUS_H_ 80 #endif // ASH_MUS_SHELF_DELEGATE_MUS_H_
OLDNEW
« no previous file with comments | « ash/mus/DEPS ('k') | ash/mus/shelf_delegate_mus.cc » ('j') | ash/mus/shelf_delegate_mus.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698