Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 CHROME_SERVICE_REMOTING_CHROMOTING_HOST_MANAGER_H_ | 5 #ifndef CHROME_SERVICE_REMOTING_CHROMOTING_HOST_MANAGER_H_ |
| 6 #define CHROME_SERVICE_REMOTING_CHROMOTING_HOST_MANAGER_H_ | 6 #define CHROME_SERVICE_REMOTING_CHROMOTING_HOST_MANAGER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/ref_counted.h" | 10 #include "base/ref_counted.h" |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 31 // enabled/disabled. Observer is specified in the constructor. | 31 // enabled/disabled. Observer is specified in the constructor. |
| 32 class Observer { | 32 class Observer { |
| 33 public: | 33 public: |
| 34 virtual ~Observer() {} | 34 virtual ~Observer() {} |
| 35 virtual void OnChromotingHostEnabled() {} | 35 virtual void OnChromotingHostEnabled() {} |
| 36 virtual void OnChromotingHostDisabled() {} | 36 virtual void OnChromotingHostDisabled() {} |
| 37 }; | 37 }; |
| 38 | 38 |
| 39 // Caller keeps ownership of |observer|. |observer| must not be | 39 // Caller keeps ownership of |observer|. |observer| must not be |
| 40 // destroyed while this object exists. | 40 // destroyed while this object exists. |
| 41 ChromotingHostManager(Observer* observer); | 41 explicit ChromotingHostManager(Observer* observer); |
| 42 | 42 |
| 43 void Initialize(base::MessageLoopProxy* file_message_loop); | 43 void Initialize(base::MessageLoopProxy* file_message_loop); |
| 44 void Teardown(); | 44 void Teardown(); |
| 45 | 45 |
| 46 // Return the reference to the chromoting host only if it has started. | 46 // Return the reference to the chromoting host only if it has started. |
| 47 remoting::ChromotingHost* GetChromotingHost() { return chromoting_host_; } | 47 remoting::ChromotingHost* GetChromotingHost() { return chromoting_host_; } |
| 48 | 48 |
| 49 // Updates credentials used for XMPP connection. | 49 // Updates credentials used for XMPP connection. |
| 50 void SetCredentials(const std::string& login, const std::string& token); | 50 void SetCredentials(const std::string& login, const std::string& token); |
| 51 | 51 |
| 52 bool IsEnabled(); | 52 bool IsEnabled(); |
| 53 | 53 |
| 54 // Start running the chromoting host asynchronously. | 54 // Start running the chromoting host asynchronously. |
| 55 void Enable(); | 55 void Enable(); |
| 56 | 56 |
| 57 // Stop chromoting host. The shutdown process will happen asynchronously. | 57 // Stop chromoting host. The shutdown process will happen asynchronously. |
| 58 void Disable(); | 58 void Disable(); |
| 59 | 59 |
| 60 void GetHostInfo(ChromotingHostInfo* host_info); | 60 void GetHostInfo(ChromotingHostInfo* host_info); |
| 61 | 61 |
| 62 private: | 62 private: |
| 63 friend class base::RefCountedThreadSafe<ChromotingHostManager>; | |
|
Nico
2011/01/27 03:55:17
! +1
| |
| 64 virtual ~ChromotingHostManager(); | |
| 65 | |
| 63 bool IsConfigInitialized(); | 66 bool IsConfigInitialized(); |
| 64 void InitializeConfig(); | 67 void InitializeConfig(); |
| 65 | 68 |
| 66 void SetEnabled(bool enabled); | 69 void SetEnabled(bool enabled); |
| 67 void Start(); | 70 void Start(); |
| 68 void Stop(); | 71 void Stop(); |
| 69 | 72 |
| 70 void OnShutdown(); | 73 void OnShutdown(); |
| 71 | 74 |
| 72 Observer* observer_; | 75 Observer* observer_; |
| 73 | 76 |
| 74 scoped_refptr<remoting::MutableHostConfig> chromoting_config_; | 77 scoped_refptr<remoting::MutableHostConfig> chromoting_config_; |
| 75 scoped_ptr<remoting::ChromotingHostContext> chromoting_context_; | 78 scoped_ptr<remoting::ChromotingHostContext> chromoting_context_; |
| 76 scoped_refptr<remoting::ChromotingHost> chromoting_host_; | 79 scoped_refptr<remoting::ChromotingHost> chromoting_host_; |
| 77 }; | 80 }; |
| 78 | 81 |
| 79 } // namespace remoting | 82 } // namespace remoting |
| 80 | 83 |
| 81 #endif // CHROME_SERVICE_REMOTING_CHROMOTING_HOST_MANAGER_H_ | 84 #endif // CHROME_SERVICE_REMOTING_CHROMOTING_HOST_MANAGER_H_ |
| OLD | NEW |