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

Side by Side Diff: chrome/renderer/extensions/request_sender.cc

Issue 145463002: Extensions: Send the tab id to platform apps. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 6 years, 11 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/renderer/extensions/request_sender.h" 5 #include "chrome/renderer/extensions/request_sender.h"
6 6
7 #include "base/values.h" 7 #include "base/values.h"
8 #include "chrome/common/extensions/extension_messages.h" 8 #include "chrome/common/extensions/extension_messages.h"
9 #include "chrome/renderer/extensions/chrome_v8_context.h" 9 #include "chrome/renderer/extensions/chrome_v8_context.h"
10 #include "chrome/renderer/extensions/dispatcher.h" 10 #include "chrome/renderer/extensions/dispatcher.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 int RequestSender::GetNextRequestId() const { 50 int RequestSender::GetNextRequestId() const {
51 static int next_request_id = 0; 51 static int next_request_id = 0;
52 return next_request_id++; 52 return next_request_id++;
53 } 53 }
54 54
55 void RequestSender::StartRequest(Source* source, 55 void RequestSender::StartRequest(Source* source,
56 const std::string& name, 56 const std::string& name,
57 int request_id, 57 int request_id,
58 bool has_callback, 58 bool has_callback,
59 bool for_io_thread, 59 bool for_io_thread,
60 int source_tab_id,
not at google - send to devlin 2014/01/24 21:37:27 yeah so (assuming I'm thinking about this right) t
60 base::ListValue* value_args) { 61 base::ListValue* value_args) {
61 ChromeV8Context* context = source->GetContext(); 62 ChromeV8Context* context = source->GetContext();
62 if (!context) 63 if (!context)
63 return; 64 return;
64 65
65 // Get the current RenderView so that we can send a routed IPC message from 66 // Get the current RenderView so that we can send a routed IPC message from
66 // the correct source. 67 // the correct source.
67 content::RenderView* renderview = context->GetRenderView(); 68 content::RenderView* renderview = context->GetRenderView();
68 if (!renderview) 69 if (!renderview)
69 return; 70 return;
(...skipping 13 matching lines...) Expand all
83 if (blink::WebFrame* webframe = context->web_frame()) 84 if (blink::WebFrame* webframe = context->web_frame())
84 source_url = webframe->document().url(); 85 source_url = webframe->document().url();
85 86
86 InsertRequest(request_id, new PendingRequest(name, source)); 87 InsertRequest(request_id, new PendingRequest(name, source));
87 88
88 ExtensionHostMsg_Request_Params params; 89 ExtensionHostMsg_Request_Params params;
89 params.name = name; 90 params.name = name;
90 params.arguments.Swap(value_args); 91 params.arguments.Swap(value_args);
91 params.extension_id = context->GetExtensionID(); 92 params.extension_id = context->GetExtensionID();
92 params.source_url = source_url; 93 params.source_url = source_url;
94 params.source_tab_id = source_tab_id;
93 params.request_id = request_id; 95 params.request_id = request_id;
94 params.has_callback = has_callback; 96 params.has_callback = has_callback;
95 params.user_gesture = 97 params.user_gesture =
96 blink::WebUserGestureIndicator::isProcessingUserGesture(); 98 blink::WebUserGestureIndicator::isProcessingUserGesture();
97 if (for_io_thread) { 99 if (for_io_thread) {
98 renderview->Send(new ExtensionHostMsg_RequestForIOThread( 100 renderview->Send(new ExtensionHostMsg_RequestForIOThread(
99 renderview->GetRoutingID(), params)); 101 renderview->GetRoutingID(), params));
100 } else { 102 } else {
101 renderview->Send(new ExtensionHostMsg_Request( 103 renderview->Send(new ExtensionHostMsg_Request(
102 renderview->GetRoutingID(), params)); 104 renderview->GetRoutingID(), params));
(...skipping 19 matching lines...) Expand all
122 for (PendingRequestMap::iterator it = pending_requests_.begin(); 124 for (PendingRequestMap::iterator it = pending_requests_.begin();
123 it != pending_requests_.end();) { 125 it != pending_requests_.end();) {
124 if (it->second->source == source) 126 if (it->second->source == source)
125 pending_requests_.erase(it++); 127 pending_requests_.erase(it++);
126 else 128 else
127 ++it; 129 ++it;
128 } 130 }
129 } 131 }
130 132
131 } // namespace extensions 133 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698