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

Side by Side Diff: ash/shell.cc

Issue 2171813004: mash: Fold ShelfItemDelegateManager into ShelfModel (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: cleanup 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/shell.h" 5 #include "ash/shell.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 10
11 #include "ash/accelerators/accelerator_controller.h" 11 #include "ash/accelerators/accelerator_controller.h"
12 #include "ash/accelerators/accelerator_controller_delegate_aura.h" 12 #include "ash/accelerators/accelerator_controller_delegate_aura.h"
13 #include "ash/accelerators/accelerator_delegate.h" 13 #include "ash/accelerators/accelerator_delegate.h"
14 #include "ash/accelerators/focus_manager_factory.h" 14 #include "ash/accelerators/focus_manager_factory.h"
15 #include "ash/aura/wm_shell_aura.h" 15 #include "ash/aura/wm_shell_aura.h"
16 #include "ash/aura/wm_window_aura.h" 16 #include "ash/aura/wm_window_aura.h"
17 #include "ash/autoclick/autoclick_controller.h" 17 #include "ash/autoclick/autoclick_controller.h"
18 #include "ash/common/ash_switches.h" 18 #include "ash/common/ash_switches.h"
19 #include "ash/common/gpu_support.h" 19 #include "ash/common/gpu_support.h"
20 #include "ash/common/keyboard/keyboard_ui.h" 20 #include "ash/common/keyboard/keyboard_ui.h"
21 #include "ash/common/login_status.h" 21 #include "ash/common/login_status.h"
22 #include "ash/common/pointer_down_watcher_delegate.h" 22 #include "ash/common/pointer_down_watcher_delegate.h"
23 #include "ash/common/session/session_state_delegate.h" 23 #include "ash/common/session/session_state_delegate.h"
24 #include "ash/common/shelf/app_list_shelf_item_delegate.h" 24 #include "ash/common/shelf/app_list_shelf_item_delegate.h"
25 #include "ash/common/shelf/shelf_item_delegate.h" 25 #include "ash/common/shelf/shelf_item_delegate.h"
26 #include "ash/common/shelf/shelf_item_delegate_manager.h"
27 #include "ash/common/shelf/shelf_model.h" 26 #include "ash/common/shelf/shelf_model.h"
28 #include "ash/common/shell_delegate.h" 27 #include "ash/common/shell_delegate.h"
29 #include "ash/common/shell_window_ids.h" 28 #include "ash/common/shell_window_ids.h"
30 #include "ash/common/system/locale/locale_notification_controller.h" 29 #include "ash/common/system/locale/locale_notification_controller.h"
31 #include "ash/common/system/status_area_widget.h" 30 #include "ash/common/system/status_area_widget.h"
32 #include "ash/common/system/tray/system_tray_delegate.h" 31 #include "ash/common/system/tray/system_tray_delegate.h"
33 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" 32 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h"
34 #include "ash/common/wm/maximize_mode/maximize_mode_window_manager.h" 33 #include "ash/common/wm/maximize_mode/maximize_mode_window_manager.h"
35 #include "ash/common/wm/mru_window_tracker.h" 34 #include "ash/common/wm/mru_window_tracker.h"
36 #include "ash/common/wm/root_window_finder.h" 35 #include "ash/common/wm/root_window_finder.h"
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after
500 return shelf && shelf->status_area_widget(); 499 return shelf && shelf->status_area_widget();
501 } 500 }
502 501
503 SystemTray* Shell::GetPrimarySystemTray() { 502 SystemTray* Shell::GetPrimarySystemTray() {
504 return GetPrimaryRootWindowController()->GetSystemTray(); 503 return GetPrimaryRootWindowController()->GetSystemTray();
505 } 504 }
506 505
507 ShelfDelegate* Shell::GetShelfDelegate() { 506 ShelfDelegate* Shell::GetShelfDelegate() {
508 if (!shelf_delegate_) { 507 if (!shelf_delegate_) {
509 ShelfModel* shelf_model = wm_shell_->shelf_model(); 508 ShelfModel* shelf_model = wm_shell_->shelf_model();
510 // Creates ShelfItemDelegateManager before ShelfDelegate.
511 // TODO(jamescook): Move this into WmShell.
512 shelf_item_delegate_manager_.reset(
513 new ShelfItemDelegateManager(shelf_model));
514
515 shelf_delegate_.reset( 509 shelf_delegate_.reset(
516 wm_shell_->delegate()->CreateShelfDelegate(shelf_model)); 510 wm_shell_->delegate()->CreateShelfDelegate(shelf_model));
517 std::unique_ptr<ShelfItemDelegate> controller(new AppListShelfItemDelegate); 511 shelf_window_watcher_.reset(new ShelfWindowWatcher(shelf_model));
518
519 // Finding the shelf model's location of the app list and setting its
520 // ShelfItemDelegate.
521 int app_list_index = shelf_model->GetItemIndexForType(TYPE_APP_LIST);
522 DCHECK_GE(app_list_index, 0);
523 ShelfID app_list_id = shelf_model->items()[app_list_index].id;
524 DCHECK(app_list_id);
525 shelf_item_delegate_manager_->SetShelfItemDelegate(app_list_id,
526 std::move(controller));
527 shelf_window_watcher_.reset(new ShelfWindowWatcher(
528 shelf_model, shelf_item_delegate_manager_.get()));
529 } 512 }
530 return shelf_delegate_.get(); 513 return shelf_delegate_.get();
531 } 514 }
532 515
533 void Shell::SetTouchHudProjectionEnabled(bool enabled) { 516 void Shell::SetTouchHudProjectionEnabled(bool enabled) {
534 if (is_touch_hud_projection_enabled_ == enabled) 517 if (is_touch_hud_projection_enabled_ == enabled)
535 return; 518 return;
536 519
537 is_touch_hud_projection_enabled_ = enabled; 520 is_touch_hud_projection_enabled_ = enabled;
538 FOR_EACH_OBSERVER(ShellObserver, *wm_shell_->shell_observers(), 521 FOR_EACH_OBSERVER(ShellObserver, *wm_shell_->shell_observers(),
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
691 674
692 // These need a valid Shell instance to clean up properly, so explicitly 675 // These need a valid Shell instance to clean up properly, so explicitly
693 // delete them before invalidating the instance. 676 // delete them before invalidating the instance.
694 // Alphabetical. TODO(oshima): sort. 677 // Alphabetical. TODO(oshima): sort.
695 magnification_controller_.reset(); 678 magnification_controller_.reset();
696 partial_magnification_controller_.reset(); 679 partial_magnification_controller_.reset();
697 tooltip_controller_.reset(); 680 tooltip_controller_.reset();
698 event_client_.reset(); 681 event_client_.reset();
699 toplevel_window_event_handler_.reset(); 682 toplevel_window_event_handler_.reset();
700 visibility_controller_.reset(); 683 visibility_controller_.reset();
701 // |shelf_item_delegate_manager_| observes the shelf model.
702 shelf_item_delegate_manager_.reset();
703 684
704 power_button_controller_.reset(); 685 power_button_controller_.reset();
705 lock_state_controller_.reset(); 686 lock_state_controller_.reset();
706 687
707 screen_pinning_controller_.reset(); 688 screen_pinning_controller_.reset();
708 689
709 #if defined(OS_CHROMEOS) 690 #if defined(OS_CHROMEOS)
710 resolution_notification_controller_.reset(); 691 resolution_notification_controller_.reset();
711 #endif 692 #endif
712 desktop_background_controller_.reset(); 693 desktop_background_controller_.reset();
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after
1127 1108
1128 void Shell::OnWindowActivated( 1109 void Shell::OnWindowActivated(
1129 aura::client::ActivationChangeObserver::ActivationReason reason, 1110 aura::client::ActivationChangeObserver::ActivationReason reason,
1130 aura::Window* gained_active, 1111 aura::Window* gained_active,
1131 aura::Window* lost_active) { 1112 aura::Window* lost_active) {
1132 if (gained_active) 1113 if (gained_active)
1133 target_root_window_ = gained_active->GetRootWindow(); 1114 target_root_window_ = gained_active->GetRootWindow();
1134 } 1115 }
1135 1116
1136 } // namespace ash 1117 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698