diff options
author | xiyuan@chromium.org <xiyuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-09 23:31:11 +0000 |
---|---|---|
committer | xiyuan@chromium.org <xiyuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-09 23:31:11 +0000 |
commit | 1e51a9d182d8387d52c5f3526289d1db30ede4d1 (patch) | |
tree | 9937bfaa65c31f8d8a14fc0c189627b25ca79a58 /ash | |
parent | 760e9d8f231b9b79164c28165d4249aeb98463d1 (diff) | |
download | chromium_src-1e51a9d182d8387d52c5f3526289d1db30ede4d1.zip chromium_src-1e51a9d182d8387d52c5f3526289d1db30ede4d1.tar.gz chromium_src-1e51a9d182d8387d52c5f3526289d1db30ede4d1.tar.bz2 |
ash: Make extension uninstall UI can use app list window as parent.
- Make window-modal window stack into the same container as its transient parent;
- Make extension uninstall dialog window modal;
- Make extension uninstall dialog a transient child of app list
window when app list is showing;
- Make app list stay when new active window is also in app list container;
BUG=122374
TEST=Verify fix for issue 122374.
Review URL: http://codereview.chromium.org/10027025
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@131478 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash')
-rw-r--r-- | ash/app_list/app_list.cc | 13 | ||||
-rw-r--r-- | ash/app_list/app_list.h | 3 | ||||
-rw-r--r-- | ash/shell.cc | 4 | ||||
-rw-r--r-- | ash/shell.h | 3 | ||||
-rw-r--r-- | ash/wm/stacking_controller.cc | 44 |
5 files changed, 52 insertions, 15 deletions
diff --git a/ash/app_list/app_list.cc b/ash/app_list/app_list.cc index 5cbb3d5..f2a007f 100644 --- a/ash/app_list/app_list.cc +++ b/ash/app_list/app_list.cc @@ -10,6 +10,7 @@ #include "ash/shell.h" #include "ash/shell_window_ids.h" #include "ash/wm/shelf_layout_manager.h" +#include "ash/wm/window_util.h" #include "ui/aura/event.h" #include "ui/aura/root_window.h" #include "ui/aura/window.h" @@ -81,6 +82,10 @@ bool AppList::IsVisible() { return view_ && view_->GetWidget()->IsVisible(); } +aura::Window* AppList::GetWindow() { + return is_visible_ && view_ ? view_->GetWidget()->GetNativeWindow() : NULL; +} + //////////////////////////////////////////////////////////////////////////////// // AppList, private: @@ -257,8 +262,12 @@ void AppList::OnWidgetClosing(views::Widget* widget) { void AppList::OnWidgetActivationChanged(views::Widget* widget, bool active) { DCHECK(view_->GetWidget() == widget); - if (view_ && is_visible_ && !active) - SetVisible(false); + if (view_ && is_visible_ && !active) { + aura::Window* self = view_->GetWidget()->GetNativeWindow(); + aura::Window* active_window = ash::wm::GetActiveWindow(); + if (active_window->parent() != self->parent()) + SetVisible(false); + } } } // namespace internal diff --git a/ash/app_list/app_list.h b/ash/app_list/app_list.h index 639d088..64c4509 100644 --- a/ash/app_list/app_list.h +++ b/ash/app_list/app_list.h @@ -42,6 +42,9 @@ class AppList : public aura::EventFilter, // is ongoing. bool GetTargetVisibility() const { return is_visible_; } + // Returns app list window or NULL if it is not visible. + aura::Window* GetWindow(); + private: // Sets app list view. If we are in visible mode, start showing animation. // Otherwise, we just close it. diff --git a/ash/shell.cc b/ash/shell.cc index 955f012..d246e6c 100644 --- a/ash/shell.cc +++ b/ash/shell.cc @@ -817,6 +817,10 @@ bool Shell::GetAppListTargetVisibility() const { return app_list_.get() && app_list_->GetTargetVisibility(); } +aura::Window* Shell::GetAppListWindow() { + return app_list_.get() ? app_list_->GetWindow() : NULL; +} + bool Shell::IsScreenLocked() const { return !delegate_.get() || delegate_->IsScreenLocked(); } diff --git a/ash/shell.h b/ash/shell.h index a03ede5..2c0657b 100644 --- a/ash/shell.h +++ b/ash/shell.h @@ -144,6 +144,9 @@ class ASH_EXPORT Shell { // Returns app list target visibility. bool GetAppListTargetVisibility() const; + // Returns app list window or NULL if it is not visible. + aura::Window* GetAppListWindow(); + // Returns true if the screen is locked. bool IsScreenLocked() const; diff --git a/ash/wm/stacking_controller.cc b/ash/wm/stacking_controller.cc index 88499e5..d8360a3 100644 --- a/ash/wm/stacking_controller.cc +++ b/ash/wm/stacking_controller.cc @@ -16,15 +16,27 @@ namespace ash { namespace internal { namespace { -aura::Window* GetContainer(int id) { +aura::Window* GetContainerById(int id) { return Shell::GetInstance()->GetContainer(id); } +aura::Window* GetContainerForWindow(aura::Window* window) { + aura::Window* container = window->parent(); + while (container && container->type() != aura::client::WINDOW_TYPE_UNKNOWN) + container = container->parent(); + return container; +} + bool IsSystemModal(aura::Window* window) { return window->transient_parent() && window->GetProperty(aura::client::kModalKey) == ui::MODAL_TYPE_SYSTEM; } +bool IsWindowModal(aura::Window* window) { + return window->transient_parent() && + window->GetProperty(aura::client::kModalKey) == ui::MODAL_TYPE_WINDOW; +} + } // namespace //////////////////////////////////////////////////////////////////////////////// @@ -34,8 +46,8 @@ StackingController::StackingController() { aura::client::SetStackingClient(this); always_on_top_controller_.reset(new internal::AlwaysOnTopController); always_on_top_controller_->SetContainers( - GetContainer(internal::kShellWindowId_DefaultContainer), - GetContainer(internal::kShellWindowId_AlwaysOnTopContainer)); + GetContainerById(internal::kShellWindowId_DefaultContainer), + GetContainerById(internal::kShellWindowId_AlwaysOnTopContainer)); } StackingController::~StackingController() { @@ -50,16 +62,19 @@ aura::Window* StackingController::GetDefaultParent(aura::Window* window) { case aura::client::WINDOW_TYPE_POPUP: if (IsSystemModal(window)) return GetSystemModalContainer(window); + else if (IsWindowModal(window)) + return GetContainerForWindow(window->transient_parent()); return always_on_top_controller_->GetContainer(window); case aura::client::WINDOW_TYPE_PANEL: - return GetContainer(internal::kShellWindowId_PanelContainer); + return GetContainerById(internal::kShellWindowId_PanelContainer); case aura::client::WINDOW_TYPE_MENU: - return GetContainer(internal::kShellWindowId_MenuContainer); + return GetContainerById(internal::kShellWindowId_MenuContainer); case aura::client::WINDOW_TYPE_TOOLTIP: - return GetContainer( + return GetContainerById( internal::kShellWindowId_DragImageAndTooltipContainer); case aura::client::WINDOW_TYPE_CONTROL: - return GetContainer(internal::kShellWindowId_UnparentedControlContainer); + return GetContainerById( + internal::kShellWindowId_UnparentedControlContainer); default: NOTREACHED() << "Window " << window->id() << " has unhandled type " << window->type(); @@ -79,9 +94,9 @@ aura::Window* StackingController::GetSystemModalContainer( // If screen lock is not active, all modal windows are placed into the // normal modal container. aura::Window* lock_container = - GetContainer(internal::kShellWindowId_LockScreenContainer); + GetContainerById(internal::kShellWindowId_LockScreenContainer); if (!lock_container->children().size()) - return GetContainer(internal::kShellWindowId_SystemModalContainer); + return GetContainerById(internal::kShellWindowId_SystemModalContainer); // Otherwise those that originate from LockScreen container and above are // placed in the screen lock modal container. @@ -89,10 +104,13 @@ aura::Window* StackingController::GetSystemModalContainer( int window_container_id = window->transient_parent()->parent()->id(); aura::Window* container = NULL; - if (window_container_id < lock_container_id) - container = GetContainer(internal::kShellWindowId_SystemModalContainer); - else - container = GetContainer(internal::kShellWindowId_LockSystemModalContainer); + if (window_container_id < lock_container_id) { + container = GetContainerById( + internal::kShellWindowId_SystemModalContainer); + } else { + container = GetContainerById( + internal::kShellWindowId_LockSystemModalContainer); + } return container; } |