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

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

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 #ifndef CHROME_RENDERER_EXTENSIONS_REQUEST_SENDER_H_ 5 #ifndef CHROME_RENDERER_EXTENSIONS_REQUEST_SENDER_H_
6 #define CHROME_RENDERER_EXTENSIONS_REQUEST_SENDER_H_ 6 #define CHROME_RENDERER_EXTENSIONS_REQUEST_SENDER_H_
7 7
8 #include <string> 8 #include <string>
9 #include <map> 9 #include <map>
10 10
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 // extension host. The response to this request will be received in 53 // extension host. The response to this request will be received in
54 // HandleResponse(). 54 // HandleResponse().
55 // TODO(koz): Remove |request_id| and generate that internally. 55 // TODO(koz): Remove |request_id| and generate that internally.
56 // There are multiple of these per render view though, so we'll 56 // There are multiple of these per render view though, so we'll
57 // need to vend the IDs centrally. 57 // need to vend the IDs centrally.
58 void StartRequest(Source* source, 58 void StartRequest(Source* source,
59 const std::string& name, 59 const std::string& name,
60 int request_id, 60 int request_id,
61 bool has_callback, 61 bool has_callback,
62 bool for_io_thread, 62 bool for_io_thread,
63 int source_tab_id,
63 base::ListValue* value_args); 64 base::ListValue* value_args);
64 65
65 // Handles responses from the extension host to calls made by StartRequest(). 66 // Handles responses from the extension host to calls made by StartRequest().
66 void HandleResponse(int request_id, 67 void HandleResponse(int request_id,
67 bool success, 68 bool success,
68 const base::ListValue& response, 69 const base::ListValue& response,
69 const std::string& error); 70 const std::string& error);
70 71
71 // Notifies this that a request source is no longer valid. 72 // Notifies this that a request source is no longer valid.
72 // TODO(kalman): Do this in a generic/safe way. 73 // TODO(kalman): Do this in a generic/safe way.
73 void InvalidateSource(Source* source); 74 void InvalidateSource(Source* source);
74 75
75 private: 76 private:
76 typedef std::map<int, linked_ptr<PendingRequest> > PendingRequestMap; 77 typedef std::map<int, linked_ptr<PendingRequest> > PendingRequestMap;
77 78
78 void InsertRequest(int request_id, PendingRequest* pending_request); 79 void InsertRequest(int request_id, PendingRequest* pending_request);
79 linked_ptr<PendingRequest> RemoveRequest(int request_id); 80 linked_ptr<PendingRequest> RemoveRequest(int request_id);
80 81
81 Dispatcher* dispatcher_; 82 Dispatcher* dispatcher_;
82 PendingRequestMap pending_requests_; 83 PendingRequestMap pending_requests_;
83 84
84 DISALLOW_COPY_AND_ASSIGN(RequestSender); 85 DISALLOW_COPY_AND_ASSIGN(RequestSender);
85 }; 86 };
86 87
87 } // namespace extensions 88 } // namespace extensions
88 89
89 #endif // CHROME_RENDERER_EXTENSIONS_REQUEST_SENDER_H_ 90 #endif // CHROME_RENDERER_EXTENSIONS_REQUEST_SENDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698