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/activation_controller.h" | 5 #include "ash/wm/activation_controller.h" |
6 | 6 |
7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
8 #include "ash/shell_window_ids.h" | 8 #include "ash/shell_window_ids.h" |
9 #include "ash/wm/window_modality_controller.h" | 9 #include "ash/wm/window_modality_controller.h" |
10 #include "ash/wm/window_util.h" | 10 #include "ash/wm/window_util.h" |
11 #include "base/auto_reset.h" | 11 #include "base/auto_reset.h" |
12 #include "ui/aura/client/activation_change_observer.h" | 12 #include "ui/aura/client/activation_change_observer.h" |
13 #include "ui/aura/client/activation_delegate.h" | 13 #include "ui/aura/client/activation_delegate.h" |
14 #include "ui/aura/client/aura_constants.h" | 14 #include "ui/aura/client/aura_constants.h" |
15 #include "ui/aura/env.h" | 15 #include "ui/aura/env.h" |
16 #include "ui/aura/focus_manager.h" | 16 #include "ui/aura/focus_manager.h" |
17 #include "ui/aura/root_window.h" | 17 #include "ui/aura/root_window.h" |
18 #include "ui/aura/window.h" | 18 #include "ui/aura/window.h" |
19 #include "ui/aura/window_delegate.h" | 19 #include "ui/aura/window_delegate.h" |
20 #include "ui/base/ui_base_types.h" | 20 #include "ui/base/ui_base_types.h" |
21 #include "ui/compositor/layer.h" | 21 #include "ui/compositor/layer.h" |
22 #include "ui/views/controls/menu/menu_controller.h" | |
22 | 23 |
23 namespace ash { | 24 namespace ash { |
24 namespace internal { | 25 namespace internal { |
25 namespace { | 26 namespace { |
26 | 27 |
27 // These are the list of container ids of containers which may contain windows | 28 // These are the list of container ids of containers which may contain windows |
28 // that need to be activated in the order that they should be activated. | 29 // that need to be activated in the order that they should be activated. |
29 const int kWindowContainerIds[] = { | 30 const int kWindowContainerIds[] = { |
30 kShellWindowId_LockSystemModalContainer, | 31 kShellWindowId_LockSystemModalContainer, |
31 kShellWindowId_SettingBubbleContainer, | 32 kShellWindowId_SettingBubbleContainer, |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
277 FOR_EACH_OBSERVER(aura::client::ActivationChangeObserver, | 278 FOR_EACH_OBSERVER(aura::client::ActivationChangeObserver, |
278 observers_, | 279 observers_, |
279 OnWindowActivated(window, old_active)); | 280 OnWindowActivated(window, old_active)); |
280 | 281 |
281 // Invoke OnLostActive after we've changed the active window. That way if the | 282 // Invoke OnLostActive after we've changed the active window. That way if the |
282 // delegate queries for active state it doesn't think the window is still | 283 // delegate queries for active state it doesn't think the window is still |
283 // active. | 284 // active. |
284 if (old_active && aura::client::GetActivationDelegate(old_active)) | 285 if (old_active && aura::client::GetActivationDelegate(old_active)) |
285 aura::client::GetActivationDelegate(old_active)->OnLostActive(); | 286 aura::client::GetActivationDelegate(old_active)->OnLostActive(); |
286 | 287 |
288 // Close any open menus (crbug.com/131027). | |
289 views::MenuController* menu_controller = | |
290 views::MenuController::GetActiveInstance(); | |
sky
2012/06/25 23:34:38
I don't like this dependency here. I would rather
flackr
2012/06/26 13:17:16
Sounds good to me. Done.
| |
291 if (menu_controller) | |
292 menu_controller->OnWidgetActivationChanged(); | |
293 | |
287 if (window) { | 294 if (window) { |
288 StackTransientParentsBelowModalWindow(window); | 295 StackTransientParentsBelowModalWindow(window); |
289 window->parent()->StackChildAtTop(window); | 296 window->parent()->StackChildAtTop(window); |
290 if (aura::client::GetActivationDelegate(window)) | 297 if (aura::client::GetActivationDelegate(window)) |
291 aura::client::GetActivationDelegate(window)->OnActivated(); | 298 aura::client::GetActivationDelegate(window)->OnActivated(); |
292 } | 299 } |
293 } | 300 } |
294 | 301 |
295 aura::Window* ActivationController::ActivateNextWindow(aura::Window* window) { | 302 aura::Window* ActivationController::ActivateNextWindow(aura::Window* window) { |
296 aura::Window* next_window = NULL; | 303 aura::Window* next_window = NULL; |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
343 if (*i != ignore && | 350 if (*i != ignore && |
344 CanActivateWindowWithEvent(*i, NULL, CURRENT_VISIBILITY) && | 351 CanActivateWindowWithEvent(*i, NULL, CURRENT_VISIBILITY) && |
345 !wm::IsWindowMinimized(*i)) | 352 !wm::IsWindowMinimized(*i)) |
346 return *i; | 353 return *i; |
347 } | 354 } |
348 return NULL; | 355 return NULL; |
349 } | 356 } |
350 | 357 |
351 } // namespace internal | 358 } // namespace internal |
352 } // namespace ash | 359 } // namespace ash |
OLD | NEW |