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

Unified Diff: extensions/renderer/request_sender.cc

Issue 227413008: Add the feature to retain the user gesture in the extension callback (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Created 6 years, 8 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 | « chrome/test/data/extensions/api_test/permissions/optional_retain_gesture/manifest.json ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/renderer/request_sender.cc
===================================================================
--- extensions/renderer/request_sender.cc (revision 265681)
+++ extensions/renderer/request_sender.cc (working copy)
@@ -11,18 +11,23 @@
#include "extensions/renderer/script_context.h"
#include "third_party/WebKit/public/web/WebDocument.h"
#include "third_party/WebKit/public/web/WebFrame.h"
+#include "third_party/WebKit/public/web/WebScopedUserGesture.h"
#include "third_party/WebKit/public/web/WebUserGestureIndicator.h"
+#include "third_party/WebKit/public/web/WebUserGestureToken.h"
namespace extensions {
// Contains info relevant to a pending API request.
struct PendingRequest {
public:
- PendingRequest(const std::string& name, RequestSender::Source* source)
- : name(name), source(source) {}
+ PendingRequest(const std::string& name,
+ RequestSender::Source* source,
+ blink::WebUserGestureToken token)
+ : name(name), source(source), token(token) {}
std::string name;
RequestSender::Source* source;
+ blink::WebUserGestureToken token;
};
RequestSender::ScopedTabID::ScopedTabID(RequestSender* request_sender,
@@ -95,7 +100,8 @@
if (blink::WebFrame* webframe = context->web_frame())
source_url = webframe->document().url();
- InsertRequest(request_id, new PendingRequest(name, source));
+ InsertRequest(request_id, new PendingRequest(name, source,
+ blink::WebUserGestureIndicator::currentUserGestureToken()));
ExtensionHostMsg_Request_Params params;
params.name = name;
@@ -127,6 +133,7 @@
return;
}
+ blink::WebScopedUserGesture gesture(request->token);
request->source->OnResponseReceived(
request->name, request_id, success, response, error);
}
« no previous file with comments | « chrome/test/data/extensions/api_test/permissions/optional_retain_gesture/manifest.json ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698