OLD | NEW |
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 | 9 |
10 #include "ash/accelerators/focus_manager_factory.h" | 10 #include "ash/accelerators/focus_manager_factory.h" |
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
407 if (priority_root && priority_root->Contains(container)) | 407 if (priority_root && priority_root->Contains(container)) |
408 containers.insert(containers.begin(), container); | 408 containers.insert(containers.begin(), container); |
409 else | 409 else |
410 containers.push_back(container); | 410 containers.push_back(container); |
411 } | 411 } |
412 } | 412 } |
413 return containers; | 413 return containers; |
414 } | 414 } |
415 | 415 |
416 // static | 416 // static |
417 bool Shell::IsLauncherPerDisplayEnabled() { | |
418 CommandLine* command_line = CommandLine::ForCurrentProcess(); | |
419 return !command_line->HasSwitch(switches::kAshDisableLauncherPerDisplay); | |
420 } | |
421 | |
422 // static | |
423 bool Shell::IsForcedMaximizeMode() { | 417 bool Shell::IsForcedMaximizeMode() { |
424 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 418 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
425 return command_line->HasSwitch(switches::kForcedMaximizeMode); | 419 return command_line->HasSwitch(switches::kForcedMaximizeMode); |
426 } | 420 } |
427 | 421 |
428 void Shell::Init() { | 422 void Shell::Init() { |
429 delegate_->PreInit(); | 423 delegate_->PreInit(); |
430 #if defined(OS_CHROMEOS) && defined(USE_X11) | 424 #if defined(OS_CHROMEOS) && defined(USE_X11) |
431 output_configurator_animation_.reset( | 425 output_configurator_animation_.reset( |
432 new internal::OutputConfiguratorAnimation()); | 426 new internal::OutputConfiguratorAnimation()); |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
725 | 719 |
726 void Shell::OnAppTerminating() { | 720 void Shell::OnAppTerminating() { |
727 FOR_EACH_OBSERVER(ShellObserver, observers_, OnAppTerminating()); | 721 FOR_EACH_OBSERVER(ShellObserver, observers_, OnAppTerminating()); |
728 } | 722 } |
729 | 723 |
730 void Shell::OnLockStateChanged(bool locked) { | 724 void Shell::OnLockStateChanged(bool locked) { |
731 FOR_EACH_OBSERVER(ShellObserver, observers_, OnLockStateChanged(locked)); | 725 FOR_EACH_OBSERVER(ShellObserver, observers_, OnLockStateChanged(locked)); |
732 } | 726 } |
733 | 727 |
734 void Shell::CreateLauncher() { | 728 void Shell::CreateLauncher() { |
735 if (IsLauncherPerDisplayEnabled()) { | 729 RootWindowControllerList controllers = GetAllRootWindowControllers(); |
736 RootWindowControllerList controllers = GetAllRootWindowControllers(); | 730 for (RootWindowControllerList::iterator iter = controllers.begin(); |
737 for (RootWindowControllerList::iterator iter = controllers.begin(); | 731 iter != controllers.end(); ++iter) |
738 iter != controllers.end(); ++iter) | 732 (*iter)->shelf()->CreateLauncher(); |
739 (*iter)->shelf()->CreateLauncher(); | |
740 } else { | |
741 GetPrimaryRootWindowController()->shelf()->CreateLauncher(); | |
742 } | |
743 } | 733 } |
744 | 734 |
745 void Shell::ShowLauncher() { | 735 void Shell::ShowLauncher() { |
746 if (IsLauncherPerDisplayEnabled()) { | 736 RootWindowControllerList controllers = GetAllRootWindowControllers(); |
747 RootWindowControllerList controllers = GetAllRootWindowControllers(); | 737 for (RootWindowControllerList::iterator iter = controllers.begin(); |
748 for (RootWindowControllerList::iterator iter = controllers.begin(); | 738 iter != controllers.end(); ++iter) |
749 iter != controllers.end(); ++iter) | 739 (*iter)->ShowLauncher(); |
750 (*iter)->ShowLauncher(); | |
751 } else { | |
752 GetPrimaryRootWindowController()->ShowLauncher(); | |
753 } | |
754 } | 740 } |
755 | 741 |
756 void Shell::AddShellObserver(ShellObserver* observer) { | 742 void Shell::AddShellObserver(ShellObserver* observer) { |
757 observers_.AddObserver(observer); | 743 observers_.AddObserver(observer); |
758 } | 744 } |
759 | 745 |
760 void Shell::RemoveShellObserver(ShellObserver* observer) { | 746 void Shell::RemoveShellObserver(ShellObserver* observer) { |
761 observers_.RemoveObserver(observer); | 747 observers_.RemoveObserver(observer); |
762 } | 748 } |
763 | 749 |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
856 void Shell::InitRootWindowForSecondaryDisplay(aura::RootWindow* root) { | 842 void Shell::InitRootWindowForSecondaryDisplay(aura::RootWindow* root) { |
857 aura::client::SetFocusClient(root, focus_client_.get()); | 843 aura::client::SetFocusClient(root, focus_client_.get()); |
858 internal::RootWindowController* controller = | 844 internal::RootWindowController* controller = |
859 new internal::RootWindowController(root); | 845 new internal::RootWindowController(root); |
860 controller->CreateContainers(); | 846 controller->CreateContainers(); |
861 // Pass false for the |is_first_run_after_boot| parameter so we'll show a | 847 // Pass false for the |is_first_run_after_boot| parameter so we'll show a |
862 // black background on this display instead of trying to mimic the boot splash | 848 // black background on this display instead of trying to mimic the boot splash |
863 // screen. | 849 // screen. |
864 controller->CreateSystemBackground(false); | 850 controller->CreateSystemBackground(false); |
865 InitRootWindowController(controller); | 851 InitRootWindowController(controller); |
866 if (IsLauncherPerDisplayEnabled()) | 852 controller->InitForPrimaryDisplay(); |
867 controller->InitForPrimaryDisplay(); | |
868 controller->root_window_layout()->OnWindowResized(); | 853 controller->root_window_layout()->OnWindowResized(); |
869 desktop_background_controller_->OnRootWindowAdded(root); | 854 desktop_background_controller_->OnRootWindowAdded(root); |
870 high_contrast_controller_->OnRootWindowAdded(root); | 855 high_contrast_controller_->OnRootWindowAdded(root); |
871 root->ShowRootWindow(); | 856 root->ShowRootWindow(); |
872 // Activate new root for testing. | 857 // Activate new root for testing. |
873 active_root_window_ = root; | 858 active_root_window_ = root; |
874 } | 859 } |
875 | 860 |
876 void Shell::DoInitialWorkspaceAnimation() { | 861 void Shell::DoInitialWorkspaceAnimation() { |
877 return GetPrimaryRootWindowController()->workspace_controller()-> | 862 return GetPrimaryRootWindowController()->workspace_controller()-> |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
962 //////////////////////////////////////////////////////////////////////////////// | 947 //////////////////////////////////////////////////////////////////////////////// |
963 // Shell, aura::client::ActivationChangeObserver implementation: | 948 // Shell, aura::client::ActivationChangeObserver implementation: |
964 | 949 |
965 void Shell::OnWindowActivated(aura::Window* gained_active, | 950 void Shell::OnWindowActivated(aura::Window* gained_active, |
966 aura::Window* lost_active) { | 951 aura::Window* lost_active) { |
967 if (gained_active) | 952 if (gained_active) |
968 active_root_window_ = gained_active->GetRootWindow(); | 953 active_root_window_ = gained_active->GetRootWindow(); |
969 } | 954 } |
970 | 955 |
971 } // namespace ash | 956 } // namespace ash |
OLD | NEW |