Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(72)

Side by Side Diff: extensions/browser/api/cast_channel/cast_socket.h

Issue 555283002: Create new class "CastTransport", which encapsulates the message read and write event loops. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Code review feedback addressed. Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_SOCKET_H_ 5 #ifndef EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_SOCKET_H_
6 #define EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_SOCKET_H_ 6 #define EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_SOCKET_H_
7 7
8 #include <queue> 8 #include <queue>
9 #include <string> 9 #include <string>
10 10
(...skipping 29 matching lines...) Expand all
40 class Logger; 40 class Logger;
41 struct LastErrors; 41 struct LastErrors;
42 class MessageFramer; 42 class MessageFramer;
43 43
44 // This class implements a channel between Chrome and a Cast device using a TCP 44 // This class implements a channel between Chrome and a Cast device using a TCP
45 // socket with SSL. The channel may authenticate that the receiver is a genuine 45 // socket with SSL. The channel may authenticate that the receiver is a genuine
46 // Cast device. All CastSocket objects must be used only on the IO thread. 46 // Cast device. All CastSocket objects must be used only on the IO thread.
47 // 47 //
48 // NOTE: Not called "CastChannel" to reduce confusion with the generated API 48 // NOTE: Not called "CastChannel" to reduce confusion with the generated API
49 // code. 49 // code.
50 // TODO(kmarshall): Inherit from CastSocket and rename to CastSocketImpl.
50 class CastSocket : public ApiResource { 51 class CastSocket : public ApiResource {
51 public: 52 public:
52 // Object to be informed of incoming messages and errors. The CastSocket that 53 // Object to be informed of incoming messages and errors. The CastSocket
54 // that
Wez 2014/09/25 02:09:15 nit: Can be un-wrapped.
Kevin M 2014/09/25 17:53:04 Done.
53 // owns the delegate must not be deleted by it, only by the ApiResourceManager 55 // owns the delegate must not be deleted by it, only by the ApiResourceManager
54 // or in the callback to Close(). 56 // or in the callback to Close().
55 class Delegate { 57 class Delegate {
56 public: 58 public:
57 // An error occurred on the channel. |last_errors| contains the last errors 59 // An error occurred on the channel. |last_errors| contains the last errors
58 // logged for the channel from the implementation. 60 // logged for the channel from the implementation.
59 virtual void OnError(const CastSocket* socket, 61 virtual void OnError(const CastSocket* socket,
60 ChannelError error_state, 62 ChannelError error_state,
61 const LastErrors& last_errors) = 0; 63 const LastErrors& last_errors) = 0;
62 // A message was received on the channel. 64 // A message was received on the channel.
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 FRIEND_TEST_ALL_PREFIXES(CastSocketTest, TestReadHeaderParseError); 337 FRIEND_TEST_ALL_PREFIXES(CastSocketTest, TestReadHeaderParseError);
336 FRIEND_TEST_ALL_PREFIXES(CastSocketTest, TestReadMany); 338 FRIEND_TEST_ALL_PREFIXES(CastSocketTest, TestReadMany);
337 FRIEND_TEST_ALL_PREFIXES(CastSocketTest, TestWriteErrorLargeMessage); 339 FRIEND_TEST_ALL_PREFIXES(CastSocketTest, TestWriteErrorLargeMessage);
338 DISALLOW_COPY_AND_ASSIGN(CastSocket); 340 DISALLOW_COPY_AND_ASSIGN(CastSocket);
339 }; 341 };
340 } // namespace cast_channel 342 } // namespace cast_channel
341 } // namespace core_api 343 } // namespace core_api
342 } // namespace extensions 344 } // namespace extensions
343 345
344 #endif // EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_SOCKET_H_ 346 #endif // EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_SOCKET_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698