| 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/root_window_controller.h" |     5 #include "ash/root_window_controller.h" | 
|     6  |     6  | 
|     7 #include <queue> |     7 #include <queue> | 
|     8 #include <vector> |     8 #include <vector> | 
|     9  |     9  | 
|    10 #include "ash/ash_constants.h" |    10 #include "ash/ash_constants.h" | 
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|    59 #include "ui/base/hit_test.h" |    59 #include "ui/base/hit_test.h" | 
|    60 #include "ui/base/models/menu_model.h" |    60 #include "ui/base/models/menu_model.h" | 
|    61 #include "ui/gfx/display.h" |    61 #include "ui/gfx/display.h" | 
|    62 #include "ui/gfx/screen.h" |    62 #include "ui/gfx/screen.h" | 
|    63 #include "ui/keyboard/keyboard_controller.h" |    63 #include "ui/keyboard/keyboard_controller.h" | 
|    64 #include "ui/keyboard/keyboard_util.h" |    64 #include "ui/keyboard/keyboard_util.h" | 
|    65 #include "ui/views/controls/menu/menu_runner.h" |    65 #include "ui/views/controls/menu/menu_runner.h" | 
|    66 #include "ui/views/view_model.h" |    66 #include "ui/views/view_model.h" | 
|    67 #include "ui/views/view_model_utils.h" |    67 #include "ui/views/view_model_utils.h" | 
|    68 #include "ui/wm/core/capture_controller.h" |    68 #include "ui/wm/core/capture_controller.h" | 
 |    69 #include "ui/wm/core/easy_resize_window_targeter.h" | 
|    69 #include "ui/wm/core/visibility_controller.h" |    70 #include "ui/wm/core/visibility_controller.h" | 
|    70 #include "ui/wm/core/window_util.h" |    71 #include "ui/wm/core/window_util.h" | 
|    71 #include "ui/wm/public/easy_resize_window_targeter.h" |  | 
|    72 #include "ui/wm/public/window_types.h" |    72 #include "ui/wm/public/window_types.h" | 
|    73  |    73  | 
|    74 #if defined(OS_CHROMEOS) |    74 #if defined(OS_CHROMEOS) | 
|    75 #include "ash/wm/boot_splash_screen_chromeos.h" |    75 #include "ash/wm/boot_splash_screen_chromeos.h" | 
|    76 #endif |    76 #endif | 
|    77  |    77  | 
|    78 namespace ash { |    78 namespace ash { | 
|    79 namespace { |    79 namespace { | 
|    80  |    80  | 
|    81 #if defined(OS_CHROMEOS) |    81 #if defined(OS_CHROMEOS) | 
| (...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   593            (*iter)->type() == ui::wm::WINDOW_TYPE_PANEL) && |   593            (*iter)->type() == ui::wm::WINDOW_TYPE_PANEL) && | 
|   594           (*iter)->layer()->GetTargetVisibility()) { |   594           (*iter)->layer()->GetTargetVisibility()) { | 
|   595         topmost_window = *iter; |   595         topmost_window = *iter; | 
|   596         break; |   596         break; | 
|   597       } |   597       } | 
|   598     } |   598     } | 
|   599   } |   599   } | 
|   600   while (topmost_window) { |   600   while (topmost_window) { | 
|   601     if (wm::GetWindowState(topmost_window)->IsFullscreen()) |   601     if (wm::GetWindowState(topmost_window)->IsFullscreen()) | 
|   602       return topmost_window; |   602       return topmost_window; | 
|   603     topmost_window = views::corewm::GetTransientParent(topmost_window); |   603     topmost_window = ::wm::GetTransientParent(topmost_window); | 
|   604   } |   604   } | 
|   605   return NULL; |   605   return NULL; | 
|   606 } |   606 } | 
|   607  |   607  | 
|   608 void RootWindowController::ActivateKeyboard( |   608 void RootWindowController::ActivateKeyboard( | 
|   609     keyboard::KeyboardController* keyboard_controller) { |   609     keyboard::KeyboardController* keyboard_controller) { | 
|   610   if (!keyboard::IsKeyboardEnabled() || |   610   if (!keyboard::IsKeyboardEnabled() || | 
|   611       GetContainer(kShellWindowId_VirtualKeyboardContainer)) { |   611       GetContainer(kShellWindowId_VirtualKeyboardContainer)) { | 
|   612     return; |   612     return; | 
|   613   } |   613   } | 
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   661       root_window_layout_(NULL), |   661       root_window_layout_(NULL), | 
|   662       docked_layout_manager_(NULL), |   662       docked_layout_manager_(NULL), | 
|   663       panel_layout_manager_(NULL), |   663       panel_layout_manager_(NULL), | 
|   664       touch_hud_debug_(NULL), |   664       touch_hud_debug_(NULL), | 
|   665       touch_hud_projection_(NULL) { |   665       touch_hud_projection_(NULL) { | 
|   666   GetRootWindowSettings(root_window())->controller = this; |   666   GetRootWindowSettings(root_window())->controller = this; | 
|   667   screen_dimmer_.reset(new ScreenDimmer(root_window())); |   667   screen_dimmer_.reset(new ScreenDimmer(root_window())); | 
|   668  |   668  | 
|   669   stacking_controller_.reset(new StackingController); |   669   stacking_controller_.reset(new StackingController); | 
|   670   aura::client::SetWindowTreeClient(root_window(), stacking_controller_.get()); |   670   aura::client::SetWindowTreeClient(root_window(), stacking_controller_.get()); | 
|   671   capture_client_.reset( |   671   capture_client_.reset(new ::wm::ScopedCaptureClient(root_window())); | 
|   672       new views::corewm::ScopedCaptureClient(root_window())); |  | 
|   673 } |   672 } | 
|   674  |   673  | 
|   675 void RootWindowController::Init(RootWindowType root_window_type, |   674 void RootWindowController::Init(RootWindowType root_window_type, | 
|   676                                 bool first_run_after_boot) { |   675                                 bool first_run_after_boot) { | 
|   677   Shell* shell = Shell::GetInstance(); |   676   Shell* shell = Shell::GetInstance(); | 
|   678   shell->InitRootWindow(root_window()); |   677   shell->InitRootWindow(root_window()); | 
|   679  |   678  | 
|   680   host_->SetCursor(ui::kCursorPointer); |   679   host_->SetCursor(ui::kCursorPointer); | 
|   681   CreateContainersInRootWindow(root_window()); |   680   CreateContainersInRootWindow(root_window()); | 
|   682  |   681  | 
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   810  |   809  | 
|   811   // The desktop background container is not part of the lock animation, so it |   810   // The desktop background container is not part of the lock animation, so it | 
|   812   // is not included in those animate groups. |   811   // is not included in those animate groups. | 
|   813   // When screen is locked desktop background is moved to lock screen background |   812   // When screen is locked desktop background is moved to lock screen background | 
|   814   // container (moved back on unlock). We want to make sure that there's an |   813   // container (moved back on unlock). We want to make sure that there's an | 
|   815   // opaque layer occluding the non-lock-screen layers. |   814   // opaque layer occluding the non-lock-screen layers. | 
|   816   aura::Window* desktop_background_container = CreateContainer( |   815   aura::Window* desktop_background_container = CreateContainer( | 
|   817       kShellWindowId_DesktopBackgroundContainer, |   816       kShellWindowId_DesktopBackgroundContainer, | 
|   818       "DesktopBackgroundContainer", |   817       "DesktopBackgroundContainer", | 
|   819       root_window); |   818       root_window); | 
|   820   views::corewm::SetChildWindowVisibilityChangesAnimated( |   819   ::wm::SetChildWindowVisibilityChangesAnimated(desktop_background_container); | 
|   821       desktop_background_container); |  | 
|   822  |   820  | 
|   823   aura::Window* non_lock_screen_containers = CreateContainer( |   821   aura::Window* non_lock_screen_containers = CreateContainer( | 
|   824       kShellWindowId_NonLockScreenContainersContainer, |   822       kShellWindowId_NonLockScreenContainersContainer, | 
|   825       "NonLockScreenContainersContainer", |   823       "NonLockScreenContainersContainer", | 
|   826       root_window); |   824       root_window); | 
|   827  |   825  | 
|   828   aura::Window* lock_background_containers = CreateContainer( |   826   aura::Window* lock_background_containers = CreateContainer( | 
|   829       kShellWindowId_LockScreenBackgroundContainer, |   827       kShellWindowId_LockScreenBackgroundContainer, | 
|   830       "LockScreenBackgroundContainer", |   828       "LockScreenBackgroundContainer", | 
|   831       root_window); |   829       root_window); | 
|   832   views::corewm::SetChildWindowVisibilityChangesAnimated( |   830   ::wm::SetChildWindowVisibilityChangesAnimated(lock_background_containers); | 
|   833       lock_background_containers); |  | 
|   834  |   831  | 
|   835   aura::Window* lock_screen_containers = CreateContainer( |   832   aura::Window* lock_screen_containers = CreateContainer( | 
|   836       kShellWindowId_LockScreenContainersContainer, |   833       kShellWindowId_LockScreenContainersContainer, | 
|   837       "LockScreenContainersContainer", |   834       "LockScreenContainersContainer", | 
|   838       root_window); |   835       root_window); | 
|   839   aura::Window* lock_screen_related_containers = CreateContainer( |   836   aura::Window* lock_screen_related_containers = CreateContainer( | 
|   840       kShellWindowId_LockScreenRelatedContainersContainer, |   837       kShellWindowId_LockScreenRelatedContainersContainer, | 
|   841       "LockScreenRelatedContainersContainer", |   838       "LockScreenRelatedContainersContainer", | 
|   842       root_window); |   839       root_window); | 
|   843  |   840  | 
|   844   CreateContainer(kShellWindowId_UnparentedControlContainer, |   841   CreateContainer(kShellWindowId_UnparentedControlContainer, | 
|   845                   "UnparentedControlContainer", |   842                   "UnparentedControlContainer", | 
|   846                   non_lock_screen_containers); |   843                   non_lock_screen_containers); | 
|   847  |   844  | 
|   848   aura::Window* default_container = CreateContainer( |   845   aura::Window* default_container = CreateContainer( | 
|   849       kShellWindowId_DefaultContainer, |   846       kShellWindowId_DefaultContainer, | 
|   850       "DefaultContainer", |   847       "DefaultContainer", | 
|   851       non_lock_screen_containers); |   848       non_lock_screen_containers); | 
|   852   views::corewm::SetChildWindowVisibilityChangesAnimated(default_container); |   849   ::wm::SetChildWindowVisibilityChangesAnimated(default_container); | 
|   853   SetUsesScreenCoordinates(default_container); |   850   SetUsesScreenCoordinates(default_container); | 
|   854   SetUsesEasyResizeTargeter(default_container); |   851   SetUsesEasyResizeTargeter(default_container); | 
|   855  |   852  | 
|   856   aura::Window* always_on_top_container = CreateContainer( |   853   aura::Window* always_on_top_container = CreateContainer( | 
|   857       kShellWindowId_AlwaysOnTopContainer, |   854       kShellWindowId_AlwaysOnTopContainer, | 
|   858       "AlwaysOnTopContainer", |   855       "AlwaysOnTopContainer", | 
|   859       non_lock_screen_containers); |   856       non_lock_screen_containers); | 
|   860   views::corewm::SetChildWindowVisibilityChangesAnimated( |   857   ::wm::SetChildWindowVisibilityChangesAnimated(always_on_top_container); | 
|   861       always_on_top_container); |  | 
|   862   SetUsesScreenCoordinates(always_on_top_container); |   858   SetUsesScreenCoordinates(always_on_top_container); | 
|   863  |   859  | 
|   864   aura::Window* docked_container = CreateContainer( |   860   aura::Window* docked_container = CreateContainer( | 
|   865       kShellWindowId_DockedContainer, |   861       kShellWindowId_DockedContainer, | 
|   866       "DockedContainer", |   862       "DockedContainer", | 
|   867       non_lock_screen_containers); |   863       non_lock_screen_containers); | 
|   868   views::corewm::SetChildWindowVisibilityChangesAnimated(docked_container); |   864   ::wm::SetChildWindowVisibilityChangesAnimated(docked_container); | 
|   869   SetUsesScreenCoordinates(docked_container); |   865   SetUsesScreenCoordinates(docked_container); | 
|   870   SetUsesEasyResizeTargeter(docked_container); |   866   SetUsesEasyResizeTargeter(docked_container); | 
|   871  |   867  | 
|   872   aura::Window* shelf_container = |   868   aura::Window* shelf_container = | 
|   873       CreateContainer(kShellWindowId_ShelfContainer, |   869       CreateContainer(kShellWindowId_ShelfContainer, | 
|   874                       "ShelfContainer", |   870                       "ShelfContainer", | 
|   875                       non_lock_screen_containers); |   871                       non_lock_screen_containers); | 
|   876   SetUsesScreenCoordinates(shelf_container); |   872   SetUsesScreenCoordinates(shelf_container); | 
|   877   DescendantShouldStayInSameRootWindow(shelf_container); |   873   DescendantShouldStayInSameRootWindow(shelf_container); | 
|   878  |   874  | 
| (...skipping 16 matching lines...) Expand all  Loading... | 
|   895                       "AppListContainer", |   891                       "AppListContainer", | 
|   896                       non_lock_screen_containers); |   892                       non_lock_screen_containers); | 
|   897   SetUsesScreenCoordinates(app_list_container); |   893   SetUsesScreenCoordinates(app_list_container); | 
|   898  |   894  | 
|   899   aura::Window* modal_container = CreateContainer( |   895   aura::Window* modal_container = CreateContainer( | 
|   900       kShellWindowId_SystemModalContainer, |   896       kShellWindowId_SystemModalContainer, | 
|   901       "SystemModalContainer", |   897       "SystemModalContainer", | 
|   902       non_lock_screen_containers); |   898       non_lock_screen_containers); | 
|   903   modal_container->SetLayoutManager( |   899   modal_container->SetLayoutManager( | 
|   904       new SystemModalContainerLayoutManager(modal_container)); |   900       new SystemModalContainerLayoutManager(modal_container)); | 
|   905   views::corewm::SetChildWindowVisibilityChangesAnimated(modal_container); |   901   ::wm::SetChildWindowVisibilityChangesAnimated(modal_container); | 
|   906   SetUsesScreenCoordinates(modal_container); |   902   SetUsesScreenCoordinates(modal_container); | 
|   907   SetUsesEasyResizeTargeter(modal_container); |   903   SetUsesEasyResizeTargeter(modal_container); | 
|   908  |   904  | 
|   909   aura::Window* input_method_container = CreateContainer( |   905   aura::Window* input_method_container = CreateContainer( | 
|   910       kShellWindowId_InputMethodContainer, |   906       kShellWindowId_InputMethodContainer, | 
|   911       "InputMethodContainer", |   907       "InputMethodContainer", | 
|   912       non_lock_screen_containers); |   908       non_lock_screen_containers); | 
|   913   views::corewm::SetChildWindowVisibilityChangesAnimated( |   909   ::wm::SetChildWindowVisibilityChangesAnimated(input_method_container); | 
|   914       input_method_container); |  | 
|   915   SetUsesScreenCoordinates(input_method_container); |   910   SetUsesScreenCoordinates(input_method_container); | 
|   916  |   911  | 
|   917   // TODO(beng): Figure out if we can make this use |   912   // TODO(beng): Figure out if we can make this use | 
|   918   // SystemModalContainerEventFilter instead of stops_event_propagation. |   913   // SystemModalContainerEventFilter instead of stops_event_propagation. | 
|   919   aura::Window* lock_container = CreateContainer( |   914   aura::Window* lock_container = CreateContainer( | 
|   920       kShellWindowId_LockScreenContainer, |   915       kShellWindowId_LockScreenContainer, | 
|   921       "LockScreenContainer", |   916       "LockScreenContainer", | 
|   922       lock_screen_containers); |   917       lock_screen_containers); | 
|   923   lock_container->SetLayoutManager( |   918   lock_container->SetLayoutManager( | 
|   924       new internal::WorkspaceLayoutManager(lock_container)); |   919       new internal::WorkspaceLayoutManager(lock_container)); | 
|   925   SetUsesScreenCoordinates(lock_container); |   920   SetUsesScreenCoordinates(lock_container); | 
|   926   // TODO(beng): stopsevents |   921   // TODO(beng): stopsevents | 
|   927  |   922  | 
|   928   aura::Window* lock_modal_container = CreateContainer( |   923   aura::Window* lock_modal_container = CreateContainer( | 
|   929       kShellWindowId_LockSystemModalContainer, |   924       kShellWindowId_LockSystemModalContainer, | 
|   930       "LockSystemModalContainer", |   925       "LockSystemModalContainer", | 
|   931       lock_screen_containers); |   926       lock_screen_containers); | 
|   932   lock_modal_container->SetLayoutManager( |   927   lock_modal_container->SetLayoutManager( | 
|   933       new SystemModalContainerLayoutManager(lock_modal_container)); |   928       new SystemModalContainerLayoutManager(lock_modal_container)); | 
|   934   views::corewm::SetChildWindowVisibilityChangesAnimated(lock_modal_container); |   929   ::wm::SetChildWindowVisibilityChangesAnimated(lock_modal_container); | 
|   935   SetUsesScreenCoordinates(lock_modal_container); |   930   SetUsesScreenCoordinates(lock_modal_container); | 
|   936   SetUsesEasyResizeTargeter(lock_modal_container); |   931   SetUsesEasyResizeTargeter(lock_modal_container); | 
|   937  |   932  | 
|   938   aura::Window* status_container = |   933   aura::Window* status_container = | 
|   939       CreateContainer(kShellWindowId_StatusContainer, |   934       CreateContainer(kShellWindowId_StatusContainer, | 
|   940                       "StatusContainer", |   935                       "StatusContainer", | 
|   941                       lock_screen_related_containers); |   936                       lock_screen_related_containers); | 
|   942   SetUsesScreenCoordinates(status_container); |   937   SetUsesScreenCoordinates(status_container); | 
|   943   DescendantShouldStayInSameRootWindow(status_container); |   938   DescendantShouldStayInSameRootWindow(status_container); | 
|   944  |   939  | 
|   945   aura::Window* settings_bubble_container = CreateContainer( |   940   aura::Window* settings_bubble_container = CreateContainer( | 
|   946       kShellWindowId_SettingBubbleContainer, |   941       kShellWindowId_SettingBubbleContainer, | 
|   947       "SettingBubbleContainer", |   942       "SettingBubbleContainer", | 
|   948       lock_screen_related_containers); |   943       lock_screen_related_containers); | 
|   949   views::corewm::SetChildWindowVisibilityChangesAnimated( |   944   ::wm::SetChildWindowVisibilityChangesAnimated(settings_bubble_container); | 
|   950       settings_bubble_container); |  | 
|   951   SetUsesScreenCoordinates(settings_bubble_container); |   945   SetUsesScreenCoordinates(settings_bubble_container); | 
|   952   DescendantShouldStayInSameRootWindow(settings_bubble_container); |   946   DescendantShouldStayInSameRootWindow(settings_bubble_container); | 
|   953  |   947  | 
|   954   aura::Window* menu_container = CreateContainer( |   948   aura::Window* menu_container = CreateContainer( | 
|   955       kShellWindowId_MenuContainer, |   949       kShellWindowId_MenuContainer, | 
|   956       "MenuContainer", |   950       "MenuContainer", | 
|   957       lock_screen_related_containers); |   951       lock_screen_related_containers); | 
|   958   views::corewm::SetChildWindowVisibilityChangesAnimated(menu_container); |   952   ::wm::SetChildWindowVisibilityChangesAnimated(menu_container); | 
|   959   SetUsesScreenCoordinates(menu_container); |   953   SetUsesScreenCoordinates(menu_container); | 
|   960  |   954  | 
|   961   aura::Window* drag_drop_container = CreateContainer( |   955   aura::Window* drag_drop_container = CreateContainer( | 
|   962       kShellWindowId_DragImageAndTooltipContainer, |   956       kShellWindowId_DragImageAndTooltipContainer, | 
|   963       "DragImageAndTooltipContainer", |   957       "DragImageAndTooltipContainer", | 
|   964       lock_screen_related_containers); |   958       lock_screen_related_containers); | 
|   965   views::corewm::SetChildWindowVisibilityChangesAnimated(drag_drop_container); |   959   ::wm::SetChildWindowVisibilityChangesAnimated(drag_drop_container); | 
|   966   SetUsesScreenCoordinates(drag_drop_container); |   960   SetUsesScreenCoordinates(drag_drop_container); | 
|   967  |   961  | 
|   968   aura::Window* overlay_container = CreateContainer( |   962   aura::Window* overlay_container = CreateContainer( | 
|   969       kShellWindowId_OverlayContainer, |   963       kShellWindowId_OverlayContainer, | 
|   970       "OverlayContainer", |   964       "OverlayContainer", | 
|   971       lock_screen_related_containers); |   965       lock_screen_related_containers); | 
|   972   SetUsesScreenCoordinates(overlay_container); |   966   SetUsesScreenCoordinates(overlay_container); | 
|   973  |   967  | 
|   974   aura::Window* virtual_keyboard_parent_container = CreateContainer( |   968   aura::Window* virtual_keyboard_parent_container = CreateContainer( | 
|   975       kShellWindowId_VirtualKeyboardParentContainer, |   969       kShellWindowId_VirtualKeyboardParentContainer, | 
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1012     DisableTouchHudProjection(); |  1006     DisableTouchHudProjection(); | 
|  1013 } |  1007 } | 
|  1014  |  1008  | 
|  1015 RootWindowController* GetRootWindowController( |  1009 RootWindowController* GetRootWindowController( | 
|  1016     const aura::Window* root_window) { |  1010     const aura::Window* root_window) { | 
|  1017   return root_window ? GetRootWindowSettings(root_window)->controller : NULL; |  1011   return root_window ? GetRootWindowSettings(root_window)->controller : NULL; | 
|  1018 } |  1012 } | 
|  1019  |  1013  | 
|  1020 }  // namespace internal |  1014 }  // namespace internal | 
|  1021 }  // namespace ash |  1015 }  // namespace ash | 
| OLD | NEW |