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_BROWSER_API_CAST_CHANNEL_CAST_CHANNEL_API_H_ | 5 #ifndef EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_CHANNEL_API_H_ |
6 #define EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_CHANNEL_API_H_ | 6 #define EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_CHANNEL_API_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 cast_channel::CastSocket* GetSocketOrCompleteWithError(int channel_id); | 91 cast_channel::CastSocket* GetSocketOrCompleteWithError(int channel_id); |
92 | 92 |
93 // Adds |socket| to |manager_| and returns the new channel_id. |manager_| | 93 // Adds |socket| to |manager_| and returns the new channel_id. |manager_| |
94 // assumes ownership of |socket|. | 94 // assumes ownership of |socket|. |
95 int AddSocket(cast_channel::CastSocket* socket); | 95 int AddSocket(cast_channel::CastSocket* socket); |
96 | 96 |
97 // Removes the CastSocket corresponding to |channel_id| from the resource | 97 // Removes the CastSocket corresponding to |channel_id| from the resource |
98 // manager. | 98 // manager. |
99 void RemoveSocket(int channel_id); | 99 void RemoveSocket(int channel_id); |
100 | 100 |
101 // Sets the function result to a ChannelInfo obtained from the state of the | 101 // Sets the function result to a ChannelInfo obtained from the state of |
102 // CastSocket corresponding to |channel_id|. | 102 // |socket|. |
103 void SetResultFromSocket(int channel_id); | 103 void SetResultFromSocket(const cast_channel::CastSocket& socket); |
104 | 104 |
105 // Sets the function result to a ChannelInfo with |error|. | 105 // Sets the function result to a ChannelInfo populated with |channel_id| and |
106 void SetResultFromError(cast_channel::ChannelError error); | 106 // |error|. |
| 107 void SetResultFromError(int channel_id, cast_channel::ChannelError error); |
107 | 108 |
108 // Returns the socket corresponding to |channel_id| if one exists, or null | 109 // Returns the socket corresponding to |channel_id| if one exists, or null |
109 // otherwise. | 110 // otherwise. |
110 cast_channel::CastSocket* GetSocket(int channel_id); | 111 cast_channel::CastSocket* GetSocket(int channel_id); |
111 | 112 |
112 private: | 113 private: |
113 // Sets the function result from |channel_info|. | 114 // Sets the function result from |channel_info|. |
114 void SetResultFromChannelInfo(const cast_channel::ChannelInfo& channel_info); | 115 void SetResultFromChannelInfo(const cast_channel::ChannelInfo& channel_info); |
115 | 116 |
116 // The API resource manager for CastSockets. | 117 // The API resource manager for CastSockets. |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 void OnClose(int result); | 200 void OnClose(int result); |
200 | 201 |
201 scoped_ptr<cast_channel::Close::Params> params_; | 202 scoped_ptr<cast_channel::Close::Params> params_; |
202 | 203 |
203 DISALLOW_COPY_AND_ASSIGN(CastChannelCloseFunction); | 204 DISALLOW_COPY_AND_ASSIGN(CastChannelCloseFunction); |
204 }; | 205 }; |
205 | 206 |
206 } // namespace extensions | 207 } // namespace extensions |
207 | 208 |
208 #endif // EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_CHANNEL_API_H_ | 209 #endif // EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_CHANNEL_API_H_ |
OLD | NEW |