| OLD | NEW |
| 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 #ifndef EXTENSIONS_RENDERER_REQUEST_SENDER_H_ | 5 #ifndef EXTENSIONS_RENDERER_REQUEST_SENDER_H_ |
| 6 #define EXTENSIONS_RENDERER_REQUEST_SENDER_H_ | 6 #define EXTENSIONS_RENDERER_REQUEST_SENDER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 // In order to avoid collision, all |request_id|s passed into StartRequest() | 68 // In order to avoid collision, all |request_id|s passed into StartRequest() |
| 69 // should be generated by this method. | 69 // should be generated by this method. |
| 70 int GetNextRequestId() const; | 70 int GetNextRequestId() const; |
| 71 | 71 |
| 72 // Makes a call to the API function |name| that is to be handled by the | 72 // Makes a call to the API function |name| that is to be handled by the |
| 73 // extension host. The response to this request will be received in | 73 // extension host. The response to this request will be received in |
| 74 // HandleResponse(). | 74 // HandleResponse(). |
| 75 // TODO(koz): Remove |request_id| and generate that internally. | 75 // TODO(koz): Remove |request_id| and generate that internally. |
| 76 // There are multiple of these per render view though, so we'll | 76 // There are multiple of these per render view though, so we'll |
| 77 // need to vend the IDs centrally. | 77 // need to vend the IDs centrally. |
| 78 void StartRequest(Source* source, | 78 // Returns true if the request is successfully sent. |
| 79 bool StartRequest(Source* source, |
| 79 const std::string& name, | 80 const std::string& name, |
| 80 int request_id, | 81 int request_id, |
| 81 bool has_callback, | 82 bool has_callback, |
| 82 bool for_io_thread, | 83 bool for_io_thread, |
| 83 base::ListValue* value_args); | 84 base::ListValue* value_args); |
| 84 | 85 |
| 85 // Sends the IPC to extension host for the API function that is described | 86 // Sends the IPC to extension host for the API function that is described |
| 86 // in |params|. | 87 // in |params|. |
| 87 virtual void SendRequest(content::RenderFrame* render_frame, | 88 virtual void SendRequest(content::RenderFrame* render_frame, |
| 88 bool for_io_thread, | 89 bool for_io_thread, |
| (...skipping 19 matching lines...) Expand all Loading... |
| 108 PendingRequestMap pending_requests_; | 109 PendingRequestMap pending_requests_; |
| 109 | 110 |
| 110 int source_tab_id_; // Id of the tab sending the request, or -1 if no tab. | 111 int source_tab_id_; // Id of the tab sending the request, or -1 if no tab. |
| 111 | 112 |
| 112 DISALLOW_COPY_AND_ASSIGN(RequestSender); | 113 DISALLOW_COPY_AND_ASSIGN(RequestSender); |
| 113 }; | 114 }; |
| 114 | 115 |
| 115 } // namespace extensions | 116 } // namespace extensions |
| 116 | 117 |
| 117 #endif // EXTENSIONS_RENDERER_REQUEST_SENDER_H_ | 118 #endif // EXTENSIONS_RENDERER_REQUEST_SENDER_H_ |
| OLD | NEW |