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

Unified Diff: remoting/host/setup/daemon_controller_delegate_win.cc

Issue 873353004: Remove InstallHost from the DaemonController. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: remoting/host/setup/daemon_controller_delegate_win.cc
diff --git a/remoting/host/setup/daemon_controller_delegate_win.cc b/remoting/host/setup/daemon_controller_delegate_win.cc
index 628dfac3ce9dc6dd588003c85c744eccab273673..e17432856f7ad47146196e64166db68f800a3156 100644
--- a/remoting/host/setup/daemon_controller_delegate_win.cc
+++ b/remoting/host/setup/daemon_controller_delegate_win.cc
@@ -131,6 +131,27 @@ void InvokeCompletionCallback(
done.Run(HResultToAsyncResult(hr));
}
+HWND GetTopLevelWindow(HWND window) {
weitao 2015/01/29 18:53:51 This will be removed in a subsequent CL when I rem
Sergey Ulanov 2015/01/29 19:00:32 I think it will still be needed for ActivateElevat
weitao 2015/01/29 23:50:57 No it won't be needed any more. Activate*Controlle
+ if (window == nullptr) {
+ return nullptr;
+ }
+
+ for (;;) {
+ LONG style = GetWindowLong(window, GWL_STYLE);
+ if ((style & WS_OVERLAPPEDWINDOW) == WS_OVERLAPPEDWINDOW ||
+ (style & WS_POPUP) == WS_POPUP) {
+ return window;
+ }
+
+ HWND parent = GetAncestor(window, GA_PARENT);
+ if (parent == nullptr) {
+ return window;
+ }
+
+ window = parent;
+ }
+}
+
} // namespace
DaemonControllerDelegateWin::DaemonControllerDelegateWin()
@@ -194,44 +215,6 @@ scoped_ptr<base::DictionaryValue> DaemonControllerDelegateWin::GetConfig() {
return make_scoped_ptr(static_cast<base::DictionaryValue*>(config.release()));
}
-void DaemonControllerDelegateWin::InstallHost(
- const DaemonController::CompletionCallback& done) {
- DoInstallHost(base::Bind(&InvokeCompletionCallback, done));
-}
-
-void DaemonControllerDelegateWin::SetConfigAndStart(
- scoped_ptr<base::DictionaryValue> config,
- bool consent,
- const DaemonController::CompletionCallback& done) {
- DoInstallHost(
- base::Bind(&DaemonControllerDelegateWin::StartHostWithConfig,
- base::Unretained(this), base::Passed(&config), consent, done));
-}
-
-void DaemonControllerDelegateWin::DoInstallHost(
- const DaemonInstallerWin::CompletionCallback& done) {
- // Configure and start the Daemon Controller if it is installed already.
- HRESULT hr = ActivateElevatedController();
- if (SUCCEEDED(hr)) {
- done.Run(S_OK);
- return;
- }
-
- // Otherwise, install it if its COM registration entry is missing.
- if (hr == CO_E_CLASSSTRING) {
- DCHECK(!installer_);
-
- installer_ = DaemonInstallerWin::Create(
- GetTopLevelWindow(window_handle_), done);
- installer_->Install();
- return;
- }
-
- LOG(ERROR) << "Failed to initiate the Chromoting Host installation "
- << "(error: 0x" << std::hex << hr << std::dec << ").";
- done.Run(hr);
-}
-
void DaemonControllerDelegateWin::UpdateConfig(
scoped_ptr<base::DictionaryValue> config,
const DaemonController::CompletionCallback& done) {
@@ -402,21 +385,11 @@ void DaemonControllerDelegateWin::ReleaseController() {
control_is_elevated_ = false;
}
-void DaemonControllerDelegateWin::StartHostWithConfig(
+void DaemonControllerDelegateWin::SetConfigAndStart(
scoped_ptr<base::DictionaryValue> config,
bool consent,
- const DaemonController::CompletionCallback& done,
- HRESULT hr) {
- installer_.reset();
-
- if (FAILED(hr)) {
- LOG(ERROR) << "Failed to install the Chromoting Host "
- << "(error: 0x" << std::hex << hr << std::dec << ").";
- InvokeCompletionCallback(done, hr);
- return;
- }
-
- hr = ActivateElevatedController();
+ const DaemonController::CompletionCallback& done) {
+ HRESULT hr = ActivateElevatedController();
if (FAILED(hr)) {
InvokeCompletionCallback(done, hr);
return;

Powered by Google App Engine
This is Rietveld 408576698