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

Unified Diff: extensions/renderer/request_sender.cc

Issue 1880933002: Begin to enable extension APIs in Extension Service Worker. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
Index: extensions/renderer/request_sender.cc
diff --git a/extensions/renderer/request_sender.cc b/extensions/renderer/request_sender.cc
index 6f3cf51a8f100760cc8f712290a164fcee5b1a19..1f230e36e934c0db26378f0fe33039773f77a205 100644
--- a/extensions/renderer/request_sender.cc
+++ b/extensions/renderer/request_sender.cc
@@ -78,12 +78,6 @@ void RequestSender::StartRequest(Source* source,
if (!context)
return;
- // Get the current RenderFrame so that we can send a routed IPC message from
- // the correct source.
- content::RenderFrame* render_frame = context->GetRenderFrame();
Devlin 2016/04/13 19:46:32 I think this early-out was important. Not least b
lazyboy 2016/04/14 02:07:53 Done.
- if (!render_frame)
- return;
-
// TODO(koz): See if we can make this a CHECK.
if (!context->HasAccessOrThrowError(name))
return;
@@ -105,6 +99,22 @@ void RequestSender::StartRequest(Source* source,
params.has_callback = has_callback;
params.user_gesture =
blink::WebUserGestureIndicator::isProcessingUserGesture();
+
+ // Set Service Worker specific params to default values.
+ params.worker_thread_id = -1;
+ params.embedded_worker_id = -1;
+
+ // Get the current RenderFrame so that we can send a routed IPC message from
+ // the correct source.
+ SendRequest(context->GetRenderFrame(), for_io_thread, params);
+}
+
+void RequestSender::SendRequest(content::RenderFrame* render_frame,
+ bool for_io_thread,
+ ExtensionHostMsg_Request_Params& params) {
+ if (!render_frame)
+ return;
+
if (for_io_thread) {
render_frame->Send(new ExtensionHostMsg_RequestForIOThread(
render_frame->GetRoutingID(), params));

Powered by Google App Engine
This is Rietveld 408576698