OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_BROWSER_EXTENSIONS_API_CAST_CHANNEL_CAST_CHANNEL_API_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_CAST_CHANNEL_CAST_CHANNEL_API_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_API_CAST_CHANNEL_CAST_CHANNEL_API_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_CAST_CHANNEL_CAST_CHANNEL_API_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/threading/thread_checker.h" | 10 #include "base/threading/thread_checker.h" |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
130 virtual bool Prepare() OVERRIDE; | 130 virtual bool Prepare() OVERRIDE; |
131 virtual void AsyncWorkStart() OVERRIDE; | 131 virtual void AsyncWorkStart() OVERRIDE; |
132 | 132 |
133 private: | 133 private: |
134 DECLARE_EXTENSION_FUNCTION("cast.channel.open", CAST_CHANNEL_OPEN) | 134 DECLARE_EXTENSION_FUNCTION("cast.channel.open", CAST_CHANNEL_OPEN) |
135 | 135 |
136 // Parses the cast:// or casts:// |url|, fills |connect_info| with the | 136 // Parses the cast:// or casts:// |url|, fills |connect_info| with the |
137 // corresponding details, and returns true. Returns false if |url| is not a | 137 // corresponding details, and returns true. Returns false if |url| is not a |
138 // valid Cast URL. | 138 // valid Cast URL. |
139 static bool ParseChannelUrl(const GURL& url, | 139 static bool ParseChannelUrl(const GURL& url, |
140 api::cast_channel::ConnectInfo* connect_info); | 140 cast_channel::ConnectInfo* connect_info); |
Wez
2014/07/16 22:42:33
nit: This is just cleanup, not related to paramete
mark a. foltz
2014/07/17 19:26:51
Done.
| |
141 | 141 |
142 // Validates that |connect_info| represents a valid IP end point and returns a | 142 // Validates that |connect_info| represents a valid IP end point and returns a |
143 // new IPEndPoint if so. Otherwise returns NULL. | 143 // new IPEndPoint if so. Otherwise returns NULL. |
144 static net::IPEndPoint* ParseConnectInfo( | 144 static net::IPEndPoint* ParseConnectInfo( |
145 const api::cast_channel::ConnectInfo& connect_info); | 145 const cast_channel::ConnectInfo& connect_info); |
146 | 146 |
147 void OnOpen(int result); | 147 void OnOpen(int result); |
148 | 148 |
149 scoped_ptr<cast_channel::Open::Params> params_; | 149 scoped_ptr<cast_channel::Open::Params> params_; |
150 // The id of the newly opened socket. | 150 // The id of the newly opened socket. |
151 int new_channel_id_; | 151 int new_channel_id_; |
152 CastChannelAPI* api_; | 152 CastChannelAPI* api_; |
153 scoped_ptr<api::cast_channel::ConnectInfo> connect_info_; | 153 scoped_ptr<cast_channel::ConnectInfo> connect_info_; |
154 scoped_ptr<net::IPEndPoint> ip_endpoint_; | 154 scoped_ptr<net::IPEndPoint> ip_endpoint_; |
155 api::cast_channel::ChannelAuthType channel_auth_; | 155 cast_channel::ChannelAuthType channel_auth_; |
156 | 156 |
157 FRIEND_TEST_ALL_PREFIXES(CastChannelOpenFunctionTest, TestParseChannelUrl); | 157 FRIEND_TEST_ALL_PREFIXES(CastChannelOpenFunctionTest, TestParseChannelUrl); |
158 FRIEND_TEST_ALL_PREFIXES(CastChannelOpenFunctionTest, TestParseConnectInfo); | 158 FRIEND_TEST_ALL_PREFIXES(CastChannelOpenFunctionTest, TestParseConnectInfo); |
159 DISALLOW_COPY_AND_ASSIGN(CastChannelOpenFunction); | 159 DISALLOW_COPY_AND_ASSIGN(CastChannelOpenFunction); |
160 }; | 160 }; |
161 | 161 |
162 class CastChannelSendFunction : public CastChannelAsyncApiFunction { | 162 class CastChannelSendFunction : public CastChannelAsyncApiFunction { |
163 public: | 163 public: |
164 CastChannelSendFunction(); | 164 CastChannelSendFunction(); |
165 | 165 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
197 void OnClose(int result); | 197 void OnClose(int result); |
198 | 198 |
199 scoped_ptr<cast_channel::Close::Params> params_; | 199 scoped_ptr<cast_channel::Close::Params> params_; |
200 | 200 |
201 DISALLOW_COPY_AND_ASSIGN(CastChannelCloseFunction); | 201 DISALLOW_COPY_AND_ASSIGN(CastChannelCloseFunction); |
202 }; | 202 }; |
203 | 203 |
204 } // namespace extensions | 204 } // namespace extensions |
205 | 205 |
206 #endif // CHROME_BROWSER_EXTENSIONS_API_CAST_CHANNEL_CAST_CHANNEL_API_H_ | 206 #endif // CHROME_BROWSER_EXTENSIONS_API_CAST_CHANNEL_CAST_CHANNEL_API_H_ |
OLD | NEW |