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..f97e26ae114559f134140a400d85a7c2ff3e4523 100644 |
--- a/chrome/browser/ui/views/extensions/extension_uninstall_dialog_view.cc |
+++ b/chrome/browser/ui/views/extensions/extension_uninstall_dialog_view.cc |
@@ -10,7 +10,6 @@ |
#include "base/strings/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/browser/ui/views/constrained_window_views.h" |
#include "extensions/common/extension.h" |
#include "grit/generated_resources.h" |
@@ -31,13 +30,6 @@ const int kIconSize = 64; |
class ExtensionUninstallDialogDelegateView; |
-// Returns parent window for extension uninstall dialog. |
-gfx::NativeWindow GetParent(Browser* browser) { |
- if (browser && browser->window()) |
- return browser->window()->GetNativeWindow(); |
- return NULL; |
-} |
- |
// Views implementation of the uninstall dialog. |
class ExtensionUninstallDialogViews |
: public extensions::ExtensionUninstallDialog { |
@@ -45,6 +37,7 @@ class ExtensionUninstallDialogViews |
ExtensionUninstallDialogViews( |
Profile* profile, |
Browser* browser, |
+ gfx::NativeWindow parent, |
extensions::ExtensionUninstallDialog::Delegate* delegate); |
virtual ~ExtensionUninstallDialogViews(); |
@@ -58,7 +51,6 @@ class ExtensionUninstallDialogViews |
virtual void Show() OVERRIDE; |
ExtensionUninstallDialogDelegateView* view_; |
- bool show_in_app_list_; |
DISALLOW_COPY_AND_ASSIGN(ExtensionUninstallDialogViews); |
}; |
@@ -112,10 +104,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, browser, parent, delegate), |
+ view_(NULL) { |
} |
ExtensionUninstallDialogViews::~ExtensionUninstallDialogViews() { |
@@ -127,19 +119,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 +229,13 @@ extensions::ExtensionUninstallDialog* |
extensions::ExtensionUninstallDialog::Create(Profile* profile, |
Browser* browser, |
Delegate* delegate) { |
- return new ExtensionUninstallDialogViews(profile, browser, delegate); |
+ return new ExtensionUninstallDialogViews(profile, browser, NULL, delegate); |
+} |
+ |
+// static |
+extensions::ExtensionUninstallDialog* |
+extensions::ExtensionUninstallDialog::CreateModal(Profile* profile, |
+ gfx::NativeWindow parent, |
+ Delegate* delegate) { |
+ return new ExtensionUninstallDialogViews(profile, NULL, parent, delegate); |
} |