| 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 private: | 68 private: |
| 69 friend class BrowserContextKeyedAPIFactory<CastChannelAPI>; | 69 friend class BrowserContextKeyedAPIFactory<CastChannelAPI>; |
| 70 friend class ::CastChannelAPITest; | 70 friend class ::CastChannelAPITest; |
| 71 friend class CastTransportDelegate; | 71 friend class CastTransportDelegate; |
| 72 | 72 |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 DISALLOW_COPY_AND_ASSIGN(CastMessageHandler); | 159 DISALLOW_COPY_AND_ASSIGN(CastMessageHandler); |
| 160 }; | 160 }; |
| 161 | 161 |
| 162 // Parses the cast:// or casts:// |url|, fills |connect_info| with the | 162 // Parses the cast:// or casts:// |url|, fills |connect_info| with the |
| 163 // corresponding details, and returns true. Returns false if |url| is not a | 163 // corresponding details, and returns true. Returns false if |url| is not a |
| 164 // valid Cast URL. | 164 // valid Cast URL. |
| 165 static bool ParseChannelUrl(const GURL& url, | 165 static bool ParseChannelUrl(const GURL& url, |
| 166 cast_channel::ConnectInfo* connect_info); | 166 cast_channel::ConnectInfo* connect_info); |
| 167 | 167 |
| 168 // Validates that |connect_info| represents a valid IP end point and returns a | 168 // Validates that |connect_info| represents a valid IP end point and returns a |
| 169 // new IPEndPoint if so. Otherwise returns NULL. | 169 // new IPEndPoint if so. Otherwise returns nullptr. |
| 170 static net::IPEndPoint* ParseConnectInfo( | 170 static net::IPEndPoint* ParseConnectInfo( |
| 171 const cast_channel::ConnectInfo& connect_info); | 171 const cast_channel::ConnectInfo& connect_info); |
| 172 | 172 |
| 173 void OnOpen(cast_channel::ChannelError result); | 173 void OnOpen(cast_channel::ChannelError result); |
| 174 | 174 |
| 175 scoped_ptr<cast_channel::Open::Params> params_; | 175 scoped_ptr<cast_channel::Open::Params> params_; |
| 176 // The id of the newly opened socket. | 176 // The id of the newly opened socket. |
| 177 int new_channel_id_; | 177 int new_channel_id_; |
| 178 CastChannelAPI* api_; | 178 CastChannelAPI* api_; |
| 179 scoped_ptr<cast_channel::ConnectInfo> connect_info_; | 179 scoped_ptr<cast_channel::ConnectInfo> connect_info_; |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 CAST_CHANNEL_SETAUTHORITYKEYS) | 263 CAST_CHANNEL_SETAUTHORITYKEYS) |
| 264 | 264 |
| 265 scoped_ptr<cast_channel::SetAuthorityKeys::Params> params_; | 265 scoped_ptr<cast_channel::SetAuthorityKeys::Params> params_; |
| 266 | 266 |
| 267 DISALLOW_COPY_AND_ASSIGN(CastChannelSetAuthorityKeysFunction); | 267 DISALLOW_COPY_AND_ASSIGN(CastChannelSetAuthorityKeysFunction); |
| 268 }; | 268 }; |
| 269 | 269 |
| 270 } // namespace extensions | 270 } // namespace extensions |
| 271 | 271 |
| 272 #endif // EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_CHANNEL_API_H_ | 272 #endif // EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_CHANNEL_API_H_ |
| OLD | NEW |