diff options
author | koz@chromium.org <koz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-30 07:57:11 +0000 |
---|---|---|
committer | koz@chromium.org <koz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-30 07:57:11 +0000 |
commit | 9c44406bbb4f12a12a597a2cb5eb9a0bf972c899 (patch) | |
tree | b115ad714f859f6400006951db43538de31aa413 | |
parent | e566d2b0d2a2eec13572309409712135a26d80fd (diff) | |
download | chromium_src-9c44406bbb4f12a12a597a2cb5eb9a0bf972c899.zip chromium_src-9c44406bbb4f12a12a597a2cb5eb9a0bf972c899.tar.gz chromium_src-9c44406bbb4f12a12a597a2cb5eb9a0bf972c899.tar.bz2 |
Make the Remove Extension dialog modal for win app list.
BUG=234594
Review URL: https://chromiumcodereview.appspot.com/15715018
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@203107 0039d316-1c4b-4281-b951-d872f2087c98
6 files changed, 35 insertions, 17 deletions
diff --git a/chrome/browser/ui/app_list/app_list_service.h b/chrome/browser/ui/app_list/app_list_service.h index 80a20b1..97b8ef6 100644 --- a/chrome/browser/ui/app_list/app_list_service.h +++ b/chrome/browser/ui/app_list/app_list_service.h @@ -9,6 +9,7 @@ #include "base/basictypes.h" #include "base/compiler_specific.h" +#include "ui/gfx/native_widget_types.h" class AppListControllerDelegate; class CommandLine; @@ -61,6 +62,9 @@ class AppListService { // operating system and shell. virtual void EnableAppList() = 0; + // Get the window the app list is in, or NULL if the app list isn't visible. + virtual gfx::NativeWindow GetAppListWindow() = 0; + // Exposed to allow testing of the controller delegate. virtual AppListControllerDelegate* CreateControllerDelegate() = 0; diff --git a/chrome/browser/ui/app_list/app_list_service_disabled.cc b/chrome/browser/ui/app_list/app_list_service_disabled.cc index 2d8128e..8122e97 100644 --- a/chrome/browser/ui/app_list/app_list_service_disabled.cc +++ b/chrome/browser/ui/app_list/app_list_service_disabled.cc @@ -43,6 +43,10 @@ class AppListServiceDisabled : public AppListService { return NULL; } + virtual gfx::NativeWindow GetAppListWindow() OVERRIDE { + return NULL; + } + DISALLOW_COPY_AND_ASSIGN(AppListServiceDisabled); }; diff --git a/chrome/browser/ui/app_list/app_list_service_mac.mm b/chrome/browser/ui/app_list/app_list_service_mac.mm index 254527b..cf8555c 100644 --- a/chrome/browser/ui/app_list/app_list_service_mac.mm +++ b/chrome/browser/ui/app_list/app_list_service_mac.mm @@ -50,7 +50,6 @@ class AppListServiceMac : public AppListServiceImpl, } void CreateAppList(Profile* profile); - NSWindow* GetNativeWindow(); void ShowWindowNearDock(); // AppListService overrides: @@ -59,6 +58,7 @@ class AppListServiceMac : public AppListServiceImpl, virtual void DismissAppList() OVERRIDE; virtual bool IsAppListVisible() const OVERRIDE; virtual void EnableAppList() OVERRIDE; + virtual gfx::NativeWindow GetAppListWindow() OVERRIDE; // AppShimHandler overrides: virtual bool OnShimLaunch(apps::AppShimHandler::Host* host) OVERRIDE; @@ -169,7 +169,7 @@ void AppListControllerDelegateCocoa::DismissView() { } gfx::NativeWindow AppListControllerDelegateCocoa::GetAppListWindow() { - return AppListServiceMac::GetInstance()->GetNativeWindow(); + return AppListServiceMac::GetInstance()->GetAppListWindow(); } bool AppListControllerDelegateCocoa::CanPin() { @@ -267,7 +267,7 @@ void AppListServiceMac::EnableAppList() { // TODO(tapted): Implement enable logic here for OSX. } -NSWindow* AppListServiceMac::GetNativeWindow() { +NSWindow* AppListServiceMac::GetAppListWindow() { return [window_controller_ window]; } @@ -358,7 +358,7 @@ NSPoint GetAppListWindowOrigin(NSWindow* window) { } void AppListServiceMac::ShowWindowNearDock() { - NSWindow* window = GetNativeWindow(); + NSWindow* window = GetAppListWindow(); DCHECK(window); [window setFrameOrigin:GetAppListWindowOrigin(window)]; [window makeKeyAndOrderFront:nil]; diff --git a/chrome/browser/ui/ash/app_list/app_list_service_ash.cc b/chrome/browser/ui/ash/app_list/app_list_service_ash.cc index c9dfc57..64ad3fe 100644 --- a/chrome/browser/ui/ash/app_list/app_list_service_ash.cc +++ b/chrome/browser/ui/ash/app_list/app_list_service_ash.cc @@ -32,6 +32,7 @@ class AppListServiceAsh : public AppListServiceImpl { virtual bool IsAppListVisible() const OVERRIDE; virtual void DismissAppList() OVERRIDE; virtual void EnableAppList() OVERRIDE; + virtual gfx::NativeWindow GetAppListWindow() OVERRIDE; DISALLOW_COPY_AND_ASSIGN(AppListServiceAsh); }; @@ -60,6 +61,12 @@ void AppListServiceAsh::DismissAppList() { void AppListServiceAsh::EnableAppList() {} +gfx::NativeWindow AppListServiceAsh::GetAppListWindow() { + if (ash::Shell::HasInstance()) + return ash::Shell::GetInstance()->GetAppListWindow(); + return NULL; +} + } // namespace namespace chrome { diff --git a/chrome/browser/ui/views/app_list/app_list_controller_win.cc b/chrome/browser/ui/views/app_list/app_list_controller_win.cc index cee089d..8f749c3 100644 --- a/chrome/browser/ui/views/app_list/app_list_controller_win.cc +++ b/chrome/browser/ui/views/app_list/app_list_controller_win.cc @@ -311,6 +311,7 @@ class AppListController : public AppListServiceImpl { virtual void DismissAppList() OVERRIDE; virtual bool IsAppListVisible() const OVERRIDE; virtual void EnableAppList() OVERRIDE; + virtual gfx::NativeWindow GetAppListWindow() OVERRIDE; virtual AppListControllerDelegate* CreateControllerDelegate() OVERRIDE; // AppListServiceImpl overrides: @@ -409,8 +410,7 @@ void AppListControllerDelegateWin::ViewClosing() { } gfx::NativeWindow AppListControllerDelegateWin::GetAppListWindow() { - app_list::AppListView* view = AppListController::GetInstance()->GetView(); - return view ? view->GetWidget()->GetNativeWindow() : NULL; + return AppListController::GetInstance()->GetAppListWindow(); } gfx::ImageSkia AppListControllerDelegateWin::GetWindowIcon() { @@ -483,6 +483,12 @@ AppListController::AppListController() AppListController::~AppListController() { } +gfx::NativeWindow AppListController::GetAppListWindow() { + if (!IsAppListVisible()) + return NULL; + return current_view_ ? current_view_->GetWidget()->GetNativeWindow() : NULL; +} + AppListControllerDelegate* AppListController::CreateControllerDelegate() { return new AppListControllerDelegateWin(); } diff --git a/chrome/browser/ui/views/extensions/extension_uninstall_dialog_view.cc b/chrome/browser/ui/views/extensions/extension_uninstall_dialog_view.cc index dc9bfa5..6ea7927 100644 --- a/chrome/browser/ui/views/extensions/extension_uninstall_dialog_view.cc +++ b/chrome/browser/ui/views/extensions/extension_uninstall_dialog_view.cc @@ -8,6 +8,7 @@ #include "base/compiler_specific.h" #include "base/string_util.h" #include "base/utf_string_conversions.h" +#include "chrome/browser/ui/app_list/app_list_service.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_window.h" #include "chrome/common/extensions/extension.h" @@ -40,19 +41,15 @@ int HorizontalMargin() { } // Returns parent window for extension uninstall dialog. -// For ash, use app list window if it is visible. -// For other platforms or when app list is not visible on ash, -// use the given browser window. -// Note this function could return NULL if ash app list is not visible and +// For platforms with an app list, use the app list window if it is visible. +// For other platforms or when app list is not visible, use the given browser +// window. +// Note this function could return NULL if the app list is not visible and // there is no browser window. gfx::NativeWindow GetParent(Browser* browser) { -#if defined(USE_ASH) - if (ash::Shell::HasInstance()) { - gfx::NativeWindow app_list = ash::Shell::GetInstance()->GetAppListWindow(); - if (app_list) - return app_list; - } -#endif + gfx::NativeWindow window = AppListService::Get()->GetAppListWindow(); + if (window) + return window; if (browser && browser->window()) return browser->window()->GetNativeWindow(); |