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/common/focus_cycler.h" | 7 #include "ash/common/focus_cycler.h" |
8 #include "ash/common/material_design/material_design_controller.h" | 8 #include "ash/common/material_design/material_design_controller.h" |
9 #include "ash/common/session/session_state_delegate.h" | 9 #include "ash/common/session/session_state_delegate.h" |
10 #include "ash/common/shelf/shelf_background_animator_observer.h" | 10 #include "ash/common/shelf/shelf_background_animator_observer.h" |
11 #include "ash/common/shelf/shelf_constants.h" | 11 #include "ash/common/shelf/shelf_constants.h" |
12 #include "ash/common/shelf/shelf_delegate.h" | 12 #include "ash/common/shelf/shelf_delegate.h" |
13 #include "ash/common/shelf/shelf_layout_manager.h" | 13 #include "ash/common/shelf/shelf_layout_manager.h" |
14 #include "ash/common/shelf/shelf_view.h" | 14 #include "ash/common/shelf/shelf_view.h" |
15 #include "ash/common/shelf/wm_dimmer_view.h" | 15 #include "ash/common/shelf/wm_dimmer_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/system/tray/system_tray_delegate.h" | 20 #include "ash/common/system/tray/system_tray_delegate.h" |
| 21 #include "ash/common/wm_lookup.h" |
21 #include "ash/common/wm_root_window_controller.h" | 22 #include "ash/common/wm_root_window_controller.h" |
22 #include "ash/common/wm_shell.h" | 23 #include "ash/common/wm_shell.h" |
23 #include "ash/common/wm_window.h" | 24 #include "ash/common/wm_window.h" |
| 25 #include "ash/common/wm_window_property.h" |
24 #include "base/memory/ptr_util.h" | 26 #include "base/memory/ptr_util.h" |
25 #include "grit/ash_resources.h" | 27 #include "grit/ash_resources.h" |
26 #include "ui/base/resource/resource_bundle.h" | 28 #include "ui/base/resource/resource_bundle.h" |
27 #include "ui/compositor/layer.h" | 29 #include "ui/compositor/layer.h" |
28 #include "ui/compositor/scoped_layer_animation_settings.h" | 30 #include "ui/compositor/scoped_layer_animation_settings.h" |
29 #include "ui/gfx/canvas.h" | 31 #include "ui/gfx/canvas.h" |
30 #include "ui/gfx/image/image.h" | 32 #include "ui/gfx/image/image.h" |
31 #include "ui/gfx/image/image_skia_operations.h" | 33 #include "ui/gfx/image/image_skia_operations.h" |
32 #include "ui/gfx/skbitmap_operations.h" | 34 #include "ui/gfx/skbitmap_operations.h" |
33 #include "ui/views/accessible_pane_view.h" | 35 #include "ui/views/accessible_pane_view.h" |
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
494 WmShell::Get()->focus_cycler()->RemoveWidget(status_area_widget_); | 496 WmShell::Get()->focus_cycler()->RemoveWidget(status_area_widget_); |
495 status_area_widget_->Shutdown(); | 497 status_area_widget_->Shutdown(); |
496 status_area_widget_ = nullptr; | 498 status_area_widget_ = nullptr; |
497 } | 499 } |
498 } | 500 } |
499 | 501 |
500 void ShelfWidget::ForceUndimming(bool force) { | 502 void ShelfWidget::ForceUndimming(bool force) { |
501 delegate_view_->ForceUndimming(force); | 503 delegate_view_->ForceUndimming(force); |
502 } | 504 } |
503 | 505 |
| 506 void ShelfWidget::UpdateIconPositionForPanel(WmWindow* panel) { |
| 507 WmWindow* shelf_window = WmLookup::Get()->GetWindowForWidget(this); |
| 508 shelf_view_->UpdatePanelIconPosition( |
| 509 panel->GetIntProperty(WmWindowProperty::SHELF_ID), |
| 510 shelf_window->ConvertRectFromScreen(panel->GetBoundsInScreen()) |
| 511 .CenterPoint()); |
| 512 } |
| 513 |
| 514 gfx::Rect ShelfWidget::GetScreenBoundsOfItemIconForWindow(WmWindow* window) { |
| 515 ShelfID id = window->GetIntProperty(WmWindowProperty::SHELF_ID); |
| 516 gfx::Rect bounds(shelf_view_->GetIdealBoundsOfItemIcon(id)); |
| 517 gfx::Point screen_origin; |
| 518 views::View::ConvertPointToScreen(shelf_view_, &screen_origin); |
| 519 return gfx::Rect(screen_origin.x() + bounds.x(), |
| 520 screen_origin.y() + bounds.y(), bounds.width(), |
| 521 bounds.height()); |
| 522 } |
| 523 |
504 void ShelfWidget::OnWidgetActivationChanged(views::Widget* widget, | 524 void ShelfWidget::OnWidgetActivationChanged(views::Widget* widget, |
505 bool active) { | 525 bool active) { |
506 activating_as_fallback_ = false; | 526 activating_as_fallback_ = false; |
507 if (active) | 527 if (active) |
508 delegate_view_->SetPaneFocusAndFocusDefault(); | 528 delegate_view_->SetPaneFocusAndFocusDefault(); |
509 else | 529 else |
510 delegate_view_->GetFocusManager()->ClearFocus(); | 530 delegate_view_->GetFocusManager()->ClearFocus(); |
511 } | 531 } |
512 | 532 |
513 int ShelfWidget::GetDimmingAlphaForTest() { | 533 int ShelfWidget::GetDimmingAlphaForTest() { |
(...skipping 17 matching lines...) Expand all Loading... |
531 if (shelf_view_) | 551 if (shelf_view_) |
532 shelf_view_->UpdateShelfItemBackground(alpha); | 552 shelf_view_->UpdateShelfItemBackground(alpha); |
533 } | 553 } |
534 | 554 |
535 void ShelfWidget::WillDeleteShelfLayoutManager() { | 555 void ShelfWidget::WillDeleteShelfLayoutManager() { |
536 shelf_layout_manager_->RemoveObserver(this); | 556 shelf_layout_manager_->RemoveObserver(this); |
537 shelf_layout_manager_ = nullptr; | 557 shelf_layout_manager_ = nullptr; |
538 } | 558 } |
539 | 559 |
540 } // namespace ash | 560 } // namespace ash |
OLD | NEW |