OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/extensions/extension_uninstall_dialog.h" | 5 #include "chrome/browser/extensions/extension_uninstall_dialog.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
114 Browser* browser, | 114 Browser* browser, |
115 extensions::ExtensionUninstallDialog::Delegate* delegate) | 115 extensions::ExtensionUninstallDialog::Delegate* delegate) |
116 : extensions::ExtensionUninstallDialog(profile, browser, delegate), | 116 : extensions::ExtensionUninstallDialog(profile, browser, delegate), |
117 view_(NULL), | 117 view_(NULL), |
118 show_in_app_list_(!browser) { | 118 show_in_app_list_(!browser) { |
119 } | 119 } |
120 | 120 |
121 ExtensionUninstallDialogViews::~ExtensionUninstallDialogViews() { | 121 ExtensionUninstallDialogViews::~ExtensionUninstallDialogViews() { |
122 // Close the widget (the views framework will delete view_). | 122 // Close the widget (the views framework will delete view_). |
123 if (view_) { | 123 if (view_) { |
124 // This can only happen if the dialog is destroyed by some external means, | |
125 // and neither of ExtensionUninstallAccepted() and | |
126 // ExtensionUninstallCanceled() have been called. In this case, the dialog | |
127 // is probably already being closed, but call Close() just to make sure. | |
124 view_->DialogDestroyed(); | 128 view_->DialogDestroyed(); |
125 view_->GetWidget()->CloseNow(); | 129 view_->GetWidget()->Close(); |
sky
2014/07/23 15:29:37
If you do this, it means the WidgetDelegate/Dialog
sashab
2014/08/06 03:09:00
If that's true, then I don't think this destructor
| |
126 } | 130 } |
127 } | 131 } |
128 | 132 |
129 void ExtensionUninstallDialogViews::Show() { | 133 void ExtensionUninstallDialogViews::Show() { |
130 // TODO(tapted): A true |desktop_type| needs to be passed in at creation time | 134 // TODO(tapted): A true |desktop_type| needs to be passed in at creation time |
131 // to remove reliance on GetActiveDesktop(). http://crbug.com/308360 | 135 // to remove reliance on GetActiveDesktop(). http://crbug.com/308360 |
132 gfx::NativeWindow parent = show_in_app_list_ ? | 136 gfx::NativeWindow parent = show_in_app_list_ ? |
133 AppListService::Get(chrome::GetActiveDesktop())->GetAppListWindow() : | 137 AppListService::Get(chrome::GetActiveDesktop())->GetAppListWindow() : |
134 GetParent(browser_); | 138 GetParent(browser_); |
135 if (browser_ && !parent) { | 139 if (browser_ && !parent) { |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
242 | 246 |
243 } // namespace | 247 } // namespace |
244 | 248 |
245 // static | 249 // static |
246 extensions::ExtensionUninstallDialog* | 250 extensions::ExtensionUninstallDialog* |
247 extensions::ExtensionUninstallDialog::Create(Profile* profile, | 251 extensions::ExtensionUninstallDialog::Create(Profile* profile, |
248 Browser* browser, | 252 Browser* browser, |
249 Delegate* delegate) { | 253 Delegate* delegate) { |
250 return new ExtensionUninstallDialogViews(profile, browser, delegate); | 254 return new ExtensionUninstallDialogViews(profile, browser, delegate); |
251 } | 255 } |
OLD | NEW |