| 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/aura/wm_shelf_aura.h" | 7 #include "ash/aura/wm_shelf_aura.h" |
| 8 #include "ash/aura/wm_window_aura.h" | 8 #include "ash/aura/wm_window_aura.h" |
| 9 #include "ash/common/ash_switches.h" | 9 #include "ash/common/ash_switches.h" |
| 10 #include "ash/common/focus_cycler.h" | 10 #include "ash/common/focus_cycler.h" |
| 11 #include "ash/common/material_design/material_design_controller.h" | 11 #include "ash/common/material_design/material_design_controller.h" |
| 12 #include "ash/common/session/session_state_delegate.h" | 12 #include "ash/common/session/session_state_delegate.h" |
| 13 #include "ash/common/shelf/shelf_constants.h" | 13 #include "ash/common/shelf/shelf_constants.h" |
| 14 #include "ash/common/shelf/shelf_delegate.h" |
| 14 #include "ash/common/shelf/shelf_model.h" | 15 #include "ash/common/shelf/shelf_model.h" |
| 15 #include "ash/common/shelf/wm_shelf_util.h" | 16 #include "ash/common/shelf/wm_shelf_util.h" |
| 16 #include "ash/common/shell_window_ids.h" | 17 #include "ash/common/shell_window_ids.h" |
| 17 #include "ash/common/system/tray/system_tray_delegate.h" | 18 #include "ash/common/system/tray/system_tray_delegate.h" |
| 18 #include "ash/common/wm_root_window_controller.h" | 19 #include "ash/common/wm_root_window_controller.h" |
| 19 #include "ash/common/wm_shell.h" | 20 #include "ash/common/wm_shell.h" |
| 20 #include "ash/shelf/shelf_delegate.h" | |
| 21 #include "ash/shelf/shelf_layout_manager.h" | 21 #include "ash/shelf/shelf_layout_manager.h" |
| 22 #include "ash/shelf/shelf_util.h" | 22 #include "ash/shelf/shelf_util.h" |
| 23 #include "ash/shelf/shelf_view.h" | 23 #include "ash/shelf/shelf_view.h" |
| 24 #include "ash/shell.h" | 24 #include "ash/shell.h" |
| 25 #include "ash/wm/status_area_layout_manager.h" | 25 #include "ash/wm/status_area_layout_manager.h" |
| 26 #include "ash/wm/window_properties.h" | 26 #include "ash/wm/window_properties.h" |
| 27 #include "ash/wm/workspace_controller.h" | 27 #include "ash/wm/workspace_controller.h" |
| 28 #include "grit/ash_resources.h" | 28 #include "grit/ash_resources.h" |
| 29 #include "ui/aura/window.h" | 29 #include "ui/aura/window.h" |
| 30 #include "ui/aura/window_event_dispatcher.h" | 30 #include "ui/aura/window_event_dispatcher.h" |
| (...skipping 687 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 718 status_area_widget_->SchedulePaint(); | 718 status_area_widget_->SchedulePaint(); |
| 719 } | 719 } |
| 720 | 720 |
| 721 bool ShelfWidget::GetDimsShelf() const { | 721 bool ShelfWidget::GetDimsShelf() const { |
| 722 return delegate_view_->GetDimmed(); | 722 return delegate_view_->GetDimmed(); |
| 723 } | 723 } |
| 724 | 724 |
| 725 void ShelfWidget::CreateShelf(WmShelfAura* wm_shelf_aura) { | 725 void ShelfWidget::CreateShelf(WmShelfAura* wm_shelf_aura) { |
| 726 DCHECK(!shelf_); | 726 DCHECK(!shelf_); |
| 727 | 727 |
| 728 ShelfDelegate* delegate = Shell::GetInstance()->GetShelfDelegate(); | 728 shelf_.reset(new Shelf(WmShell::Get()->shelf_model(), wm_shelf_aura, this)); |
| 729 shelf_.reset( | |
| 730 new Shelf(WmShell::Get()->shelf_model(), delegate, wm_shelf_aura, this)); | |
| 731 // Must be initialized before the delegate is notified because the delegate | 729 // Must be initialized before the delegate is notified because the delegate |
| 732 // may try to access the WmShelf. | 730 // may try to access the WmShelf. |
| 733 wm_shelf_aura->SetShelf(shelf_.get()); | 731 wm_shelf_aura->SetShelf(shelf_.get()); |
| 734 delegate->OnShelfCreated(shelf_.get()); | 732 WmShell::Get()->shelf_delegate()->OnShelfCreated(shelf_.get()); |
| 735 | 733 |
| 736 SetFocusCycler(WmShell::Get()->focus_cycler()); | 734 SetFocusCycler(WmShell::Get()->focus_cycler()); |
| 737 } | 735 } |
| 738 | 736 |
| 739 void ShelfWidget::PostCreateShelf() { | 737 void ShelfWidget::PostCreateShelf() { |
| 740 shelf_->SetVisible( | 738 shelf_->SetVisible( |
| 741 WmShell::Get()->GetSessionStateDelegate()->IsActiveUserSessionStarted()); | 739 WmShell::Get()->GetSessionStateDelegate()->IsActiveUserSessionStarted()); |
| 742 shelf_layout_manager_->LayoutShelf(); | 740 shelf_layout_manager_->LayoutShelf(); |
| 743 shelf_layout_manager_->UpdateAutoHideState(); | 741 shelf_layout_manager_->UpdateAutoHideState(); |
| 744 Show(); | 742 Show(); |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 819 shelf_layout_manager_->UpdateAutoHideForMouseEvent(event); | 817 shelf_layout_manager_->UpdateAutoHideForMouseEvent(event); |
| 820 } | 818 } |
| 821 | 819 |
| 822 void ShelfWidget::OnGestureEvent(ui::GestureEvent* event) { | 820 void ShelfWidget::OnGestureEvent(ui::GestureEvent* event) { |
| 823 Widget::OnGestureEvent(event); | 821 Widget::OnGestureEvent(event); |
| 824 if (Shell::GetInstance()->in_mus() && shelf_layout_manager_) | 822 if (Shell::GetInstance()->in_mus() && shelf_layout_manager_) |
| 825 shelf_layout_manager_->UpdateAutoHideForGestureEvent(event); | 823 shelf_layout_manager_->UpdateAutoHideForGestureEvent(event); |
| 826 } | 824 } |
| 827 | 825 |
| 828 } // namespace ash | 826 } // namespace ash |
| OLD | NEW |