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

Unified Diff: chrome/browser/extensions/api/management/chrome_management_api_delegate.cc

Issue 1225693009: Show extension uninstall dialog in browser window. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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(),
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698