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

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: Used %u instead of %zu for printf format string (%zu crashed Windows) Created 6 years, 2 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
53 // owns the delegate must not be deleted by it, only by the ApiResourceManager 54 // that owns the delegate must not be deleted by it, only by the
54 // or in the callback to Close(). 55 // ApiResourceManager or in the callback to Close().
55 class Delegate { 56 class Delegate {
56 public: 57 public:
57 // An error occurred on the channel. |last_errors| contains the last errors 58 // An error occurred on the channel. |last_errors| contains the last errors
58 // logged for the channel from the implementation. 59 // logged for the channel from the implementation.
59 virtual void OnError(const CastSocket* socket, 60 virtual void OnError(const CastSocket* socket,
60 ChannelError error_state, 61 ChannelError error_state,
61 const LastErrors& last_errors) = 0; 62 const LastErrors& last_errors) = 0;
62 // A message was received on the channel. 63 // A message was received on the channel.
63 virtual void OnMessage(const CastSocket* socket, 64 virtual void OnMessage(const CastSocket* socket,
64 const MessageInfo& message) = 0; 65 const MessageInfo& message) = 0;
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 FRIEND_TEST_ALL_PREFIXES(CastSocketTest, TestReadHeaderParseError); 336 FRIEND_TEST_ALL_PREFIXES(CastSocketTest, TestReadHeaderParseError);
336 FRIEND_TEST_ALL_PREFIXES(CastSocketTest, TestReadMany); 337 FRIEND_TEST_ALL_PREFIXES(CastSocketTest, TestReadMany);
337 FRIEND_TEST_ALL_PREFIXES(CastSocketTest, TestWriteErrorLargeMessage); 338 FRIEND_TEST_ALL_PREFIXES(CastSocketTest, TestWriteErrorLargeMessage);
338 DISALLOW_COPY_AND_ASSIGN(CastSocket); 339 DISALLOW_COPY_AND_ASSIGN(CastSocket);
339 }; 340 };
340 } // namespace cast_channel 341 } // namespace cast_channel
341 } // namespace core_api 342 } // namespace core_api
342 } // namespace extensions 343 } // namespace extensions
343 344
344 #endif // EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_SOCKET_H_ 345 #endif // EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_SOCKET_H_
OLDNEW
« no previous file with comments | « extensions/browser/api/cast_channel/cast_message_util.cc ('k') | extensions/browser/api/cast_channel/cast_socket.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698