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

Side by Side Diff: remoting/host/setup/service_client.h

Issue 22992002: Service account setup for headless Linux hosts (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 4 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 REMOTING_HOST_SETUP_SERVICE_CLIENT_H_ 5 #ifndef REMOTING_HOST_SETUP_SERVICE_CLIENT_H_
6 #define REMOTING_HOST_SETUP_SERVICE_CLIENT_H_ 6 #define REMOTING_HOST_SETUP_SERVICE_CLIENT_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
11 11
12 namespace net { 12 namespace net {
13 class URLRequestContextGetter; 13 class URLRequestContextGetter;
14 } 14 }
15 15
16 // A class that gives access to the Chromoting service. 16 // A class that gives access to the Chromoting service.
17 namespace remoting { 17 namespace remoting {
18 18
19 class ServiceClient { 19 class ServiceClient {
20 public: 20 public:
21 // TODO(simonmorris): Consider using a Callback instead of a delegate. 21 // TODO(simonmorris): Consider using a Callback instead of a delegate.
22 class Delegate { 22 class Delegate {
23 public: 23 public:
24 // Invoked when a host has been registered. 24 // Invoked when a host has been registered.
25 virtual void OnHostRegistered() = 0; 25 virtual void OnHostRegistered(const std::string& authorization_code) = 0;
26 // Invoked when a host has been unregistered. 26 // Invoked when a host has been unregistered.
27 virtual void OnHostUnregistered() = 0; 27 virtual void OnHostUnregistered() = 0;
28 // Invoked when there is an OAuth error. 28 // Invoked when there is an OAuth error.
29 virtual void OnOAuthError() = 0; 29 virtual void OnOAuthError() = 0;
30 // Invoked when there is a network error or upon receiving an invalid 30 // Invoked when there is a network error or upon receiving an invalid
31 // response. 31 // response.
32 virtual void OnNetworkError(int response_code) = 0; 32 virtual void OnNetworkError(int response_code) = 0;
33 33
34 protected: 34 protected:
35 virtual ~Delegate() {} 35 virtual ~Delegate() {}
36 }; 36 };
37 ServiceClient(const std::string& chromoting_hosts_url, 37 ServiceClient(const std::string& chromoting_hosts_url,
38 net::URLRequestContextGetter* context_getter); 38 net::URLRequestContextGetter* context_getter);
39 ~ServiceClient(); 39 ~ServiceClient();
40 40
41 // Register a host. 41 // Register a host.
42 void RegisterHost(const std::string& host_id, 42 void RegisterHost(const std::string& host_id,
43 const std::string& host_name, 43 const std::string& host_name,
44 const std::string& public_key, 44 const std::string& public_key,
45 const std::string& host_client_id,
45 const std::string& oauth_access_token, 46 const std::string& oauth_access_token,
46 Delegate* delegate); 47 Delegate* delegate);
47 // Unregister a host. 48 // Unregister a host.
48 void UnregisterHost(const std::string& host_id, 49 void UnregisterHost(const std::string& host_id,
49 const std::string& oauth_access_token, 50 const std::string& oauth_access_token,
50 Delegate* delegate); 51 Delegate* delegate);
51 52
52 private: 53 private:
53 // The guts of the implementation live in this class. 54 // The guts of the implementation live in this class.
54 class Core; 55 class Core;
55 scoped_refptr<Core> core_; 56 scoped_refptr<Core> core_;
56 DISALLOW_COPY_AND_ASSIGN(ServiceClient); 57 DISALLOW_COPY_AND_ASSIGN(ServiceClient);
57 }; 58 };
58 59
59 } // namespace remoting 60 } // namespace remoting
60 61
61 #endif // REMOTING_HOST_SETUP_SERVICE_CLIENT_H_ 62 #endif // REMOTING_HOST_SETUP_SERVICE_CLIENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698