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

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

Issue 2522763005: [Extensions] Remove the source_tab_id property on API request messages (Closed)
Patch Set: compile Created 4 years 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
« no previous file with comments | « extensions/renderer/native_extension_bindings_system_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "extensions/renderer/request_sender.h" 5 #include "extensions/renderer/request_sender.h"
6 6
7 #include "base/metrics/histogram_macros.h" 7 #include "base/metrics/histogram_macros.h"
8 #include "base/timer/elapsed_timer.h" 8 #include "base/timer/elapsed_timer.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "content/public/renderer/render_frame.h" 10 #include "content/public/renderer/render_frame.h"
11 #include "extensions/common/constants.h" 11 #include "extensions/common/constants.h"
12 #include "extensions/common/extension_messages.h" 12 #include "extensions/common/extension_messages.h"
13 #include "extensions/renderer/extension_frame_helper.h"
14 #include "extensions/renderer/script_context.h" 13 #include "extensions/renderer/script_context.h"
15 #include "third_party/WebKit/public/web/WebDocument.h" 14 #include "third_party/WebKit/public/web/WebDocument.h"
16 #include "third_party/WebKit/public/web/WebLocalFrame.h" 15 #include "third_party/WebKit/public/web/WebLocalFrame.h"
17 #include "third_party/WebKit/public/web/WebScopedUserGesture.h" 16 #include "third_party/WebKit/public/web/WebScopedUserGesture.h"
18 #include "third_party/WebKit/public/web/WebUserGestureIndicator.h" 17 #include "third_party/WebKit/public/web/WebUserGestureIndicator.h"
19 #include "third_party/WebKit/public/web/WebUserGestureToken.h" 18 #include "third_party/WebKit/public/web/WebUserGestureToken.h"
20 19
21 namespace extensions { 20 namespace extensions {
22 21
23 // Contains info relevant to a pending API request. 22 // Contains info relevant to a pending API request.
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 87
89 GURL source_url; 88 GURL source_url;
90 if (blink::WebLocalFrame* webframe = context->web_frame()) 89 if (blink::WebLocalFrame* webframe = context->web_frame())
91 source_url = webframe->document().url(); 90 source_url = webframe->document().url();
92 91
93 InsertRequest(request_id, 92 InsertRequest(request_id,
94 base::MakeUnique<PendingRequest>( 93 base::MakeUnique<PendingRequest>(
95 name, source, 94 name, source,
96 blink::WebUserGestureIndicator::currentUserGestureToken())); 95 blink::WebUserGestureIndicator::currentUserGestureToken()));
97 96
98 int tab_id = -1;
99 if (render_frame) {
100 ExtensionFrameHelper* frame_helper =
101 ExtensionFrameHelper::Get(render_frame);
102 DCHECK(frame_helper);
103 tab_id = frame_helper->tab_id();
104 }
105
106 ExtensionHostMsg_Request_Params params; 97 ExtensionHostMsg_Request_Params params;
107 params.name = name; 98 params.name = name;
108 params.arguments.Swap(value_args); 99 params.arguments.Swap(value_args);
109 params.extension_id = context->GetExtensionID(); 100 params.extension_id = context->GetExtensionID();
110 params.source_url = source_url; 101 params.source_url = source_url;
111 params.source_tab_id = tab_id;
112 params.request_id = request_id; 102 params.request_id = request_id;
113 params.has_callback = has_callback; 103 params.has_callback = has_callback;
114 params.user_gesture = 104 params.user_gesture =
115 blink::WebUserGestureIndicator::isProcessingUserGesture(); 105 blink::WebUserGestureIndicator::isProcessingUserGesture();
116 106
117 // Set Service Worker specific params to default values. 107 // Set Service Worker specific params to default values.
118 params.worker_thread_id = -1; 108 params.worker_thread_id = -1;
119 params.service_worker_version_id = kInvalidServiceWorkerVersionId; 109 params.service_worker_version_id = kInvalidServiceWorkerVersionId;
120 110
121 SendRequest(render_frame, for_io_thread, params); 111 SendRequest(render_frame, for_io_thread, params);
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 for (PendingRequestMap::iterator it = pending_requests_.begin(); 149 for (PendingRequestMap::iterator it = pending_requests_.begin();
160 it != pending_requests_.end();) { 150 it != pending_requests_.end();) {
161 if (it->second->source == source) 151 if (it->second->source == source)
162 pending_requests_.erase(it++); 152 pending_requests_.erase(it++);
163 else 153 else
164 ++it; 154 ++it;
165 } 155 }
166 } 156 }
167 157
168 } // namespace extensions 158 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/renderer/native_extension_bindings_system_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698