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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 | 109 |
110 // Removes the CastSocket corresponding to |channel_id| from the resource | 110 // Removes the CastSocket corresponding to |channel_id| from the resource |
111 // manager. | 111 // manager. |
112 void RemoveSocket(int channel_id); | 112 void RemoveSocket(int channel_id); |
113 | 113 |
114 // Sets the function result to a ChannelInfo obtained from the state of | 114 // Sets the function result to a ChannelInfo obtained from the state of |
115 // |socket|. | 115 // |socket|. |
116 void SetResultFromSocket(const cast_channel::CastSocket& socket); | 116 void SetResultFromSocket(const cast_channel::CastSocket& socket); |
117 | 117 |
118 // Sets the function result to a ChannelInfo populated with |channel_id| and | 118 // Sets the function result to a ChannelInfo populated with |channel_id| and |
119 // |error|. | 119 // |channel_error|. |
120 void SetResultFromError(int channel_id, cast_channel::ChannelError error); | 120 void SetResultFromError(int channel_id, |
| 121 cast_channel::ChannelError channel_error); |
121 | 122 |
122 // Returns the socket corresponding to |channel_id| if one exists, or null | 123 // Returns the socket corresponding to |channel_id| if one exists, or null |
123 // otherwise. | 124 // otherwise. |
124 cast_channel::CastSocket* GetSocket(int channel_id); | 125 cast_channel::CastSocket* GetSocket(int channel_id); |
125 | 126 |
126 private: | 127 private: |
127 // Sets the function result from |channel_info|. | 128 // Sets the function result from |channel_info|. |
128 void SetResultFromChannelInfo(const cast_channel::ChannelInfo& channel_info); | 129 void SetResultFromChannelInfo(const cast_channel::ChannelInfo& channel_info); |
129 | 130 |
130 // The API resource manager for CastSockets. | 131 // The API resource manager for CastSockets. |
131 ApiResourceManager<cast_channel::CastSocket>* manager_; | 132 ApiResourceManager<cast_channel::CastSocket>* manager_; |
132 | 133 |
133 // The result of the function. | 134 // Whether the api function generated a channel error. |
134 cast_channel::ChannelError error_; | 135 bool is_channel_error_; |
135 }; | 136 }; |
136 | 137 |
137 class CastChannelOpenFunction : public CastChannelAsyncApiFunction { | 138 class CastChannelOpenFunction : public CastChannelAsyncApiFunction { |
138 public: | 139 public: |
139 CastChannelOpenFunction(); | 140 CastChannelOpenFunction(); |
140 | 141 |
141 protected: | 142 protected: |
142 ~CastChannelOpenFunction() override; | 143 ~CastChannelOpenFunction() override; |
143 | 144 |
144 // AsyncApiFunction: | 145 // AsyncApiFunction: |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 CAST_CHANNEL_SETAUTHORITYKEYS) | 254 CAST_CHANNEL_SETAUTHORITYKEYS) |
254 | 255 |
255 scoped_ptr<cast_channel::SetAuthorityKeys::Params> params_; | 256 scoped_ptr<cast_channel::SetAuthorityKeys::Params> params_; |
256 | 257 |
257 DISALLOW_COPY_AND_ASSIGN(CastChannelSetAuthorityKeysFunction); | 258 DISALLOW_COPY_AND_ASSIGN(CastChannelSetAuthorityKeysFunction); |
258 }; | 259 }; |
259 | 260 |
260 } // namespace extensions | 261 } // namespace extensions |
261 | 262 |
262 #endif // EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_CHANNEL_API_H_ | 263 #endif // EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_CHANNEL_API_H_ |
OLD | NEW |