Commit 1a378356 authored by Robert Liao's avatar Robert Liao Committed by Commit Bot

Convert //remoting to use ComPtr

This is a mostly automated refactor.

BUG=638327
TBR=garykac@chromium.org

Change-Id: I579160fb7c69c7b5cbc77e1d8349e144320319bd
Reviewed-on: https://chromium-review.googlesource.com/724261Reviewed-by: default avatarRobert Liao <robliao@chromium.org>
Reviewed-by: default avatarGary Kacmarcik <garykac@chromium.org>
Reviewed-by: default avatarScott Graham <scottmg@chromium.org>
Commit-Queue: Robert Liao <robliao@chromium.org>
Cr-Commit-Position: refs/heads/master@{#509645}
parent a11d49dc
...@@ -101,7 +101,7 @@ bool AudioCapturerWin::Initialize() { ...@@ -101,7 +101,7 @@ bool AudioCapturerWin::Initialize() {
DCHECK(thread_checker_.CalledOnValidThread()); DCHECK(thread_checker_.CalledOnValidThread());
HRESULT hr = S_OK; HRESULT hr = S_OK;
base::win::ScopedComPtr<IMMDeviceEnumerator> mm_device_enumerator; Microsoft::WRL::ComPtr<IMMDeviceEnumerator> mm_device_enumerator;
hr = ::CoCreateInstance(__uuidof(MMDeviceEnumerator), nullptr, CLSCTX_ALL, hr = ::CoCreateInstance(__uuidof(MMDeviceEnumerator), nullptr, CLSCTX_ALL,
IID_PPV_ARGS(&mm_device_enumerator)); IID_PPV_ARGS(&mm_device_enumerator));
if (FAILED(hr)) { if (FAILED(hr)) {
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include <audioclient.h> #include <audioclient.h>
#include <mmdeviceapi.h> #include <mmdeviceapi.h>
#include <wrl/client.h>
#include <memory> #include <memory>
...@@ -14,7 +15,6 @@ ...@@ -14,7 +15,6 @@
#include "base/threading/thread_checker.h" #include "base/threading/thread_checker.h"
#include "base/timer/timer.h" #include "base/timer/timer.h"
#include "base/win/scoped_co_mem.h" #include "base/win/scoped_co_mem.h"
#include "base/win/scoped_comptr.h"
#include "remoting/host/audio_capturer.h" #include "remoting/host/audio_capturer.h"
#include "remoting/host/win/audio_volume_filter_win.h" #include "remoting/host/win/audio_volume_filter_win.h"
#include "remoting/proto/audio.pb.h" #include "remoting/proto/audio.pb.h"
...@@ -69,9 +69,9 @@ class AudioCapturerWin : public AudioCapturer { ...@@ -69,9 +69,9 @@ class AudioCapturerWin : public AudioCapturer {
AudioVolumeFilterWin volume_filter_; AudioVolumeFilterWin volume_filter_;
base::win::ScopedCoMem<WAVEFORMATEX> wave_format_ex_; base::win::ScopedCoMem<WAVEFORMATEX> wave_format_ex_;
base::win::ScopedComPtr<IAudioCaptureClient> audio_capture_client_; Microsoft::WRL::ComPtr<IAudioCaptureClient> audio_capture_client_;
base::win::ScopedComPtr<IAudioClient> audio_client_; Microsoft::WRL::ComPtr<IAudioClient> audio_client_;
base::win::ScopedComPtr<IMMDevice> mm_device_; Microsoft::WRL::ComPtr<IMMDevice> mm_device_;
std::unique_ptr<DefaultAudioDeviceChangeDetector> default_device_detector_; std::unique_ptr<DefaultAudioDeviceChangeDetector> default_device_detector_;
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include <objbase.h> #include <objbase.h>
#include <sddl.h> #include <sddl.h>
#include <wrl/client.h>
#include <limits> #include <limits>
#include <memory> #include <memory>
...@@ -25,7 +26,6 @@ ...@@ -25,7 +26,6 @@
#include "base/timer/timer.h" #include "base/timer/timer.h"
#include "base/win/registry.h" #include "base/win/registry.h"
#include "base/win/scoped_bstr.h" #include "base/win/scoped_bstr.h"
#include "base/win/scoped_comptr.h"
#include "base/win/scoped_handle.h" #include "base/win/scoped_handle.h"
#include "base/win/windows_version.h" #include "base/win/windows_version.h"
#include "ipc/ipc_message_macros.h" #include "ipc/ipc_message_macros.h"
...@@ -206,7 +206,7 @@ class RdpSession : public DesktopSessionWin { ...@@ -206,7 +206,7 @@ class RdpSession : public DesktopSessionWin {
DWORD* value); DWORD* value);
// Used to create an RDP desktop session. // Used to create an RDP desktop session.
base::win::ScopedComPtr<IRdpDesktopSession> rdp_desktop_session_; Microsoft::WRL::ComPtr<IRdpDesktopSession> rdp_desktop_session_;
// Used to match |rdp_desktop_session_| with the session it is attached to. // Used to match |rdp_desktop_session_| with the session it is attached to.
std::string terminal_id_; std::string terminal_id_;
...@@ -304,7 +304,7 @@ bool RdpSession::Initialize(const ScreenResolution& resolution) { ...@@ -304,7 +304,7 @@ bool RdpSession::Initialize(const ScreenResolution& resolution) {
} }
// Create an RDP session. // Create an RDP session.
base::win::ScopedComPtr<IRdpDesktopSessionEventHandler> event_handler( Microsoft::WRL::ComPtr<IRdpDesktopSessionEventHandler> event_handler(
new EventHandler(weak_factory_.GetWeakPtr())); new EventHandler(weak_factory_.GetWeakPtr()));
terminal_id_ = base::GenerateGUID(); terminal_id_ = base::GenerateGUID();
base::win::ScopedBstr terminal_id(base::UTF8ToUTF16(terminal_id_).c_str()); base::win::ScopedBstr terminal_id(base::UTF8ToUTF16(terminal_id_).c_str());
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include <ole2.h> #include <ole2.h>
#include <exdisp.h> #include <exdisp.h>
#include <wrl/client.h>
#include <string> #include <string>
...@@ -14,7 +15,6 @@ ...@@ -14,7 +15,6 @@
#include "base/macros.h" #include "base/macros.h"
#include "base/sequence_checker.h" #include "base/sequence_checker.h"
#include "base/timer/timer.h" #include "base/timer/timer.h"
#include "base/win/scoped_comptr.h"
namespace remoting { namespace remoting {
...@@ -43,7 +43,7 @@ class AuthCodeGetter { ...@@ -43,7 +43,7 @@ class AuthCodeGetter {
// The authorization code callback. // The authorization code callback.
base::Callback<void(const std::string&)> on_auth_code_; base::Callback<void(const std::string&)> on_auth_code_;
// The browser through which the user requests an authorization code. // The browser through which the user requests an authorization code.
base::win::ScopedComPtr<IWebBrowser2> browser_; Microsoft::WRL::ComPtr<IWebBrowser2> browser_;
// A timer used to poll the browser's URL. // A timer used to poll the browser's URL.
base::OneShotTimer timer_; base::OneShotTimer timer_;
// The interval at which the timer fires. // The interval at which the timer fires.
......
...@@ -7,8 +7,8 @@ ...@@ -7,8 +7,8 @@
#include <endpointvolume.h> #include <endpointvolume.h>
#include <mmdeviceapi.h> #include <mmdeviceapi.h>
#include <wrl/client.h>
#include "base/win/scoped_comptr.h"
#include "remoting/host/audio_volume_filter.h" #include "remoting/host/audio_volume_filter.h"
namespace remoting { namespace remoting {
...@@ -28,7 +28,7 @@ class AudioVolumeFilterWin : public AudioVolumeFilter { ...@@ -28,7 +28,7 @@ class AudioVolumeFilterWin : public AudioVolumeFilter {
float GetAudioLevel() override; float GetAudioLevel() override;
private: private:
base::win::ScopedComPtr<IAudioEndpointVolume> audio_volume_; Microsoft::WRL::ComPtr<IAudioEndpointVolume> audio_volume_;
}; };
} // namespace remoting } // namespace remoting
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
namespace remoting { namespace remoting {
DefaultAudioDeviceChangeDetector::DefaultAudioDeviceChangeDetector( DefaultAudioDeviceChangeDetector::DefaultAudioDeviceChangeDetector(
const base::win::ScopedComPtr<IMMDeviceEnumerator>& enumerator) const Microsoft::WRL::ComPtr<IMMDeviceEnumerator>& enumerator)
: enumerator_(enumerator) { : enumerator_(enumerator) {
DCHECK(enumerator_); DCHECK(enumerator_);
HRESULT hr = enumerator_->RegisterEndpointNotificationCallback(this); HRESULT hr = enumerator_->RegisterEndpointNotificationCallback(this);
......
...@@ -6,9 +6,9 @@ ...@@ -6,9 +6,9 @@
#define REMOTING_HOST_WIN_DEFAULT_AUDIO_DEVICE_CHANGE_DETECTOR_H_ #define REMOTING_HOST_WIN_DEFAULT_AUDIO_DEVICE_CHANGE_DETECTOR_H_
#include <mmdeviceapi.h> #include <mmdeviceapi.h>
#include <wrl/client.h>
#include "base/synchronization/lock.h" #include "base/synchronization/lock.h"
#include "base/win/scoped_comptr.h"
namespace remoting { namespace remoting {
...@@ -21,7 +21,7 @@ namespace remoting { ...@@ -21,7 +21,7 @@ namespace remoting {
class DefaultAudioDeviceChangeDetector final : public IMMNotificationClient { class DefaultAudioDeviceChangeDetector final : public IMMNotificationClient {
public: public:
explicit DefaultAudioDeviceChangeDetector( explicit DefaultAudioDeviceChangeDetector(
const base::win::ScopedComPtr<IMMDeviceEnumerator>& enumerator); const Microsoft::WRL::ComPtr<IMMDeviceEnumerator>& enumerator);
~DefaultAudioDeviceChangeDetector(); ~DefaultAudioDeviceChangeDetector();
bool GetAndReset(); bool GetAndReset();
...@@ -44,7 +44,7 @@ class DefaultAudioDeviceChangeDetector final : public IMMNotificationClient { ...@@ -44,7 +44,7 @@ class DefaultAudioDeviceChangeDetector final : public IMMNotificationClient {
ULONG __stdcall AddRef() override; ULONG __stdcall AddRef() override;
ULONG __stdcall Release() override; ULONG __stdcall Release() override;
const base::win::ScopedComPtr<IMMDeviceEnumerator> enumerator_; const Microsoft::WRL::ComPtr<IMMDeviceEnumerator> enumerator_;
bool changed_ = false; bool changed_ = false;
base::Lock lock_; base::Lock lock_;
}; };
......
...@@ -260,10 +260,10 @@ void RdpClientWindow::OnClose() { ...@@ -260,10 +260,10 @@ void RdpClientWindow::OnClose() {
LRESULT RdpClientWindow::OnCreate(CREATESTRUCT* create_struct) { LRESULT RdpClientWindow::OnCreate(CREATESTRUCT* create_struct) {
CAxWindow2 activex_window; CAxWindow2 activex_window;
base::win::ScopedComPtr<IUnknown> control; Microsoft::WRL::ComPtr<IUnknown> control;
HRESULT result = E_FAIL; HRESULT result = E_FAIL;
base::win::ScopedComPtr<mstsc::IMsTscSecuredSettings> secured_settings; Microsoft::WRL::ComPtr<mstsc::IMsTscSecuredSettings> secured_settings;
base::win::ScopedComPtr<mstsc::IMsRdpClientSecuredSettings> secured_settings2; Microsoft::WRL::ComPtr<mstsc::IMsRdpClientSecuredSettings> secured_settings2;
base::win::ScopedBstr server_name( base::win::ScopedBstr server_name(
base::UTF8ToUTF16(server_endpoint_.ToStringWithoutPort()).c_str()); base::UTF8ToUTF16(server_endpoint_.ToStringWithoutPort()).c_str());
base::win::ScopedBstr terminal_id(base::UTF8ToUTF16(terminal_id_).c_str()); base::win::ScopedBstr terminal_id(base::UTF8ToUTF16(terminal_id_).c_str());
...@@ -465,7 +465,7 @@ HRESULT RdpClientWindow::OnDisconnected(long reason) { ...@@ -465,7 +465,7 @@ HRESULT RdpClientWindow::OnDisconnected(long reason) {
// Get the error message as well. // Get the error message as well.
base::win::ScopedBstr error_message; base::win::ScopedBstr error_message;
base::win::ScopedComPtr<mstsc::IMsRdpClient5> client5; Microsoft::WRL::ComPtr<mstsc::IMsRdpClient5> client5;
result = client_.CopyTo(client5.GetAddressOf()); result = client_.CopyTo(client5.GetAddressOf());
if (SUCCEEDED(result)) { if (SUCCEEDED(result)) {
result = client5->GetErrorDescription(reason, extended_code, result = client5->GetErrorDescription(reason, extended_code,
......
...@@ -9,11 +9,11 @@ ...@@ -9,11 +9,11 @@
#include <atlcom.h> #include <atlcom.h>
#include <atlcrack.h> #include <atlcrack.h>
#include <atlctl.h> #include <atlctl.h>
#include <wrl/client.h>
#include "base/memory/ref_counted.h" #include "base/memory/ref_counted.h"
#include "base/message_loop/message_loop.h" #include "base/message_loop/message_loop.h"
#include "base/timer/timer.h" #include "base/timer/timer.h"
#include "base/win/scoped_comptr.h"
#include "net/base/ip_endpoint.h" #include "net/base/ip_endpoint.h"
#include "remoting/host/screen_resolution.h" #include "remoting/host/screen_resolution.h"
// The following header was generated by Visual Studio. We had to check it in // The following header was generated by Visual Studio. We had to check it in
...@@ -177,9 +177,9 @@ class RdpClientWindow ...@@ -177,9 +177,9 @@ class RdpClientWindow
bool user_logged_in_ = false; bool user_logged_in_ = false;
// Interfaces exposed by the RDP ActiveX control. // Interfaces exposed by the RDP ActiveX control.
base::win::ScopedComPtr<mstsc::IMsRdpClient> client_; Microsoft::WRL::ComPtr<mstsc::IMsRdpClient> client_;
base::win::ScopedComPtr<mstsc::IMsRdpClient9> client_9_; Microsoft::WRL::ComPtr<mstsc::IMsRdpClient9> client_9_;
base::win::ScopedComPtr<mstsc::IMsRdpClientAdvancedSettings> client_settings_; Microsoft::WRL::ComPtr<mstsc::IMsRdpClientAdvancedSettings> client_settings_;
// Used to cancel modal dialog boxes shown by the RDP control. // Used to cancel modal dialog boxes shown by the RDP control.
class WindowHook; class WindowHook;
......
...@@ -8,10 +8,10 @@ ...@@ -8,10 +8,10 @@
#include <atlbase.h> #include <atlbase.h>
#include <atlcom.h> #include <atlcom.h>
#include <atlctl.h> #include <atlctl.h>
#include <wrl/client.h>
#include <memory> #include <memory>
#include "base/win/scoped_comptr.h"
// chromoting_lib.h contains MIDL-generated declarations. // chromoting_lib.h contains MIDL-generated declarations.
#include "remoting/host/win/chromoting_lib.h" #include "remoting/host/win/chromoting_lib.h"
#include "remoting/host/win/rdp_client.h" #include "remoting/host/win/rdp_client.h"
...@@ -71,7 +71,7 @@ class __declspec(uuid(RDP_DESKTOP_SESSION_CLSID)) RdpDesktopSession ...@@ -71,7 +71,7 @@ class __declspec(uuid(RDP_DESKTOP_SESSION_CLSID)) RdpDesktopSession
// Holds a reference to the caller's EventHandler, through which notifications // Holds a reference to the caller's EventHandler, through which notifications
// are dispatched. Released in Disconnect(), to prevent further notifications. // are dispatched. Released in Disconnect(), to prevent further notifications.
base::win::ScopedComPtr<IRdpDesktopSessionEventHandler> event_handler_; Microsoft::WRL::ComPtr<IRdpDesktopSessionEventHandler> event_handler_;
DECLARE_PROTECT_FINAL_CONSTRUCT() DECLARE_PROTECT_FINAL_CONSTRUCT()
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment