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

Unified Diff: chrome/browser/extensions/webstore_inline_installer.cc

Issue 1554233005: Don't allow inline install if frame is deleted before user accepts (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2564
Patch Set: Created 4 years, 11 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/extensions/webstore_inline_installer.cc
diff --git a/chrome/browser/extensions/webstore_inline_installer.cc b/chrome/browser/extensions/webstore_inline_installer.cc
index 045d996465d3616d7cded6e997339c801ebfa203..e0eaf4343f5212024317a8edb4f8113f4edbec12 100644
--- a/chrome/browser/extensions/webstore_inline_installer.cc
+++ b/chrome/browser/extensions/webstore_inline_installer.cc
@@ -7,6 +7,7 @@
#include "base/strings/stringprintf.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser_finder.h"
+#include "content/public/browser/navigation_details.h"
#include "content/public/browser/web_contents.h"
using content::WebContents;
@@ -29,6 +30,7 @@ const char kInitiatedFromPopupError[] =
WebstoreInlineInstaller::WebstoreInlineInstaller(
content::WebContents* web_contents,
+ content::RenderFrameHost* host,
const std::string& webstore_item_id,
const GURL& requestor_url,
const Callback& callback)
@@ -37,8 +39,8 @@ WebstoreInlineInstaller::WebstoreInlineInstaller(
Profile::FromBrowserContext(web_contents->GetBrowserContext()),
callback),
content::WebContentsObserver(web_contents),
- requestor_url_(requestor_url) {
-}
+ host_(host),
+ requestor_url_(requestor_url) {}
WebstoreInlineInstaller::~WebstoreInlineInstaller() {}
@@ -91,8 +93,8 @@ bool WebstoreInlineInstaller::IsRequestorPermitted(
}
bool WebstoreInlineInstaller::CheckRequestorAlive() const {
- // The tab may have gone away - cancel installation in that case.
- return web_contents() != NULL;
+ // The frame or tab may have gone away - cancel installation in that case.
+ return host_ != nullptr && web_contents() != nullptr;
}
const GURL& WebstoreInlineInstaller::GetRequestorURL() const {
@@ -176,6 +178,15 @@ bool WebstoreInlineInstaller::CheckRequestorPermitted(
// Private implementation.
//
+void WebstoreInlineInstaller::DidNavigateAnyFrame(
+ content::RenderFrameHost* render_frame_host,
+ const content::LoadCommittedDetails& details,
+ const content::FrameNavigateParams& params) {
+ if (!details.is_in_page &&
+ (render_frame_host == host_ || details.is_main_frame))
+ host_ = nullptr;
+}
+
void WebstoreInlineInstaller::WebContentsDestroyed() {
AbortInstall();
}

Powered by Google App Engine
This is Rietveld 408576698