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/wm/ash_activation_controller.h" | 5 #include "ash/wm/ash_activation_controller.h" |
6 | 6 |
7 #include "ash/launcher/launcher.h" | 7 #include "ash/launcher/launcher.h" |
8 #include "ash/root_window_controller.h" | 8 #include "ash/root_window_controller.h" |
| 9 #include "ash/shelf/shelf_widget.h" |
9 #include "ash/shell.h" | 10 #include "ash/shell.h" |
10 #include "ash/shell_delegate.h" | 11 #include "ash/shell_delegate.h" |
11 #include "ash/wm/activation_controller.h" | 12 #include "ash/wm/activation_controller.h" |
12 #include "ash/wm/property_util.h" | 13 #include "ash/wm/property_util.h" |
13 #include "ash/wm/window_util.h" | 14 #include "ash/wm/window_util.h" |
14 #include "ash/wm/workspace_controller.h" | 15 #include "ash/wm/workspace_controller.h" |
15 #include "ui/views/corewm/window_modality_controller.h" | 16 #include "ui/views/corewm/window_modality_controller.h" |
16 #include "ui/views/widget/widget.h" | 17 #include "ui/views/widget/widget.h" |
17 | 18 |
18 namespace ash { | 19 namespace ash { |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 aura::Window* AshActivationController::PrepareToActivateLauncher() { | 88 aura::Window* AshActivationController::PrepareToActivateLauncher() { |
88 // If workspace controller is not available, then it means that the root | 89 // If workspace controller is not available, then it means that the root |
89 // window is being destroyed. We can't activate any window then. | 90 // window is being destroyed. We can't activate any window then. |
90 if (!GetRootWindowController( | 91 if (!GetRootWindowController( |
91 Shell::GetActiveRootWindow())->workspace_controller()) { | 92 Shell::GetActiveRootWindow())->workspace_controller()) { |
92 return NULL; | 93 return NULL; |
93 } | 94 } |
94 // Fallback to a launcher only when Spoken feedback is enabled. | 95 // Fallback to a launcher only when Spoken feedback is enabled. |
95 if (!Shell::GetInstance()->delegate()->IsSpokenFeedbackEnabled()) | 96 if (!Shell::GetInstance()->delegate()->IsSpokenFeedbackEnabled()) |
96 return NULL; | 97 return NULL; |
97 Launcher* launcher; | 98 ShelfWidget* shelf = GetRootWindowController( |
98 if (Shell::IsLauncherPerDisplayEnabled()) { | 99 Shell::IsLauncherPerDisplayEnabled() ? |
99 launcher = GetRootWindowController( | 100 Shell::GetActiveRootWindow() : |
100 Shell::GetActiveRootWindow())->launcher(); | 101 Shell::GetPrimaryRootWindow())->shelf(); |
101 } else { | 102 // Launcher's window may be already destroyed in shutting down process. |
102 launcher = Launcher::ForPrimaryDisplay(); | 103 if (!shelf) |
103 } | |
104 // Launcher is not always available, eg. not in the login screen. | |
105 if (!launcher) | |
106 return NULL; | 104 return NULL; |
107 views::Widget* launcher_widget = launcher->widget(); | |
108 // Launcher's window may be already destroyed in shutting down process. | |
109 if (!launcher_widget) | |
110 return NULL; | |
111 aura::Window* launcher_window = launcher_widget->GetNativeWindow(); | |
112 // Notify launcher to allow activation via CanActivate(). | 105 // Notify launcher to allow activation via CanActivate(). |
113 launcher->WillActivateAsFallback(); | 106 shelf->WillActivateAsFallback(); |
114 return launcher_window; | 107 return shelf->GetNativeWindow(); |
115 } | 108 } |
116 | 109 |
117 } // namespace internal | 110 } // namespace internal |
118 } // namespace ash | 111 } // namespace ash |
OLD | NEW |