Index: chrome/browser/extensions/api/management/chrome_management_api_delegate.cc |
diff --git a/chrome/browser/extensions/api/management/chrome_management_api_delegate.cc b/chrome/browser/extensions/api/management/chrome_management_api_delegate.cc |
index 661bf478158998bc14dd8b2ba7db123a17d98944..ad326dbb4517566a56d56f07d6fe60c9e2c10fce 100644 |
--- a/chrome/browser/extensions/api/management/chrome_management_api_delegate.cc |
+++ b/chrome/browser/extensions/api/management/chrome_management_api_delegate.cc |
@@ -6,6 +6,7 @@ |
#include "base/strings/utf_string_conversions.h" |
#include "chrome/browser/extensions/bookmark_app_helper.h" |
+#include "chrome/browser/extensions/chrome_extension_function_details.h" |
#include "chrome/browser/extensions/chrome_requirements_checker.h" |
#include "chrome/browser/extensions/extension_service.h" |
#include "chrome/browser/extensions/extension_util.h" |
@@ -77,12 +78,21 @@ class ManagementUninstallFunctionUninstallDialogDelegate |
const extensions::Extension* target_extension, |
bool show_programmatic_uninstall_ui) |
: function_(function) { |
- content::WebContents* web_contents = function->GetSenderWebContents(); |
+ Profile* profile = Profile::FromBrowserContext(function->browser_context()); |
+ content::WebContents* web_contents = |
+ ChromeExtensionFunctionDetails(function).GetVisibleWebContents(); |
not at google - send to devlin
2015/07/10 17:02:25
I'd slightly restructure this, to avoid the cast f
|
+ gfx::NativeWindow window = |
+ web_contents ? web_contents->GetTopLevelNativeWindow() : nullptr; |
+ |
+ if (!window) { |
+ // This shouldn't happen if we have user gesture. |
+ Browser* browser = |
+ chrome::FindBrowserWithProfile(profile, chrome::GetActiveDesktop()); |
not at google - send to devlin
2015/07/10 17:02:25
You could move this into GetNativeWindowForUI?
|
+ window = browser->window()->GetNativeWindow(); |
+ } |
+ |
extension_uninstall_dialog_.reset( |
- extensions::ExtensionUninstallDialog::Create( |
- Profile::FromBrowserContext(function->browser_context()), |
- web_contents ? web_contents->GetTopLevelNativeWindow() : nullptr, |
- this)); |
+ extensions::ExtensionUninstallDialog::Create(profile, window, this)); |
if (show_programmatic_uninstall_ui) { |
extension_uninstall_dialog_->ConfirmUninstallByExtension( |
target_extension, function->extension(), |