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

Side by Side Diff: extensions/renderer/bindings/api_request_handler.cc

Issue 2962093002: [Extensions Bindings] Add activity logging of custom handling (Closed)
Patch Set: nit Created 3 years, 5 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/bindings/api_request_handler.h" 5 #include "extensions/renderer/bindings/api_request_handler.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/guid.h" 8 #include "base/guid.h"
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 pending_requests_.insert(std::make_pair( 99 pending_requests_.insert(std::make_pair(
100 request_id, PendingRequest(isolate, callback, context, callback_args))); 100 request_id, PendingRequest(isolate, callback, context, callback_args)));
101 } 101 }
102 102
103 request->has_user_gesture = 103 request->has_user_gesture =
104 blink::WebUserGestureIndicator::IsProcessingUserGestureThreadSafe(); 104 blink::WebUserGestureIndicator::IsProcessingUserGestureThreadSafe();
105 request->arguments = std::move(arguments); 105 request->arguments = std::move(arguments);
106 request->method_name = method; 106 request->method_name = method;
107 request->thread = thread; 107 request->thread = thread;
108 108
109 last_sent_request_id_ = request_id;
109 send_request_.Run(std::move(request), context); 110 send_request_.Run(std::move(request), context);
110 return request_id; 111 return request_id;
111 } 112 }
112 113
113 void APIRequestHandler::CompleteRequest(int request_id, 114 void APIRequestHandler::CompleteRequest(int request_id,
114 const base::ListValue& response_args, 115 const base::ListValue& response_args,
115 const std::string& error) { 116 const std::string& error) {
116 auto iter = pending_requests_.find(request_id); 117 auto iter = pending_requests_.find(request_id);
117 // The request may have been removed if the context was invalidated before a 118 // The request may have been removed if the context was invalidated before a
118 // response is ready. 119 // response is ready.
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 } 170 }
170 171
171 std::set<int> APIRequestHandler::GetPendingRequestIdsForTesting() const { 172 std::set<int> APIRequestHandler::GetPendingRequestIdsForTesting() const {
172 std::set<int> result; 173 std::set<int> result;
173 for (const auto& pair : pending_requests_) 174 for (const auto& pair : pending_requests_)
174 result.insert(pair.first); 175 result.insert(pair.first);
175 return result; 176 return result;
176 } 177 }
177 178
178 } // namespace extensions 179 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/renderer/bindings/api_request_handler.h ('k') | extensions/renderer/native_extension_bindings_system.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698