Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6180)

Unified Diff: chrome/browser/ui/views/extensions/extension_uninstall_dialog_view.cc

Issue 382133003: Refactored ExtensionUninstallDialog to take a NativeWindow instead of a Browser (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removed the BrowserFinder method, and kept the dialog unconstructed until it's shown Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..60684f2f47940b4124519d50f909e91a56e232b4 100644
--- a/chrome/browser/ui/views/extensions/extension_uninstall_dialog_view.cc
+++ b/chrome/browser/ui/views/extensions/extension_uninstall_dialog_view.cc
@@ -31,20 +31,13 @@ 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 {
public:
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);
};
@@ -111,11 +103,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 +118,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();
tapted 2014/07/24 07:46:33 Actually .. I think there's still an annoying life
sashab 2014/07/25 02:44:33 Opened crbug.com/397396 to track this and added a
}
void ExtensionUninstallDialogViews::ExtensionUninstallAccepted() {
@@ -245,7 +226,7 @@ void ExtensionUninstallDialogDelegateView::Layout() {
// static
extensions::ExtensionUninstallDialog*
extensions::ExtensionUninstallDialog::Create(Profile* profile,
- Browser* browser,
+ gfx::NativeWindow parent,
Delegate* delegate) {
- return new ExtensionUninstallDialogViews(profile, browser, delegate);
+ return new ExtensionUninstallDialogViews(profile, parent, delegate);
}

Powered by Google App Engine
This is Rietveld 408576698