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..1c19400fe1a3e15ad9b56c765d6171fbdf95581e 100644 |
--- a/chrome/browser/extensions/api/management/chrome_management_api_delegate.cc |
+++ b/chrome/browser/extensions/api/management/chrome_management_api_delegate.cc |
@@ -30,11 +30,13 @@ |
#include "content/public/browser/web_contents.h" |
#include "extensions/browser/api/management/management_api.h" |
#include "extensions/browser/api/management/management_api_constants.h" |
+#include "extensions/browser/extension_host.h" |
#include "extensions/browser/extension_prefs.h" |
#include "extensions/browser/extension_registry.h" |
#include "extensions/browser/extension_system.h" |
#include "extensions/common/constants.h" |
#include "extensions/common/extension.h" |
+#include "extensions/common/manifest_handlers/background_info.h" |
namespace { |
@@ -77,12 +79,28 @@ class ManagementUninstallFunctionUninstallDialogDelegate |
const extensions::Extension* target_extension, |
bool show_programmatic_uninstall_ui) |
: function_(function) { |
+ Profile* profile = Profile::FromBrowserContext(function->browser_context()); |
content::WebContents* web_contents = function->GetSenderWebContents(); |
+ const extensions::Extension* extension = function->extension(); |
+ gfx::NativeWindow window = |
+ web_contents ? web_contents->GetTopLevelNativeWindow() : nullptr; |
+ |
+ if (extension && extensions::BackgroundInfo::HasBackgroundPage(extension)) { |
+ extensions::ExtensionHost* background_host = |
+ extensions::ProcessManager::Get(function->browser_context()) |
+ ->GetBackgroundHostForExtension(extension->id()); |
+ // Do not use the window of the background page. |
+ if (background_host && background_host->host_contents() == web_contents) |
+ window = nullptr; |
+ } |
not at google - send to devlin
2015/07/08 23:10:04
Is this entire block of code necessary? I would ha
wjywbs
2015/07/09 00:27:12
No, GetTopLevelNativeWindow() does not return null
not at google - send to devlin
2015/07/09 16:30:42
ok, could you check for a null root window then?
wjywbs
2015/07/09 16:54:25
The window->GetRootWindow() function is only defin
not at google - send to devlin
2015/07/09 17:13:39
ahhh damn it. Alright! This all finally reminded m
wjywbs
2015/07/10 02:34:43
Done.
|
+ |
+ if (!window) { |
+ Browser* browser = |
+ chrome::FindBrowserWithProfile(profile, chrome::GetActiveDesktop()); |
+ 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(), |