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

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

Issue 2029323002: mash: Convert AshPopupAlignmentDelegate to wm common types (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
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
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 #include "ash/aura/wm_shelf_aura.h" 5 #include "ash/aura/wm_shelf_aura.h"
6 6
7 #include "ash/aura/wm_window_aura.h" 7 #include "ash/aura/wm_window_aura.h"
8 #include "ash/common/shelf/wm_shelf_observer.h" 8 #include "ash/common/shelf/wm_shelf_observer.h"
9 #include "ash/common/wm_window.h" 9 #include "ash/common/wm_window.h"
10 #include "ash/shelf/shelf.h" 10 #include "ash/shelf/shelf.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 } 45 }
46 46
47 void WmShelfAura::ResetShelfLayoutManager() { 47 void WmShelfAura::ResetShelfLayoutManager() {
48 if (!shelf_layout_manager_) 48 if (!shelf_layout_manager_)
49 return; 49 return;
50 shelf_layout_manager_->RemoveObserver(this); 50 shelf_layout_manager_->RemoveObserver(this);
51 shelf_layout_manager_ = nullptr; 51 shelf_layout_manager_ = nullptr;
52 } 52 }
53 53
54 WmWindow* WmShelfAura::GetWindow() { 54 WmWindow* WmShelfAura::GetWindow() {
55 return WmWindowAura::Get(shelf_->shelf_widget()->GetNativeView()); 55 // Use |shelf_layout_manager_| to access ShelfWidget because it is set
56 // before |shelf_| is available.
57 return shelf_layout_manager_
58 ? WmWindowAura::Get(
59 shelf_layout_manager_->shelf_widget()->GetNativeView())
60 : nullptr;
56 } 61 }
57 62
58 ShelfAlignment WmShelfAura::GetAlignment() const { 63 ShelfAlignment WmShelfAura::GetAlignment() const {
59 return shelf_->alignment(); 64 return shelf_ ? shelf_->alignment() : SHELF_ALIGNMENT_BOTTOM_LOCKED;
60 } 65 }
61 66
62 void WmShelfAura::SetAlignment(ShelfAlignment alignment) { 67 void WmShelfAura::SetAlignment(ShelfAlignment alignment) {
63 shelf_->SetAlignment(alignment); 68 shelf_->SetAlignment(alignment);
msw 2016/06/16 18:56:48 nit: null checks in setters, etc. too?
James Cook 2016/06/16 21:08:14 Actually, I went the other way and only added the
64 } 69 }
65 70
66 ShelfAutoHideBehavior WmShelfAura::GetAutoHideBehavior() const { 71 ShelfAutoHideBehavior WmShelfAura::GetAutoHideBehavior() const {
67 return shelf_->auto_hide_behavior(); 72 return shelf_ ? shelf_->auto_hide_behavior() : SHELF_AUTO_HIDE_BEHAVIOR_NEVER;
68 } 73 }
69 74
70 void WmShelfAura::SetAutoHideBehavior(ShelfAutoHideBehavior behavior) { 75 void WmShelfAura::SetAutoHideBehavior(ShelfAutoHideBehavior behavior) {
71 shelf_->SetAutoHideBehavior(behavior); 76 shelf_->SetAutoHideBehavior(behavior);
72 } 77 }
73 78
79 ShelfAutoHideState WmShelfAura::GetAutoHideState() const {
80 return shelf_layout_manager_ ? shelf_layout_manager_->auto_hide_state()
81 : SHELF_AUTO_HIDE_SHOWN;
82 }
83
74 ShelfBackgroundType WmShelfAura::GetBackgroundType() const { 84 ShelfBackgroundType WmShelfAura::GetBackgroundType() const {
75 return shelf_->shelf_widget()->GetBackgroundType(); 85 return shelf_layout_manager_
86 ? shelf_layout_manager_->shelf_widget()->GetBackgroundType()
87 : SHELF_BACKGROUND_DEFAULT;
76 } 88 }
77 89
78 void WmShelfAura::UpdateVisibilityState() { 90 void WmShelfAura::UpdateVisibilityState() {
79 shelf_->shelf_layout_manager()->UpdateVisibilityState(); 91 shelf_->shelf_layout_manager()->UpdateVisibilityState();
80 } 92 }
81 93
82 ShelfVisibilityState WmShelfAura::GetVisibilityState() const { 94 ShelfVisibilityState WmShelfAura::GetVisibilityState() const {
83 return shelf_layout_manager_ ? shelf_layout_manager_->visibility_state() 95 return shelf_layout_manager_ ? shelf_layout_manager_->visibility_state()
84 : SHELF_HIDDEN; 96 : SHELF_HIDDEN;
85 } 97 }
86 98
99 gfx::Rect WmShelfAura::GetUserWorkAreaBounds() const {
100 return shelf_layout_manager_ ? shelf_layout_manager_->user_work_area_bounds()
101 : gfx::Rect();
102 }
103
87 void WmShelfAura::UpdateIconPositionForWindow(WmWindow* window) { 104 void WmShelfAura::UpdateIconPositionForWindow(WmWindow* window) {
88 shelf_->UpdateIconPositionForWindow(WmWindowAura::GetAuraWindow(window)); 105 shelf_->UpdateIconPositionForWindow(WmWindowAura::GetAuraWindow(window));
89 } 106 }
90 107
91 gfx::Rect WmShelfAura::GetScreenBoundsOfItemIconForWindow(WmWindow* window) { 108 gfx::Rect WmShelfAura::GetScreenBoundsOfItemIconForWindow(WmWindow* window) {
92 return shelf_->GetScreenBoundsOfItemIconForWindow( 109 return shelf_->GetScreenBoundsOfItemIconForWindow(
93 WmWindowAura::GetAuraWindow(window)); 110 WmWindowAura::GetAuraWindow(window));
94 } 111 }
95 112
96 void WmShelfAura::AddObserver(WmShelfObserver* observer) { 113 void WmShelfAura::AddObserver(WmShelfObserver* observer) {
(...skipping 13 matching lines...) Expand all
110 BackgroundAnimatorChangeType change_type) { 127 BackgroundAnimatorChangeType change_type) {
111 FOR_EACH_OBSERVER(WmShelfObserver, observers_, 128 FOR_EACH_OBSERVER(WmShelfObserver, observers_,
112 OnBackgroundUpdated(background_type, change_type)); 129 OnBackgroundUpdated(background_type, change_type));
113 } 130 }
114 131
115 void WmShelfAura::WillChangeVisibilityState(ShelfVisibilityState new_state) { 132 void WmShelfAura::WillChangeVisibilityState(ShelfVisibilityState new_state) {
116 FOR_EACH_OBSERVER(WmShelfObserver, observers_, 133 FOR_EACH_OBSERVER(WmShelfObserver, observers_,
117 WillChangeVisibilityState(new_state)); 134 WillChangeVisibilityState(new_state));
118 } 135 }
119 136
137 void WmShelfAura::OnAutoHideStateChanged(ShelfAutoHideState new_state) {
138 FOR_EACH_OBSERVER(WmShelfObserver, observers_,
139 OnAutoHideStateChanged(new_state));
140 }
141
120 void WmShelfAura::OnShelfIconPositionsChanged() { 142 void WmShelfAura::OnShelfIconPositionsChanged() {
121 FOR_EACH_OBSERVER(WmShelfObserver, observers_, OnShelfIconPositionsChanged()); 143 FOR_EACH_OBSERVER(WmShelfObserver, observers_, OnShelfIconPositionsChanged());
122 } 144 }
123 145
124 } // namespace ash 146 } // namespace ash
OLDNEW
« no previous file with comments | « ash/aura/wm_shelf_aura.h ('k') | ash/common/shelf/wm_shelf.h » ('j') | ash/shelf/shelf.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698