OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 BLIMP_NET_BROWSER_CONNECTION_HANDLER_H_ | 5 #ifndef BLIMP_NET_BROWSER_CONNECTION_HANDLER_H_ |
6 #define BLIMP_NET_BROWSER_CONNECTION_HANDLER_H_ | 6 #define BLIMP_NET_BROWSER_CONNECTION_HANDLER_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 17 matching lines...) Expand all Loading... | |
28 // the lifetime of the application. | 28 // the lifetime of the application. |
29 // BrowserConnectionHandler is created on the UI thread, and then used and | 29 // BrowserConnectionHandler is created on the UI thread, and then used and |
30 // destroyed on the IO thread. | 30 // destroyed on the IO thread. |
31 class BLIMP_NET_EXPORT BrowserConnectionHandler | 31 class BLIMP_NET_EXPORT BrowserConnectionHandler |
32 : public ConnectionHandler, | 32 : public ConnectionHandler, |
33 public ConnectionErrorObserver { | 33 public ConnectionErrorObserver { |
34 public: | 34 public: |
35 BrowserConnectionHandler(); | 35 BrowserConnectionHandler(); |
36 ~BrowserConnectionHandler() override; | 36 ~BrowserConnectionHandler() override; |
37 | 37 |
38 // Registers a message processor which will receive all messages of the |type| | 38 // Registers a message processor which will receive all messages of the |
39 // specified. Only one handler may be added per type. | 39 // |feature_case| |
Kevin M
2016/05/21 00:32:05
Premature newline here
| |
40 // specified. Only one handler may be added per feature. | |
40 // That caller must ensure |incoming_processor| remains valid while | 41 // That caller must ensure |incoming_processor| remains valid while |
41 // this object is in-use. | 42 // this object is in-use. |
42 // | 43 // |
43 // Returns a BlimpMessageProcessor object for sending messages of type |type|. | 44 // Returns a BlimpMessageProcessor object for sending messages for a given |
45 // feature. | |
44 virtual std::unique_ptr<BlimpMessageProcessor> RegisterFeature( | 46 virtual std::unique_ptr<BlimpMessageProcessor> RegisterFeature( |
45 BlimpMessage::Type type, | 47 BlimpMessage::FeatureCase feature_case, |
46 BlimpMessageProcessor* incoming_processor); | 48 BlimpMessageProcessor* incoming_processor); |
47 | 49 |
48 // ConnectionHandler implementation. | 50 // ConnectionHandler implementation. |
49 void HandleConnection(std::unique_ptr<BlimpConnection> connection) override; | 51 void HandleConnection(std::unique_ptr<BlimpConnection> connection) override; |
50 | 52 |
51 // ConnectionErrorObserver implementation. | 53 // ConnectionErrorObserver implementation. |
52 void OnConnectionError(int error) override; | 54 void OnConnectionError(int error) override; |
53 | 55 |
54 private: | 56 private: |
55 void DropCurrentConnection(); | 57 void DropCurrentConnection(); |
(...skipping 14 matching lines...) Expand all Loading... | |
70 | 72 |
71 // Holds network resources while there is a Client connected. | 73 // Holds network resources while there is a Client connected. |
72 std::unique_ptr<BlimpConnection> connection_; | 74 std::unique_ptr<BlimpConnection> connection_; |
73 | 75 |
74 DISALLOW_COPY_AND_ASSIGN(BrowserConnectionHandler); | 76 DISALLOW_COPY_AND_ASSIGN(BrowserConnectionHandler); |
75 }; | 77 }; |
76 | 78 |
77 } // namespace blimp | 79 } // namespace blimp |
78 | 80 |
79 #endif // BLIMP_NET_BROWSER_CONNECTION_HANDLER_H_ | 81 #endif // BLIMP_NET_BROWSER_CONNECTION_HANDLER_H_ |
OLD | NEW |