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

Side by Side Diff: blimp/net/blimp_connection.h

Issue 1429193002: Add interfaces for most major Blimp net components. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address haibinlu's feedback #2 Created 5 years, 1 month 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 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_BLIMP_CONNECTION_H_ 5 #ifndef BLIMP_NET_BLIMP_CONNECTION_H_
6 #define BLIMP_NET_BLIMP_CONNECTION_H_ 6 #define BLIMP_NET_BLIMP_CONNECTION_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/memory/scoped_ptr.h"
9 #include "blimp/net/blimp_net_export.h" 10 #include "blimp/net/blimp_net_export.h"
10 11
11 namespace blimp { 12 namespace blimp {
12 13
14 class BlimpMessageProcessor;
15
16 // Encapsulates the state and logic used to exchange BlimpMessages over
17 // a network connection.
13 class BLIMP_NET_EXPORT BlimpConnection { 18 class BLIMP_NET_EXPORT BlimpConnection {
14 public: 19 public:
20 class DisconnectObserver {
21 // Called when the network connection for |this| is disconnected.
22 virtual void OnDisconnected() = 0;
23 };
24
15 BlimpConnection(); 25 BlimpConnection();
26
16 ~BlimpConnection(); 27 ~BlimpConnection();
17 28
29 // Lets |observer| know when the network connection is terminated.
30 void AddDisconnectObserver(const DisconnectObserver& observer);
31
32 // Sets the processor for BlimpConnection->BrowserSession message routing.
33 // Will discontinue use of any previously set message processors.
34 void set_incoming_message_processor(
35 scoped_ptr<BlimpMessageProcessor> processor);
36
37 // Gets a processor for BrowserSession->BlimpConnection message routing.
38 scoped_ptr<BlimpMessageProcessor> take_outgoing_message_processor() const;
39
18 private: 40 private:
19 DISALLOW_COPY_AND_ASSIGN(BlimpConnection); 41 DISALLOW_COPY_AND_ASSIGN(BlimpConnection);
20 }; 42 };
21 43
22 } // namespace blimp 44 } // namespace blimp
23 45
24 #endif // BLIMP_NET_BLIMP_CONNECTION_H_ 46 #endif // BLIMP_NET_BLIMP_CONNECTION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698