| 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 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 active_root_window_(NULL), | 204 active_root_window_(NULL), |
| 205 delegate_(delegate), | 205 delegate_(delegate), |
| 206 activation_client_(NULL), | 206 activation_client_(NULL), |
| 207 #if defined(OS_CHROMEOS) && defined(USE_X11) | 207 #if defined(OS_CHROMEOS) && defined(USE_X11) |
| 208 output_configurator_(new chromeos::OutputConfigurator()), | 208 output_configurator_(new chromeos::OutputConfigurator()), |
| 209 #endif // defined(OS_CHROMEOS) | 209 #endif // defined(OS_CHROMEOS) |
| 210 native_cursor_manager_(new AshNativeCursorManager), | 210 native_cursor_manager_(new AshNativeCursorManager), |
| 211 cursor_manager_(scoped_ptr<views::corewm::NativeCursorManager>( | 211 cursor_manager_(scoped_ptr<views::corewm::NativeCursorManager>( |
| 212 native_cursor_manager_)), | 212 native_cursor_manager_)), |
| 213 browser_context_(NULL), | 213 browser_context_(NULL), |
| 214 simulate_modal_window_open_for_testing_(false) { | 214 simulate_modal_window_open_for_testing_(false), |
| 215 is_touch_hud_projection_enabled_(false) { |
| 215 DCHECK(delegate_.get()); | 216 DCHECK(delegate_.get()); |
| 216 display_manager_.reset(new internal::DisplayManager); | 217 display_manager_.reset(new internal::DisplayManager); |
| 217 mirror_window_controller_.reset(new internal::MirrorWindowController); | 218 mirror_window_controller_.reset(new internal::MirrorWindowController); |
| 218 | 219 |
| 219 ANNOTATE_LEAKING_OBJECT_PTR(screen_); // see crbug.com/156466 | 220 ANNOTATE_LEAKING_OBJECT_PTR(screen_); // see crbug.com/156466 |
| 220 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_ALTERNATE, screen_); | 221 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_ALTERNATE, screen_); |
| 221 if (!gfx::Screen::GetScreenByType(gfx::SCREEN_TYPE_NATIVE)) | 222 if (!gfx::Screen::GetScreenByType(gfx::SCREEN_TYPE_NATIVE)) |
| 222 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, screen_); | 223 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, screen_); |
| 223 display_controller_.reset(new DisplayController); | 224 display_controller_.reset(new DisplayController); |
| 224 #if defined(OS_CHROMEOS) && defined(USE_X11) | 225 #if defined(OS_CHROMEOS) && defined(USE_X11) |
| (...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 853 launcher_model_.reset(new LauncherModel); | 854 launcher_model_.reset(new LauncherModel); |
| 854 // Attempt to create the Launcher. This may fail if the application is not | 855 // Attempt to create the Launcher. This may fail if the application is not |
| 855 // ready to create it yet, in which case the app is responsible for calling | 856 // ready to create it yet, in which case the app is responsible for calling |
| 856 // ash::Shell::CreateLauncher() when ready. | 857 // ash::Shell::CreateLauncher() when ready. |
| 857 launcher_delegate_.reset( | 858 launcher_delegate_.reset( |
| 858 delegate_->CreateLauncherDelegate(launcher_model_.get())); | 859 delegate_->CreateLauncherDelegate(launcher_model_.get())); |
| 859 } | 860 } |
| 860 return launcher_delegate_.get(); | 861 return launcher_delegate_.get(); |
| 861 } | 862 } |
| 862 | 863 |
| 864 void Shell::SetTouchHudProjectionEnabled(bool enabled) { |
| 865 if (is_touch_hud_projection_enabled_ == enabled) |
| 866 return; |
| 867 |
| 868 RootWindowList roots = GetInstance()->GetAllRootWindows(); |
| 869 for (RootWindowList::iterator iter = roots.begin(); iter != roots.end(); |
| 870 ++iter) { |
| 871 internal::RootWindowController* controller = GetRootWindowController(*iter); |
| 872 if (enabled) |
| 873 controller->EnableTouchHudProjection(); |
| 874 else |
| 875 controller->DisableTouchHudProjection(); |
| 876 } |
| 877 is_touch_hud_projection_enabled_ = enabled; |
| 878 } |
| 879 |
| 863 void Shell::InitRootWindowForSecondaryDisplay(aura::RootWindow* root) { | 880 void Shell::InitRootWindowForSecondaryDisplay(aura::RootWindow* root) { |
| 864 aura::client::SetFocusClient(root, focus_client_.get()); | 881 aura::client::SetFocusClient(root, focus_client_.get()); |
| 865 internal::RootWindowController* controller = | 882 internal::RootWindowController* controller = |
| 866 new internal::RootWindowController(root); | 883 new internal::RootWindowController(root); |
| 867 controller->CreateContainers(); | 884 controller->CreateContainers(); |
| 868 // Pass false for the |is_first_run_after_boot| parameter so we'll show a | 885 // Pass false for the |is_first_run_after_boot| parameter so we'll show a |
| 869 // black background on this display instead of trying to mimic the boot splash | 886 // black background on this display instead of trying to mimic the boot splash |
| 870 // screen. | 887 // screen. |
| 871 controller->CreateSystemBackground(false); | 888 controller->CreateSystemBackground(false); |
| 872 InitRootWindowController(controller); | 889 InitRootWindowController(controller); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 912 | 929 |
| 913 if (nested_dispatcher_controller_) { | 930 if (nested_dispatcher_controller_) { |
| 914 aura::client::SetDispatcherClient(root_window, | 931 aura::client::SetDispatcherClient(root_window, |
| 915 nested_dispatcher_controller_.get()); | 932 nested_dispatcher_controller_.get()); |
| 916 } | 933 } |
| 917 if (user_action_client_) | 934 if (user_action_client_) |
| 918 aura::client::SetUserActionClient(root_window, user_action_client_.get()); | 935 aura::client::SetUserActionClient(root_window, user_action_client_.get()); |
| 919 | 936 |
| 920 root_window->SetCursor(ui::kCursorPointer); | 937 root_window->SetCursor(ui::kCursorPointer); |
| 921 controller->InitLayoutManagers(); | 938 controller->InitLayoutManagers(); |
| 939 controller->InitTouchHuds(); |
| 922 | 940 |
| 923 // TODO(oshima): Move the instance to RootWindowController when | 941 // TODO(oshima): Move the instance to RootWindowController when |
| 924 // the extended desktop is enabled by default. | 942 // the extended desktop is enabled by default. |
| 925 internal::AlwaysOnTopController* always_on_top_controller = | 943 internal::AlwaysOnTopController* always_on_top_controller = |
| 926 new internal::AlwaysOnTopController; | 944 new internal::AlwaysOnTopController; |
| 927 always_on_top_controller->SetAlwaysOnTopContainer( | 945 always_on_top_controller->SetAlwaysOnTopContainer( |
| 928 root_window->GetChildById(internal::kShellWindowId_AlwaysOnTopContainer)); | 946 root_window->GetChildById(internal::kShellWindowId_AlwaysOnTopContainer)); |
| 929 root_window->SetProperty(internal::kAlwaysOnTopControllerKey, | 947 root_window->SetProperty(internal::kAlwaysOnTopControllerKey, |
| 930 always_on_top_controller); | 948 always_on_top_controller); |
| 931 if (GetPrimaryRootWindowController()->GetSystemModalLayoutManager(NULL)-> | 949 if (GetPrimaryRootWindowController()->GetSystemModalLayoutManager(NULL)-> |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 968 //////////////////////////////////////////////////////////////////////////////// | 986 //////////////////////////////////////////////////////////////////////////////// |
| 969 // Shell, aura::client::ActivationChangeObserver implementation: | 987 // Shell, aura::client::ActivationChangeObserver implementation: |
| 970 | 988 |
| 971 void Shell::OnWindowActivated(aura::Window* gained_active, | 989 void Shell::OnWindowActivated(aura::Window* gained_active, |
| 972 aura::Window* lost_active) { | 990 aura::Window* lost_active) { |
| 973 if (gained_active) | 991 if (gained_active) |
| 974 active_root_window_ = gained_active->GetRootWindow(); | 992 active_root_window_ = gained_active->GetRootWindow(); |
| 975 } | 993 } |
| 976 | 994 |
| 977 } // namespace ash | 995 } // namespace ash |
| OLD | NEW |