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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 // CastSockets and make this class the sole owner of Logger. | 52 // CastSockets and make this class the sole owner of Logger. |
53 // Alternatively, | 53 // Alternatively, |
54 // consider making Logger not ref-counted by passing a weak | 54 // consider making Logger not ref-counted by passing a weak |
55 // reference of Logger to the CastSockets instead. | 55 // reference of Logger to the CastSockets instead. |
56 scoped_refptr<cast_channel::Logger> GetLogger(); | 56 scoped_refptr<cast_channel::Logger> GetLogger(); |
57 | 57 |
58 // Sets the CastSocket instance to be used for testing. | 58 // Sets the CastSocket instance to be used for testing. |
59 void SetSocketForTest(scoped_ptr<cast_channel::CastSocket> socket_for_test); | 59 void SetSocketForTest(scoped_ptr<cast_channel::CastSocket> socket_for_test); |
60 | 60 |
61 // Returns a test CastSocket instance, if it is defined. | 61 // Returns a test CastSocket instance, if it is defined. |
62 // Otherwise returns a scoped_ptr with a NULL ptr value. | 62 // Otherwise returns a scoped_ptr with a nullptr value. |
63 scoped_ptr<cast_channel::CastSocket> GetSocketForTest(); | 63 scoped_ptr<cast_channel::CastSocket> GetSocketForTest(); |
64 | 64 |
65 // Returns the API browser context. | 65 // Returns the API browser context. |
66 content::BrowserContext* GetBrowserContext() const; | 66 content::BrowserContext* GetBrowserContext() const; |
67 | 67 |
68 // Sets injected ping timeout timer for testing. | 68 // Sets injected ping timeout timer for testing. |
69 void SetPingTimeoutTimerForTest(scoped_ptr<base::Timer> timer); | 69 void SetPingTimeoutTimerForTest(scoped_ptr<base::Timer> timer); |
70 | 70 |
71 // Gets the injected ping timeout timer, if set. | 71 // Gets the injected ping timeout timer, if set. |
72 // Returns a null scoped ptr if there is no injected timer. | 72 // Returns a null scoped ptr if there is no injected timer. |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 DISALLOW_COPY_AND_ASSIGN(CastMessageHandler); | 169 DISALLOW_COPY_AND_ASSIGN(CastMessageHandler); |
170 }; | 170 }; |
171 | 171 |
172 // Parses the cast:// or casts:// |url|, fills |connect_info| with the | 172 // Parses the cast:// or casts:// |url|, fills |connect_info| with the |
173 // corresponding details, and returns true. Returns false if |url| is not a | 173 // corresponding details, and returns true. Returns false if |url| is not a |
174 // valid Cast URL. | 174 // valid Cast URL. |
175 static bool ParseChannelUrl(const GURL& url, | 175 static bool ParseChannelUrl(const GURL& url, |
176 cast_channel::ConnectInfo* connect_info); | 176 cast_channel::ConnectInfo* connect_info); |
177 | 177 |
178 // Validates that |connect_info| represents a valid IP end point and returns a | 178 // Validates that |connect_info| represents a valid IP end point and returns a |
179 // new IPEndPoint if so. Otherwise returns NULL. | 179 // new IPEndPoint if so. Otherwise returns nullptr. |
180 static net::IPEndPoint* ParseConnectInfo( | 180 static net::IPEndPoint* ParseConnectInfo( |
181 const cast_channel::ConnectInfo& connect_info); | 181 const cast_channel::ConnectInfo& connect_info); |
182 | 182 |
183 void OnOpen(cast_channel::ChannelError result); | 183 void OnOpen(cast_channel::ChannelError result); |
184 | 184 |
185 scoped_ptr<cast_channel::Open::Params> params_; | 185 scoped_ptr<cast_channel::Open::Params> params_; |
186 // The id of the newly opened socket. | 186 // The id of the newly opened socket. |
187 int new_channel_id_; | 187 int new_channel_id_; |
188 CastChannelAPI* api_; | 188 CastChannelAPI* api_; |
189 scoped_ptr<cast_channel::ConnectInfo> connect_info_; | 189 scoped_ptr<cast_channel::ConnectInfo> connect_info_; |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 CAST_CHANNEL_SETAUTHORITYKEYS) | 275 CAST_CHANNEL_SETAUTHORITYKEYS) |
276 | 276 |
277 scoped_ptr<cast_channel::SetAuthorityKeys::Params> params_; | 277 scoped_ptr<cast_channel::SetAuthorityKeys::Params> params_; |
278 | 278 |
279 DISALLOW_COPY_AND_ASSIGN(CastChannelSetAuthorityKeysFunction); | 279 DISALLOW_COPY_AND_ASSIGN(CastChannelSetAuthorityKeysFunction); |
280 }; | 280 }; |
281 | 281 |
282 } // namespace extensions | 282 } // namespace extensions |
283 | 283 |
284 #endif // EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_CHANNEL_API_H_ | 284 #endif // EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_CHANNEL_API_H_ |
OLD | NEW |