| 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/common/shelf/shelf_widget.h" | 5 #include "ash/common/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/common/focus_cycler.h" | 8 #include "ash/common/focus_cycler.h" |
| 9 #include "ash/common/session/session_state_delegate.h" | 9 #include "ash/common/session/session_state_delegate.h" |
| 10 #include "ash/common/shelf/app_list_button.h" | 10 #include "ash/common/shelf/app_list_button.h" |
| 11 #include "ash/common/shelf/shelf_background_animator_observer.h" | 11 #include "ash/common/shelf/shelf_background_animator_observer.h" |
| 12 #include "ash/common/shelf/shelf_constants.h" | 12 #include "ash/common/shelf/shelf_constants.h" |
| 13 #include "ash/common/shelf/shelf_delegate.h" | 13 #include "ash/common/shelf/shelf_delegate.h" |
| 14 #include "ash/common/shelf/shelf_layout_manager.h" | 14 #include "ash/common/shelf/shelf_layout_manager.h" |
| 15 #include "ash/common/shelf/shelf_view.h" | 15 #include "ash/common/shelf/shelf_view.h" |
| 16 #include "ash/common/shelf/wm_shelf.h" | 16 #include "ash/common/shelf/wm_shelf.h" |
| 17 #include "ash/common/shelf/wm_shelf_util.h" | 17 #include "ash/common/shelf/wm_shelf_util.h" |
| 18 #include "ash/common/system/status_area_layout_manager.h" | 18 #include "ash/common/system/status_area_layout_manager.h" |
| 19 #include "ash/common/system/status_area_widget.h" | 19 #include "ash/common/system/status_area_widget.h" |
| 20 #include "ash/common/wm_shell.h" | 20 #include "ash/common/wm_shell.h" |
| 21 #include "ash/common/wm_window.h" | 21 #include "ash/common/wm_window.h" |
| 22 #include "ash/common/wm_window_property.h" | |
| 23 #include "ash/root_window_controller.h" | 22 #include "ash/root_window_controller.h" |
| 23 #include "ash/wm/window_properties.h" |
| 24 #include "base/memory/ptr_util.h" | 24 #include "base/memory/ptr_util.h" |
| 25 #include "ui/compositor/layer.h" | 25 #include "ui/compositor/layer.h" |
| 26 #include "ui/compositor/scoped_layer_animation_settings.h" | 26 #include "ui/compositor/scoped_layer_animation_settings.h" |
| 27 #include "ui/gfx/skbitmap_operations.h" | 27 #include "ui/gfx/skbitmap_operations.h" |
| 28 #include "ui/views/accessible_pane_view.h" | 28 #include "ui/views/accessible_pane_view.h" |
| 29 #include "ui/views/layout/fill_layout.h" | 29 #include "ui/views/layout/fill_layout.h" |
| 30 #include "ui/views/widget/widget.h" | 30 #include "ui/views/widget/widget.h" |
| 31 #include "ui/views/widget/widget_delegate.h" | 31 #include "ui/views/widget/widget_delegate.h" |
| 32 | 32 |
| 33 namespace ash { | 33 namespace ash { |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 | 300 |
| 301 CloseNow(); | 301 CloseNow(); |
| 302 } | 302 } |
| 303 | 303 |
| 304 void ShelfWidget::UpdateIconPositionForPanel(WmWindow* panel) { | 304 void ShelfWidget::UpdateIconPositionForPanel(WmWindow* panel) { |
| 305 if (!shelf_view_) | 305 if (!shelf_view_) |
| 306 return; | 306 return; |
| 307 | 307 |
| 308 WmWindow* shelf_window = WmWindow::Get(this->GetNativeWindow()); | 308 WmWindow* shelf_window = WmWindow::Get(this->GetNativeWindow()); |
| 309 shelf_view_->UpdatePanelIconPosition( | 309 shelf_view_->UpdatePanelIconPosition( |
| 310 panel->GetIntProperty(WmWindowProperty::SHELF_ID), | 310 panel->aura_window()->GetProperty(kShelfIDKey), |
| 311 shelf_window->ConvertRectFromScreen(panel->GetBoundsInScreen()) | 311 shelf_window->ConvertRectFromScreen(panel->GetBoundsInScreen()) |
| 312 .CenterPoint()); | 312 .CenterPoint()); |
| 313 } | 313 } |
| 314 | 314 |
| 315 gfx::Rect ShelfWidget::GetScreenBoundsOfItemIconForWindow(WmWindow* window) { | 315 gfx::Rect ShelfWidget::GetScreenBoundsOfItemIconForWindow(WmWindow* window) { |
| 316 // Window animations can be triggered during session restore before the shelf | 316 // Window animations can be triggered during session restore before the shelf |
| 317 // view is created. In that case, return default empty bounds. | 317 // view is created. In that case, return default empty bounds. |
| 318 if (!shelf_view_) | 318 if (!shelf_view_) |
| 319 return gfx::Rect(); | 319 return gfx::Rect(); |
| 320 | 320 |
| 321 ShelfID id = window->GetIntProperty(WmWindowProperty::SHELF_ID); | 321 ShelfID id = window->aura_window()->GetProperty(kShelfIDKey); |
| 322 gfx::Rect bounds(shelf_view_->GetIdealBoundsOfItemIcon(id)); | 322 gfx::Rect bounds(shelf_view_->GetIdealBoundsOfItemIcon(id)); |
| 323 gfx::Point screen_origin; | 323 gfx::Point screen_origin; |
| 324 views::View::ConvertPointToScreen(shelf_view_, &screen_origin); | 324 views::View::ConvertPointToScreen(shelf_view_, &screen_origin); |
| 325 return gfx::Rect(screen_origin.x() + bounds.x(), | 325 return gfx::Rect(screen_origin.x() + bounds.x(), |
| 326 screen_origin.y() + bounds.y(), bounds.width(), | 326 screen_origin.y() + bounds.y(), bounds.width(), |
| 327 bounds.height()); | 327 bounds.height()); |
| 328 } | 328 } |
| 329 | 329 |
| 330 AppListButton* ShelfWidget::GetAppListButton() const { | 330 AppListButton* ShelfWidget::GetAppListButton() const { |
| 331 return shelf_view_ ? shelf_view_->GetAppListButton() : nullptr; | 331 return shelf_view_ ? shelf_view_->GetAppListButton() : nullptr; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 349 if (shelf_view_) | 349 if (shelf_view_) |
| 350 shelf_view_->UpdateShelfItemBackground(color); | 350 shelf_view_->UpdateShelfItemBackground(color); |
| 351 } | 351 } |
| 352 | 352 |
| 353 void ShelfWidget::WillDeleteShelfLayoutManager() { | 353 void ShelfWidget::WillDeleteShelfLayoutManager() { |
| 354 shelf_layout_manager_->RemoveObserver(this); | 354 shelf_layout_manager_->RemoveObserver(this); |
| 355 shelf_layout_manager_ = nullptr; | 355 shelf_layout_manager_ = nullptr; |
| 356 } | 356 } |
| 357 | 357 |
| 358 } // namespace ash | 358 } // namespace ash |
| OLD | NEW |