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

Side by Side Diff: remoting/host/host_status_service.h

Issue 11362267: Add status service for remoting host. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | remoting/host/host_status_service.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2012 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 REMOTING_HOST_HOST_STATUS_SERVICE_H_
6 #define REMOTING_HOST_HOST_STATUS_SERVICE_H_
7
8 #include <string>
9
10 #include "base/memory/scoped_ptr.h"
11 #include "remoting/host/websocket_listener.h"
12
13 namespace base {
14 class DictionaryValue;
15 } // namespace remoting
16
17 namespace remoting {
18
19 // HostStatusService implements WebSocket server that communicates with the
20 // remoting web app and lets it get current status of the host.
Wez 2012/11/20 05:55:53 nit: "HostStatusService implements a WebSocket ser
Sergey Ulanov 2012/11/22 00:29:35 Done.
21 class HostStatusService {
22 public:
23 HostStatusService();
24 ~HostStatusService();
25
26 // Must be called whenever state of the host changes.
27 void SetHostIsUp(const std::string& host_id);
28 void SetHostIsDown();
29
30 private:
31 class Connection;
32 friend class Connection;
33
34 // A helper to validate origin of an incoming connection.
35 static bool IsAllowedOrigin(const std::string& origin);
36
37 // Callback from WebsocketListener.
38 void OnNewConnection(scoped_ptr<WebsocketConnection> connection);
39
40 // Called from Connection instances when |connection| is closed and the
41 // Connection object should be destroyed.
42 void OnConnectionClosed(Connection* connection);
43
44 // Creates a status message that should be sent as a response to an incoming
45 // getHostState message.
46 scoped_ptr<base::DictionaryValue> GetStatusMessage();
47
48 WebsocketListener websocket_listener_;
49 std::set<Connection*> connections_;
50
51 // Host name we expect in incoming connections, e.g. "localhost:12810".
52 std::string service_host_name_;
53
54 // Current state of the host to provide to clients.
55 bool started_;
56 std::string host_id_;
57
58 DISALLOW_COPY_AND_ASSIGN(HostStatusService);
59 };
60
61 } // namespace remoting
62
63 #endif // REMOTING_HOST_HOST_STATUS_SERVICE_H_
OLDNEW
« no previous file with comments | « no previous file | remoting/host/host_status_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698