diff options
author | oshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-02 01:42:47 +0000 |
---|---|---|
committer | oshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-02 01:42:47 +0000 |
commit | 80549c15ef5f28bd944dc3fbb1a4089f10146b6f (patch) | |
tree | 147c0249fdb9e9d67ea154a02522f029af0c8b2d /ash | |
parent | 8244643a07d2d7ffa082d02b22a80d09a621bf65 (diff) | |
download | chromium_src-80549c15ef5f28bd944dc3fbb1a4089f10146b6f.zip chromium_src-80549c15ef5f28bd944dc3fbb1a4089f10146b6f.tar.gz chromium_src-80549c15ef5f28bd944dc3fbb1a4089f10146b6f.tar.bz2 |
Cleanup: move AlwaysOnTopController to RootWindowController
remove if (shelf_) as it should always be there.
BUG=253991
Review URL: https://chromiumcodereview.appspot.com/18323011
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@209575 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash')
-rw-r--r-- | ash/root_window_controller.cc | 24 | ||||
-rw-r--r-- | ash/root_window_controller.h | 6 | ||||
-rw-r--r-- | ash/shell.cc | 11 | ||||
-rw-r--r-- | ash/wm/stacking_controller.cc | 23 | ||||
-rw-r--r-- | ash/wm/stacking_controller.h | 4 | ||||
-rw-r--r-- | ash/wm/window_properties.cc | 5 | ||||
-rw-r--r-- | ash/wm/window_properties.h | 6 | ||||
-rw-r--r-- | ash/wm/workspace/workspace_layout_manager.cc | 6 |
8 files changed, 31 insertions, 54 deletions
diff --git a/ash/root_window_controller.cc b/ash/root_window_controller.cc index b765fff..b9d13ab 100644 --- a/ash/root_window_controller.cc +++ b/ash/root_window_controller.cc @@ -23,6 +23,8 @@ #include "ash/system/tray/system_tray_delegate.h" #include "ash/touch/touch_hud_debug.h" #include "ash/touch/touch_hud_projection.h" +#include "ash/touch/touch_observer_hud.h" +#include "ash/wm/always_on_top_controller.h" #include "ash/wm/base_layout_manager.h" #include "ash/wm/boot_splash_screen.h" #include "ash/wm/dock/docked_window_layout_manager.h" @@ -263,6 +265,8 @@ void RootWindowController::InitLayoutManagers() { always_on_top_container->SetLayoutManager( new BaseLayoutManager( always_on_top_container->GetRootWindow())); + always_on_top_controller_.reset(new internal::AlwaysOnTopController); + always_on_top_controller_->SetAlwaysOnTopContainer(always_on_top_container); } void RootWindowController::InitForPrimaryDisplay() { @@ -337,22 +341,19 @@ void RootWindowController::OnLauncherCreated() { } void RootWindowController::ShowLauncher() { - if (!shelf_.get() || !shelf_->launcher()) + if (!shelf_->launcher()) return; shelf_->launcher()->SetVisible(true); shelf_->status_area_widget()->Show(); } void RootWindowController::OnLoginStateChanged(user::LoginStatus status) { - // TODO(oshima): remove if when launcher per display is enabled by - // default. - if (shelf_) - shelf_->shelf_layout_manager()->UpdateVisibilityState(); + shelf_->shelf_layout_manager()->UpdateVisibilityState(); } void RootWindowController::UpdateAfterLoginStatusChange( user::LoginStatus status) { - if (shelf_.get() && shelf_->status_area_widget()) + if (shelf_->status_area_widget()) shelf_->status_area_widget()->UpdateAfterLoginStatusChange(status); } @@ -373,6 +374,8 @@ void RootWindowController::HandleDesktopBackgroundVisible() { } void RootWindowController::CloseChildWindows() { + if (!shelf_.get()) + return; // panel_layout_manager_ needs to be shut down before windows are destroyed. if (panel_layout_manager_) { panel_layout_manager_->Shutdown(); @@ -380,10 +383,9 @@ void RootWindowController::CloseChildWindows() { } // TODO(harrym): Remove when Status Area Widget is a child view. - if (shelf_) - shelf_->ShutdownStatusAreaWidget(); + shelf_->ShutdownStatusAreaWidget(); - if (shelf_.get() && shelf_->shelf_layout_manager()) + if (shelf_->shelf_layout_manager()) shelf_->shelf_layout_manager()->set_workspace_controller(NULL); // Close background widget first as it depends on tooltip. @@ -423,13 +425,13 @@ void RootWindowController::DisableTouchHudProjection() { } ShelfLayoutManager* RootWindowController::GetShelfLayoutManager() { - return shelf_.get() ? shelf_->shelf_layout_manager() : NULL; + return shelf_->shelf_layout_manager(); } SystemTray* RootWindowController::GetSystemTray() { // We assume in throughout the code that this will not return NULL. If code // triggers this for valid reasons, it should test status_area_widget first. - CHECK(shelf_.get() && shelf_->status_area_widget()); + CHECK(shelf_->status_area_widget()); return shelf_->status_area_widget()->system_tray(); } diff --git a/ash/root_window_controller.h b/ash/root_window_controller.h index 4fe4578..a6b81c1 100644 --- a/ash/root_window_controller.h +++ b/ash/root_window_controller.h @@ -45,6 +45,7 @@ class ToplevelWindowEventHandler; namespace internal { +class AlwaysOnTopController; class BootSplashScreen; class DockedWindowLayoutManager; class PanelLayoutManager; @@ -88,6 +89,10 @@ class ASH_EXPORT RootWindowController { return workspace_controller_.get(); } + AlwaysOnTopController* always_on_top_controller() { + return always_on_top_controller_.get(); + } + ScreenDimmer* screen_dimmer() { return screen_dimmer_.get(); } // Access the shelf associated with this root window controller, @@ -230,6 +235,7 @@ class ASH_EXPORT RootWindowController { scoped_ptr<ScreenDimmer> screen_dimmer_; scoped_ptr<WorkspaceController> workspace_controller_; + scoped_ptr<AlwaysOnTopController> always_on_top_controller_; // Heads-up displays for touch events. These HUDs are not owned by the root // window controller and manage their own lifetimes. diff --git a/ash/shell.cc b/ash/shell.cc index 0ee5b6f..3f451df 100644 --- a/ash/shell.cc +++ b/ash/shell.cc @@ -39,7 +39,6 @@ #include "ash/system/tray/system_tray_delegate.h" #include "ash/system/tray/system_tray_notifier.h" #include "ash/wm/activation_controller.h" -#include "ash/wm/always_on_top_controller.h" #include "ash/wm/app_list_controller.h" #include "ash/wm/ash_activation_controller.h" #include "ash/wm/ash_focus_rules.h" @@ -938,16 +937,8 @@ void Shell::InitRootWindowController( controller->InitLayoutManagers(); controller->InitTouchHuds(); - // TODO(oshima): Move the instance to RootWindowController when - // the extended desktop is enabled by default. - internal::AlwaysOnTopController* always_on_top_controller = - new internal::AlwaysOnTopController; - always_on_top_controller->SetAlwaysOnTopContainer( - root_window->GetChildById(internal::kShellWindowId_AlwaysOnTopContainer)); - root_window->SetProperty(internal::kAlwaysOnTopControllerKey, - always_on_top_controller); if (GetPrimaryRootWindowController()->GetSystemModalLayoutManager(NULL)-> - has_modal_background()) { + has_modal_background()) { controller->GetSystemModalLayoutManager(NULL)->CreateModalBackground(); } diff --git a/ash/wm/stacking_controller.cc b/ash/wm/stacking_controller.cc index 3ba9dca..24f38d5 100644 --- a/ash/wm/stacking_controller.cc +++ b/ash/wm/stacking_controller.cc @@ -4,11 +4,13 @@ #include "ash/wm/stacking_controller.h" +#include "ash/root_window_controller.h" #include "ash/session_state_delegate.h" #include "ash/shell.h" #include "ash/shell_window_ids.h" #include "ash/wm/always_on_top_controller.h" #include "ash/wm/coordinate_conversion.h" +#include "ash/wm/property_util.h" #include "ash/wm/window_properties.h" #include "ui/aura/client/aura_constants.h" #include "ui/aura/root_window.h" @@ -52,6 +54,11 @@ bool IsPanelAttached(aura::Window* window) { return window->GetProperty(internal::kPanelAttachedKey); } +internal::AlwaysOnTopController* +GetAlwaysOnTopController(aura::RootWindow* root_window) { + return GetRootWindowController(root_window)->always_on_top_controller(); +} + } // namespace //////////////////////////////////////////////////////////////////////////////// @@ -144,20 +151,4 @@ aura::Window* StackingController::GetSystemModalContainer( return container; } -// TODO(oshima): Remove this once extended desktop is on by default. -internal::AlwaysOnTopController* -StackingController::GetAlwaysOnTopController(aura::RootWindow* root_window) { - internal::AlwaysOnTopController* controller = - root_window->GetProperty(internal::kAlwaysOnTopControllerKey); - if (!controller) { - controller = new internal::AlwaysOnTopController; - controller->SetAlwaysOnTopContainer( - root_window->GetChildById( - internal::kShellWindowId_AlwaysOnTopContainer)); - // RootWindow owns the AlwaysOnTopController object. - root_window->SetProperty(internal::kAlwaysOnTopControllerKey, controller); - } - return controller; -} - } // namespace ash diff --git a/ash/wm/stacking_controller.h b/ash/wm/stacking_controller.h index 21611ed..07003cb 100644 --- a/ash/wm/stacking_controller.h +++ b/ash/wm/stacking_controller.h @@ -40,10 +40,6 @@ class ASH_EXPORT StackingController : public aura::client::StackingClient { aura::Window* GetSystemModalContainer(aura::RootWindow* root, aura::Window* window) const; - // Returns the AlwaysOnTopController of the |root_window|. - internal::AlwaysOnTopController* GetAlwaysOnTopController( - aura::RootWindow* root_window); - DISALLOW_COPY_AND_ASSIGN(StackingController); }; diff --git a/ash/wm/window_properties.cc b/ash/wm/window_properties.cc index 64d55a7..9dda0174 100644 --- a/ash/wm/window_properties.cc +++ b/ash/wm/window_properties.cc @@ -5,21 +5,16 @@ #include "ash/wm/window_properties.h" #include "ash/root_window_controller.h" -#include "ash/wm/always_on_top_controller.h" #include "ash/wm/frame_painter.h" #include "ui/aura/window_property.h" #include "ui/gfx/rect.h" -DECLARE_WINDOW_PROPERTY_TYPE(ash::internal::AlwaysOnTopController*); DECLARE_EXPORTED_WINDOW_PROPERTY_TYPE(ASH_EXPORT, ash::FramePainter*); DECLARE_WINDOW_PROPERTY_TYPE(ash::WindowPersistsAcrossAllWorkspacesType) DECLARE_WINDOW_PROPERTY_TYPE(ash::internal::RootWindowController*); namespace ash { namespace internal { -DEFINE_OWNED_WINDOW_PROPERTY_KEY(ash::internal::AlwaysOnTopController, - kAlwaysOnTopControllerKey, - NULL); DEFINE_WINDOW_PROPERTY_KEY(bool, kContinueDragAfterReparent, false); DEFINE_WINDOW_PROPERTY_KEY(bool, kCyclingThroughWorkspacesKey, false); DEFINE_WINDOW_PROPERTY_KEY(bool, kFullscreenUsesMinimalChromeKey, false); diff --git a/ash/wm/window_properties.h b/ash/wm/window_properties.h index ae30435..c5bba1f 100644 --- a/ash/wm/window_properties.h +++ b/ash/wm/window_properties.h @@ -17,18 +17,12 @@ class Rect; namespace ash { class FramePainter; namespace internal { -class AlwaysOnTopController; class RootWindowController; // Shell-specific window property keys. // Alphabetical sort. -// A Key to store AlwaysOnTopController per RootWindow. The value is -// owned by the RootWindow. -extern const aura::WindowProperty<internal::AlwaysOnTopController*>* const - kAlwaysOnTopControllerKey; - // A property key to indicate that an in progress drag should be continued // after the window is reparented to another container. extern const aura::WindowProperty<bool>* const kContinueDragAfterReparent; diff --git a/ash/wm/workspace/workspace_layout_manager.cc b/ash/wm/workspace/workspace_layout_manager.cc index 6e9feca..15052ee 100644 --- a/ash/wm/workspace/workspace_layout_manager.cc +++ b/ash/wm/workspace/workspace_layout_manager.cc @@ -5,11 +5,13 @@ #include "ash/wm/workspace/workspace_layout_manager.h" #include "ash/ash_switches.h" +#include "ash/root_window_controller.h" #include "ash/screen_ash.h" #include "ash/session_state_delegate.h" #include "ash/shell.h" #include "ash/wm/always_on_top_controller.h" #include "ash/wm/base_layout_manager.h" +#include "ash/wm/property_util.h" #include "ash/wm/window_animations.h" #include "ash/wm/window_properties.h" #include "ash/wm/window_util.h" @@ -240,8 +242,8 @@ void WorkspaceLayoutManager::OnWindowPropertyChanged(Window* window, if (key == aura::client::kAlwaysOnTopKey && window->GetProperty(aura::client::kAlwaysOnTopKey)) { internal::AlwaysOnTopController* controller = - window->GetRootWindow()->GetProperty( - internal::kAlwaysOnTopControllerKey); + GetRootWindowController(window->GetRootWindow())-> + always_on_top_controller(); controller->GetContainer(window)->AddChild(window); } } |