From 2a4fd78e5763cd30fd766609790b69bb5aab8649 Mon Sep 17 00:00:00 2001 From: weitaosu Date: Thu, 29 Jan 2015 18:12:31 -0800 Subject: [PATCH] Remove InstallHost from the DaemonController. The InstallHost functionality is no longer used now that our Npapi plugin is gone. I am removing it in preparation for the removal of ElevatedDaemonController. BUG=453172 Review URL: https://codereview.chromium.org/873353004 Cr-Commit-Position: refs/heads/master@{#313857} --- remoting/host/setup/daemon_controller.cc | 16 - remoting/host/setup/daemon_controller.h | 9 - .../host/setup/daemon_controller_delegate_linux.cc | 5 - .../host/setup/daemon_controller_delegate_linux.h | 1 - .../host/setup/daemon_controller_delegate_mac.h | 1 - .../host/setup/daemon_controller_delegate_mac.mm | 5 - .../host/setup/daemon_controller_delegate_win.cc | 75 ++-- .../host/setup/daemon_controller_delegate_win.h | 16 - remoting/host/setup/daemon_installer_win.cc | 412 --------------------- remoting/host/setup/daemon_installer_win.h | 52 --- .../setup/me2me_native_messaging_host_unittest.cc | 6 - remoting/remoting_host.gypi | 2 - 12 files changed, 24 insertions(+), 576 deletions(-) delete mode 100644 remoting/host/setup/daemon_installer_win.cc delete mode 100644 remoting/host/setup/daemon_installer_win.h diff --git a/remoting/host/setup/daemon_controller.cc b/remoting/host/setup/daemon_controller.cc index 41221fe728fd..d22a64b09464 100644 --- a/remoting/host/setup/daemon_controller.cc +++ b/remoting/host/setup/daemon_controller.cc @@ -47,16 +47,6 @@ void DaemonController::GetConfig(const GetConfigCallback& done) { ServiceOrQueueRequest(request); } -void DaemonController::InstallHost(const CompletionCallback& done) { - DCHECK(caller_task_runner_->BelongsToCurrentThread()); - - DaemonController::CompletionCallback wrapped_done = base::Bind( - &DaemonController::InvokeCompletionCallbackAndScheduleNext, this, done); - base::Closure request = base::Bind( - &DaemonController::DoInstallHost, this, wrapped_done); - ServiceOrQueueRequest(request); -} - void DaemonController::SetConfigAndStart( scoped_ptr config, bool consent, @@ -140,12 +130,6 @@ void DaemonController::DoGetConfig(const GetConfigCallback& done) { base::Bind(done, base::Passed(&config))); } -void DaemonController::DoInstallHost(const CompletionCallback& done) { - DCHECK(delegate_task_runner_->BelongsToCurrentThread()); - - delegate_->InstallHost(done); -} - void DaemonController::DoSetConfigAndStart( scoped_ptr config, bool consent, diff --git a/remoting/host/setup/daemon_controller.h b/remoting/host/setup/daemon_controller.h index 522a84026689..b7b5b5879a44 100644 --- a/remoting/host/setup/daemon_controller.h +++ b/remoting/host/setup/daemon_controller.h @@ -121,10 +121,6 @@ class DaemonController : public base::RefCountedThreadSafe { // sensitive have been filtered out. virtual scoped_ptr GetConfig() = 0; - // Download and install the host component. |done| is invoked on the - // calling thread when the operation is completed. - virtual void InstallHost(const CompletionCallback& done) = 0; - // Starts the daemon process. This may require that the daemon be // downloaded and installed. |done| is invoked on the calling thread when // the operation is completed. @@ -175,10 +171,6 @@ class DaemonController : public base::RefCountedThreadSafe { // sensitive have been filtered out. void GetConfig(const GetConfigCallback& done); - // Download and install the host component. |done| is called when the - // operation is finished or fails. - void InstallHost(const CompletionCallback& done); - // Start the daemon process. This may require that the daemon be // downloaded and installed. |done| is called when the // operation is finished or fails. @@ -224,7 +216,6 @@ class DaemonController : public base::RefCountedThreadSafe { // Blocking helper methods used to call the delegate. void DoGetConfig(const GetConfigCallback& done); - void DoInstallHost(const CompletionCallback& done); void DoSetConfigAndStart(scoped_ptr config, bool consent, const CompletionCallback& done); diff --git a/remoting/host/setup/daemon_controller_delegate_linux.cc b/remoting/host/setup/daemon_controller_delegate_linux.cc index 28254709a9b6..7c52d021466c 100644 --- a/remoting/host/setup/daemon_controller_delegate_linux.cc +++ b/remoting/host/setup/daemon_controller_delegate_linux.cc @@ -196,11 +196,6 @@ scoped_ptr DaemonControllerDelegateLinux::GetConfig() { return result.Pass(); } -void DaemonControllerDelegateLinux::InstallHost( - const DaemonController::CompletionCallback& done) { - NOTREACHED(); -} - void DaemonControllerDelegateLinux::SetConfigAndStart( scoped_ptr config, bool consent, diff --git a/remoting/host/setup/daemon_controller_delegate_linux.h b/remoting/host/setup/daemon_controller_delegate_linux.h index 916072c74c1e..873170885383 100644 --- a/remoting/host/setup/daemon_controller_delegate_linux.h +++ b/remoting/host/setup/daemon_controller_delegate_linux.h @@ -18,7 +18,6 @@ class DaemonControllerDelegateLinux : public DaemonController::Delegate { // DaemonController::Delegate interface. DaemonController::State GetState() override; scoped_ptr GetConfig() override; - void InstallHost(const DaemonController::CompletionCallback& done) override; void SetConfigAndStart( scoped_ptr config, bool consent, diff --git a/remoting/host/setup/daemon_controller_delegate_mac.h b/remoting/host/setup/daemon_controller_delegate_mac.h index ec69d32c5aa9..78c08e80bba2 100644 --- a/remoting/host/setup/daemon_controller_delegate_mac.h +++ b/remoting/host/setup/daemon_controller_delegate_mac.h @@ -19,7 +19,6 @@ class DaemonControllerDelegateMac : public DaemonController::Delegate { // DaemonController::Delegate interface. DaemonController::State GetState() override; scoped_ptr GetConfig() override; - void InstallHost(const DaemonController::CompletionCallback& done) override; void SetConfigAndStart( scoped_ptr config, bool consent, diff --git a/remoting/host/setup/daemon_controller_delegate_mac.mm b/remoting/host/setup/daemon_controller_delegate_mac.mm index 76499c613c42..c5d02d49ae2e 100644 --- a/remoting/host/setup/daemon_controller_delegate_mac.mm +++ b/remoting/host/setup/daemon_controller_delegate_mac.mm @@ -64,11 +64,6 @@ scoped_ptr DaemonControllerDelegateMac::GetConfig() { return config.Pass(); } -void DaemonControllerDelegateMac::InstallHost( - const DaemonController::CompletionCallback& done) { - NOTREACHED(); -} - void DaemonControllerDelegateMac::SetConfigAndStart( scoped_ptr config, bool consent, diff --git a/remoting/host/setup/daemon_controller_delegate_win.cc b/remoting/host/setup/daemon_controller_delegate_win.cc index 628dfac3ce9d..e17432856f7a 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) { + 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 DaemonControllerDelegateWin::GetConfig() { return make_scoped_ptr(static_cast(config.release())); } -void DaemonControllerDelegateWin::InstallHost( - const DaemonController::CompletionCallback& done) { - DoInstallHost(base::Bind(&InvokeCompletionCallback, done)); -} - -void DaemonControllerDelegateWin::SetConfigAndStart( - scoped_ptr 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 config, const DaemonController::CompletionCallback& done) { @@ -402,21 +385,11 @@ void DaemonControllerDelegateWin::ReleaseController() { control_is_elevated_ = false; } -void DaemonControllerDelegateWin::StartHostWithConfig( +void DaemonControllerDelegateWin::SetConfigAndStart( scoped_ptr 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; diff --git a/remoting/host/setup/daemon_controller_delegate_win.h b/remoting/host/setup/daemon_controller_delegate_win.h index 9ffafb100e71..29ad739fb96c 100644 --- a/remoting/host/setup/daemon_controller_delegate_win.h +++ b/remoting/host/setup/daemon_controller_delegate_win.h @@ -11,7 +11,6 @@ // chromoting_lib.h contains MIDL-generated declarations. #include "remoting/host/chromoting_lib.h" #include "remoting/host/setup/daemon_controller.h" -#include "remoting/host/setup/daemon_installer_win.h" namespace remoting { @@ -25,8 +24,6 @@ class DaemonControllerDelegateWin : public DaemonController::Delegate { // DaemonController::Delegate interface. virtual DaemonController::State GetState() override; virtual scoped_ptr GetConfig() override; - virtual void InstallHost( - const DaemonController::CompletionCallback& done) override; virtual void SetConfigAndStart( scoped_ptr config, bool consent, @@ -51,17 +48,6 @@ class DaemonControllerDelegateWin : public DaemonController::Delegate { // Releases the cached instance of the controller. void ReleaseController(); - // Install the host and then invoke the callback. - void DoInstallHost(const DaemonInstallerWin::CompletionCallback& done); - - // Procedes with the daemon configuration if the installation succeeded, - // otherwise reports the error. - void StartHostWithConfig( - scoped_ptr config, - bool consent, - const DaemonController::CompletionCallback& done, - HRESULT hr); - // |control_| and |control2_| hold references to an instance of the daemon // controller to prevent a UAC prompt on every operation. base::win::ScopedComPtr control_; @@ -77,8 +63,6 @@ class DaemonControllerDelegateWin : public DaemonController::Delegate { // Handle of the plugin window. HWND window_handle_; - scoped_ptr installer_; - DISALLOW_COPY_AND_ASSIGN(DaemonControllerDelegateWin); }; diff --git a/remoting/host/setup/daemon_installer_win.cc b/remoting/host/setup/daemon_installer_win.cc deleted file mode 100644 index a125dfeb819b..000000000000 --- a/remoting/host/setup/daemon_installer_win.cc +++ /dev/null @@ -1,412 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "remoting/host/setup/daemon_installer_win.h" - -#include - -#include "base/bind.h" -#include "base/message_loop/message_loop.h" -#include "base/process/launch.h" -#include "base/strings/string16.h" -#include "base/strings/stringprintf.h" -#include "base/strings/utf_string_conversions.h" -#include "base/time/time.h" -#include "base/timer/timer.h" -#include "base/win/object_watcher.h" -#include "base/win/registry.h" -#include "base/win/scoped_bstr.h" -#include "base/win/scoped_comptr.h" -#include "base/win/scoped_handle.h" -#include "base/win/scoped_variant.h" -#include "base/win/windows_version.h" -#include "google_update/google_update_idl.h" -#include "remoting/base/dispatch_win.h" -#include "remoting/host/win/omaha.h" - -using base::win::ScopedBstr; -using base::win::ScopedComPtr; -using base::win::ScopedVariant; - -namespace { - -// ProgID of the per-machine Omaha COM server. -const wchar_t kGoogleUpdate[] = L"GoogleUpdate.Update3WebMachine"; - -// The COM elevation moniker for the per-machine Omaha COM server. -const wchar_t kGoogleUpdateElevationMoniker[] = - L"Elevation:Administrator!new:GoogleUpdate.Update3WebMachine"; - -// The registry key where the configuration of Omaha is stored. -const wchar_t kOmahaUpdateKeyName[] = L"Software\\Google\\Update"; - -// The name of the value where the full path to GoogleUpdate.exe is stored. -const wchar_t kOmahaPathValueName[] = L"path"; - -// The command line format string for GoogleUpdate.exe -const wchar_t kGoogleUpdateCommandLineFormat[] = - L"\"%ls\" /install \"bundlename=Chromoting%%20Host&appguid=%ls&" - L"appname=Chromoting%%20Host&needsadmin=True&lang=%ls\""; - -// TODO(alexeypa): Get the desired laungage from the web app. -const wchar_t kOmahaLanguage[] = L"en"; - -// An empty string for optional parameters. -const wchar_t kOmahaEmpty[] = L""; - -// The installation status polling interval. -const int kOmahaPollIntervalMs = 500; - -} // namespace - -namespace remoting { - -// This class implements on-demand installation of the Chromoting Host via -// per-machine Omaha instance. -class DaemonComInstallerWin : public DaemonInstallerWin { - public: - DaemonComInstallerWin(const ScopedComPtr& update3, - const CompletionCallback& done); - - // DaemonInstallerWin implementation. - virtual void Install() override; - - private: - // Polls the installation status performing state-specific actions (such as - // starting installation once download has finished). - void PollInstallationStatus(); - - // Omaha interfaces. - ScopedVariant app_; - ScopedVariant bundle_; - ScopedComPtr update3_; - - base::Timer polling_timer_; -}; - -// This class implements on-demand installation of the Chromoting Host by -// launching a per-user instance of Omaha and requesting elevation. -class DaemonCommandLineInstallerWin - : public DaemonInstallerWin, - public base::win::ObjectWatcher::Delegate { - public: - DaemonCommandLineInstallerWin(const CompletionCallback& done); - ~DaemonCommandLineInstallerWin(); - - // DaemonInstallerWin implementation. - virtual void Install() override; - - // base::win::ObjectWatcher::Delegate implementation. - virtual void OnObjectSignaled(HANDLE object) override; - - private: - // Handle of the launched process. - base::Process process_; - - // Used to determine when the launched process terminates. - base::win::ObjectWatcher process_watcher_; -}; - -DaemonComInstallerWin::DaemonComInstallerWin( - const ScopedComPtr& update3, - const CompletionCallback& done) - : DaemonInstallerWin(done), - update3_(update3), - polling_timer_( - FROM_HERE, - base::TimeDelta::FromMilliseconds(kOmahaPollIntervalMs), - base::Bind(&DaemonComInstallerWin::PollInstallationStatus, - base::Unretained(this)), - false) { -} - -void DaemonComInstallerWin::Install() { - // Create an app bundle. - HRESULT hr = dispatch::Invoke(update3_.get(), L"createAppBundleWeb", - DISPATCH_METHOD, bundle_.Receive()); - if (FAILED(hr)) { - Done(hr); - return; - } - if (bundle_.type() != VT_DISPATCH) { - Done(DISP_E_TYPEMISMATCH); - return; - } - - hr = dispatch::Invoke(V_DISPATCH(&bundle_), L"initialize", DISPATCH_METHOD, - nullptr); - if (FAILED(hr)) { - Done(hr); - return; - } - - // Add Chromoting Host to the bundle. - ScopedVariant appid(kHostOmahaAppid); - ScopedVariant empty(kOmahaEmpty); - ScopedVariant language(kOmahaLanguage); - hr = dispatch::Invoke(V_DISPATCH(&bundle_), L"createApp", DISPATCH_METHOD, - appid, empty, language, empty, nullptr); - if (FAILED(hr)) { - Done(hr); - return; - } - - hr = dispatch::Invoke(V_DISPATCH(&bundle_), L"checkForUpdate", - DISPATCH_METHOD, nullptr); - if (FAILED(hr)) { - Done(hr); - return; - } - - hr = dispatch::Invoke(V_DISPATCH(&bundle_), L"appWeb", - DISPATCH_PROPERTYGET, ScopedVariant(0), app_.Receive()); - if (FAILED(hr)) { - Done(hr); - return; - } - if (app_.type() != VT_DISPATCH) { - Done(DISP_E_TYPEMISMATCH); - return; - } - - // Now poll for the installation status. - PollInstallationStatus(); -} - -void DaemonComInstallerWin::PollInstallationStatus() { - // Get the current application installation state. - // N.B. The object underlying the ICurrentState interface has static data that - // does not get updated as the server state changes. To get the most "current" - // state, the currentState property needs to be queried again. - ScopedVariant current_state; - HRESULT hr = dispatch::Invoke(V_DISPATCH(&app_), L"currentState", - DISPATCH_PROPERTYGET, current_state.Receive()); - if (FAILED(hr)) { - Done(hr); - return; - } - if (current_state.type() != VT_DISPATCH) { - Done(DISP_E_TYPEMISMATCH); - return; - } - - ScopedVariant state; - hr = dispatch::Invoke(V_DISPATCH(¤t_state), L"stateValue", - DISPATCH_PROPERTYGET, state.Receive()); - if (state.type() != VT_I4) { - Done(DISP_E_TYPEMISMATCH); - return; - } - - // Perform state-specific actions. - switch (V_I4(&state)) { - case STATE_INIT: - case STATE_WAITING_TO_CHECK_FOR_UPDATE: - case STATE_CHECKING_FOR_UPDATE: - case STATE_WAITING_TO_DOWNLOAD: - case STATE_RETRYING_DOWNLOAD: - case STATE_DOWNLOADING: - case STATE_WAITING_TO_INSTALL: - case STATE_INSTALLING: - case STATE_PAUSED: - break; - - case STATE_UPDATE_AVAILABLE: - hr = dispatch::Invoke(V_DISPATCH(&bundle_), L"download", - DISPATCH_METHOD, nullptr); - if (FAILED(hr)) { - Done(hr); - return; - } - break; - - case STATE_DOWNLOAD_COMPLETE: - case STATE_EXTRACTING: - case STATE_APPLYING_DIFFERENTIAL_PATCH: - case STATE_READY_TO_INSTALL: - hr = dispatch::Invoke(V_DISPATCH(&bundle_), L"install", - DISPATCH_METHOD, nullptr); - if (FAILED(hr)) { - Done(hr); - return; - } - break; - - case STATE_INSTALL_COMPLETE: - case STATE_NO_UPDATE: - // Installation complete or not required. Report success. - Done(S_OK); - return; - - case STATE_ERROR: { - ScopedVariant error_code; - hr = dispatch::Invoke(V_DISPATCH(¤t_state), L"errorCode", - DISPATCH_PROPERTYGET, error_code.Receive()); - if (FAILED(hr)) { - Done(hr); - return; - } - if (error_code.type() != VT_UI4) { - Done(DISP_E_TYPEMISMATCH); - return; - } - Done(V_UI4(&error_code)); - return; - } - - default: - LOG(ERROR) << "Unknown bundle state: " << V_I4(&state) << "."; - Done(E_FAIL); - return; - } - - // Keep polling. - polling_timer_.Reset(); -} - -DaemonCommandLineInstallerWin::DaemonCommandLineInstallerWin( - const CompletionCallback& done) : DaemonInstallerWin(done) { -} - -DaemonCommandLineInstallerWin::~DaemonCommandLineInstallerWin() { - process_watcher_.StopWatching(); -} - -void DaemonCommandLineInstallerWin::Install() { - // Get the full path to GoogleUpdate.exe from the registry. - base::win::RegKey update_key; - LONG result = update_key.Open(HKEY_CURRENT_USER, - kOmahaUpdateKeyName, - KEY_READ); - if (result != ERROR_SUCCESS) { - Done(HRESULT_FROM_WIN32(result)); - return; - } - - // presubmit: allow wstring - std::wstring google_update; - result = update_key.ReadValue(kOmahaPathValueName, &google_update); - if (result != ERROR_SUCCESS) { - Done(HRESULT_FROM_WIN32(result)); - return; - } - - // Launch the updater process and wait for its termination. - base::string16 command_line = base::WideToUTF16( - base::StringPrintf(kGoogleUpdateCommandLineFormat, - google_update.c_str(), - kHostOmahaAppid, - kOmahaLanguage)); - - base::LaunchOptions options; - process_ = base::LaunchProcess(command_line, options); - if (!process_.IsValid()) { - result = GetLastError(); - Done(HRESULT_FROM_WIN32(result)); - return; - } - - if (!process_watcher_.StartWatching(process_.Handle(), this)) { - result = GetLastError(); - Done(HRESULT_FROM_WIN32(result)); - return; - } -} - -void DaemonCommandLineInstallerWin::OnObjectSignaled(HANDLE object) { - // Check if the updater process returned success. - DWORD exit_code; - if (GetExitCodeProcess(process_.Handle(), &exit_code) && exit_code == 0) { - Done(S_OK); - } else { - Done(E_FAIL); - } -} - -DaemonInstallerWin::DaemonInstallerWin(const CompletionCallback& done) - : done_(done) { -} - -DaemonInstallerWin::~DaemonInstallerWin() { -} - -void DaemonInstallerWin::Done(HRESULT result) { - CompletionCallback done = done_; - done_.Reset(); - done.Run(result); -} - -// static -scoped_ptr DaemonInstallerWin::Create( - HWND window_handle, - CompletionCallback done) { - HRESULT result = E_FAIL; - ScopedComPtr update3; - - // Check if the machine instance of Omaha is available. The COM elevation is - // supported on Vista+, so on XP/W2K3 we assume that we are running under - // a privileged user and get ACCESS_DENIED later if we are not. - if (base::win::GetVersion() < base::win::VERSION_VISTA) { - CLSID class_id; - result = CLSIDFromProgID(kGoogleUpdate, &class_id); - if (SUCCEEDED(result)) { - result = CoCreateInstance(class_id, - nullptr, - CLSCTX_LOCAL_SERVER, - IID_IDispatch, - update3.ReceiveVoid()); - } - } else { - BIND_OPTS3 bind_options; - memset(&bind_options, 0, sizeof(bind_options)); - bind_options.cbStruct = sizeof(bind_options); - bind_options.hwnd = GetTopLevelWindow(window_handle); - bind_options.dwClassContext = CLSCTX_LOCAL_SERVER; - result = CoGetObject(kGoogleUpdateElevationMoniker, - &bind_options, - IID_IDispatch, - update3.ReceiveVoid()); - } - - if (result == CO_E_CLASSSTRING) { - // The machine instance of Omaha is not available so we will have to run - // GoogleUpdate.exe manually passing "needsadmin=True". This will cause - // Omaha to install the machine instance first and then install Chromoting - // Host. - return make_scoped_ptr(new DaemonCommandLineInstallerWin(done)); - } - - if (!SUCCEEDED(result)) { - // The user declined the UAC prompt or some other error occured. - done.Run(result); - return nullptr; - } - - // The machine instance of Omaha is available and we successfully passed - // the UAC prompt. - return make_scoped_ptr(new DaemonComInstallerWin(update3, done)); -} - -HWND GetTopLevelWindow(HWND window) { - 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 remoting diff --git a/remoting/host/setup/daemon_installer_win.h b/remoting/host/setup/daemon_installer_win.h deleted file mode 100644 index 7aaa2eb7e2aa..000000000000 --- a/remoting/host/setup/daemon_installer_win.h +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef REMOTING_HOST_DAEMON_INSTALLER_WIN_H_ -#define REMOTING_HOST_DAEMON_INSTALLER_WIN_H_ - -#include - -#include "base/basictypes.h" -#include "base/callback.h" -#include "base/memory/scoped_ptr.h" - -namespace remoting { - -class DaemonInstallerWin { - public: - typedef base::Callback CompletionCallback; - - virtual ~DaemonInstallerWin(); - - // Initiates download and installation of the Chromoting Host. - virtual void Install() = 0; - - // Creates an instance of the Chromoting Host installer passing the completion - // callback to be called when the installation finishes. In case of an error - // returns nullptr and passed the error code to |done|. - static scoped_ptr Create(HWND window_handle, - CompletionCallback done); - - protected: - DaemonInstallerWin(const CompletionCallback& done); - - // Invokes the completion callback to report the installation result. - void Done(HRESULT result); - - private: - // The completion callback that should be called to report the installation - // result. - CompletionCallback done_; - - DISALLOW_COPY_AND_ASSIGN(DaemonInstallerWin); -}; - -// Returns the first top-level (i.e. WS_OVERLAPPED or WS_POPUP) window in -// the chain of parents of |window|. Returns |window| if it represents -// a top-level window. Returns nullptr when |window| is nullptr. -HWND GetTopLevelWindow(HWND window); - -} // namespace remoting - -#endif // REMOTING_HOST_DAEMON_INSTALLER_WIN_H_ diff --git a/remoting/host/setup/me2me_native_messaging_host_unittest.cc b/remoting/host/setup/me2me_native_messaging_host_unittest.cc index 7d2ad685b7cc..b336b8d70f9e 100644 --- a/remoting/host/setup/me2me_native_messaging_host_unittest.cc +++ b/remoting/host/setup/me2me_native_messaging_host_unittest.cc @@ -140,7 +140,6 @@ class MockDaemonControllerDelegate : public DaemonController::Delegate { // DaemonController::Delegate interface. DaemonController::State GetState() override; scoped_ptr GetConfig() override; - void InstallHost(const DaemonController::CompletionCallback& done) override; void SetConfigAndStart( scoped_ptr config, bool consent, @@ -168,11 +167,6 @@ scoped_ptr MockDaemonControllerDelegate::GetConfig() { return make_scoped_ptr(new base::DictionaryValue()); } -void MockDaemonControllerDelegate::InstallHost( - const DaemonController::CompletionCallback& done) { - done.Run(DaemonController::RESULT_OK); -} - void MockDaemonControllerDelegate::SetConfigAndStart( scoped_ptr config, bool consent, diff --git a/remoting/remoting_host.gypi b/remoting/remoting_host.gypi index 21cd4c0b3f1d..59175fe78602 100644 --- a/remoting/remoting_host.gypi +++ b/remoting/remoting_host.gypi @@ -257,8 +257,6 @@ 'host/setup/daemon_controller_delegate_mac.mm', 'host/setup/daemon_controller_delegate_win.cc', 'host/setup/daemon_controller_delegate_win.h', - 'host/setup/daemon_installer_win.cc', - 'host/setup/daemon_installer_win.h', 'host/setup/me2me_native_messaging_host.cc', 'host/setup/me2me_native_messaging_host.h', 'host/setup/oauth_client.cc', -- 2.11.4.GIT