Chromium Code Reviews| 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); |
| } |