diff options
author | oshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-13 09:15:06 +0000 |
---|---|---|
committer | oshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-13 09:15:06 +0000 |
commit | 1bca2284b9ec3f2338ca74dc7339a8cfc51a24c9 (patch) | |
tree | 735b21c0a958ebd2b01da9d01a4a3113dfafab00 /ash | |
parent | 300172b0511b909db0a91db2c8c0f9e48f4ed054 (diff) | |
download | chromium_src-1bca2284b9ec3f2338ca74dc7339a8cfc51a24c9.zip chromium_src-1bca2284b9ec3f2338ca74dc7339a8cfc51a24c9.tar.gz chromium_src-1bca2284b9ec3f2338ca74dc7339a8cfc51a24c9.tar.bz2 |
Revert r141871 "Add RootWindowController that keeps per root window state."
This reverts commit d696be73d92539286ad99338a26ceffe320be7cc.
TBR=oshima@chromium.org
BUG=none
TEST=none
Review URL: https://chromiumcodereview.appspot.com/10545154
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@141875 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash')
-rw-r--r-- | ash/accelerators/accelerator_controller.cc | 11 | ||||
-rw-r--r-- | ash/ash.gyp | 2 | ||||
-rw-r--r-- | ash/launcher/launcher_context_menu.cc | 15 | ||||
-rw-r--r-- | ash/root_window_controller.cc | 218 | ||||
-rw-r--r-- | ash/root_window_controller.h | 84 | ||||
-rw-r--r-- | ash/shell.cc | 329 | ||||
-rw-r--r-- | ash/shell.h | 38 | ||||
-rw-r--r-- | ash/system/status_area_widget.cc | 7 | ||||
-rw-r--r-- | ash/tooltips/tooltip_controller.cc | 1 | ||||
-rw-r--r-- | ash/wm/app_list_controller.cc | 4 | ||||
-rw-r--r-- | ash/wm/property_util.cc | 11 | ||||
-rw-r--r-- | ash/wm/property_util.h | 11 | ||||
-rw-r--r-- | ash/wm/screen_dimmer.h | 2 | ||||
-rw-r--r-- | ash/wm/screen_dimmer_unittest.cc | 3 | ||||
-rw-r--r-- | ash/wm/system_gesture_event_filter.cc | 7 | ||||
-rw-r--r-- | ash/wm/window_properties.cc | 4 | ||||
-rw-r--r-- | ash/wm/window_properties.h | 4 | ||||
-rw-r--r-- | ash/wm/window_util.cc | 5 | ||||
-rw-r--r-- | ash/wm/window_util.h | 6 |
19 files changed, 283 insertions, 479 deletions
diff --git a/ash/accelerators/accelerator_controller.cc b/ash/accelerators/accelerator_controller.cc index 0bd5ece..ae314fb 100644 --- a/ash/accelerators/accelerator_controller.cc +++ b/ash/accelerators/accelerator_controller.cc @@ -15,7 +15,6 @@ #include "ash/launcher/launcher_model.h" #include "ash/monitor/monitor_controller.h" #include "ash/monitor/multi_monitor_manager.h" -#include "ash/root_window_controller.h" #include "ash/screenshot_delegate.h" #include "ash/shell.h" #include "ash/shell_delegate.h" @@ -113,9 +112,9 @@ bool HandleShowTaskManager() { // Rotates the default window container. bool HandleRotateWindows() { - aura::Window* target = - Shell::GetPrimaryRootWindowController()->GetContainer( - internal::kShellWindowId_DefaultContainer); + aura::Window* target = Shell::GetContainer( + Shell::GetPrimaryRootWindow(), + internal::kShellWindowId_DefaultContainer); scoped_ptr<ui::LayerAnimationSequence> screen_rotation( new ui::LayerAnimationSequence(new ui::ScreenRotation(360))); target->layer()->GetAnimator()->StartAnimation( @@ -192,8 +191,8 @@ void PrintWindowHierarchy(aura::Window* window, int indent) { bool HandlePrintWindowHierarchy() { DLOG(INFO) << "Window hierarchy:"; aura::Window* container = - Shell::GetPrimaryRootWindowController()->GetContainer( - internal::kShellWindowId_DefaultContainer); + Shell::GetContainer(Shell::GetPrimaryRootWindow(), + internal::kShellWindowId_DefaultContainer); PrintWindowHierarchy(container, 0); return true; } diff --git a/ash/ash.gyp b/ash/ash.gyp index 67907da..5897fce 100644 --- a/ash/ash.gyp +++ b/ash/ash.gyp @@ -101,8 +101,6 @@ 'monitor/multi_monitor_manager.h', 'monitor/secondary_monitor_view.cc', 'monitor/secondary_monitor_view.h', - 'root_window_controller.cc', - 'root_window_controller.h', 'screen_ash.cc', 'screen_ash.h', 'screensaver/screensaver_view.cc', diff --git a/ash/launcher/launcher_context_menu.cc b/ash/launcher/launcher_context_menu.cc index cb92a3b..7b586ba 100644 --- a/ash/launcher/launcher_context_menu.cc +++ b/ash/launcher/launcher_context_menu.cc @@ -4,7 +4,6 @@ #include "ash/launcher/launcher_context_menu.h" -#include "ash/root_window_controller.h" #include "ash/shell.h" #include "ash/wm/shelf_auto_hide_behavior.h" #include "grit/ash_strings.h" @@ -25,21 +24,21 @@ LauncherContextMenu::~LauncherContextMenu() { // static bool LauncherContextMenu::IsAutoHideMenuHideChecked() { - internal::RootWindowController* controller = - Shell::GetPrimaryRootWindowController(); + ash::Shell* shell = ash::Shell::GetInstance(); ash::ShelfAutoHideBehavior auto_hide_behavior = - Shell::GetInstance()->GetShelfAutoHideBehavior(); - return (controller->IsInMaximizedMode() && + shell->GetShelfAutoHideBehavior(); + return (shell->IsInMaximizedMode() && (auto_hide_behavior == ash::SHELF_AUTO_HIDE_BEHAVIOR_DEFAULT || auto_hide_behavior == ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS)) || - (!controller->IsInMaximizedMode() && + (!shell->IsInMaximizedMode() && auto_hide_behavior == ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); } // static ShelfAutoHideBehavior LauncherContextMenu::GetToggledAutoHideBehavior() { + ash::Shell* shell = ash::Shell::GetInstance(); ash::ShelfAutoHideBehavior auto_hide_behavior; - if (Shell::GetPrimaryRootWindowController()->IsInMaximizedMode()) { + if (shell->IsInMaximizedMode()) { if (IsAutoHideMenuHideChecked()) auto_hide_behavior = ash::SHELF_AUTO_HIDE_BEHAVIOR_NEVER; else @@ -54,7 +53,7 @@ ShelfAutoHideBehavior LauncherContextMenu::GetToggledAutoHideBehavior() { // static int LauncherContextMenu::GetAutoHideResourceStringId() { - return Shell::GetPrimaryRootWindowController()->IsInMaximizedMode() ? + return ash::Shell::GetInstance()->IsInMaximizedMode() ? IDS_AURA_LAUNCHER_CONTEXT_MENU_AUTO_HIDE_MAXIMIZED : IDS_AURA_LAUNCHER_CONTEXT_MENU_AUTO_HIDE_NOT_MAXIMIZED; } diff --git a/ash/root_window_controller.cc b/ash/root_window_controller.cc deleted file mode 100644 index 0938beb..0000000 --- a/ash/root_window_controller.cc +++ /dev/null @@ -1,218 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "ash/root_window_controller.h" - -#include "ash/shell.h" -#include "ash/shell_factory.h" -#include "ash/shell_window_ids.h" -#include "ash/wm/base_layout_manager.h" -#include "ash/wm/event_client_impl.h" -#include "ash/wm/property_util.h" -#include "ash/wm/root_window_layout_manager.h" -#include "ash/wm/screen_dimmer.h" -#include "ash/wm/system_modal_container_layout_manager.h" -#include "ash/wm/toplevel_window_event_filter.h" -#include "ash/wm/visibility_controller.h" -#include "ash/wm/workspace/workspace_manager.h" -#include "ash/wm/workspace_controller.h" -#include "ui/aura/client/tooltip_client.h" -#include "ui/aura/root_window.h" - -namespace ash { -namespace { - -// Creates a new window for use as a container. -aura::Window* CreateContainer(int window_id, - const char* name, - aura::Window* parent) { - aura::Window* container = new aura::Window(NULL); - container->set_id(window_id); - container->SetName(name); - container->Init(ui::LAYER_NOT_DRAWN); - parent->AddChild(container); - if (window_id != internal::kShellWindowId_UnparentedControlContainer) - container->Show(); - return container; -} - -// Creates each of the special window containers that holds windows of various -// types in the shell UI. -void CreateContainersInRootWindow(aura::RootWindow* root_window) { - // These containers are just used by PowerButtonController to animate groups - // of containers simultaneously without messing up the current transformations - // on those containers. These are direct children of the root window; all of - // the other containers are their children. - aura::Window* non_lock_screen_containers = CreateContainer( - internal::kShellWindowId_NonLockScreenContainersContainer, - "NonLockScreenContainersContainer", - root_window); - aura::Window* lock_screen_containers = CreateContainer( - internal::kShellWindowId_LockScreenContainersContainer, - "LockScreenContainersContainer", - root_window); - aura::Window* lock_screen_related_containers = CreateContainer( - internal::kShellWindowId_LockScreenRelatedContainersContainer, - "LockScreenRelatedContainersContainer", - root_window); - - CreateContainer(internal::kShellWindowId_UnparentedControlContainer, - "UnparentedControlContainer", - non_lock_screen_containers); - - aura::Window* desktop_background_containers = CreateContainer( - internal::kShellWindowId_DesktopBackgroundContainer, - "DesktopBackgroundContainer", - non_lock_screen_containers); - SetChildWindowVisibilityChangesAnimated(desktop_background_containers); - - aura::Window* default_container = CreateContainer( - internal::kShellWindowId_DefaultContainer, - "DefaultContainer", - non_lock_screen_containers); - default_container->SetEventFilter( - new ToplevelWindowEventFilter(default_container)); - SetChildWindowVisibilityChangesAnimated(default_container); - - aura::Window* always_on_top_container = CreateContainer( - internal::kShellWindowId_AlwaysOnTopContainer, - "AlwaysOnTopContainer", - non_lock_screen_containers); - always_on_top_container->SetEventFilter( - new ToplevelWindowEventFilter(always_on_top_container)); - SetChildWindowVisibilityChangesAnimated(always_on_top_container); - - CreateContainer(internal::kShellWindowId_PanelContainer, - "PanelContainer", - non_lock_screen_containers); - - CreateContainer(internal::kShellWindowId_LauncherContainer, - "LauncherContainer", - non_lock_screen_containers); - - CreateContainer(internal::kShellWindowId_AppListContainer, - "AppListContainer", - non_lock_screen_containers); - - aura::Window* modal_container = CreateContainer( - internal::kShellWindowId_SystemModalContainer, - "SystemModalContainer", - non_lock_screen_containers); - modal_container->SetEventFilter( - new ToplevelWindowEventFilter(modal_container)); - modal_container->SetLayoutManager( - new internal::SystemModalContainerLayoutManager(modal_container)); - SetChildWindowVisibilityChangesAnimated(modal_container); - - // TODO(beng): Figure out if we can make this use - // SystemModalContainerEventFilter instead of stops_event_propagation. - aura::Window* lock_container = CreateContainer( - internal::kShellWindowId_LockScreenContainer, - "LockScreenContainer", - lock_screen_containers); - lock_container->SetLayoutManager( - new internal::BaseLayoutManager(root_window)); - // TODO(beng): stopsevents - - aura::Window* lock_modal_container = CreateContainer( - internal::kShellWindowId_LockSystemModalContainer, - "LockSystemModalContainer", - lock_screen_containers); - lock_modal_container->SetEventFilter( - new ToplevelWindowEventFilter(lock_modal_container)); - lock_modal_container->SetLayoutManager( - new internal::SystemModalContainerLayoutManager(lock_modal_container)); - SetChildWindowVisibilityChangesAnimated(lock_modal_container); - - CreateContainer(internal::kShellWindowId_StatusContainer, - "StatusContainer", - lock_screen_related_containers); - - aura::Window* settings_bubble_container = CreateContainer( - internal::kShellWindowId_SettingBubbleContainer, - "SettingBubbleContainer", - lock_screen_related_containers); - SetChildWindowVisibilityChangesAnimated(settings_bubble_container); - - aura::Window* menu_container = CreateContainer( - internal::kShellWindowId_MenuContainer, - "MenuContainer", - lock_screen_related_containers); - SetChildWindowVisibilityChangesAnimated(menu_container); - - aura::Window* drag_drop_container = CreateContainer( - internal::kShellWindowId_DragImageAndTooltipContainer, - "DragImageAndTooltipContainer", - lock_screen_related_containers); - SetChildWindowVisibilityChangesAnimated(drag_drop_container); - - CreateContainer(internal::kShellWindowId_OverlayContainer, - "OverlayContainer", - lock_screen_related_containers); -} - -} // namespace - -namespace internal { - -RootWindowController::RootWindowController(aura::RootWindow* root_window) - : root_window_(root_window) { - SetRootWindowController(root_window, this); - - event_client_.reset(new internal::EventClientImpl(root_window)); - screen_dimmer_.reset(new internal::ScreenDimmer(root_window)); -} - -RootWindowController::~RootWindowController() { - SetRootWindowController(root_window_.get(), NULL); - event_client_.reset(); - screen_dimmer_.reset(); - workspace_controller_.reset(); - root_window_.reset(); -} - -aura::Window* RootWindowController::GetContainer(int container_id) { - return root_window_->GetChildById(container_id); -} - -void RootWindowController::InitLayoutManagers() { - root_window_layout_ = - new internal::RootWindowLayoutManager(root_window_.get()); - root_window_->SetLayoutManager(root_window_layout_); - - aura::Window* default_container = - GetContainer(internal::kShellWindowId_DefaultContainer); - // Workspace manager has its own layout managers. - workspace_controller_.reset( - new internal::WorkspaceController(default_container)); - - aura::Window* always_on_top_container = - GetContainer(internal::kShellWindowId_AlwaysOnTopContainer); - always_on_top_container->SetLayoutManager( - new internal::BaseLayoutManager( - always_on_top_container->GetRootWindow())); -} - -void RootWindowController::CreateContainers() { - CreateContainersInRootWindow(root_window_.get()); -} - -void RootWindowController::CloseChildWindows() { - // Close background widget first as it depends on tooltip. - root_window_layout_->SetBackgroundWidget(NULL); - workspace_controller_.reset(); - aura::client::SetTooltipClient(root_window_.get(), NULL); - - while (!root_window_->children().empty()) { - aura::Window* child = root_window_->children()[0]; - delete child; - } -} - -bool RootWindowController::IsInMaximizedMode() const { - return workspace_controller_->workspace_manager()->IsInMaximizedMode(); -} - -} // namespace internal -} // namespace ash diff --git a/ash/root_window_controller.h b/ash/root_window_controller.h deleted file mode 100644 index 66cf105..0000000 --- a/ash/root_window_controller.h +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef ASH_ROOT_WINDOW_CONTROLLER_H_ -#define ASH_ROOT_WINDOW_CONTROLLER_H_ -#pragma once - -#include "base/basictypes.h" -#include "base/memory/scoped_ptr.h" - -class SkBitmap; - -namespace aura { -class EventFilter; -class RootWindow; -class Window; -namespace shared { -class InputMethodEventFilter; -class RootWindowEventFilter; -} // namespace shared -} // namespace aura - -namespace ash { -namespace internal { - -class EventClientImpl; -class RootWindowLayoutManager; -class ScreenDimmer; -class WorkspaceController; - -// This class maintains the per root window state for ash. This class -// owns the root window and other dependent objects that should be -// deleted upon the deletion of the root window. The RootWindowController -// for particular root window is stored as a property and can be obtained -// using |GetRootWindowController(aura::RootWindow*)| function. -class RootWindowController { - public: - explicit RootWindowController(aura::RootWindow* root_window); - ~RootWindowController(); - - aura::RootWindow* root_window() { - return root_window_.get(); - } - - internal::RootWindowLayoutManager* root_window_layout() { - return root_window_layout_; - } - - internal::WorkspaceController* workspace_controller() { - return workspace_controller_.get(); - } - - internal::ScreenDimmer* screen_dimmer() { - return screen_dimmer_.get(); - } - - aura::Window* GetContainer(int container_id); - - void CreateContainers(); - void InitLayoutManagers(); - - // Deletes all child windows and performs necessary cleanup. - void CloseChildWindows(); - - // Returns true if the workspace has a maximized or fullscreen window. - bool IsInMaximizedMode() const; - - private: - scoped_ptr<aura::RootWindow> root_window_; - internal::RootWindowLayoutManager* root_window_layout_; - - // An event filter that pre-handles all key events to send them to an IME. - scoped_ptr<internal::EventClientImpl> event_client_; - scoped_ptr<internal::ScreenDimmer> screen_dimmer_; - scoped_ptr<internal::WorkspaceController> workspace_controller_; - - DISALLOW_COPY_AND_ASSIGN(RootWindowController); -}; - -} // namespace internal -} // ash - -#endif // ASH_ROOT_WINDOW_CONTROLLER_H_ diff --git a/ash/shell.cc b/ash/shell.cc index 3070679..63062980 100644 --- a/ash/shell.cc +++ b/ash/shell.cc @@ -20,7 +20,6 @@ #include "ash/monitor/monitor_controller.h" #include "ash/monitor/multi_monitor_manager.h" #include "ash/monitor/secondary_monitor_view.h" -#include "ash/root_window_controller.h" #include "ash/screen_ash.h" #include "ash/shell_context_menu.h" #include "ash/shell_delegate.h" @@ -107,6 +106,135 @@ namespace { using aura::Window; using views::Widget; +// Creates a new window for use as a container. +aura::Window* CreateContainer(int window_id, + const char* name, + aura::Window* parent) { + aura::Window* container = new aura::Window(NULL); + container->set_id(window_id); + container->SetName(name); + container->Init(ui::LAYER_NOT_DRAWN); + parent->AddChild(container); + if (window_id != internal::kShellWindowId_UnparentedControlContainer) + container->Show(); + return container; +} + +// Creates each of the special window containers that holds windows of various +// types in the shell UI. +void CreateSpecialContainers(aura::RootWindow* root_window) { + // These containers are just used by PowerButtonController to animate groups + // of containers simultaneously without messing up the current transformations + // on those containers. These are direct children of the root window; all of + // the other containers are their children. + aura::Window* non_lock_screen_containers = CreateContainer( + internal::kShellWindowId_NonLockScreenContainersContainer, + "NonLockScreenContainersContainer", + root_window); + aura::Window* lock_screen_containers = CreateContainer( + internal::kShellWindowId_LockScreenContainersContainer, + "LockScreenContainersContainer", + root_window); + aura::Window* lock_screen_related_containers = CreateContainer( + internal::kShellWindowId_LockScreenRelatedContainersContainer, + "LockScreenRelatedContainersContainer", + root_window); + + CreateContainer(internal::kShellWindowId_UnparentedControlContainer, + "UnparentedControlContainer", + non_lock_screen_containers); + + aura::Window* desktop_background_containers = CreateContainer( + internal::kShellWindowId_DesktopBackgroundContainer, + "DesktopBackgroundContainer", + non_lock_screen_containers); + SetChildWindowVisibilityChangesAnimated(desktop_background_containers); + + aura::Window* default_container = CreateContainer( + internal::kShellWindowId_DefaultContainer, + "DefaultContainer", + non_lock_screen_containers); + default_container->SetEventFilter( + new ToplevelWindowEventFilter(default_container)); + SetChildWindowVisibilityChangesAnimated(default_container); + + aura::Window* always_on_top_container = CreateContainer( + internal::kShellWindowId_AlwaysOnTopContainer, + "AlwaysOnTopContainer", + non_lock_screen_containers); + always_on_top_container->SetEventFilter( + new ToplevelWindowEventFilter(always_on_top_container)); + SetChildWindowVisibilityChangesAnimated(always_on_top_container); + + CreateContainer(internal::kShellWindowId_PanelContainer, + "PanelContainer", + non_lock_screen_containers); + + CreateContainer(internal::kShellWindowId_LauncherContainer, + "LauncherContainer", + non_lock_screen_containers); + + CreateContainer(internal::kShellWindowId_AppListContainer, + "AppListContainer", + non_lock_screen_containers); + + aura::Window* modal_container = CreateContainer( + internal::kShellWindowId_SystemModalContainer, + "SystemModalContainer", + non_lock_screen_containers); + modal_container->SetEventFilter( + new ToplevelWindowEventFilter(modal_container)); + modal_container->SetLayoutManager( + new internal::SystemModalContainerLayoutManager(modal_container)); + SetChildWindowVisibilityChangesAnimated(modal_container); + + // TODO(beng): Figure out if we can make this use + // SystemModalContainerEventFilter instead of stops_event_propagation. + aura::Window* lock_container = CreateContainer( + internal::kShellWindowId_LockScreenContainer, + "LockScreenContainer", + lock_screen_containers); + lock_container->SetLayoutManager( + new internal::BaseLayoutManager(root_window)); + // TODO(beng): stopsevents + + aura::Window* lock_modal_container = CreateContainer( + internal::kShellWindowId_LockSystemModalContainer, + "LockSystemModalContainer", + lock_screen_containers); + lock_modal_container->SetEventFilter( + new ToplevelWindowEventFilter(lock_modal_container)); + lock_modal_container->SetLayoutManager( + new internal::SystemModalContainerLayoutManager(lock_modal_container)); + SetChildWindowVisibilityChangesAnimated(lock_modal_container); + + CreateContainer(internal::kShellWindowId_StatusContainer, + "StatusContainer", + lock_screen_related_containers); + + aura::Window* settings_bubble_container = CreateContainer( + internal::kShellWindowId_SettingBubbleContainer, + "SettingBubbleContainer", + lock_screen_related_containers); + SetChildWindowVisibilityChangesAnimated(settings_bubble_container); + + aura::Window* menu_container = CreateContainer( + internal::kShellWindowId_MenuContainer, + "MenuContainer", + lock_screen_related_containers); + SetChildWindowVisibilityChangesAnimated(menu_container); + + aura::Window* drag_drop_container = CreateContainer( + internal::kShellWindowId_DragImageAndTooltipContainer, + "DragImageAndTooltipContainer", + lock_screen_related_containers); + SetChildWindowVisibilityChangesAnimated(drag_drop_container); + + CreateContainer(internal::kShellWindowId_OverlayContainer, + "OverlayContainer", + lock_screen_related_containers); +} + // This dummy class is used for shell unit tests. We dont have chrome delegate // in these tests. class DummyUserWallpaperDelegate : public UserWallpaperDelegate { @@ -144,7 +272,7 @@ bool Shell::initially_hide_cursor_ = false; Shell::TestApi::TestApi(Shell* shell) : shell_(shell) {} internal::RootWindowLayoutManager* Shell::TestApi::root_window_layout() { - return shell_->GetPrimaryRootWindowController()->root_window_layout(); + return shell_->root_window_layout_; } aura::shared::InputMethodEventFilter* @@ -158,14 +286,15 @@ internal::SystemGestureEventFilter* } internal::WorkspaceController* Shell::TestApi::workspace_controller() { - return shell_->GetPrimaryRootWindowController()->workspace_controller(); + return shell_->workspace_controller_.get(); } //////////////////////////////////////////////////////////////////////////////// // Shell, public: Shell::Shell(ShellDelegate* delegate) - : screen_(new ScreenAsh), + : root_window_(aura::MonitorManager::CreateRootWindowForPrimaryMonitor()), + screen_(new ScreenAsh), env_filter_(NULL), delegate_(delegate), #if defined(OS_CHROMEOS) @@ -173,6 +302,7 @@ Shell::Shell(ShellDelegate* delegate) #endif // defined(OS_CHROMEOS) shelf_(NULL), panel_layout_manager_(NULL), + root_window_layout_(NULL), status_area_widget_(NULL), browser_context_(NULL) { gfx::Screen::SetInstance(screen_); @@ -203,8 +333,20 @@ Shell::~Shell() { if (touch_observer_hud_.get()) RemoveEnvEventFilter(touch_observer_hud_.get()); + // Close background widget now so that the focus manager of the + // widget gets deleted in the final message loop run. + root_window_layout_->SetBackgroundWidget(NULL); + + aura::RootWindow* root_window = GetPrimaryRootWindow(); + // TooltipController is deleted with the Shell so removing its references. RemoveEnvEventFilter(tooltip_controller_.get()); + aura::client::SetTooltipClient(root_window, NULL); + tooltip_controller_.reset(); + + // Make sure we delete WorkspaceController before launcher is + // deleted as it has a reference to launcher model. + workspace_controller_.reset(); // The status area needs to be shut down before the windows are destroyed. status_area_widget_->Shutdown(); @@ -218,26 +360,35 @@ Shell::~Shell() { // Destroy secondary monitor's widgets before all the windows are destroyed. monitor_controller_.reset(); - root_window_controller_->CloseChildWindows(); + // Delete containers now so that child windows does not access + // observers when they are destructed. + while (!root_window->children().empty()) { + aura::Window* child = root_window->children()[0]; + delete child; + } // These need a valid Shell instance to clean up properly, so explicitly // delete them before invalidating the instance. // Alphabetical. drag_drop_controller_.reset(); + event_client_.reset(); magnification_controller_.reset(); monitor_controller_.reset(); power_button_controller_.reset(); resize_shadow_controller_.reset(); + screen_dimmer_.reset(); shadow_controller_.reset(); tooltip_controller_.reset(); window_cycle_controller_.reset(); + aura::client::SetCaptureClient(root_window, NULL); capture_controller_.reset(); + aura::client::SetDispatcherClient(root_window, NULL); nested_dispatcher_controller_.reset(); + aura::client::SetUserActionClient(root_window, NULL); user_action_client_.reset(); + aura::client::SetVisibilityClient(root_window, NULL); visibility_controller_.reset(); - root_window_controller_.reset(); - // Launcher widget has a InputMethodBridge that references to // input_method_filter_'s input_method_. So explicitly release launcher_ // before input_method_filter_. And this needs to be after we delete all @@ -247,6 +398,7 @@ Shell::~Shell() { // Delete the activation controller after other controllers and launcher // because they might have registered ActivationChangeObserver. + aura::client::SetActivationClient(root_window, NULL); activation_controller_.reset(); DCHECK(instance_ == this); @@ -288,13 +440,8 @@ void Shell::DeleteInstance() { } // static -internal::RootWindowController* Shell::GetPrimaryRootWindowController() { - return GetInstance()->root_window_controller_.get(); -} - -// static aura::RootWindow* Shell::GetPrimaryRootWindow() { - return GetPrimaryRootWindowController()->root_window(); + return GetInstance()->root_window_.get(); } // static @@ -334,14 +481,17 @@ void Shell::Init() { aura::Env::GetInstance()->SetEventFilter(env_filter_); aura::Env::GetInstance()->cursor_manager()->set_delegate(this); - aura::RootWindow* root_window = - aura::MonitorManager::CreateRootWindowForPrimaryMonitor(); + + aura::RootWindow* root_window = GetPrimaryRootWindow(); active_root_window_ = root_window; focus_manager_.reset(new aura::FocusManager); + root_window_->set_focus_manager(focus_manager_.get()); #if !defined(OS_MACOSX) nested_dispatcher_controller_.reset(new NestedDispatcherController); + aura::client::SetDispatcherClient(root_window, + nested_dispatcher_controller_.get()); accelerator_controller_.reset(new AcceleratorController); #endif shell_context_menu_.reset(new internal::ShellContextMenu); @@ -362,6 +512,7 @@ void Shell::Init() { DCHECK_EQ(3U, GetEnvEventFilterCount()); input_method_filter_.reset(new aura::shared::InputMethodEventFilter()); + input_method_filter_->SetInputMethodPropertyInRootWindow(root_window); AddEnvEventFilter(input_method_filter_.get()); #if !defined(OS_MACOSX) @@ -375,10 +526,18 @@ void Shell::Init() { slow_animation_filter_.reset(new internal::SlowAnimationEventFilter); AddEnvEventFilter(slow_animation_filter_.get()); + root_window->SetCursor(ui::kCursorPointer); + if (initially_hide_cursor_) + aura::Env::GetInstance()->cursor_manager()->ShowCursor(false); + activation_controller_.reset( new internal::ActivationController(focus_manager_.get())); + aura::client::SetActivationClient(root_window, activation_controller_.get()); capture_controller_.reset(new internal::CaptureController); + aura::client::SetCaptureClient(root_window, capture_controller_.get()); + + CreateSpecialContainers(root_window); CommandLine* command_line = CommandLine::ForCurrentProcess(); @@ -387,40 +546,17 @@ void Shell::Init() { AddEnvEventFilter(touch_observer_hud_.get()); } - root_window_controller_.reset( - new internal::RootWindowController(root_window)); - root_window_controller_->CreateContainers(); - - // Create Controllers that may need root window. - // TODO(oshima): Move as many controllers before creating - // RootWindowController as possible. stacking_controller_.reset(new internal::StackingController); - visibility_controller_.reset(new internal::VisibilityController); - drag_drop_controller_.reset(new internal::DragDropController); - tooltip_controller_.reset(new internal::TooltipController( - drag_drop_controller_.get())); - if (delegate_.get()) - user_action_client_.reset(delegate_->CreateUserActionClient()); - window_modality_controller_.reset(new internal::WindowModalityController); - AddEnvEventFilter(window_modality_controller_.get()); - AddEnvEventFilter(tooltip_controller_.get()); - magnification_controller_.reset(new internal::MagnificationController); - high_contrast_controller_.reset(new HighContrastController); - video_detector_.reset(new VideoDetector); - window_cycle_controller_.reset(new WindowCycleController); - monitor_controller_.reset(new internal::MonitorController); + root_window_layout_ = new internal::RootWindowLayoutManager(root_window); + root_window->SetLayoutManager(root_window_layout_); - InitRootWindow(root_window); + event_client_.reset(new internal::EventClientImpl(root_window)); - // Initialize Primary RootWindow specific items. status_area_widget_ = new internal::StatusAreaWidget(); status_area_widget_->CreateTrayViews(delegate_.get()); status_area_widget_->Show(); - focus_cycler_.reset(new internal::FocusCycler()); - focus_cycler_->AddWidget(status_area_widget_); - // This controller needs to be set before SetupManagedWindowMode. desktop_background_controller_.reset(new DesktopBackgroundController()); if (delegate_.get()) @@ -428,28 +564,54 @@ void Shell::Init() { if (!user_wallpaper_delegate_.get()) user_wallpaper_delegate_.reset(new DummyUserWallpaperDelegate()); - InitLayoutManagersForPrimaryDisplay(root_window_controller_.get()); + if (delegate_.get()) + user_action_client_.reset(delegate_->CreateUserActionClient()); + if (user_action_client_.get()) + aura::client::SetUserActionClient(root_window, user_action_client_.get()); + + InitLayoutManagers(); if (!command_line->HasSwitch(switches::kAuraNoShadows)) { resize_shadow_controller_.reset(new internal::ResizeShadowController()); shadow_controller_.reset(new internal::ShadowController()); } + focus_cycler_.reset(new internal::FocusCycler()); + focus_cycler_->AddWidget(status_area_widget_); + if (!delegate_.get() || delegate_->IsUserLoggedIn()) CreateLauncher(); - // Force Layout - root_window_controller_->root_window_layout()->OnWindowResized(); + // Force a layout. + root_window->layout_manager()->OnWindowResized(); // It needs to be created after OnWindowResized has been called, otherwise the // widget will not paint when restoring after a browser crash. user_wallpaper_delegate_->InitializeWallpaper(); + window_modality_controller_.reset(new internal::WindowModalityController); + AddEnvEventFilter(window_modality_controller_.get()); + + visibility_controller_.reset(new internal::VisibilityController); + aura::client::SetVisibilityClient(root_window, visibility_controller_.get()); + + drag_drop_controller_.reset(new internal::DragDropController); + aura::client::SetDragDropClient(root_window, drag_drop_controller_.get()); + + tooltip_controller_.reset( + new internal::TooltipController(drag_drop_controller_.get())); + aura::client::SetTooltipClient(root_window, tooltip_controller_.get()); + + AddEnvEventFilter(tooltip_controller_.get()); + + magnification_controller_.reset(new internal::MagnificationController); + high_contrast_controller_.reset(new HighContrastController); power_button_controller_.reset(new PowerButtonController); AddShellObserver(power_button_controller_.get()); - - if (initially_hide_cursor_) - aura::Env::GetInstance()->cursor_manager()->ShowCursor(false); + video_detector_.reset(new VideoDetector); + window_cycle_controller_.reset(new WindowCycleController); + monitor_controller_.reset(new internal::MonitorController); + screen_dimmer_.reset(new internal::ScreenDimmer(root_window)); } void Shell::AddEnvEventFilter(aura::EventFilter* filter) { @@ -542,9 +704,9 @@ void Shell::CreateLauncher() { if (launcher_.get()) return; - aura::Window* default_container = - GetPrimaryRootWindowController()-> - GetContainer(internal::kShellWindowId_DefaultContainer); + aura::Window* default_container = GetContainer( + GetPrimaryRootWindow(), + internal::kShellWindowId_DefaultContainer); launcher_.reset(new Launcher(default_container)); launcher_->SetFocusCycler(focus_cycler_.get()); @@ -586,10 +748,6 @@ ShelfAlignment Shell::GetShelfAlignment() { return shelf_->alignment(); } -void Shell::SetDimming(bool should_dim) { - GetPrimaryRootWindowController()->screen_dimmer()->SetDimming(should_dim); -} - SystemTrayDelegate* Shell::tray_delegate() { return status_area_widget_->system_tray_delegate(); } @@ -599,8 +757,11 @@ SystemTray* Shell::system_tray() { } int Shell::GetGridSize() const { - return GetPrimaryRootWindowController()->workspace_controller()-> - workspace_manager()->grid_size(); + return workspace_controller_->workspace_manager()->grid_size(); +} + +bool Shell::IsInMaximizedMode() const { + return workspace_controller_->workspace_manager()->IsInMaximizedMode(); } void Shell::InitRootWindowForSecondaryMonitor(aura::RootWindow* root) { @@ -620,55 +781,41 @@ void Shell::InitRootWindowForSecondaryMonitor(aura::RootWindow* root) { aura::client::SetCaptureClient(root, capture_controller_.get()); } -void Shell::InitRootWindow(aura::RootWindow* root_window) { - DCHECK(activation_controller_.get()); - DCHECK(visibility_controller_.get()); - DCHECK(drag_drop_controller_.get()); - DCHECK(capture_controller_.get()); - - root_window->set_focus_manager(focus_manager_.get()); - input_method_filter_->SetInputMethodPropertyInRootWindow(root_window); - aura::client::SetActivationClient(root_window, activation_controller_.get()); - aura::client::SetVisibilityClient(root_window, visibility_controller_.get()); - aura::client::SetDragDropClient(root_window, drag_drop_controller_.get()); - aura::client::SetTooltipClient(root_window, tooltip_controller_.get()); - aura::client::SetCaptureClient(root_window, capture_controller_.get()); - - if (nested_dispatcher_controller_.get()) { - aura::client::SetDispatcherClient(root_window, - nested_dispatcher_controller_.get()); - } - if (user_action_client_.get()) - aura::client::SetUserActionClient(root_window, user_action_client_.get()); - - root_window->SetCursor(ui::kCursorPointer); - root_window_controller_->InitLayoutManagers(); -} - //////////////////////////////////////////////////////////////////////////////// // Shell, private: -void Shell::InitLayoutManagersForPrimaryDisplay( - internal::RootWindowController* controller) { +void Shell::InitLayoutManagers() { + DCHECK(root_window_layout_); DCHECK(status_area_widget_); internal::ShelfLayoutManager* shelf_layout_manager = new internal::ShelfLayoutManager(status_area_widget_); - controller->GetContainer(internal::kShellWindowId_LauncherContainer)-> + GetContainer( + GetPrimaryRootWindow(), + internal::kShellWindowId_LauncherContainer)-> SetLayoutManager(shelf_layout_manager); shelf_ = shelf_layout_manager; internal::StatusAreaLayoutManager* status_area_layout_manager = new internal::StatusAreaLayoutManager(shelf_layout_manager); - controller->GetContainer(internal::kShellWindowId_StatusContainer)-> + GetContainer(GetPrimaryRootWindow(), + internal::kShellWindowId_StatusContainer)-> SetLayoutManager(status_area_layout_manager); + aura::Window* default_container = GetContainer( + GetPrimaryRootWindow(), internal::kShellWindowId_DefaultContainer); + // Workspace manager has its own layout managers. + workspace_controller_.reset( + new internal::WorkspaceController(default_container)); + workspace_controller_->workspace_manager()->set_shelf(shelf_layout_manager); shelf_layout_manager->set_workspace_manager( - controller->workspace_controller()->workspace_manager()); + workspace_controller_->workspace_manager()); - // TODO(oshima): Support multiple displays. - controller->workspace_controller()->workspace_manager()-> - set_shelf(shelf()); + aura::Window* always_on_top_container = GetContainer( + GetPrimaryRootWindow(), internal::kShellWindowId_AlwaysOnTopContainer); + always_on_top_container->SetLayoutManager( + new internal::BaseLayoutManager( + always_on_top_container->GetRootWindow())); // Create Panel layout manager if (CommandLine::ForCurrentProcess()-> @@ -686,8 +833,8 @@ void Shell::InitLayoutManagersForPrimaryDisplay( } void Shell::DisableWorkspaceGridLayout() { - GetPrimaryRootWindowController()-> - workspace_controller()->workspace_manager()->set_grid_size(0); + if (workspace_controller_.get()) + workspace_controller_->workspace_manager()->set_grid_size(0); } void Shell::SetCursor(gfx::NativeCursor cursor) { diff --git a/ash/shell.h b/ash/shell.h index daa17f0..c178cbf 100644 --- a/ash/shell.h +++ b/ash/shell.h @@ -80,6 +80,7 @@ class ActivationController; class AppListController; class CaptureController; class DragDropController; +class EventClientImpl; class FocusCycler; class KeyRewriterEventFilter; class MagnificationController; @@ -87,8 +88,8 @@ class MonitorController; class PanelLayoutManager; class PartialScreenshotEventFilter; class ResizeShadowController; -class RootWindowController; class RootWindowLayoutManager; +class ScreenDimmer; class ShadowController; class ShelfLayoutManager; class ShellContextMenu; @@ -143,9 +144,6 @@ class ASH_EXPORT Shell : aura::CursorDelegate { static void DeleteInstance(); - // Returns the root window controller for the primary root window. - static internal::RootWindowController* GetPrimaryRootWindowController(); - // Gets the primary RootWindow. The primary RootWindow is the one // that has a launcher. static aura::RootWindow* GetPrimaryRootWindow(); @@ -172,6 +170,10 @@ class ASH_EXPORT Shell : aura::CursorDelegate { active_root_window_ = active_root_window; } + internal::RootWindowLayoutManager* root_window_layout() const { + return root_window_layout_; + } + // Adds or removes |filter| from the aura::Env's CompoundEventFilter. void AddEnvEventFilter(aura::EventFilter* filter); void RemoveEnvEventFilter(aura::EventFilter* filter); @@ -281,6 +283,10 @@ class ASH_EXPORT Shell : aura::CursorDelegate { return magnification_controller_.get(); } + internal::ScreenDimmer* screen_dimmer() { + return screen_dimmer_.get(); + } + Launcher* launcher() { return launcher_.get(); } const ScreenAsh* screen() { return screen_; } @@ -295,9 +301,6 @@ class ASH_EXPORT Shell : aura::CursorDelegate { void SetShelfAlignment(ShelfAlignment alignment); ShelfAlignment GetShelfAlignment(); - // Dims or undims the screen. - void SetDimming(bool should_dim); - // TODO(sky): don't expose this! internal::ShelfLayoutManager* shelf() const { return shelf_; } @@ -312,6 +315,9 @@ class ASH_EXPORT Shell : aura::CursorDelegate { // Returns the size of the grid. int GetGridSize() const; + // Returns true if in maximized or fullscreen mode. + bool IsInMaximizedMode() const; + static void set_initially_hide_cursor(bool hide) { initially_hide_cursor_ = hide; } @@ -342,7 +348,6 @@ class ASH_EXPORT Shell : aura::CursorDelegate { private: FRIEND_TEST_ALL_PREFIXES(WindowManagerTest, MouseEventCursors); FRIEND_TEST_ALL_PREFIXES(WindowManagerTest, TransformActivate); - friend class internal::RootWindowController; typedef std::pair<aura::Window*, gfx::Rect> WindowAndBoundsPair; @@ -351,13 +356,8 @@ class ASH_EXPORT Shell : aura::CursorDelegate { void Init(); - // Initiailze the root window so that it can host browser windows. - void InitRootWindow(aura::RootWindow* root); - - // Initializes the layout managers and event filters specific for - // primary display. - void InitLayoutManagersForPrimaryDisplay( - internal::RootWindowController* root_window_controller); + // Initializes the layout managers and event filters. + void InitLayoutManagers(); // Disables the workspace grid layout. void DisableWorkspaceGridLayout(); @@ -372,7 +372,7 @@ class ASH_EXPORT Shell : aura::CursorDelegate { // when the screen is initially created. static bool initially_hide_cursor_; - scoped_ptr<internal::RootWindowController> root_window_controller_; + scoped_ptr<aura::RootWindow> root_window_; ScreenAsh* screen_; // Active root window. Never become NULL. @@ -402,6 +402,7 @@ class ASH_EXPORT Shell : aura::CursorDelegate { scoped_ptr<internal::CaptureController> capture_controller_; scoped_ptr<internal::WindowModalityController> window_modality_controller_; scoped_ptr<internal::DragDropController> drag_drop_controller_; + scoped_ptr<internal::WorkspaceController> workspace_controller_; scoped_ptr<internal::ResizeShadowController> resize_shadow_controller_; scoped_ptr<internal::ShadowController> shadow_controller_; scoped_ptr<internal::TooltipController> tooltip_controller_; @@ -412,9 +413,11 @@ class ASH_EXPORT Shell : aura::CursorDelegate { scoped_ptr<VideoDetector> video_detector_; scoped_ptr<WindowCycleController> window_cycle_controller_; scoped_ptr<internal::FocusCycler> focus_cycler_; + scoped_ptr<internal::EventClientImpl> event_client_; scoped_ptr<internal::MonitorController> monitor_controller_; scoped_ptr<HighContrastController> high_contrast_controller_; scoped_ptr<internal::MagnificationController> magnification_controller_; + scoped_ptr<internal::ScreenDimmer> screen_dimmer_; scoped_ptr<aura::FocusManager> focus_manager_; scoped_ptr<aura::client::UserActionClient> user_action_client_; @@ -459,6 +462,9 @@ class ASH_EXPORT Shell : aura::CursorDelegate { ObserverList<ShellObserver> observers_; + // Owned by aura::RootWindow, cached here for type safety. + internal::RootWindowLayoutManager* root_window_layout_; + // Widget containing system tray. internal::StatusAreaWidget* status_area_widget_; diff --git a/ash/system/status_area_widget.cc b/ash/system/status_area_widget.cc index 9c0a312..f0ae1d0 100644 --- a/ash/system/status_area_widget.cc +++ b/ash/system/status_area_widget.cc @@ -4,7 +4,6 @@ #include "ash/system/status_area_widget.h" -#include "ash/root_window_controller.h" #include "ash/shell.h" #include "ash/shell_delegate.h" #include "ash/shell_window_ids.h" @@ -286,9 +285,9 @@ StatusAreaWidget::StatusAreaWidget() views::Widget::InitParams params( views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); params.delegate = widget_delegate_; - params.parent = - Shell::GetPrimaryRootWindowController()->GetContainer( - ash::internal::kShellWindowId_StatusContainer); + params.parent = Shell::GetContainer( + Shell::GetPrimaryRootWindow(), + ash::internal::kShellWindowId_StatusContainer); params.transparent = true; Init(params); set_focus_on_creation(false); diff --git a/ash/tooltips/tooltip_controller.cc b/ash/tooltips/tooltip_controller.cc index 23b30a5..368603d 100644 --- a/ash/tooltips/tooltip_controller.cc +++ b/ash/tooltips/tooltip_controller.cc @@ -104,6 +104,7 @@ class TooltipController::Tooltip { label_.set_owned_by_client(); widget_.reset(CreateTooltip()); widget_->SetContentsView(&label_); + widget_->Activate(); } ~Tooltip() { diff --git a/ash/wm/app_list_controller.cc b/ash/wm/app_list_controller.cc index 5ffc075..d4c51f1 100644 --- a/ash/wm/app_list_controller.cc +++ b/ash/wm/app_list_controller.cc @@ -5,7 +5,6 @@ #include "ash/wm/app_list_controller.h" #include "ash/ash_switches.h" -#include "ash/root_window_controller.h" #include "ash/shell.h" #include "ash/shell_delegate.h" #include "ash/shell_window_ids.h" @@ -86,7 +85,8 @@ void AppListController::SetVisible(bool visible) { app_list::AppListView* view = new app_list::AppListView( Shell::GetInstance()->delegate()->CreateAppListViewDelegate()); view->InitAsBubble( - Shell::GetPrimaryRootWindowController()->GetContainer( + Shell::GetContainer( + Shell::GetPrimaryRootWindow(), kShellWindowId_AppListContainer), Shell::GetInstance()->launcher()->GetAppListButtonView(), GetBubbleArrowLocation()); diff --git a/ash/wm/property_util.cc b/ash/wm/property_util.cc index a51d298..50a7bed 100644 --- a/ash/wm/property_util.cc +++ b/ash/wm/property_util.cc @@ -8,7 +8,6 @@ #include "ash/wm/window_properties.h" #include "ash/wm/window_util.h" #include "ui/aura/client/aura_constants.h" -#include "ui/aura/root_window.h" #include "ui/aura/window.h" #include "ui/base/ui_base_types.h" #include "ui/gfx/rect.h" @@ -73,14 +72,4 @@ void SetDefaultPersistsAcrossAllWorkspaces(bool value) { g_default_windows_persist_across_all_workspaces = value; } -internal::RootWindowController* GetRootWindowController( - aura::RootWindow* root_window) { - return root_window->GetProperty(internal::kRootWindowControllerKey); } - -void SetRootWindowController(aura::RootWindow* root_window, - internal::RootWindowController* controller) { - root_window->SetProperty(internal::kRootWindowControllerKey, controller); -} - -} // namespace ash diff --git a/ash/wm/property_util.h b/ash/wm/property_util.h index 1850269..ce0940b 100644 --- a/ash/wm/property_util.h +++ b/ash/wm/property_util.h @@ -9,7 +9,6 @@ #include "ash/ash_export.h" namespace aura { -class RootWindow; class Window; } @@ -18,9 +17,6 @@ class Rect; } namespace ash { -namespace internal { -class RootWindowController; -} // Sets the restore bounds property on |window|. Deletes existing bounds value // if exists. @@ -65,13 +61,6 @@ ASH_EXPORT bool GetPersistsAcrossAllWorkspaces(aura::Window* window); // The default is false. ASH_EXPORT void SetDefaultPersistsAcrossAllWorkspaces(bool value); -// Sets/Gets the RootWindowController for |root_window|. -ASH_EXPORT void SetRootWindowController( - aura::RootWindow* root_window, - internal::RootWindowController* controller); -ASH_EXPORT internal::RootWindowController* GetRootWindowController( - aura::RootWindow* root_window); - } #endif // ASH_WM_PROPERTY_UTIL_H_ diff --git a/ash/wm/screen_dimmer.h b/ash/wm/screen_dimmer.h index daa60ea0..eeedecc 100644 --- a/ash/wm/screen_dimmer.h +++ b/ash/wm/screen_dimmer.h @@ -47,7 +47,7 @@ class ASH_EXPORT ScreenDimmer : public aura::RootWindowObserver { explicit ScreenDimmer(aura::RootWindow* root_window); virtual ~ScreenDimmer(); - // Dim or undim the root window. + // Dim or undim the screen. void SetDimming(bool should_dim); // aura::RootWindowObserver overrides: diff --git a/ash/wm/screen_dimmer_unittest.cc b/ash/wm/screen_dimmer_unittest.cc index 2c40e33..ecc6cd5 100644 --- a/ash/wm/screen_dimmer_unittest.cc +++ b/ash/wm/screen_dimmer_unittest.cc @@ -4,7 +4,6 @@ #include "ash/wm/screen_dimmer.h" -#include "ash/root_window_controller.h" #include "ash/shell.h" #include "ash/test/ash_test_base.h" #include "base/basictypes.h" @@ -22,7 +21,7 @@ class ScreenDimmerTest : public AshTestBase { void SetUp() OVERRIDE { AshTestBase::SetUp(); - dimmer_ = Shell::GetPrimaryRootWindowController()->screen_dimmer(); + dimmer_ = Shell::GetInstance()->screen_dimmer(); test_api_.reset(new internal::ScreenDimmer::TestApi(dimmer_)); } diff --git a/ash/wm/system_gesture_event_filter.cc b/ash/wm/system_gesture_event_filter.cc index 1db677f..98cbac9 100644 --- a/ash/wm/system_gesture_event_filter.cc +++ b/ash/wm/system_gesture_event_filter.cc @@ -6,7 +6,6 @@ #include "ash/accelerators/accelerator_controller.h" #include "ash/launcher/launcher.h" -#include "ash/root_window_controller.h" #include "ash/screen_ash.h" #include "ash/shell.h" #include "ash/shell_window_ids.h" @@ -80,9 +79,9 @@ Widget* CreateAffordanceWidget() { params.transparent = true; widget->Init(params); widget->SetOpacity(0xFF); - widget->GetNativeWindow()->SetParent( - ash::Shell::GetPrimaryRootWindowController()->GetContainer( - ash::internal::kShellWindowId_OverlayContainer)); + widget->GetNativeWindow()->SetParent(ash::Shell::GetContainer( + ash::Shell::GetPrimaryRootWindow(), + ash::internal::kShellWindowId_OverlayContainer)); ash::SetWindowVisibilityAnimationTransition(widget->GetNativeView(), ash::ANIMATE_HIDE); return widget; diff --git a/ash/wm/window_properties.cc b/ash/wm/window_properties.cc index a312149..7f15c5b 100644 --- a/ash/wm/window_properties.cc +++ b/ash/wm/window_properties.cc @@ -4,7 +4,6 @@ #include "ash/wm/window_properties.h" -#include "ash/root_window_controller.h" #include "ash/wm/always_on_top_controller.h" #include "ash/wm/shadow_types.h" #include "ui/aura/window_property.h" @@ -16,7 +15,6 @@ DECLARE_WINDOW_PROPERTY_TYPE(ash::internal::AlwaysOnTopController*); DECLARE_WINDOW_PROPERTY_TYPE(ash::internal::ShadowType); DECLARE_WINDOW_PROPERTY_TYPE(ash::WindowPersistsAcrossAllWorkspacesType) DECLARE_WINDOW_PROPERTY_TYPE(ui_controls::UIControlsAura*) -DECLARE_WINDOW_PROPERTY_TYPE(ash::internal::RootWindowController*); namespace ash { namespace internal { @@ -35,8 +33,6 @@ DEFINE_WINDOW_PROPERTY_KEY(ash::WindowPersistsAcrossAllWorkspacesType, kWindowPersistsAcrossAllWorkspacesKey, WINDOW_PERSISTS_ACROSS_ALL_WORKSPACES_VALUE_DEFAULT); DEFINE_WINDOW_PROPERTY_KEY(bool, kWindowTrackedByWorkspaceKey, true); -DEFINE_WINDOW_PROPERTY_KEY(RootWindowController*, - kRootWindowControllerKey, NULL); } // namespace internal } // namespace ash diff --git a/ash/wm/window_properties.h b/ash/wm/window_properties.h index ef99942..88c1b70 100644 --- a/ash/wm/window_properties.h +++ b/ash/wm/window_properties.h @@ -18,7 +18,6 @@ class UIControlsAura; namespace ash { namespace internal { class AlwaysOnTopController; -class RootWindowController; // Shell-specific window property keys. @@ -53,9 +52,6 @@ extern const aura::WindowProperty<WindowPersistsAcrossAllWorkspacesType>* const extern const aura::WindowProperty<bool>* const kWindowTrackedByWorkspaceKey; -extern const aura::WindowProperty<RootWindowController*>* const - kRootWindowControllerKey; - // Alphabetical sort. } // namespace internal diff --git a/ash/wm/window_util.cc b/ash/wm/window_util.cc index 833e02c..5ac2f11 100644 --- a/ash/wm/window_util.cc +++ b/ash/wm/window_util.cc @@ -99,10 +99,5 @@ void CenterWindow(aura::Window* window) { window->SetBounds(center); } -internal::RootWindowController* GetRootWindowController( - aura::RootWindow* root_window) { - return root_window->GetProperty(internal::kRootWindowControllerKey); -} - } // namespace wm } // namespace ash diff --git a/ash/wm/window_util.h b/ash/wm/window_util.h index e0bd718..6cfc907 100644 --- a/ash/wm/window_util.h +++ b/ash/wm/window_util.h @@ -9,14 +9,10 @@ #include "ash/ash_export.h" namespace aura { -class RootWindow; class Window; } namespace ash { -namespace internal { -class RootWindowController; -} namespace wm { // Convenience setters/getters for |aura::client::kRootWindowActiveWindow|. @@ -25,8 +21,6 @@ ASH_EXPORT void DeactivateWindow(aura::Window* window); ASH_EXPORT bool IsActiveWindow(aura::Window* window); ASH_EXPORT aura::Window* GetActiveWindow(); ASH_EXPORT bool CanActivateWindow(aura::Window* window); -ASH_EXPORT internal::RootWindowController* GetRootWindowController( - aura::RootWindow* root_window); // Retrieves the activatable window for |window|. If |window| is activatable, // this will just return it, otherwise it will climb the parent/transient parent |