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

Side by Side Diff: blimp/client/core/session/connection_status.h

Issue 2322843002: Propagate connection info to Blimp android UI. (Closed)
Patch Set: Remove BlimpStringUtil after discussion of string res files. Created 4 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
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef BLIMP_CLIENT_CORE_SESSION_CONNECTION_STATUS_H_
6 #define BLIMP_CLIENT_CORE_SESSION_CONNECTION_STATUS_H_
7
8 #include "base/macros.h"
9 #include "base/observer_list.h"
10 #include "blimp/client/core/session/network_event_observer.h"
11 #include "blimp/client/public/session/assignment.h"
12 #include "net/base/ip_endpoint.h"
13
14 namespace blimp {
15 namespace client {
16
17 // Provides Blimp engine connection status, and also handles observers
18 // that listen to network connection events on main thread.
19 class ConnectionStatus {
David Trainor- moved to gerrit 2016/09/09 19:33:47 Should this be a NetworkEventObserver and BlimpCli
xingliu 2016/09/10 22:45:47 Done.
20 public:
21 ConnectionStatus();
22 ~ConnectionStatus();
23
24 // Return if the engine IP and port is valid.
25 bool IsValid() const;
26
27 // Get engine IP and port.
28 const net::IPEndPoint& GetIpEndPoint();
29
30 // Return if we connected to the engine.
31 bool IsConnected() const;
32
33 // Broadcast network events.
34 void AddObserver(NetworkEventObserver* observer);
35 void RemoveObserver(NetworkEventObserver* observer);
36
37 // Set connection states.
38 void onAssignmentResult(int result, const Assignment& assignment);
David Trainor- moved to gerrit 2016/09/09 19:33:47 on -> On
xingliu 2016/09/10 22:45:46 Done.
39 void OnConnected();
40 void OnDisconnected(int result);
41
42 private:
43 // Observers listen to session events.
44 base::ObserverList<NetworkEventObserver> connection_observers_;
45
46 // IP address and port of the engine.
47 net::IPEndPoint engine_endpoint_;
48
49 // If the client is currently connected.
50 bool is_connected_;
51
52 DISALLOW_COPY_AND_ASSIGN(ConnectionStatus);
53 };
54
55 } // namespace client
56 } // namespace blimp
57
58 #endif // BLIMP_CLIENT_CORE_SESSION_CONNECTION_STATUS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698