Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(57)

Side by Side Diff: ash/shelf/shelf_widget.cc

Issue 2177663002: mash: Move ownership of ShelfDelegate to WmShell (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix WallpaperManagerBrowserTest Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 ShelfDelegate* delegate = WmShell::Get()->shelf_delegate();
729 DCHECK(delegate);
729 shelf_.reset( 730 shelf_.reset(
730 new Shelf(WmShell::Get()->shelf_model(), delegate, wm_shelf_aura, this)); 731 new Shelf(WmShell::Get()->shelf_model(), delegate, wm_shelf_aura, this));
731 // Must be initialized before the delegate is notified because the delegate 732 // Must be initialized before the delegate is notified because the delegate
732 // may try to access the WmShelf. 733 // may try to access the WmShelf.
733 wm_shelf_aura->SetShelf(shelf_.get()); 734 wm_shelf_aura->SetShelf(shelf_.get());
734 delegate->OnShelfCreated(shelf_.get()); 735 delegate->OnShelfCreated(shelf_.get());
735 736
736 SetFocusCycler(WmShell::Get()->focus_cycler()); 737 SetFocusCycler(WmShell::Get()->focus_cycler());
737 } 738 }
738 739
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
819 shelf_layout_manager_->UpdateAutoHideForMouseEvent(event); 820 shelf_layout_manager_->UpdateAutoHideForMouseEvent(event);
820 } 821 }
821 822
822 void ShelfWidget::OnGestureEvent(ui::GestureEvent* event) { 823 void ShelfWidget::OnGestureEvent(ui::GestureEvent* event) {
823 Widget::OnGestureEvent(event); 824 Widget::OnGestureEvent(event);
824 if (Shell::GetInstance()->in_mus() && shelf_layout_manager_) 825 if (Shell::GetInstance()->in_mus() && shelf_layout_manager_)
825 shelf_layout_manager_->UpdateAutoHideForGestureEvent(event); 826 shelf_layout_manager_->UpdateAutoHideForGestureEvent(event);
826 } 827 }
827 828
828 } // namespace ash 829 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698