OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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_widget.h" | 5 #include "ash/shelf/shelf_widget.h" |
6 | 6 |
7 #include "ash/animation/animation_change_type.h" | 7 #include "ash/animation/animation_change_type.h" |
8 #include "ash/focus_cycler.h" | 8 #include "ash/focus_cycler.h" |
9 #include "ash/public/cpp/window_properties.h" | 9 #include "ash/public/cpp/window_properties.h" |
10 #include "ash/root_window_controller.h" | 10 #include "ash/root_window_controller.h" |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 background_animator_.RemoveObserver(status_area_widget_); | 290 background_animator_.RemoveObserver(status_area_widget_); |
291 Shell::Get()->focus_cycler()->RemoveWidget(status_area_widget_); | 291 Shell::Get()->focus_cycler()->RemoveWidget(status_area_widget_); |
292 status_area_widget_->Shutdown(); | 292 status_area_widget_->Shutdown(); |
293 status_area_widget_ = nullptr; | 293 status_area_widget_ = nullptr; |
294 } | 294 } |
295 | 295 |
296 CloseNow(); | 296 CloseNow(); |
297 } | 297 } |
298 | 298 |
299 void ShelfWidget::UpdateIconPositionForPanel(WmWindow* panel) { | 299 void ShelfWidget::UpdateIconPositionForPanel(WmWindow* panel) { |
300 ShelfID* id = panel->aura_window()->GetProperty(kShelfIDKey); | 300 ShelfID id = |
301 if (!shelf_view_ || !id) | 301 ShelfID::Deserialize(panel->aura_window()->GetProperty(kShelfIDKey)); |
| 302 if (!shelf_view_ || id.IsNull()) |
302 return; | 303 return; |
303 | 304 |
304 WmWindow* shelf_window = WmWindow::Get(this->GetNativeWindow()); | 305 WmWindow* shelf_window = WmWindow::Get(this->GetNativeWindow()); |
305 shelf_view_->UpdatePanelIconPosition( | 306 shelf_view_->UpdatePanelIconPosition( |
306 *id, shelf_window->ConvertRectFromScreen(panel->GetBoundsInScreen()) | 307 id, shelf_window->ConvertRectFromScreen(panel->GetBoundsInScreen()) |
307 .CenterPoint()); | 308 .CenterPoint()); |
308 } | 309 } |
309 | 310 |
310 gfx::Rect ShelfWidget::GetScreenBoundsOfItemIconForWindow(WmWindow* window) { | 311 gfx::Rect ShelfWidget::GetScreenBoundsOfItemIconForWindow(WmWindow* window) { |
311 ShelfID* id = window->aura_window()->GetProperty(kShelfIDKey); | 312 ShelfID id = |
| 313 ShelfID::Deserialize(window->aura_window()->GetProperty(kShelfIDKey)); |
312 // Window animations can be triggered during session restore before the shelf | 314 // Window animations can be triggered during session restore before the shelf |
313 // view is created. In that case, return default empty bounds. | 315 // view is created. In that case, return default empty bounds. |
314 if (!shelf_view_ || !id) | 316 if (!shelf_view_ || id.IsNull()) |
315 return gfx::Rect(); | 317 return gfx::Rect(); |
316 | 318 |
317 gfx::Rect bounds(shelf_view_->GetIdealBoundsOfItemIcon(*id)); | 319 gfx::Rect bounds(shelf_view_->GetIdealBoundsOfItemIcon(id)); |
318 gfx::Point screen_origin; | 320 gfx::Point screen_origin; |
319 views::View::ConvertPointToScreen(shelf_view_, &screen_origin); | 321 views::View::ConvertPointToScreen(shelf_view_, &screen_origin); |
320 return gfx::Rect(screen_origin.x() + bounds.x(), | 322 return gfx::Rect(screen_origin.x() + bounds.x(), |
321 screen_origin.y() + bounds.y(), bounds.width(), | 323 screen_origin.y() + bounds.y(), bounds.width(), |
322 bounds.height()); | 324 bounds.height()); |
323 } | 325 } |
324 | 326 |
325 AppListButton* ShelfWidget::GetAppListButton() const { | 327 AppListButton* ShelfWidget::GetAppListButton() const { |
326 return shelf_view_ ? shelf_view_->GetAppListButton() : nullptr; | 328 return shelf_view_ ? shelf_view_->GetAppListButton() : nullptr; |
327 } | 329 } |
(...skipping 16 matching lines...) Expand all Loading... |
344 if (shelf_view_) | 346 if (shelf_view_) |
345 shelf_view_->UpdateShelfItemBackground(color); | 347 shelf_view_->UpdateShelfItemBackground(color); |
346 } | 348 } |
347 | 349 |
348 void ShelfWidget::WillDeleteShelfLayoutManager() { | 350 void ShelfWidget::WillDeleteShelfLayoutManager() { |
349 shelf_layout_manager_->RemoveObserver(this); | 351 shelf_layout_manager_->RemoveObserver(this); |
350 shelf_layout_manager_ = nullptr; | 352 shelf_layout_manager_ = nullptr; |
351 } | 353 } |
352 | 354 |
353 } // namespace ash | 355 } // namespace ash |
OLD | NEW |