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

Unified Diff: chrome/renderer/extensions/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/renderer/extensions/request_sender.h ('k') | extensions/browser/extension_function.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/extensions/request_sender.cc
===================================================================
--- chrome/renderer/extensions/request_sender.cc (revision 262146)
+++ chrome/renderer/extensions/request_sender.cc (working copy)
@@ -11,19 +11,23 @@
#include "extensions/common/extension_messages.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)
not at google - send to devlin 2014/04/10 20:21:07 run "git cl format" pls
wjywbs 2014/04/10 21:14:26 Fixed.
+ : name(name), source(source), token(token) {
}
std::string name;
RequestSender::Source* source;
+ blink::WebUserGestureToken token;
};
RequestSender::ScopedTabID::ScopedTabID(RequestSender* request_sender,
@@ -98,7 +102,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;
@@ -122,7 +127,8 @@
void RequestSender::HandleResponse(int request_id,
bool success,
const base::ListValue& response,
- const std::string& error) {
+ const std::string& error,
+ bool user_gesture) {
linked_ptr<PendingRequest> request = RemoveRequest(request_id);
if (!request.get()) {
@@ -130,6 +136,10 @@
return;
}
+ scoped_ptr<blink::WebScopedUserGesture> gesture;
+ if (user_gesture)
+ gesture.reset(new blink::WebScopedUserGesture(request->token));
not at google - send to devlin 2014/04/10 20:21:07 ok... but just to check, if the dialog is shown an
wjywbs 2014/04/10 21:14:26 I waited for about 10 minutes and it worked.
+
request->source->OnResponseReceived(request->name, request_id, success,
response, error);
}
« no previous file with comments | « chrome/renderer/extensions/request_sender.h ('k') | extensions/browser/extension_function.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698