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

Side by Side Diff: ash/shell.cc

Issue 2318223003: mash: Migrate wallpaper controllers to ash/common. (Closed)
Patch Set: Fix nit. Created 4 years, 3 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_unittest.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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 #include "ash/first_run/first_run_helper_impl.h" 51 #include "ash/first_run/first_run_helper_impl.h"
52 #include "ash/high_contrast/high_contrast_controller.h" 52 #include "ash/high_contrast/high_contrast_controller.h"
53 #include "ash/host/ash_window_tree_host_init_params.h" 53 #include "ash/host/ash_window_tree_host_init_params.h"
54 #include "ash/ime/input_method_event_handler.h" 54 #include "ash/ime/input_method_event_handler.h"
55 #include "ash/magnifier/magnification_controller.h" 55 #include "ash/magnifier/magnification_controller.h"
56 #include "ash/magnifier/partial_magnification_controller.h" 56 #include "ash/magnifier/partial_magnification_controller.h"
57 #include "ash/root_window_controller.h" 57 #include "ash/root_window_controller.h"
58 #include "ash/shell_init_params.h" 58 #include "ash/shell_init_params.h"
59 #include "ash/system/chromeos/screen_layout_observer.h" 59 #include "ash/system/chromeos/screen_layout_observer.h"
60 #include "ash/utility/screenshot_controller.h" 60 #include "ash/utility/screenshot_controller.h"
61 #include "ash/wallpaper/wallpaper_controller.h"
62 #include "ash/wallpaper/wallpaper_view.h"
63 #include "ash/wm/ash_focus_rules.h" 61 #include "ash/wm/ash_focus_rules.h"
64 #include "ash/wm/ash_native_cursor_manager.h" 62 #include "ash/wm/ash_native_cursor_manager.h"
65 #include "ash/wm/event_client_impl.h" 63 #include "ash/wm/event_client_impl.h"
66 #include "ash/wm/immersive_handler_factory_ash.h" 64 #include "ash/wm/immersive_handler_factory_ash.h"
67 #include "ash/wm/lock_state_controller.h" 65 #include "ash/wm/lock_state_controller.h"
68 #include "ash/wm/overlay_event_filter.h" 66 #include "ash/wm/overlay_event_filter.h"
69 #include "ash/wm/overview/scoped_overview_animation_settings_factory_aura.h" 67 #include "ash/wm/overview/scoped_overview_animation_settings_factory_aura.h"
70 #include "ash/wm/power_button_controller.h" 68 #include "ash/wm/power_button_controller.h"
71 #include "ash/wm/resize_shadow_controller.h" 69 #include "ash/wm/resize_shadow_controller.h"
72 #include "ash/wm/screen_pinning_controller.h" 70 #include "ash/wm/screen_pinning_controller.h"
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 Shell* Shell::instance_ = nullptr; 185 Shell* Shell::instance_ = nullptr;
188 // static 186 // static
189 bool Shell::initially_hide_cursor_ = false; 187 bool Shell::initially_hide_cursor_ = false;
190 188
191 //////////////////////////////////////////////////////////////////////////////// 189 ////////////////////////////////////////////////////////////////////////////////
192 // Shell, public: 190 // Shell, public:
193 191
194 // static 192 // static
195 Shell* Shell::CreateInstance(const ShellInitParams& init_params) { 193 Shell* Shell::CreateInstance(const ShellInitParams& init_params) {
196 CHECK(!instance_); 194 CHECK(!instance_);
197 instance_ = new Shell(init_params.delegate, init_params.blocking_pool); 195 instance_ = new Shell(init_params.delegate);
198 instance_->Init(init_params); 196 instance_->Init(init_params);
199 return instance_; 197 return instance_;
200 } 198 }
201 199
202 // static 200 // static
203 Shell* Shell::GetInstance() { 201 Shell* Shell::GetInstance() {
204 CHECK(instance_); 202 CHECK(instance_);
205 return instance_; 203 return instance_;
206 } 204 }
207 205
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 479
482 void Shell::DoInitialWorkspaceAnimation() { 480 void Shell::DoInitialWorkspaceAnimation() {
483 return GetPrimaryRootWindowController() 481 return GetPrimaryRootWindowController()
484 ->workspace_controller() 482 ->workspace_controller()
485 ->DoInitialAnimation(); 483 ->DoInitialAnimation();
486 } 484 }
487 485
488 //////////////////////////////////////////////////////////////////////////////// 486 ////////////////////////////////////////////////////////////////////////////////
489 // Shell, private: 487 // Shell, private:
490 488
491 Shell::Shell(ShellDelegate* delegate, base::SequencedWorkerPool* blocking_pool) 489 Shell::Shell(ShellDelegate* delegate)
492 : wm_shell_(new WmShellAura(base::WrapUnique(delegate))), 490 : wm_shell_(new WmShellAura(base::WrapUnique(delegate))),
493 link_handler_model_factory_(nullptr), 491 link_handler_model_factory_(nullptr),
494 activation_client_(nullptr), 492 activation_client_(nullptr),
495 #if defined(OS_CHROMEOS) 493 #if defined(OS_CHROMEOS)
496 display_configurator_(new ui::DisplayConfigurator()), 494 display_configurator_(new ui::DisplayConfigurator()),
497 #endif // defined(OS_CHROMEOS) 495 #endif // defined(OS_CHROMEOS)
498 native_cursor_manager_(nullptr), 496 native_cursor_manager_(nullptr),
499 simulate_modal_window_open_for_testing_(false), 497 simulate_modal_window_open_for_testing_(false),
500 is_touch_hud_projection_enabled_(false), 498 is_touch_hud_projection_enabled_(false) {
501 blocking_pool_(blocking_pool) {
502 DCHECK(aura::Env::GetInstanceDontCreate()); 499 DCHECK(aura::Env::GetInstanceDontCreate());
503 gpu_support_.reset(wm_shell_->delegate()->CreateGPUSupport()); 500 gpu_support_.reset(wm_shell_->delegate()->CreateGPUSupport());
504 display_manager_.reset(ScreenAsh::CreateDisplayManager()); 501 display_manager_.reset(ScreenAsh::CreateDisplayManager());
505 window_tree_host_manager_.reset(new WindowTreeHostManager); 502 window_tree_host_manager_.reset(new WindowTreeHostManager);
506 user_metrics_recorder_.reset(new UserMetricsRecorder); 503 user_metrics_recorder_.reset(new UserMetricsRecorder);
507 504
508 #if defined(OS_CHROMEOS) 505 #if defined(OS_CHROMEOS)
509 PowerStatus::Initialize(); 506 PowerStatus::Initialize();
510 #endif 507 #endif
511 } 508 }
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
620 visibility_controller_.reset(); 617 visibility_controller_.reset();
621 618
622 power_button_controller_.reset(); 619 power_button_controller_.reset();
623 lock_state_controller_.reset(); 620 lock_state_controller_.reset();
624 621
625 screen_pinning_controller_.reset(); 622 screen_pinning_controller_.reset();
626 623
627 #if defined(OS_CHROMEOS) 624 #if defined(OS_CHROMEOS)
628 resolution_notification_controller_.reset(); 625 resolution_notification_controller_.reset();
629 #endif 626 #endif
630 wallpaper_controller_.reset();
631 screenshot_controller_.reset(); 627 screenshot_controller_.reset();
632 mouse_cursor_filter_.reset(); 628 mouse_cursor_filter_.reset();
633 modality_filter_.reset(); 629 modality_filter_.reset();
634 630
635 #if defined(OS_CHROMEOS) 631 #if defined(OS_CHROMEOS)
636 touch_transformer_controller_.reset(); 632 touch_transformer_controller_.reset();
637 stylus_metrics_recorder_.reset(); 633 stylus_metrics_recorder_.reset();
638 audio_a11y_controller_.reset(); 634 audio_a11y_controller_.reset();
639 #endif // defined(OS_CHROMEOS) 635 #endif // defined(OS_CHROMEOS)
640 636
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
673 #endif 669 #endif
674 670
675 // Needs to happen right before |instance_| is reset. 671 // Needs to happen right before |instance_| is reset.
676 wm_shell_.reset(); 672 wm_shell_.reset();
677 673
678 DCHECK(instance_ == this); 674 DCHECK(instance_ == this);
679 instance_ = nullptr; 675 instance_ = nullptr;
680 } 676 }
681 677
682 void Shell::Init(const ShellInitParams& init_params) { 678 void Shell::Init(const ShellInitParams& init_params) {
683 wm_shell_->Initialize(); 679 wm_shell_->Initialize(init_params.blocking_pool);
684 680
685 in_mus_ = init_params.in_mus; 681 in_mus_ = init_params.in_mus;
686 682
687 immersive_handler_factory_ = base::MakeUnique<ImmersiveHandlerFactoryAsh>(); 683 immersive_handler_factory_ = base::MakeUnique<ImmersiveHandlerFactoryAsh>();
688 684
689 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) 685 #if defined(OS_LINUX) && !defined(OS_CHROMEOS)
690 DCHECK(in_mus_) << "linux desktop does not support ash."; 686 DCHECK(in_mus_) << "linux desktop does not support ash.";
691 #endif 687 #endif
692 688
693 scoped_overview_animation_settings_factory_.reset( 689 scoped_overview_animation_settings_factory_.reset(
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
743 // observer gets invoked after the root windows are configured. 739 // observer gets invoked after the root windows are configured.
744 display_configurator_->AddObserver(display_change_observer_.get()); 740 display_configurator_->AddObserver(display_change_observer_.get());
745 display_error_observer_.reset(new DisplayErrorObserver()); 741 display_error_observer_.reset(new DisplayErrorObserver());
746 display_configurator_->AddObserver(display_error_observer_.get()); 742 display_configurator_->AddObserver(display_error_observer_.get());
747 display_configurator_->set_state_controller(display_change_observer_.get()); 743 display_configurator_->set_state_controller(display_change_observer_.get());
748 display_configurator_->set_mirroring_controller(display_manager_.get()); 744 display_configurator_->set_mirroring_controller(display_manager_.get());
749 display_configurator_->ForceInitialConfigure( 745 display_configurator_->ForceInitialConfigure(
750 wm_shell_->delegate()->IsFirstRunAfterBoot() ? kChromeOsBootColor : 0); 746 wm_shell_->delegate()->IsFirstRunAfterBoot() ? kChromeOsBootColor : 0);
751 display_initialized = true; 747 display_initialized = true;
752 } 748 }
753 display_color_manager_.reset( 749 display_color_manager_.reset(new DisplayColorManager(
754 new DisplayColorManager(display_configurator_.get(), blocking_pool_)); 750 display_configurator_.get(), init_params.blocking_pool));
755 #endif // defined(OS_CHROMEOS) 751 #endif // defined(OS_CHROMEOS)
756 752
757 if (!display_initialized) 753 if (!display_initialized)
758 display_manager_->InitDefaultDisplay(); 754 display_manager_->InitDefaultDisplay();
759 755
760 display_manager_->RefreshFontParams(); 756 display_manager_->RefreshFontParams();
761 757
762 aura::Env::GetInstance()->set_context_factory(init_params.context_factory); 758 aura::Env::GetInstance()->set_context_factory(init_params.context_factory);
763 759
764 // The WindowModalityController needs to be at the front of the input event 760 // The WindowModalityController needs to be at the front of the input event
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
881 877
882 tooltip_controller_.reset(new views::corewm::TooltipController( 878 tooltip_controller_.reset(new views::corewm::TooltipController(
883 std::unique_ptr<views::corewm::Tooltip>(new views::corewm::TooltipAura))); 879 std::unique_ptr<views::corewm::Tooltip>(new views::corewm::TooltipAura)));
884 AddPreTargetHandler(tooltip_controller_.get()); 880 AddPreTargetHandler(tooltip_controller_.get());
885 881
886 modality_filter_.reset(new SystemModalContainerEventFilter(this)); 882 modality_filter_.reset(new SystemModalContainerEventFilter(this));
887 AddPreTargetHandler(modality_filter_.get()); 883 AddPreTargetHandler(modality_filter_.get());
888 884
889 event_client_.reset(new EventClientImpl); 885 event_client_.reset(new EventClientImpl);
890 886
891 // This controller needs to be set before SetupManagedWindowMode.
892 wallpaper_controller_.reset(new WallpaperController(blocking_pool_));
893
894 session_state_delegate_.reset( 887 session_state_delegate_.reset(
895 wm_shell_->delegate()->CreateSessionStateDelegate()); 888 wm_shell_->delegate()->CreateSessionStateDelegate());
896 wm_shell_->CreatePointerWatcherAdapter(); 889 wm_shell_->CreatePointerWatcherAdapter();
897 890
898 resize_shadow_controller_.reset(new ResizeShadowController()); 891 resize_shadow_controller_.reset(new ResizeShadowController());
899 shadow_controller_.reset(new ::wm::ShadowController(activation_client_)); 892 shadow_controller_.reset(new ::wm::ShadowController(activation_client_));
900 893
901 wm_shell_->SetSystemTrayDelegate( 894 wm_shell_->SetSystemTrayDelegate(
902 base::WrapUnique(wm_shell_->delegate()->CreateSystemTrayDelegate())); 895 base::WrapUnique(wm_shell_->delegate()->CreateSystemTrayDelegate()));
903 896
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
1026 std::unique_ptr<ui::EventTargetIterator> Shell::GetChildIterator() const { 1019 std::unique_ptr<ui::EventTargetIterator> Shell::GetChildIterator() const {
1027 return std::unique_ptr<ui::EventTargetIterator>(); 1020 return std::unique_ptr<ui::EventTargetIterator>();
1028 } 1021 }
1029 1022
1030 ui::EventTargeter* Shell::GetEventTargeter() { 1023 ui::EventTargeter* Shell::GetEventTargeter() {
1031 NOTREACHED(); 1024 NOTREACHED();
1032 return nullptr; 1025 return nullptr;
1033 } 1026 }
1034 1027
1035 } // namespace ash 1028 } // namespace ash
OLDNEW
« no previous file with comments | « ash/shell.h ('k') | ash/shell_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698