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

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

Issue 877343004: Move the |ElevatedDaemonController| implementation to |DaemonControllerDelegateWin| (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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
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"
Sergey Ulanov 2015/01/31 01:06:58 This can be removed.
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
11 namespace base {
12 class FilePath;
Sergey Ulanov 2015/01/31 01:06:58 Don't need this.
13 } // namespace base
14
15 namespace remoting { 15 namespace remoting {
16 16
17 class DaemonInstallerWin; 17 class DaemonInstallerWin;
18 18
19 class DaemonControllerDelegateWin : public DaemonController::Delegate { 19 class DaemonControllerDelegateWin : public DaemonController::Delegate {
20 public: 20 public:
21 DaemonControllerDelegateWin(); 21 DaemonControllerDelegateWin();
22 virtual ~DaemonControllerDelegateWin(); 22 virtual ~DaemonControllerDelegateWin();
23 23
24 // DaemonController::Delegate interface. 24 // DaemonController::Delegate interface.
25 virtual DaemonController::State GetState() override; 25 virtual DaemonController::State GetState() override;
26 virtual scoped_ptr<base::DictionaryValue> GetConfig() override; 26 virtual scoped_ptr<base::DictionaryValue> GetConfig() override;
27 virtual void SetConfigAndStart( 27 virtual void SetConfigAndStart(
28 scoped_ptr<base::DictionaryValue> config, 28 scoped_ptr<base::DictionaryValue> config,
29 bool consent, 29 bool consent,
30 const DaemonController::CompletionCallback& done) override; 30 const DaemonController::CompletionCallback& done) override;
31 virtual void UpdateConfig( 31 virtual void UpdateConfig(
32 scoped_ptr<base::DictionaryValue> config, 32 scoped_ptr<base::DictionaryValue> config,
33 const DaemonController::CompletionCallback& done) override; 33 const DaemonController::CompletionCallback& done) override;
34 virtual void Stop(const DaemonController::CompletionCallback& done) override; 34 virtual void Stop(const DaemonController::CompletionCallback& done) override;
35 virtual void SetWindow(void* window_handle) override; 35 virtual void SetWindow(void* window_handle) override;
36 virtual std::string GetVersion() override; 36 virtual std::string GetVersion() override;
37 virtual DaemonController::UsageStatsConsent GetUsageStatsConsent() override; 37 virtual DaemonController::UsageStatsConsent GetUsageStatsConsent() override;
38 38
39 private: 39 private:
40 // Activates an unprivileged instance of the daemon controller and caches it. 40 HRESULT DoGetConfig(BSTR* config_out);
Sergey Ulanov 2015/01/31 01:06:58 These don't need to be methods in this class. Make
41 HRESULT ActivateController(); 41 HRESULT DoGetVersion(BSTR* version_out);
42 42 HRESULT SetConfig(BSTR config);
43 // Activates an instance of the daemon controller and caches it. If COM 43 HRESULT StartDaemon();
44 // Elevation is supported (Vista+) the activated instance is elevated, 44 HRESULT StopDaemon();
45 // otherwise it is activated under credentials of the caller. 45 HRESULT DoUpdateConfig(BSTR config);
46 HRESULT ActivateElevatedController(); 46 HRESULT DoGetUsageStatsConsent(BOOL* allowed, BOOL* set_by_policy);
47 47 HRESULT SetUsageStatsConsent(BOOL allowed);
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 48
66 DISALLOW_COPY_AND_ASSIGN(DaemonControllerDelegateWin); 49 DISALLOW_COPY_AND_ASSIGN(DaemonControllerDelegateWin);
67 }; 50 };
68 51
69 } // namespace remoting 52 } // namespace remoting
70 53
71 #endif // REMOTING_HOST_SETUP_DAEMON_CONTROLLER_DELEGATE_WIN_H_ 54 #endif // REMOTING_HOST_SETUP_DAEMON_CONTROLLER_DELEGATE_WIN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698