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

Unified Diff: content/renderer/web_ui_extension.cc

Issue 2535483003: Require user gesture for powerful download operations (Closed)
Patch Set: Run vulcanize.py Created 4 years, 1 month 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 | « chrome/browser/ui/webui/md_downloads/md_downloads_dom_handler.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/web_ui_extension.cc
diff --git a/content/renderer/web_ui_extension.cc b/content/renderer/web_ui_extension.cc
index a793b4e215b1121be9f10b0a1623ca783c1214e7..cb42f6063ddc72b0f75e2269b802d50e0162cae1 100644
--- a/content/renderer/web_ui_extension.cc
+++ b/content/renderer/web_ui_extension.cc
@@ -7,6 +7,7 @@
#include <memory>
#include <utility>
+#include "base/strings/string_util.h"
#include "base/values.h"
#include "content/common/view_messages.h"
#include "content/public/child/v8_value_converter.h"
@@ -21,6 +22,7 @@
#include "third_party/WebKit/public/web/WebDocument.h"
#include "third_party/WebKit/public/web/WebKit.h"
#include "third_party/WebKit/public/web/WebLocalFrame.h"
+#include "third_party/WebKit/public/web/WebUserGestureIndicator.h"
#include "third_party/WebKit/public/web/WebView.h"
#include "url/gurl.h"
#include "v8/include/v8.h"
@@ -96,6 +98,13 @@ void WebUIExtension::Send(gin::Arguments* args) {
return;
}
+ if (base::EndsWith(message, "RequiringGesture",
+ base::CompareCase::SENSITIVE) &&
+ !blink::WebUserGestureIndicator::isProcessingUserGesture()) {
+ NOTREACHED();
+ return;
+ }
+
// If they've provided an optional message parameter, convert that into a
// Value to send to the browser process.
std::unique_ptr<base::ListValue> content;
« no previous file with comments | « chrome/browser/ui/webui/md_downloads/md_downloads_dom_handler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698