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 #include "ash/shelf/shelf.h" | 5 #include "ash/shelf/shelf.h" |
6 | 6 |
7 #include "ash/public/cpp/config.h" | 7 #include "ash/public/cpp/config.h" |
8 #include "ash/public/cpp/shelf_item_delegate.h" | 8 #include "ash/public/cpp/shelf_item_delegate.h" |
9 #include "ash/public/cpp/shell_window_ids.h" | 9 #include "ash/public/cpp/shell_window_ids.h" |
10 #include "ash/root_window_controller.h" | 10 #include "ash/root_window_controller.h" |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 case LoginStatus::KIOSK_APP: | 98 case LoginStatus::KIOSK_APP: |
99 case LoginStatus::ARC_KIOSK_APP: | 99 case LoginStatus::ARC_KIOSK_APP: |
100 case LoginStatus::NOT_LOGGED_IN: | 100 case LoginStatus::NOT_LOGGED_IN: |
101 return false; | 101 return false; |
102 } | 102 } |
103 | 103 |
104 NOTREACHED(); | 104 NOTREACHED(); |
105 return false; | 105 return false; |
106 } | 106 } |
107 | 107 |
108 void Shelf::CreateShelfWidget(WmWindow* root) { | 108 void Shelf::CreateShelfWidget(aura::Window* root) { |
109 DCHECK(!shelf_widget_); | 109 DCHECK(!shelf_widget_); |
110 WmWindow* shelf_container = | 110 aura::Window* shelf_container = |
111 root->GetChildByShellWindowId(kShellWindowId_ShelfContainer); | 111 root->GetChildById(kShellWindowId_ShelfContainer); |
112 shelf_widget_.reset(new ShelfWidget(shelf_container, this)); | 112 shelf_widget_.reset(new ShelfWidget(shelf_container, this)); |
113 | 113 |
114 DCHECK(!shelf_layout_manager_); | 114 DCHECK(!shelf_layout_manager_); |
115 shelf_layout_manager_ = shelf_widget_->shelf_layout_manager(); | 115 shelf_layout_manager_ = shelf_widget_->shelf_layout_manager(); |
116 shelf_layout_manager_->AddObserver(this); | 116 shelf_layout_manager_->AddObserver(this); |
117 | 117 |
118 // Must occur after |shelf_widget_| is constructed because the system tray | 118 // Must occur after |shelf_widget_| is constructed because the system tray |
119 // constructors call back into Shelf::shelf_widget(). | 119 // constructors call back into Shelf::shelf_widget(). |
120 DCHECK(!shelf_widget_->status_area_widget()); | 120 DCHECK(!shelf_widget_->status_area_widget()); |
121 WmWindow* status_container = | 121 aura::Window* status_container = |
122 root->GetChildByShellWindowId(kShellWindowId_StatusContainer); | 122 root->GetChildById(kShellWindowId_StatusContainer); |
123 shelf_widget_->CreateStatusAreaWidget(status_container); | 123 shelf_widget_->CreateStatusAreaWidget(status_container); |
124 } | 124 } |
125 | 125 |
126 void Shelf::ShutdownShelfWidget() { | 126 void Shelf::ShutdownShelfWidget() { |
127 if (shelf_widget_) | 127 if (shelf_widget_) |
128 shelf_widget_->Shutdown(); | 128 shelf_widget_->Shutdown(); |
129 } | 129 } |
130 | 130 |
131 void Shelf::DestroyShelfWidget() { | 131 void Shelf::DestroyShelfWidget() { |
132 shelf_widget_.reset(); | 132 shelf_widget_.reset(); |
133 } | 133 } |
134 | 134 |
135 void Shelf::NotifyShelfInitialized() { | 135 void Shelf::NotifyShelfInitialized() { |
136 DCHECK(shelf_layout_manager_); | 136 DCHECK(shelf_layout_manager_); |
137 DCHECK(shelf_widget_); | 137 DCHECK(shelf_widget_); |
138 Shell::Get()->shelf_controller()->NotifyShelfInitialized(this); | 138 Shell::Get()->shelf_controller()->NotifyShelfInitialized(this); |
139 } | 139 } |
140 | 140 |
141 WmWindow* Shelf::GetWindow() { | 141 aura::Window* Shelf::GetWindow() { |
142 return WmWindow::Get(shelf_widget_->GetNativeWindow()); | 142 return shelf_widget_->GetNativeWindow(); |
143 } | 143 } |
144 | 144 |
145 void Shelf::SetAlignment(ShelfAlignment alignment) { | 145 void Shelf::SetAlignment(ShelfAlignment alignment) { |
146 DCHECK(shelf_layout_manager_); | 146 DCHECK(shelf_layout_manager_); |
147 | 147 |
148 if (alignment_ == alignment) | 148 if (alignment_ == alignment) |
149 return; | 149 return; |
150 | 150 |
151 if (shelf_locking_manager_.is_locked() && | 151 if (shelf_locking_manager_.is_locked() && |
152 alignment != SHELF_ALIGNMENT_BOTTOM_LOCKED) { | 152 alignment != SHELF_ALIGNMENT_BOTTOM_LOCKED) { |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 | 229 |
230 gfx::Rect Shelf::GetIdealBounds() { | 230 gfx::Rect Shelf::GetIdealBounds() { |
231 return shelf_layout_manager_->GetIdealBounds(); | 231 return shelf_layout_manager_->GetIdealBounds(); |
232 } | 232 } |
233 | 233 |
234 gfx::Rect Shelf::GetUserWorkAreaBounds() const { | 234 gfx::Rect Shelf::GetUserWorkAreaBounds() const { |
235 return shelf_layout_manager_ ? shelf_layout_manager_->user_work_area_bounds() | 235 return shelf_layout_manager_ ? shelf_layout_manager_->user_work_area_bounds() |
236 : gfx::Rect(); | 236 : gfx::Rect(); |
237 } | 237 } |
238 | 238 |
239 void Shelf::UpdateIconPositionForPanel(WmWindow* panel) { | 239 void Shelf::UpdateIconPositionForPanel(aura::Window* panel) { |
240 shelf_widget_->UpdateIconPositionForPanel(panel); | 240 shelf_widget_->UpdateIconPositionForPanel(panel); |
241 } | 241 } |
242 | 242 |
243 gfx::Rect Shelf::GetScreenBoundsOfItemIconForWindow(WmWindow* window) { | 243 gfx::Rect Shelf::GetScreenBoundsOfItemIconForWindow(aura::Window* window) { |
244 if (!shelf_widget_) | 244 if (!shelf_widget_) |
245 return gfx::Rect(); | 245 return gfx::Rect(); |
246 return shelf_widget_->GetScreenBoundsOfItemIconForWindow(window); | 246 return shelf_widget_->GetScreenBoundsOfItemIconForWindow(window); |
247 } | 247 } |
248 | 248 |
249 // static | 249 // static |
250 void Shelf::LaunchShelfItem(int item_index) { | 250 void Shelf::LaunchShelfItem(int item_index) { |
251 ShelfModel* shelf_model = Shell::Get()->shelf_model(); | 251 ShelfModel* shelf_model = Shell::Get()->shelf_model(); |
252 const ShelfItems& items = shelf_model->items(); | 252 const ShelfItems& items = shelf_model->items(); |
253 int item_count = shelf_model->item_count(); | 253 int item_count = shelf_model->item_count(); |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 | 353 |
354 void Shelf::OnBackgroundUpdated(ShelfBackgroundType background_type, | 354 void Shelf::OnBackgroundUpdated(ShelfBackgroundType background_type, |
355 AnimationChangeType change_type) { | 355 AnimationChangeType change_type) { |
356 if (background_type == GetBackgroundType()) | 356 if (background_type == GetBackgroundType()) |
357 return; | 357 return; |
358 for (auto& observer : observers_) | 358 for (auto& observer : observers_) |
359 observer.OnBackgroundTypeChanged(background_type, change_type); | 359 observer.OnBackgroundTypeChanged(background_type, change_type); |
360 } | 360 } |
361 | 361 |
362 } // namespace ash | 362 } // namespace ash |
OLD | NEW |