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

Side by Side Diff: ash/shell.cc

Issue 2750483005: Moves app_list() and related functions from Shell to WmShell (Closed)
Patch Set: Created 3 years, 9 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
« no previous file with comments | « ash/shell.h ('k') | ash/shell/app_list.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 #include "base/trace_event/trace_event.h" 104 #include "base/trace_event/trace_event.h"
105 #include "chromeos/audio/audio_a11y_controller.h" 105 #include "chromeos/audio/audio_a11y_controller.h"
106 #include "chromeos/chromeos_switches.h" 106 #include "chromeos/chromeos_switches.h"
107 #include "chromeos/dbus/dbus_thread_manager.h" 107 #include "chromeos/dbus/dbus_thread_manager.h"
108 #include "chromeos/system/devicemode.h" 108 #include "chromeos/system/devicemode.h"
109 #include "components/ui_devtools/devtools_server.h" 109 #include "components/ui_devtools/devtools_server.h"
110 #include "services/preferences/public/cpp/pref_client_store.h" 110 #include "services/preferences/public/cpp/pref_client_store.h"
111 #include "services/preferences/public/interfaces/preferences.mojom.h" 111 #include "services/preferences/public/interfaces/preferences.mojom.h"
112 #include "services/service_manager/public/cpp/connector.h" 112 #include "services/service_manager/public/cpp/connector.h"
113 #include "services/ui/public/interfaces/constants.mojom.h" 113 #include "services/ui/public/interfaces/constants.mojom.h"
114 #include "ui/app_list/presenter/app_list.h"
114 #include "ui/aura/client/aura_constants.h" 115 #include "ui/aura/client/aura_constants.h"
115 #include "ui/aura/env.h" 116 #include "ui/aura/env.h"
116 #include "ui/aura/layout_manager.h" 117 #include "ui/aura/layout_manager.h"
117 #include "ui/aura/mus/user_activity_forwarder.h" 118 #include "ui/aura/mus/user_activity_forwarder.h"
118 #include "ui/aura/window.h" 119 #include "ui/aura/window.h"
119 #include "ui/aura/window_event_dispatcher.h" 120 #include "ui/aura/window_event_dispatcher.h"
120 #include "ui/base/ui_base_switches.h" 121 #include "ui/base/ui_base_switches.h"
121 #include "ui/base/user_activity/user_activity_detector.h" 122 #include "ui/base/user_activity/user_activity_detector.h"
122 #include "ui/chromeos/user_activity_power_manager_notifier.h" 123 #include "ui/chromeos/user_activity_power_manager_notifier.h"
123 #include "ui/compositor/layer.h" 124 #include "ui/compositor/layer.h"
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 } 412 }
412 413
413 void Shell::AddShellObserver(ShellObserver* observer) { 414 void Shell::AddShellObserver(ShellObserver* observer) {
414 shell_observers_.AddObserver(observer); 415 shell_observers_.AddObserver(observer);
415 } 416 }
416 417
417 void Shell::RemoveShellObserver(ShellObserver* observer) { 418 void Shell::RemoveShellObserver(ShellObserver* observer) {
418 shell_observers_.RemoveObserver(observer); 419 shell_observers_.RemoveObserver(observer);
419 } 420 }
420 421
422 void Shell::ShowAppList() {
423 // Show the app list on the default display for new windows.
424 app_list_->Show(
425 GetWmRootWindowForNewWindows()->GetDisplayNearestWindow().id());
426 }
427
428 void Shell::DismissAppList() {
429 app_list_->Dismiss();
430 }
431
432 void Shell::ToggleAppList() {
433 // Toggle the app list on the default display for new windows.
434 app_list_->ToggleAppList(
435 GetWmRootWindowForNewWindows()->GetDisplayNearestWindow().id());
436 }
437
438 bool Shell::IsAppListVisible() const {
439 return app_list_->IsVisible();
440 }
441
442 bool Shell::GetAppListTargetVisibility() const {
443 return app_list_->GetTargetVisibility();
444 }
445
421 void Shell::NotifyMaximizeModeStarted() { 446 void Shell::NotifyMaximizeModeStarted() {
422 for (auto& observer : shell_observers_) 447 for (auto& observer : shell_observers_)
423 observer.OnMaximizeModeStarted(); 448 observer.OnMaximizeModeStarted();
424 } 449 }
425 450
426 void Shell::NotifyMaximizeModeEnding() { 451 void Shell::NotifyMaximizeModeEnding() {
427 for (auto& observer : shell_observers_) 452 for (auto& observer : shell_observers_)
428 observer.OnMaximizeModeEnding(); 453 observer.OnMaximizeModeEnding();
429 } 454 }
430 455
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
474 observer.OnShelfAutoHideBehaviorChanged(root_window); 499 observer.OnShelfAutoHideBehaviorChanged(root_window);
475 } 500 }
476 501
477 //////////////////////////////////////////////////////////////////////////////// 502 ////////////////////////////////////////////////////////////////////////////////
478 // Shell, private: 503 // Shell, private:
479 504
480 Shell::Shell(std::unique_ptr<ShellDelegate> shell_delegate, 505 Shell::Shell(std::unique_ptr<ShellDelegate> shell_delegate,
481 std::unique_ptr<WmShell> wm_shell) 506 std::unique_ptr<WmShell> wm_shell)
482 : wm_shell_(std::move(wm_shell)), 507 : wm_shell_(std::move(wm_shell)),
483 shell_delegate_(std::move(shell_delegate)), 508 shell_delegate_(std::move(shell_delegate)),
509 app_list_(base::MakeUnique<app_list::AppList>()),
484 link_handler_model_factory_(nullptr), 510 link_handler_model_factory_(nullptr),
485 display_configurator_(new display::DisplayConfigurator()), 511 display_configurator_(new display::DisplayConfigurator()),
486 native_cursor_manager_(nullptr), 512 native_cursor_manager_(nullptr),
487 simulate_modal_window_open_for_testing_(false), 513 simulate_modal_window_open_for_testing_(false),
488 is_touch_hud_projection_enabled_(false) { 514 is_touch_hud_projection_enabled_(false) {
489 // TODO(sky): better refactor cash/mash dependencies. Perhaps put all cash 515 // TODO(sky): better refactor cash/mash dependencies. Perhaps put all cash
490 // state on WmShellAura. http://crbug.com/671246. 516 // state on WmShellAura. http://crbug.com/671246.
491 517
492 if (!wm_shell_->IsRunningInMash()) { 518 if (!wm_shell_->IsRunningInMash()) {
493 gpu_support_.reset(shell_delegate_->CreateGPUSupport()); 519 gpu_support_.reset(shell_delegate_->CreateGPUSupport());
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
655 display_change_observer_.reset(); 681 display_change_observer_.reset();
656 shutdown_observer_.reset(); 682 shutdown_observer_.reset();
657 683
658 PowerStatus::Shutdown(); 684 PowerStatus::Shutdown();
659 685
660 // Ensure that DBusThreadManager outlives this Shell. 686 // Ensure that DBusThreadManager outlives this Shell.
661 DCHECK(chromeos::DBusThreadManager::IsInitialized()); 687 DCHECK(chromeos::DBusThreadManager::IsInitialized());
662 688
663 // Needs to happen right before |instance_| is reset. 689 // Needs to happen right before |instance_| is reset.
664 wm_shell_.reset(); 690 wm_shell_.reset();
691 app_list_.reset();
msw 2017/03/14 20:20:05 nit: probably not needed; it'd be nice to avoid im
sky 2017/03/14 21:06:50 Done.
665 wallpaper_delegate_.reset(); 692 wallpaper_delegate_.reset();
666 pref_store_ = nullptr; 693 pref_store_ = nullptr;
667 shell_delegate_.reset(); 694 shell_delegate_.reset();
668 695
669 DCHECK(instance_ == this); 696 DCHECK(instance_ == this);
670 instance_ = nullptr; 697 instance_ = nullptr;
671 } 698 }
672 699
673 void Shell::Init(const ShellInitParams& init_params) { 700 void Shell::Init(const ShellInitParams& init_params) {
674 const bool is_mash = wm_shell_->IsRunningInMash(); 701 const bool is_mash = wm_shell_->IsRunningInMash();
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after
1076 void Shell::OnWindowActivated( 1103 void Shell::OnWindowActivated(
1077 aura::client::ActivationChangeObserver::ActivationReason reason, 1104 aura::client::ActivationChangeObserver::ActivationReason reason,
1078 aura::Window* gained_active, 1105 aura::Window* gained_active,
1079 aura::Window* lost_active) { 1106 aura::Window* lost_active) {
1080 WmWindow* gained_active_wm = WmWindow::Get(gained_active); 1107 WmWindow* gained_active_wm = WmWindow::Get(gained_active);
1081 if (gained_active_wm) 1108 if (gained_active_wm)
1082 root_window_for_new_windows_ = gained_active_wm->GetRootWindow(); 1109 root_window_for_new_windows_ = gained_active_wm->GetRootWindow();
1083 } 1110 }
1084 1111
1085 } // namespace ash 1112 } // namespace ash
OLDNEW
« no previous file with comments | « ash/shell.h ('k') | ash/shell/app_list.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698