Commit 9c44406b authored by koz@chromium.org's avatar koz@chromium.org

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
parent e566d2b0
......@@ -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;
......
......@@ -43,6 +43,10 @@ class AppListServiceDisabled : public AppListService {
return NULL;
}
virtual gfx::NativeWindow GetAppListWindow() OVERRIDE {
return NULL;
}
DISALLOW_COPY_AND_ASSIGN(AppListServiceDisabled);
};
......
......@@ -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];
......
......@@ -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 {
......
......@@ -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();
}
......
......@@ -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();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment