| 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 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 active_root_window_(NULL), | 201 active_root_window_(NULL), |
| 202 delegate_(delegate), | 202 delegate_(delegate), |
| 203 activation_client_(NULL), | 203 activation_client_(NULL), |
| 204 #if defined(OS_CHROMEOS) && defined(USE_X11) | 204 #if defined(OS_CHROMEOS) && defined(USE_X11) |
| 205 output_configurator_(new chromeos::OutputConfigurator()), | 205 output_configurator_(new chromeos::OutputConfigurator()), |
| 206 #endif // defined(OS_CHROMEOS) | 206 #endif // defined(OS_CHROMEOS) |
| 207 native_cursor_manager_(new AshNativeCursorManager), | 207 native_cursor_manager_(new AshNativeCursorManager), |
| 208 cursor_manager_(scoped_ptr<views::corewm::NativeCursorManager>( | 208 cursor_manager_(scoped_ptr<views::corewm::NativeCursorManager>( |
| 209 native_cursor_manager_)), | 209 native_cursor_manager_)), |
| 210 browser_context_(NULL), | 210 browser_context_(NULL), |
| 211 simulate_modal_window_open_for_testing_(false) { | 211 simulate_modal_window_open_for_testing_(false), |
| 212 touch_hud_projection_enabled_(false) { |
| 212 DCHECK(delegate_.get()); | 213 DCHECK(delegate_.get()); |
| 213 display_manager_.reset(new internal::DisplayManager); | 214 display_manager_.reset(new internal::DisplayManager); |
| 214 mirror_window_controller_.reset(new internal::MirrorWindowController); | 215 mirror_window_controller_.reset(new internal::MirrorWindowController); |
| 215 | 216 |
| 216 ANNOTATE_LEAKING_OBJECT_PTR(screen_); // see crbug.com/156466 | 217 ANNOTATE_LEAKING_OBJECT_PTR(screen_); // see crbug.com/156466 |
| 217 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_ALTERNATE, screen_); | 218 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_ALTERNATE, screen_); |
| 218 if (!gfx::Screen::GetScreenByType(gfx::SCREEN_TYPE_NATIVE)) | 219 if (!gfx::Screen::GetScreenByType(gfx::SCREEN_TYPE_NATIVE)) |
| 219 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, screen_); | 220 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, screen_); |
| 220 display_controller_.reset(new DisplayController); | 221 display_controller_.reset(new DisplayController); |
| 221 #if defined(OS_CHROMEOS) && defined(USE_X11) | 222 #if defined(OS_CHROMEOS) && defined(USE_X11) |
| (...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 842 launcher_model_.reset(new LauncherModel); | 843 launcher_model_.reset(new LauncherModel); |
| 843 // Attempt to create the Launcher. This may fail if the application is not | 844 // Attempt to create the Launcher. This may fail if the application is not |
| 844 // ready to create it yet, in which case the app is responsible for calling | 845 // ready to create it yet, in which case the app is responsible for calling |
| 845 // ash::Shell::CreateLauncher() when ready. | 846 // ash::Shell::CreateLauncher() when ready. |
| 846 launcher_delegate_.reset( | 847 launcher_delegate_.reset( |
| 847 delegate_->CreateLauncherDelegate(launcher_model_.get())); | 848 delegate_->CreateLauncherDelegate(launcher_model_.get())); |
| 848 } | 849 } |
| 849 return launcher_delegate_.get(); | 850 return launcher_delegate_.get(); |
| 850 } | 851 } |
| 851 | 852 |
| 853 void Shell::SetTouchHudProjectionEnabled(bool enabled) { |
| 854 if (touch_hud_projection_enabled_ == enabled) |
| 855 return; |
| 856 |
| 857 RootWindowList roots = GetInstance()->GetAllRootWindows(); |
| 858 for (RootWindowList::iterator iter = roots.begin(); iter != roots.end(); |
| 859 ++iter) { |
| 860 internal::RootWindowController* controller = GetRootWindowController(*iter); |
| 861 if (enabled) |
| 862 controller->EnableTouchHudProjection(); |
| 863 else |
| 864 controller->DisableTouchHudProjection(); |
| 865 } |
| 866 touch_hud_projection_enabled_ = enabled; |
| 867 } |
| 868 |
| 869 void Shell::ToggleTouchHudProjection() { |
| 870 SetTouchHudProjectionEnabled(!touch_hud_projection_enabled_); |
| 871 } |
| 872 |
| 852 void Shell::InitRootWindowForSecondaryDisplay(aura::RootWindow* root) { | 873 void Shell::InitRootWindowForSecondaryDisplay(aura::RootWindow* root) { |
| 853 aura::client::SetFocusClient(root, focus_client_.get()); | 874 aura::client::SetFocusClient(root, focus_client_.get()); |
| 854 internal::RootWindowController* controller = | 875 internal::RootWindowController* controller = |
| 855 new internal::RootWindowController(root); | 876 new internal::RootWindowController(root); |
| 856 controller->CreateContainers(); | 877 controller->CreateContainers(); |
| 857 // Pass false for the |is_first_run_after_boot| parameter so we'll show a | 878 // Pass false for the |is_first_run_after_boot| parameter so we'll show a |
| 858 // black background on this display instead of trying to mimic the boot splash | 879 // black background on this display instead of trying to mimic the boot splash |
| 859 // screen. | 880 // screen. |
| 860 controller->CreateSystemBackground(false); | 881 controller->CreateSystemBackground(false); |
| 861 InitRootWindowController(controller); | 882 InitRootWindowController(controller); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 901 | 922 |
| 902 if (nested_dispatcher_controller_) { | 923 if (nested_dispatcher_controller_) { |
| 903 aura::client::SetDispatcherClient(root_window, | 924 aura::client::SetDispatcherClient(root_window, |
| 904 nested_dispatcher_controller_.get()); | 925 nested_dispatcher_controller_.get()); |
| 905 } | 926 } |
| 906 if (user_action_client_) | 927 if (user_action_client_) |
| 907 aura::client::SetUserActionClient(root_window, user_action_client_.get()); | 928 aura::client::SetUserActionClient(root_window, user_action_client_.get()); |
| 908 | 929 |
| 909 root_window->SetCursor(ui::kCursorPointer); | 930 root_window->SetCursor(ui::kCursorPointer); |
| 910 controller->InitLayoutManagers(); | 931 controller->InitLayoutManagers(); |
| 932 controller->InitTouchHuds(); |
| 911 | 933 |
| 912 // TODO(oshima): Move the instance to RootWindowController when | 934 // TODO(oshima): Move the instance to RootWindowController when |
| 913 // the extended desktop is enabled by default. | 935 // the extended desktop is enabled by default. |
| 914 internal::AlwaysOnTopController* always_on_top_controller = | 936 internal::AlwaysOnTopController* always_on_top_controller = |
| 915 new internal::AlwaysOnTopController; | 937 new internal::AlwaysOnTopController; |
| 916 always_on_top_controller->SetAlwaysOnTopContainer( | 938 always_on_top_controller->SetAlwaysOnTopContainer( |
| 917 root_window->GetChildById(internal::kShellWindowId_AlwaysOnTopContainer)); | 939 root_window->GetChildById(internal::kShellWindowId_AlwaysOnTopContainer)); |
| 918 root_window->SetProperty(internal::kAlwaysOnTopControllerKey, | 940 root_window->SetProperty(internal::kAlwaysOnTopControllerKey, |
| 919 always_on_top_controller); | 941 always_on_top_controller); |
| 920 if (GetPrimaryRootWindowController()->GetSystemModalLayoutManager(NULL)-> | 942 if (GetPrimaryRootWindowController()->GetSystemModalLayoutManager(NULL)-> |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 957 //////////////////////////////////////////////////////////////////////////////// | 979 //////////////////////////////////////////////////////////////////////////////// |
| 958 // Shell, aura::client::ActivationChangeObserver implementation: | 980 // Shell, aura::client::ActivationChangeObserver implementation: |
| 959 | 981 |
| 960 void Shell::OnWindowActivated(aura::Window* gained_active, | 982 void Shell::OnWindowActivated(aura::Window* gained_active, |
| 961 aura::Window* lost_active) { | 983 aura::Window* lost_active) { |
| 962 if (gained_active) | 984 if (gained_active) |
| 963 active_root_window_ = gained_active->GetRootWindow(); | 985 active_root_window_ = gained_active->GetRootWindow(); |
| 964 } | 986 } |
| 965 | 987 |
| 966 } // namespace ash | 988 } // namespace ash |
| OLD | NEW |