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

Side by Side Diff: ash/aura/wm_shelf_aura.h

Issue 2041583004: mash: Move WmShelfAura ownership to RootWindowController and init it earlier (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@moveshelftypes
Patch Set: . Created 4 years, 6 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
« no previous file with comments | « ash/aura/wm_root_window_controller_aura.cc ('k') | ash/aura/wm_shelf_aura.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_AURA_WM_SHELF_AURA_H_ 5 #ifndef ASH_AURA_WM_SHELF_AURA_H_
6 #define ASH_AURA_WM_SHELF_AURA_H_ 6 #define ASH_AURA_WM_SHELF_AURA_H_
7 7
8 #include "ash/ash_export.h" 8 #include "ash/ash_export.h"
9 #include "ash/common/shelf/wm_shelf.h" 9 #include "ash/common/shelf/wm_shelf.h"
10 #include "ash/shelf/shelf_icon_observer.h" 10 #include "ash/shelf/shelf_icon_observer.h"
11 #include "ash/shelf/shelf_layout_manager_observer.h" 11 #include "ash/shelf/shelf_layout_manager_observer.h"
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/observer_list.h" 13 #include "base/observer_list.h"
14 14
15 namespace ash { 15 namespace ash {
16 16
17 class Shelf; 17 class Shelf;
18 class ShelfLayoutManager; 18 class ShelfLayoutManager;
19 19
20 // Aura implementation of WmShelf. 20 // Aura implementation of WmShelf.
21 class ASH_EXPORT WmShelfAura : public WmShelf, 21 class ASH_EXPORT WmShelfAura : public WmShelf,
22 public ShelfLayoutManagerObserver, 22 public ShelfLayoutManagerObserver,
23 public ShelfIconObserver { 23 public ShelfIconObserver {
24 public: 24 public:
25 explicit WmShelfAura(Shelf* shelf); 25 WmShelfAura();
26 ~WmShelfAura() override; 26 ~WmShelfAura() override;
27 27
28 // This object is initialized in multiple steps as the RootWindowController
29 // constructs the components of the shelf.
30 void SetShelfLayoutManager(ShelfLayoutManager* shelf_layout_manager);
31 void SetShelf(Shelf* shelf);
32
33 void Shutdown();
34
28 static Shelf* GetShelf(WmShelf* shelf); 35 static Shelf* GetShelf(WmShelf* shelf);
29 36
30 private: 37 private:
38 void ResetShelfLayoutManager();
39
31 // WmShelf: 40 // WmShelf:
32 WmWindow* GetWindow() override; 41 WmWindow* GetWindow() override;
33 ShelfAlignment GetAlignment() const override; 42 ShelfAlignment GetAlignment() const override;
34 ShelfBackgroundType GetBackgroundType() const override; 43 ShelfBackgroundType GetBackgroundType() const override;
35 void UpdateVisibilityState() override; 44 void UpdateVisibilityState() override;
36 ShelfVisibilityState GetVisibilityState() const override; 45 ShelfVisibilityState GetVisibilityState() const override;
37 void UpdateIconPositionForWindow(WmWindow* window) override; 46 void UpdateIconPositionForWindow(WmWindow* window) override;
38 gfx::Rect GetScreenBoundsOfItemIconForWindow(WmWindow* window) override; 47 gfx::Rect GetScreenBoundsOfItemIconForWindow(WmWindow* window) override;
39 void AddObserver(WmShelfObserver* observer) override; 48 void AddObserver(WmShelfObserver* observer) override;
40 void RemoveObserver(WmShelfObserver* observer) override; 49 void RemoveObserver(WmShelfObserver* observer) override;
41 50
42 // ShelfLayoutManagerObserver: 51 // ShelfLayoutManagerObserver:
43 void WillDeleteShelfLayoutManager() override; 52 void WillDeleteShelfLayoutManager() override;
44 void OnBackgroundUpdated(ShelfBackgroundType background_type, 53 void OnBackgroundUpdated(ShelfBackgroundType background_type,
45 BackgroundAnimatorChangeType change_type) override; 54 BackgroundAnimatorChangeType change_type) override;
46 void WillChangeVisibilityState(ShelfVisibilityState new_state) override; 55 void WillChangeVisibilityState(ShelfVisibilityState new_state) override;
47 56
48 // ShelfIconObserver: 57 // ShelfIconObserver:
49 void OnShelfIconPositionsChanged() override; 58 void OnShelfIconPositionsChanged() override;
50 59
51 Shelf* shelf_; 60 // May be null during login.
61 Shelf* shelf_ = nullptr;
62
63 // Cached separately because it may be destroyed before |shelf_|.
64 ShelfLayoutManager* shelf_layout_manager_ = nullptr;
65
52 base::ObserverList<WmShelfObserver> observers_; 66 base::ObserverList<WmShelfObserver> observers_;
53 // ShelfLayoutManager is cached separately as it may be destroyed before
54 // WmShelfAura.
55 ShelfLayoutManager* shelf_layout_manager_;
56 67
57 DISALLOW_COPY_AND_ASSIGN(WmShelfAura); 68 DISALLOW_COPY_AND_ASSIGN(WmShelfAura);
58 }; 69 };
59 70
60 } // namespace ash 71 } // namespace ash
61 72
62 #endif // ASH_AURA_WM_SHELF_AURA_H_ 73 #endif // ASH_AURA_WM_SHELF_AURA_H_
OLDNEW
« no previous file with comments | « ash/aura/wm_root_window_controller_aura.cc ('k') | ash/aura/wm_shelf_aura.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698