| Index: chrome/browser/ui/views/extensions/extension_uninstall_dialog_view.cc
|
| 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 d6d3a8c5964cfc01de4fcaa12927df3a1940c441..f515e25933858b369a77ab1e3b86a156f1cbcaff 100644
|
| --- a/chrome/browser/ui/views/extensions/extension_uninstall_dialog_view.cc
|
| +++ b/chrome/browser/ui/views/extensions/extension_uninstall_dialog_view.cc
|
| @@ -44,7 +44,7 @@ class ExtensionUninstallDialogViews
|
| public:
|
| ExtensionUninstallDialogViews(
|
| Profile* profile,
|
| - Browser* browser,
|
| + gfx::NativeWindow parent,
|
| extensions::ExtensionUninstallDialog::Delegate* delegate);
|
| virtual ~ExtensionUninstallDialogViews();
|
|
|
| @@ -58,7 +58,6 @@ class ExtensionUninstallDialogViews
|
| virtual void Show() OVERRIDE;
|
|
|
| ExtensionUninstallDialogDelegateView* view_;
|
| - bool show_in_app_list_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(ExtensionUninstallDialogViews);
|
| };
|
| @@ -111,11 +110,10 @@ class ExtensionUninstallDialogDelegateView : public views::DialogDelegateView {
|
|
|
| ExtensionUninstallDialogViews::ExtensionUninstallDialogViews(
|
| Profile* profile,
|
| - Browser* browser,
|
| + gfx::NativeWindow parent,
|
| extensions::ExtensionUninstallDialog::Delegate* delegate)
|
| - : extensions::ExtensionUninstallDialog(profile, browser, delegate),
|
| - view_(NULL),
|
| - show_in_app_list_(!browser) {
|
| + : extensions::ExtensionUninstallDialog(profile, parent, delegate),
|
| + view_(NULL) {
|
| }
|
|
|
| ExtensionUninstallDialogViews::~ExtensionUninstallDialogViews() {
|
| @@ -127,19 +125,9 @@ ExtensionUninstallDialogViews::~ExtensionUninstallDialogViews() {
|
| }
|
|
|
| void ExtensionUninstallDialogViews::Show() {
|
| - // TODO(tapted): A true |desktop_type| needs to be passed in at creation time
|
| - // to remove reliance on GetActiveDesktop(). http://crbug.com/308360
|
| - gfx::NativeWindow parent = show_in_app_list_ ?
|
| - AppListService::Get(chrome::GetActiveDesktop())->GetAppListWindow() :
|
| - GetParent(browser_);
|
| - if (browser_ && !parent) {
|
| - delegate_->ExtensionUninstallCanceled();
|
| - return;
|
| - }
|
| -
|
| view_ = new ExtensionUninstallDialogDelegateView(
|
| this, extension_, triggering_extension_, &icon_);
|
| - CreateBrowserModalDialogViews(view_, parent)->Show();
|
| + CreateBrowserModalDialogViews(view_, parent_)->Show();
|
| }
|
|
|
| void ExtensionUninstallDialogViews::ExtensionUninstallAccepted() {
|
| @@ -247,5 +235,18 @@ extensions::ExtensionUninstallDialog*
|
| extensions::ExtensionUninstallDialog::Create(Profile* profile,
|
| Browser* browser,
|
| Delegate* delegate) {
|
| - return new ExtensionUninstallDialogViews(profile, browser, delegate);
|
| + // If no browser window can be found, GetParent(browser) will be NULL, which
|
| + // will display this dialog as a standalone window (rather than a modal).
|
| + ExtensionUninstallDialogViews* dialog =
|
| + new ExtensionUninstallDialogViews(profile, GetParent(browser), delegate);
|
| + dialog->RegisterObserver(browser);
|
| + return dialog;
|
| +}
|
| +
|
| +// static
|
| +extensions::ExtensionUninstallDialog*
|
| +extensions::ExtensionUninstallDialog::CreateModal(Profile* profile,
|
| + gfx::NativeWindow parent,
|
| + Delegate* delegate) {
|
| + return new ExtensionUninstallDialogViews(profile, parent, delegate);
|
| }
|
|
|