| OLD | NEW |
| 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_DAEMON_CONTROLLER_DELEGATE_WIN_H_ | 5 #ifndef REMOTING_HOST_SETUP_DAEMON_CONTROLLER_DELEGATE_WIN_H_ |
| 6 #define REMOTING_HOST_SETUP_DAEMON_CONTROLLER_DELEGATE_WIN_H_ | 6 #define REMOTING_HOST_SETUP_DAEMON_CONTROLLER_DELEGATE_WIN_H_ |
| 7 | 7 |
| 8 #include "base/memory/scoped_ptr.h" | |
| 9 #include "base/timer/timer.h" | |
| 10 #include "base/win/scoped_comptr.h" | 8 #include "base/win/scoped_comptr.h" |
| 11 // chromoting_lib.h contains MIDL-generated declarations. | |
| 12 #include "remoting/host/chromoting_lib.h" | |
| 13 #include "remoting/host/setup/daemon_controller.h" | 9 #include "remoting/host/setup/daemon_controller.h" |
| 14 | 10 |
| 15 namespace remoting { | 11 namespace remoting { |
| 16 | 12 |
| 17 class DaemonInstallerWin; | 13 class DaemonInstallerWin; |
| 18 | 14 |
| 19 class DaemonControllerDelegateWin : public DaemonController::Delegate { | 15 class DaemonControllerDelegateWin : public DaemonController::Delegate { |
| 20 public: | 16 public: |
| 21 DaemonControllerDelegateWin(); | 17 DaemonControllerDelegateWin(); |
| 22 virtual ~DaemonControllerDelegateWin(); | 18 virtual ~DaemonControllerDelegateWin(); |
| 23 | 19 |
| 24 // DaemonController::Delegate interface. | 20 // DaemonController::Delegate interface. |
| 25 virtual DaemonController::State GetState() override; | 21 virtual DaemonController::State GetState() override; |
| 26 virtual scoped_ptr<base::DictionaryValue> GetConfig() override; | 22 virtual scoped_ptr<base::DictionaryValue> GetConfig() override; |
| 27 virtual void SetConfigAndStart( | 23 virtual void SetConfigAndStart( |
| 28 scoped_ptr<base::DictionaryValue> config, | 24 scoped_ptr<base::DictionaryValue> config, |
| 29 bool consent, | 25 bool consent, |
| 30 const DaemonController::CompletionCallback& done) override; | 26 const DaemonController::CompletionCallback& done) override; |
| 31 virtual void UpdateConfig( | 27 virtual void UpdateConfig( |
| 32 scoped_ptr<base::DictionaryValue> config, | 28 scoped_ptr<base::DictionaryValue> config, |
| 33 const DaemonController::CompletionCallback& done) override; | 29 const DaemonController::CompletionCallback& done) override; |
| 34 virtual void Stop(const DaemonController::CompletionCallback& done) override; | 30 virtual void Stop(const DaemonController::CompletionCallback& done) override; |
| 35 virtual void SetWindow(void* window_handle) override; | 31 virtual void SetWindow(void* window_handle) override; |
| 36 virtual std::string GetVersion() override; | 32 virtual std::string GetVersion() override; |
| 37 virtual DaemonController::UsageStatsConsent GetUsageStatsConsent() override; | 33 virtual DaemonController::UsageStatsConsent GetUsageStatsConsent() override; |
| 38 | 34 |
| 39 private: | |
| 40 // Activates an unprivileged instance of the daemon controller and caches it. | |
| 41 HRESULT ActivateController(); | |
| 42 | |
| 43 // Activates an instance of the daemon controller and caches it. If COM | |
| 44 // Elevation is supported (Vista+) the activated instance is elevated, | |
| 45 // otherwise it is activated under credentials of the caller. | |
| 46 HRESULT ActivateElevatedController(); | |
| 47 | |
| 48 // Releases the cached instance of the controller. | |
| 49 void ReleaseController(); | |
| 50 | |
| 51 // |control_| and |control2_| hold references to an instance of the daemon | |
| 52 // controller to prevent a UAC prompt on every operation. | |
| 53 base::win::ScopedComPtr<IDaemonControl> control_; | |
| 54 base::win::ScopedComPtr<IDaemonControl2> control2_; | |
| 55 | |
| 56 // True if |control_| holds a reference to an elevated instance of the daemon | |
| 57 // controller. | |
| 58 bool control_is_elevated_; | |
| 59 | |
| 60 // This timer is used to release |control_| after a timeout. | |
| 61 scoped_ptr<base::OneShotTimer<DaemonControllerDelegateWin> > release_timer_; | |
| 62 | |
| 63 // Handle of the plugin window. | |
| 64 HWND window_handle_; | |
| 65 | |
| 66 DISALLOW_COPY_AND_ASSIGN(DaemonControllerDelegateWin); | 35 DISALLOW_COPY_AND_ASSIGN(DaemonControllerDelegateWin); |
| 67 }; | 36 }; |
| 68 | 37 |
| 69 } // namespace remoting | 38 } // namespace remoting |
| 70 | 39 |
| 71 #endif // REMOTING_HOST_SETUP_DAEMON_CONTROLLER_DELEGATE_WIN_H_ | 40 #endif // REMOTING_HOST_SETUP_DAEMON_CONTROLLER_DELEGATE_WIN_H_ |
| OLD | NEW |