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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: chrome/renderer/extensions/request_sender.cc
===================================================================
--- chrome/renderer/extensions/request_sender.cc (revision 246091)
+++ chrome/renderer/extensions/request_sender.cc (working copy)
@@ -26,9 +26,24 @@
RequestSender::Source* source;
};
-RequestSender::RequestSender(Dispatcher* dispatcher) : dispatcher_(dispatcher) {
+RequestSender::ScopedTabID::ScopedTabID(RequestSender* request_sender,
+ int tab_id)
+ : request_sender_(request_sender),
+ tab_id_(tab_id),
+ previous_tab_id_(request_sender->sender_tab_id_) {
+ request_sender_->sender_tab_id_ = tab_id;
}
+RequestSender::ScopedTabID::~ScopedTabID() {
+ DCHECK_EQ(tab_id_, request_sender_->sender_tab_id_);
+ request_sender_->sender_tab_id_ = previous_tab_id_;
+}
+
+RequestSender::RequestSender(Dispatcher* dispatcher)
+ : dispatcher_(dispatcher),
+ sender_tab_id_(-1) {
+}
+
RequestSender::~RequestSender() {
}
@@ -57,6 +72,7 @@
int request_id,
bool has_callback,
bool for_io_thread,
+ int source_tab_id,
base::ListValue* value_args) {
ChromeV8Context* context = source->GetContext();
if (!context)
@@ -90,6 +106,7 @@
params.arguments.Swap(value_args);
params.extension_id = context->GetExtensionID();
params.source_url = source_url;
+ params.source_tab_id = source_tab_id;
not at google - send to devlin 2014/01/28 18:45:45 I was imagining the source_tab_id would be read fr
Lei Zhang 2014/01/28 22:52:27 Ah, yes. That is much simpler. Done.
params.request_id = request_id;
params.has_callback = has_callback;
params.user_gesture =

Powered by Google App Engine
This is Rietveld 408576698