Use make_scoped_ptr() in src/remoting.

Also minor code cleanup in daemon_installer_win.cc .

Review URL: https://codereview.chromium.org/608343002

Cr-Commit-Position: refs/heads/master@{#297583}
diff --git a/remoting/client/audio_player_unittest.cc b/remoting/client/audio_player_unittest.cc
index a6b5a5b..a4e0ea5 100644
--- a/remoting/client/audio_player_unittest.cc
+++ b/remoting/client/audio_player_unittest.cc
@@ -118,33 +118,28 @@
 TEST_F(AudioPlayerTest, Init) {
   ASSERT_EQ(0, GetNumQueuedPackets());
 
-  scoped_ptr<AudioPacket> packet(CreatePacket44100Hz(10));
-  audio_->ProcessAudioPacket(packet.Pass());
+  audio_->ProcessAudioPacket(CreatePacket44100Hz(10));
   ASSERT_EQ(1, GetNumQueuedPackets());
 }
 
 TEST_F(AudioPlayerTest, MultipleSamples) {
-  scoped_ptr<AudioPacket> packet1(CreatePacket44100Hz(10));
-  audio_->ProcessAudioPacket(packet1.Pass());
+  audio_->ProcessAudioPacket(CreatePacket44100Hz(10));
   ASSERT_EQ(10, GetNumQueuedSamples());
   ASSERT_EQ(1, GetNumQueuedPackets());
 
-  scoped_ptr<AudioPacket> packet2(CreatePacket44100Hz(20));
-  audio_->ProcessAudioPacket(packet2.Pass());
+  audio_->ProcessAudioPacket(CreatePacket44100Hz(20));
   ASSERT_EQ(30, GetNumQueuedSamples());
   ASSERT_EQ(2, GetNumQueuedPackets());
 }
 
 TEST_F(AudioPlayerTest, ChangeSampleRate) {
-  scoped_ptr<AudioPacket> packet1(CreatePacket44100Hz(10));
-  audio_->ProcessAudioPacket(packet1.Pass());
+  audio_->ProcessAudioPacket(CreatePacket44100Hz(10));
   ASSERT_EQ(10, GetNumQueuedSamples());
   ASSERT_EQ(1, GetNumQueuedPackets());
 
   // New packet with different sampling rate causes previous samples to
   // be removed.
-  scoped_ptr<AudioPacket> packet2(CreatePacket48000Hz(20));
-  audio_->ProcessAudioPacket(packet2.Pass());
+  audio_->ProcessAudioPacket(CreatePacket48000Hz(20));
   ASSERT_EQ(20, GetNumQueuedSamples());
   ASSERT_EQ(1, GetNumQueuedPackets());
 }
@@ -152,8 +147,7 @@
 TEST_F(AudioPlayerTest, ExceedLatency) {
   // Push about 4 seconds worth of samples.
   for (int i = 0; i < 100; ++i) {
-    scoped_ptr<AudioPacket> packet1(CreatePacket48000Hz(2000));
-    audio_->ProcessAudioPacket(packet1.Pass());
+    audio_->ProcessAudioPacket(CreatePacket48000Hz(2000));
   }
 
   // Verify that we don't have more than 0.5s.
@@ -168,9 +162,8 @@
 
   // Process 100 samples.
   int packet1_samples = 100;
-  scoped_ptr<AudioPacket> packet(CreatePacket44100Hz(packet1_samples));
   total_samples += packet1_samples;
-  audio_->ProcessAudioPacket(packet.Pass());
+  audio_->ProcessAudioPacket(CreatePacket44100Hz(packet1_samples));
   ASSERT_EQ(total_samples, GetNumQueuedSamples());
   ASSERT_EQ(1, GetNumQueuedPackets());
   ASSERT_EQ(bytes_consumed, GetBytesConsumed());
@@ -197,16 +190,14 @@
 
   // Packet 1.
   int packet1_samples = 20;
-  scoped_ptr<AudioPacket> packet1(CreatePacket44100Hz(packet1_samples));
   total_samples += packet1_samples;
-  audio_->ProcessAudioPacket(packet1.Pass());
+  audio_->ProcessAudioPacket(CreatePacket44100Hz(packet1_samples));
   ASSERT_EQ(total_samples, GetNumQueuedSamples());
 
   // Packet 2.
   int packet2_samples = 70;
-  scoped_ptr<AudioPacket> packet2(CreatePacket44100Hz(packet2_samples));
   total_samples += packet2_samples;
-  audio_->ProcessAudioPacket(packet2.Pass());
+  audio_->ProcessAudioPacket(CreatePacket44100Hz(packet2_samples));
   ASSERT_EQ(total_samples, GetNumQueuedSamples());
   ASSERT_EQ(bytes_consumed, GetBytesConsumed());
 
@@ -242,17 +233,15 @@
 
   // Packet 1.
   int packet1_samples = 50;
-  scoped_ptr<AudioPacket> packet1(CreatePacket44100Hz(packet1_samples));
   total_samples += packet1_samples;
-  audio_->ProcessAudioPacket(packet1.Pass());
+  audio_->ProcessAudioPacket(CreatePacket44100Hz(packet1_samples));
   ASSERT_EQ(total_samples, GetNumQueuedSamples());
   ASSERT_EQ(bytes_consumed, GetBytesConsumed());
 
   // Packet 2.
   int packet2_samples = 30;
-  scoped_ptr<AudioPacket> packet2(CreatePacket44100Hz(packet2_samples));
   total_samples += packet2_samples;
-  audio_->ProcessAudioPacket(packet2.Pass());
+  audio_->ProcessAudioPacket(CreatePacket44100Hz(packet2_samples));
   ASSERT_EQ(total_samples, GetNumQueuedSamples());
   ASSERT_EQ(bytes_consumed, GetBytesConsumed());
 
@@ -310,9 +299,8 @@
 
   // Packet 1.
   int packet1_samples = 10;
-  scoped_ptr<AudioPacket> packet1(CreatePacket44100Hz(packet1_samples));
   total_samples += packet1_samples;
-  audio_->ProcessAudioPacket(packet1.Pass());
+  audio_->ProcessAudioPacket(CreatePacket44100Hz(packet1_samples));
   ASSERT_EQ(total_samples, GetNumQueuedSamples());
   ASSERT_EQ(bytes_consumed, GetBytesConsumed());
 
diff --git a/remoting/codec/audio_decoder.cc b/remoting/codec/audio_decoder.cc
index 20e7d8b..326b458 100644
--- a/remoting/codec/audio_decoder.cc
+++ b/remoting/codec/audio_decoder.cc
@@ -16,9 +16,9 @@
   const protocol::ChannelConfig& audio_config = config.audio_config();
 
   if (audio_config.codec == protocol::ChannelConfig::CODEC_VERBATIM) {
-    return scoped_ptr<AudioDecoder>(new AudioDecoderVerbatim());
+    return make_scoped_ptr(new AudioDecoderVerbatim());
   } else if (audio_config.codec == protocol::ChannelConfig::CODEC_OPUS) {
-    return scoped_ptr<AudioDecoder>(new AudioDecoderOpus());
+    return make_scoped_ptr(new AudioDecoderOpus());
   }
 
   NOTIMPLEMENTED();
diff --git a/remoting/codec/video_decoder_vpx.cc b/remoting/codec/video_decoder_vpx.cc
index bae8c23..e16be14 100644
--- a/remoting/codec/video_decoder_vpx.cc
+++ b/remoting/codec/video_decoder_vpx.cc
@@ -59,7 +59,7 @@
     return nullptr;
   }
 
-  return scoped_ptr<VideoDecoderVpx>(new VideoDecoderVpx(codec.Pass()));
+  return make_scoped_ptr(new VideoDecoderVpx(codec.Pass()));
 }
 
 // static
@@ -79,7 +79,7 @@
     return nullptr;
   }
 
-  return scoped_ptr<VideoDecoderVpx>(new VideoDecoderVpx(codec.Pass()));
+  return make_scoped_ptr(new VideoDecoderVpx(codec.Pass()));
 }
 
 VideoDecoderVpx::~VideoDecoderVpx() {}
diff --git a/remoting/codec/video_encoder_vpx.cc b/remoting/codec/video_encoder_vpx.cc
index e43cf5bf..45368023 100644
--- a/remoting/codec/video_encoder_vpx.cc
+++ b/remoting/codec/video_encoder_vpx.cc
@@ -215,12 +215,12 @@
 
 // static
 scoped_ptr<VideoEncoderVpx> VideoEncoderVpx::CreateForVP8() {
-  return scoped_ptr<VideoEncoderVpx>(new VideoEncoderVpx(false));
+  return make_scoped_ptr(new VideoEncoderVpx(false));
 }
 
 // static
 scoped_ptr<VideoEncoderVpx> VideoEncoderVpx::CreateForVP9() {
-  return scoped_ptr<VideoEncoderVpx>(new VideoEncoderVpx(true));
+  return make_scoped_ptr(new VideoEncoderVpx(true));
 }
 
 VideoEncoderVpx::~VideoEncoderVpx() {}
diff --git a/remoting/host/audio_capturer_linux.cc b/remoting/host/audio_capturer_linux.cc
index 1210397..c253d8a 100644
--- a/remoting/host/audio_capturer_linux.cc
+++ b/remoting/host/audio_capturer_linux.cc
@@ -84,7 +84,7 @@
       g_pulseaudio_pipe_sink_reader.Get();
   if (!reader.get())
     return nullptr;
-  return scoped_ptr<AudioCapturer>(new AudioCapturerLinux(reader));
+  return make_scoped_ptr(new AudioCapturerLinux(reader));
 }
 
 }  // namespace remoting
diff --git a/remoting/host/audio_capturer_win.cc b/remoting/host/audio_capturer_win.cc
index 75412db..0279135e 100644
--- a/remoting/host/audio_capturer_win.cc
+++ b/remoting/host/audio_capturer_win.cc
@@ -245,8 +245,7 @@
     if ((flags & AUDCLNT_BUFFERFLAGS_SILENT) == 0 &&
         !silence_detector_.IsSilence(
             reinterpret_cast<const int16*>(data), frames * kChannels)) {
-      scoped_ptr<AudioPacket> packet =
-          scoped_ptr<AudioPacket>(new AudioPacket());
+      scoped_ptr<AudioPacket> packet(new AudioPacket());
       packet->add_data(data, frames * wave_format_ex_->nBlockAlign);
       packet->set_encoding(AudioPacket::ENCODING_RAW);
       packet->set_sampling_rate(sampling_rate_);
@@ -279,7 +278,7 @@
 }
 
 scoped_ptr<AudioCapturer> AudioCapturer::Create() {
-  return scoped_ptr<AudioCapturer>(new AudioCapturerWin());
+  return make_scoped_ptr(new AudioCapturerWin());
 }
 
 }  // namespace remoting
diff --git a/remoting/host/basic_desktop_environment.cc b/remoting/host/basic_desktop_environment.cc
index eb5e9bf..2cf80c5f 100644
--- a/remoting/host/basic_desktop_environment.cc
+++ b/remoting/host/basic_desktop_environment.cc
@@ -42,10 +42,8 @@
 
 scoped_ptr<webrtc::MouseCursorMonitor>
 BasicDesktopEnvironment::CreateMouseCursorMonitor() {
-  return scoped_ptr<webrtc::MouseCursorMonitor>(
-      webrtc::MouseCursorMonitor::CreateForScreen(
-          *desktop_capture_options_,
-          webrtc::kFullDesktopScreenId));
+  return make_scoped_ptr(webrtc::MouseCursorMonitor::CreateForScreen(
+      *desktop_capture_options_, webrtc::kFullDesktopScreenId));
 }
 
 std::string BasicDesktopEnvironment::GetCapabilities() const {
@@ -66,7 +64,7 @@
 
   // The basic desktop environment does not use X DAMAGE, since it is
   // broken on many systems - see http://crbug.com/73423.
-  return scoped_ptr<webrtc::DesktopCapturer>(
+  return make_scoped_ptr(
       webrtc::ScreenCapturer::Create(*desktop_capture_options_));
 }
 
diff --git a/remoting/host/chromoting_host_unittest.cc b/remoting/host/chromoting_host_unittest.cc
index 86eee320..c3c2fac5 100644
--- a/remoting/host/chromoting_host_unittest.cc
+++ b/remoting/host/chromoting_host_unittest.cc
@@ -90,7 +90,7 @@
     host_.reset(new ChromotingHost(
         &signal_strategy_,
         desktop_environment_factory_.get(),
-        scoped_ptr<protocol::SessionManager>(session_manager_),
+        make_scoped_ptr(session_manager_),
         task_runner_,   // Audio
         task_runner_,   // Input
         task_runner_,   // Video capture
diff --git a/remoting/host/client_session.cc b/remoting/host/client_session.cc
index 8d45b8f..eb4a130 100644
--- a/remoting/host/client_session.cc
+++ b/remoting/host/client_session.cc
@@ -481,10 +481,9 @@
 scoped_ptr<protocol::ClipboardStub> ClientSession::CreateClipboardProxy() {
   DCHECK(CalledOnValidThread());
 
-  return scoped_ptr<protocol::ClipboardStub>(
-      new protocol::ClipboardThreadProxy(
-          client_clipboard_factory_.GetWeakPtr(),
-          base::MessageLoopProxy::current()));
+  return make_scoped_ptr(
+      new protocol::ClipboardThreadProxy(client_clipboard_factory_.GetWeakPtr(),
+                                         base::MessageLoopProxy::current()));
 }
 
 // TODO(sergeyu): Move this to SessionManager?
@@ -511,9 +510,9 @@
   const protocol::ChannelConfig& audio_config = config.audio_config();
 
   if (audio_config.codec == protocol::ChannelConfig::CODEC_VERBATIM) {
-    return scoped_ptr<AudioEncoder>(new AudioEncoderVerbatim());
+    return make_scoped_ptr(new AudioEncoderVerbatim());
   } else if (audio_config.codec == protocol::ChannelConfig::CODEC_OPUS) {
-    return scoped_ptr<AudioEncoder>(new AudioEncoderOpus());
+    return make_scoped_ptr(new AudioEncoderOpus());
   }
 
   NOTREACHED();
diff --git a/remoting/host/clipboard_mac.mm b/remoting/host/clipboard_mac.mm
index 2050d854..55d2f38 100644
--- a/remoting/host/clipboard_mac.mm
+++ b/remoting/host/clipboard_mac.mm
@@ -117,7 +117,7 @@
 }
 
 scoped_ptr<Clipboard> Clipboard::Create() {
-  return scoped_ptr<Clipboard>(new ClipboardMac());
+  return make_scoped_ptr(new ClipboardMac());
 }
 
 }  // namespace remoting
diff --git a/remoting/host/clipboard_win.cc b/remoting/host/clipboard_win.cc
index 28851794..4d8fd93 100644
--- a/remoting/host/clipboard_win.cc
+++ b/remoting/host/clipboard_win.cc
@@ -272,7 +272,7 @@
 }
 
 scoped_ptr<Clipboard> Clipboard::Create() {
-  return scoped_ptr<Clipboard>(new ClipboardWin());
+  return make_scoped_ptr(new ClipboardWin());
 }
 
 }  // namespace remoting
diff --git a/remoting/host/clipboard_x11.cc b/remoting/host/clipboard_x11.cc
index 01a012b..a5c91a6c 100644
--- a/remoting/host/clipboard_x11.cc
+++ b/remoting/host/clipboard_x11.cc
@@ -128,7 +128,7 @@
 }
 
 scoped_ptr<Clipboard> Clipboard::Create() {
-  return scoped_ptr<Clipboard>(new ClipboardX11());
+  return make_scoped_ptr(new ClipboardX11());
 }
 
 }  // namespace remoting
diff --git a/remoting/host/continue_window_linux.cc b/remoting/host/continue_window_linux.cc
index 8e7a41d..018c815 100644
--- a/remoting/host/continue_window_linux.cc
+++ b/remoting/host/continue_window_linux.cc
@@ -115,7 +115,7 @@
 
 // static
 scoped_ptr<HostWindow> HostWindow::CreateContinueWindow() {
-  return scoped_ptr<HostWindow>(new ContinueWindowGtk());
+  return make_scoped_ptr(new ContinueWindowGtk());
 }
 
 }  // namespace remoting
diff --git a/remoting/host/continue_window_mac.mm b/remoting/host/continue_window_mac.mm
index 4bc08f4..7db1619 100644
--- a/remoting/host/continue_window_mac.mm
+++ b/remoting/host/continue_window_mac.mm
@@ -73,7 +73,7 @@
 
 // static
 scoped_ptr<HostWindow> HostWindow::CreateContinueWindow() {
-  return scoped_ptr<HostWindow>(new ContinueWindowMac());
+  return make_scoped_ptr(new ContinueWindowMac());
 }
 
 }  // namespace remoting
diff --git a/remoting/host/continue_window_win.cc b/remoting/host/continue_window_win.cc
index 1b06fd0..ebc306a6 100644
--- a/remoting/host/continue_window_win.cc
+++ b/remoting/host/continue_window_win.cc
@@ -129,7 +129,7 @@
 
 // static
 scoped_ptr<HostWindow> HostWindow::CreateContinueWindow() {
-  return scoped_ptr<HostWindow>(new ContinueWindowWin());
+  return make_scoped_ptr(new ContinueWindowWin());
 }
 
 }  // namespace remoting
diff --git a/remoting/host/curtain_mode_linux.cc b/remoting/host/curtain_mode_linux.cc
index 5e15180..66cf5fc8 100644
--- a/remoting/host/curtain_mode_linux.cc
+++ b/remoting/host/curtain_mode_linux.cc
@@ -103,7 +103,7 @@
     scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner,
     scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner,
     base::WeakPtr<ClientSessionControl> client_session_control) {
-  return scoped_ptr<CurtainMode>(new CurtainModeLinux());
+  return make_scoped_ptr(new CurtainModeLinux());
 }
 
 }  // namespace remoting
diff --git a/remoting/host/curtain_mode_mac.cc b/remoting/host/curtain_mode_mac.cc
index aa851563..04da373 100644
--- a/remoting/host/curtain_mode_mac.cc
+++ b/remoting/host/curtain_mode_mac.cc
@@ -260,9 +260,8 @@
     scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner,
     scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner,
     base::WeakPtr<ClientSessionControl> client_session_control) {
-  return scoped_ptr<CurtainMode>(new CurtainModeMac(caller_task_runner,
-                                                    ui_task_runner,
-                                                    client_session_control));
+  return make_scoped_ptr(new CurtainModeMac(
+      caller_task_runner, ui_task_runner, client_session_control));
 }
 
 }  // namespace remoting
diff --git a/remoting/host/curtain_mode_win.cc b/remoting/host/curtain_mode_win.cc
index d4d50ea..3fc3946 100644
--- a/remoting/host/curtain_mode_win.cc
+++ b/remoting/host/curtain_mode_win.cc
@@ -50,7 +50,7 @@
   // |client_session_control| is not used because the client session is
   // disconnected as soon as the session is re-attached to the local console.
   // See RdpDesktopSession for more details.
-  return scoped_ptr<CurtainMode>(new CurtainModeWin());
+  return make_scoped_ptr(new CurtainModeWin());
 }
 
 }  // namespace remoting
diff --git a/remoting/host/daemon_process_unittest.cc b/remoting/host/daemon_process_unittest.cc
index c0a9140..7043f788 100644
--- a/remoting/host/daemon_process_unittest.cc
+++ b/remoting/host/daemon_process_unittest.cc
@@ -100,7 +100,7 @@
     int terminal_id,
     const ScreenResolution& resolution,
     bool virtual_terminal) {
-  return scoped_ptr<DesktopSession>(DoCreateDesktopSessionPtr(terminal_id));
+  return make_scoped_ptr(DoCreateDesktopSessionPtr(terminal_id));
 }
 
 bool MockDaemonProcess::OnMessageReceived(const IPC::Message& message) {
diff --git a/remoting/host/desktop_resizer_linux.cc b/remoting/host/desktop_resizer_linux.cc
index be24adb..df38cd4 100644
--- a/remoting/host/desktop_resizer_linux.cc
+++ b/remoting/host/desktop_resizer_linux.cc
@@ -324,7 +324,7 @@
 }
 
 scoped_ptr<DesktopResizer> DesktopResizer::Create() {
-  return scoped_ptr<DesktopResizer>(new DesktopResizerLinux);
+  return make_scoped_ptr(new DesktopResizerLinux);
 }
 
 }  // namespace remoting
diff --git a/remoting/host/desktop_resizer_mac.cc b/remoting/host/desktop_resizer_mac.cc
index ef4659f2..42adbc4d 100644
--- a/remoting/host/desktop_resizer_mac.cc
+++ b/remoting/host/desktop_resizer_mac.cc
@@ -167,7 +167,7 @@
 }
 
 scoped_ptr<DesktopResizer> DesktopResizer::Create() {
-  return scoped_ptr<DesktopResizer>(new DesktopResizerMac);
+  return make_scoped_ptr(new DesktopResizerMac);
 }
 
 }  // namespace remoting
diff --git a/remoting/host/desktop_resizer_win.cc b/remoting/host/desktop_resizer_win.cc
index 6ac1f59..8abd0de 100644
--- a/remoting/host/desktop_resizer_win.cc
+++ b/remoting/host/desktop_resizer_win.cc
@@ -185,7 +185,7 @@
 }
 
 scoped_ptr<DesktopResizer> DesktopResizer::Create() {
-  return scoped_ptr<DesktopResizer>(new DesktopResizerWin);
+  return make_scoped_ptr(new DesktopResizerWin);
 }
 
 }  // namespace remoting
diff --git a/remoting/host/desktop_session_agent.cc b/remoting/host/desktop_session_agent.cc
index 32a50a8..2be6266 100644
--- a/remoting/host/desktop_session_agent.cc
+++ b/remoting/host/desktop_session_agent.cc
@@ -76,8 +76,7 @@
     scoped_ptr<base::SharedMemory> memory(new base::SharedMemory());
     if (!memory->CreateAndMapAnonymous(size))
       return nullptr;
-    return scoped_ptr<SharedBuffer>(
-        new SharedBuffer(agent, memory.Pass(), size, id));
+    return make_scoped_ptr(new SharedBuffer(agent, memory.Pass(), size, id));
   }
 
   virtual ~SharedBuffer() {
diff --git a/remoting/host/desktop_session_proxy.cc b/remoting/host/desktop_session_proxy.cc
index 7b7f57fb..ec163ca 100644
--- a/remoting/host/desktop_session_proxy.cc
+++ b/remoting/host/desktop_session_proxy.cc
@@ -124,31 +124,30 @@
 scoped_ptr<AudioCapturer> DesktopSessionProxy::CreateAudioCapturer() {
   DCHECK(caller_task_runner_->BelongsToCurrentThread());
 
-  return scoped_ptr<AudioCapturer>(new IpcAudioCapturer(this));
+  return make_scoped_ptr(new IpcAudioCapturer(this));
 }
 
 scoped_ptr<InputInjector> DesktopSessionProxy::CreateInputInjector() {
   DCHECK(caller_task_runner_->BelongsToCurrentThread());
 
-  return scoped_ptr<InputInjector>(new IpcInputInjector(this));
+  return make_scoped_ptr(new IpcInputInjector(this));
 }
 
 scoped_ptr<ScreenControls> DesktopSessionProxy::CreateScreenControls() {
   DCHECK(caller_task_runner_->BelongsToCurrentThread());
 
-  return scoped_ptr<ScreenControls>(new IpcScreenControls(this));
+  return make_scoped_ptr(new IpcScreenControls(this));
 }
 
 scoped_ptr<webrtc::DesktopCapturer> DesktopSessionProxy::CreateVideoCapturer() {
   DCHECK(caller_task_runner_->BelongsToCurrentThread());
 
-  return scoped_ptr<webrtc::DesktopCapturer>(new IpcVideoFrameCapturer(this));
+  return make_scoped_ptr(new IpcVideoFrameCapturer(this));
 }
 
 scoped_ptr<webrtc::MouseCursorMonitor>
     DesktopSessionProxy::CreateMouseCursorMonitor() {
-  return scoped_ptr<webrtc::MouseCursorMonitor>(
-      new IpcMouseCursorMonitor(this));
+  return make_scoped_ptr(new IpcMouseCursorMonitor(this));
 }
 
 std::string DesktopSessionProxy::GetCapabilities() const {
@@ -520,9 +519,7 @@
 void DesktopSessionProxy::OnMouseCursor(
     const webrtc::MouseCursor& mouse_cursor) {
   DCHECK(caller_task_runner_->BelongsToCurrentThread());
-  scoped_ptr<webrtc::MouseCursor> cursor(
-      webrtc::MouseCursor::CopyOf(mouse_cursor));
-  PostMouseCursor(cursor.Pass());
+  PostMouseCursor(make_scoped_ptr(webrtc::MouseCursor::CopyOf(mouse_cursor)));
 }
 
 void DesktopSessionProxy::OnInjectClipboardEvent(
diff --git a/remoting/host/desktop_shape_tracker_win.cc b/remoting/host/desktop_shape_tracker_win.cc
index 6b31c0c..bec7354 100644
--- a/remoting/host/desktop_shape_tracker_win.cc
+++ b/remoting/host/desktop_shape_tracker_win.cc
@@ -135,7 +135,7 @@
 // static
 scoped_ptr<DesktopShapeTracker> DesktopShapeTracker::Create(
     webrtc::DesktopCaptureOptions options) {
-  return scoped_ptr<DesktopShapeTracker>(new DesktopShapeTrackerWin());
+  return make_scoped_ptr(new DesktopShapeTrackerWin());
 }
 
 }  // namespace remoting
diff --git a/remoting/host/disconnect_window_linux.cc b/remoting/host/disconnect_window_linux.cc
index 4a9c36e9..c51b578 100644
--- a/remoting/host/disconnect_window_linux.cc
+++ b/remoting/host/disconnect_window_linux.cc
@@ -289,7 +289,7 @@
 
 // static
 scoped_ptr<HostWindow> HostWindow::CreateDisconnectWindow() {
-  return scoped_ptr<HostWindow>(new DisconnectWindowGtk());
+  return make_scoped_ptr(new DisconnectWindowGtk());
 }
 
 }  // namespace remoting
diff --git a/remoting/host/disconnect_window_mac.mm b/remoting/host/disconnect_window_mac.mm
index 1467305b0..5acfb2b 100644
--- a/remoting/host/disconnect_window_mac.mm
+++ b/remoting/host/disconnect_window_mac.mm
@@ -75,7 +75,7 @@
 
 // static
 scoped_ptr<HostWindow> HostWindow::CreateDisconnectWindow() {
-  return scoped_ptr<HostWindow>(new DisconnectWindowMac());
+  return make_scoped_ptr(new DisconnectWindowMac());
 }
 
 }  // namespace remoting
diff --git a/remoting/host/disconnect_window_win.cc b/remoting/host/disconnect_window_win.cc
index 07eeabc..a9b892cb 100644
--- a/remoting/host/disconnect_window_win.cc
+++ b/remoting/host/disconnect_window_win.cc
@@ -394,7 +394,7 @@
 
 // static
 scoped_ptr<HostWindow> HostWindow::CreateDisconnectWindow() {
-  return scoped_ptr<HostWindow>(new DisconnectWindowWin());
+  return make_scoped_ptr(new DisconnectWindowWin());
 }
 
 }  // namespace remoting
diff --git a/remoting/host/fake_desktop_environment.cc b/remoting/host/fake_desktop_environment.cc
index bdf0d0a..7f84b6e1 100644
--- a/remoting/host/fake_desktop_environment.cc
+++ b/remoting/host/fake_desktop_environment.cc
@@ -48,11 +48,11 @@
 }
 
 scoped_ptr<InputInjector> FakeDesktopEnvironment::CreateInputInjector() {
-  return scoped_ptr<InputInjector>(new FakeInputInjector());
+  return make_scoped_ptr(new FakeInputInjector());
 }
 
 scoped_ptr<ScreenControls> FakeDesktopEnvironment::CreateScreenControls() {
-  return scoped_ptr<ScreenControls>(new FakeScreenControls());
+  return make_scoped_ptr(new FakeScreenControls());
 }
 
 scoped_ptr<webrtc::DesktopCapturer>
@@ -65,7 +65,7 @@
 
 scoped_ptr<webrtc::MouseCursorMonitor>
 FakeDesktopEnvironment::CreateMouseCursorMonitor() {
-  return scoped_ptr<webrtc::MouseCursorMonitor>(new FakeMouseCursorMonitor());
+  return make_scoped_ptr(new FakeMouseCursorMonitor());
 }
 
 std::string FakeDesktopEnvironment::GetCapabilities() const {
diff --git a/remoting/host/gnubby_auth_handler_posix.cc b/remoting/host/gnubby_auth_handler_posix.cc
index 7c8761d..13c8f41 100644
--- a/remoting/host/gnubby_auth_handler_posix.cc
+++ b/remoting/host/gnubby_auth_handler_posix.cc
@@ -99,7 +99,7 @@
 // static
 scoped_ptr<GnubbyAuthHandler> GnubbyAuthHandler::Create(
     protocol::ClientStub* client_stub) {
-  return scoped_ptr<GnubbyAuthHandler>(new GnubbyAuthHandlerPosix(client_stub));
+  return make_scoped_ptr(new GnubbyAuthHandlerPosix(client_stub));
 }
 
 // static
diff --git a/remoting/host/gnubby_auth_handler_posix_unittest.cc b/remoting/host/gnubby_auth_handler_posix_unittest.cc
index 1c9bd86..94f28e06 100644
--- a/remoting/host/gnubby_auth_handler_posix_unittest.cc
+++ b/remoting/host/gnubby_auth_handler_posix_unittest.cc
@@ -141,7 +141,7 @@
 
   base::MockTimer* mock_timer = new base::MockTimer(false, false);
   auth_handler_posix_->GetGnubbySocketForTesting(socket)
-      ->SetTimerForTesting(scoped_ptr<base::Timer>(mock_timer));
+      ->SetTimerForTesting(make_scoped_ptr(mock_timer));
   delegate_->DidRead(socket, reinterpret_cast<const char*>(request_data), 1);
   mock_timer->Fire();
 
diff --git a/remoting/host/host_event_logger_posix.cc b/remoting/host/host_event_logger_posix.cc
index 1a18f30..c462b64 100644
--- a/remoting/host/host_event_logger_posix.cc
+++ b/remoting/host/host_event_logger_posix.cc
@@ -106,8 +106,7 @@
 scoped_ptr<HostEventLogger> HostEventLogger::Create(
     base::WeakPtr<HostStatusMonitor> monitor,
     const std::string& application_name) {
-  return scoped_ptr<HostEventLogger>(
-      new HostEventLoggerPosix(monitor, application_name));
+  return make_scoped_ptr(new HostEventLoggerPosix(monitor, application_name));
 }
 
 }  // namespace remoting
diff --git a/remoting/host/host_event_logger_win.cc b/remoting/host/host_event_logger_win.cc
index acd6aaf8..f89c97d 100644
--- a/remoting/host/host_event_logger_win.cc
+++ b/remoting/host/host_event_logger_win.cc
@@ -150,8 +150,7 @@
 scoped_ptr<HostEventLogger> HostEventLogger::Create(
     base::WeakPtr<HostStatusMonitor> monitor,
     const std::string& application_name) {
-  return scoped_ptr<HostEventLogger>(
-      new HostEventLoggerWin(monitor, application_name));
+  return make_scoped_ptr(new HostEventLoggerWin(monitor, application_name));
 }
 
 }  // namespace remoting
diff --git a/remoting/host/host_mock_objects.cc b/remoting/host/host_mock_objects.cc
index 775314ce..c48517f5 100644
--- a/remoting/host/host_mock_objects.cc
+++ b/remoting/host/host_mock_objects.cc
@@ -23,31 +23,31 @@
 MockDesktopEnvironment::~MockDesktopEnvironment() {}
 
 scoped_ptr<AudioCapturer> MockDesktopEnvironment::CreateAudioCapturer() {
-  return scoped_ptr<AudioCapturer>(CreateAudioCapturerPtr());
+  return make_scoped_ptr(CreateAudioCapturerPtr());
 }
 
 scoped_ptr<InputInjector> MockDesktopEnvironment::CreateInputInjector() {
-  return scoped_ptr<InputInjector>(CreateInputInjectorPtr());
+  return make_scoped_ptr(CreateInputInjectorPtr());
 }
 
 scoped_ptr<ScreenControls> MockDesktopEnvironment::CreateScreenControls() {
-  return scoped_ptr<ScreenControls>(CreateScreenControlsPtr());
+  return make_scoped_ptr(CreateScreenControlsPtr());
 }
 
 scoped_ptr<webrtc::DesktopCapturer>
 MockDesktopEnvironment::CreateVideoCapturer() {
-  return scoped_ptr<webrtc::DesktopCapturer>(CreateVideoCapturerPtr());
+  return make_scoped_ptr(CreateVideoCapturerPtr());
 }
 
 scoped_ptr<GnubbyAuthHandler>
 MockDesktopEnvironment::CreateGnubbyAuthHandler(
     protocol::ClientStub* client_stub) {
-  return scoped_ptr<GnubbyAuthHandler>(CreateGnubbyAuthHandlerPtr(client_stub));
+  return make_scoped_ptr(CreateGnubbyAuthHandlerPtr(client_stub));
 }
 
 scoped_ptr<webrtc::MouseCursorMonitor>
 MockDesktopEnvironment::CreateMouseCursorMonitor() {
-  return scoped_ptr<webrtc::MouseCursorMonitor>(CreateMouseCursorMonitorPtr());
+  return make_scoped_ptr(CreateMouseCursorMonitorPtr());
 }
 
 MockDesktopEnvironmentFactory::MockDesktopEnvironmentFactory() {}
@@ -56,7 +56,7 @@
 
 scoped_ptr<DesktopEnvironment> MockDesktopEnvironmentFactory::Create(
     base::WeakPtr<ClientSessionControl> client_session_control) {
-  return scoped_ptr<DesktopEnvironment>(CreatePtr());
+  return make_scoped_ptr(CreatePtr());
 }
 
 MockInputInjector::MockInputInjector() {}
diff --git a/remoting/host/input_injector_mac.cc b/remoting/host/input_injector_mac.cc
index f695d95e..963574f 100644
--- a/remoting/host/input_injector_mac.cc
+++ b/remoting/host/input_injector_mac.cc
@@ -338,7 +338,7 @@
 scoped_ptr<InputInjector> InputInjector::Create(
     scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
     scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) {
-  return scoped_ptr<InputInjector>(new InputInjectorMac(main_task_runner));
+  return make_scoped_ptr(new InputInjectorMac(main_task_runner));
 }
 
 }  // namespace remoting
diff --git a/remoting/host/input_injector_win.cc b/remoting/host/input_injector_win.cc
index c3f841b5..9a8b9f5 100644
--- a/remoting/host/input_injector_win.cc
+++ b/remoting/host/input_injector_win.cc
@@ -325,7 +325,7 @@
 scoped_ptr<InputInjector> InputInjector::Create(
     scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
     scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) {
-  return scoped_ptr<InputInjector>(
+  return make_scoped_ptr(
       new InputInjectorWin(main_task_runner, ui_task_runner));
 }
 
diff --git a/remoting/host/ipc_desktop_environment.cc b/remoting/host/ipc_desktop_environment.cc
index e8e23054..f1b1f75 100644
--- a/remoting/host/ipc_desktop_environment.cc
+++ b/remoting/host/ipc_desktop_environment.cc
@@ -104,7 +104,7 @@
     base::WeakPtr<ClientSessionControl> client_session_control) {
   DCHECK(caller_task_runner_->BelongsToCurrentThread());
 
-  return scoped_ptr<DesktopEnvironment>(
+  return make_scoped_ptr(
       new IpcDesktopEnvironment(audio_task_runner_,
                                 caller_task_runner_,
                                 capture_task_runner_,
diff --git a/remoting/host/it2me/it2me_native_messaging_host_unittest.cc b/remoting/host/it2me/it2me_native_messaging_host_unittest.cc
index 3d49b5cf..56515a9 100644
--- a/remoting/host/it2me/it2me_native_messaging_host_unittest.cc
+++ b/remoting/host/it2me/it2me_native_messaging_host_unittest.cc
@@ -279,7 +279,7 @@
     return nullptr;
   }
 
-  return scoped_ptr<base::DictionaryValue>(
+  return make_scoped_ptr(
       static_cast<base::DictionaryValue*>(message.release()));
 }
 
diff --git a/remoting/host/it2me_desktop_environment.cc b/remoting/host/it2me_desktop_environment.cc
index 68aa57d..7bb5507c 100644
--- a/remoting/host/it2me_desktop_environment.cc
+++ b/remoting/host/it2me_desktop_environment.cc
@@ -85,11 +85,10 @@
     base::WeakPtr<ClientSessionControl> client_session_control) {
   DCHECK(caller_task_runner()->BelongsToCurrentThread());
 
-  return scoped_ptr<DesktopEnvironment>(
-      new It2MeDesktopEnvironment(caller_task_runner(),
-                                  input_task_runner(),
-                                  ui_task_runner(),
-                                  client_session_control));
+  return make_scoped_ptr(new It2MeDesktopEnvironment(caller_task_runner(),
+                                                     input_task_runner(),
+                                                     ui_task_runner(),
+                                                     client_session_control));
 }
 
 }  // namespace remoting
diff --git a/remoting/host/local_input_monitor_linux.cc b/remoting/host/local_input_monitor_linux.cc
index 742472b..02431a1a 100644
--- a/remoting/host/local_input_monitor_linux.cc
+++ b/remoting/host/local_input_monitor_linux.cc
@@ -322,10 +322,8 @@
     scoped_refptr<base::SingleThreadTaskRunner> input_task_runner,
     scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner,
     base::WeakPtr<ClientSessionControl> client_session_control) {
-  return scoped_ptr<LocalInputMonitor>(
-      new LocalInputMonitorLinux(caller_task_runner,
-                                 input_task_runner,
-                                 client_session_control));
+  return make_scoped_ptr(new LocalInputMonitorLinux(
+      caller_task_runner, input_task_runner, client_session_control));
 }
 
 }  // namespace remoting
diff --git a/remoting/host/local_input_monitor_mac.mm b/remoting/host/local_input_monitor_mac.mm
index 8c3ddc9..a5163a88 100644
--- a/remoting/host/local_input_monitor_mac.mm
+++ b/remoting/host/local_input_monitor_mac.mm
@@ -281,10 +281,8 @@
     scoped_refptr<base::SingleThreadTaskRunner> input_task_runner,
     scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner,
     base::WeakPtr<ClientSessionControl> client_session_control) {
-  return scoped_ptr<LocalInputMonitor>(
-      new LocalInputMonitorMac(caller_task_runner,
-                               ui_task_runner,
-                               client_session_control));
+  return make_scoped_ptr(new LocalInputMonitorMac(
+      caller_task_runner, ui_task_runner, client_session_control));
 }
 
 }  // namespace remoting
diff --git a/remoting/host/local_input_monitor_win.cc b/remoting/host/local_input_monitor_win.cc
index 13bee41..a387b80 100644
--- a/remoting/host/local_input_monitor_win.cc
+++ b/remoting/host/local_input_monitor_win.cc
@@ -239,10 +239,8 @@
     scoped_refptr<base::SingleThreadTaskRunner> input_task_runner,
     scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner,
     base::WeakPtr<ClientSessionControl> client_session_control) {
-  return scoped_ptr<LocalInputMonitor>(
-      new LocalInputMonitorWin(caller_task_runner,
-                               ui_task_runner,
-                               client_session_control));
+  return make_scoped_ptr(new LocalInputMonitorWin(
+      caller_task_runner, ui_task_runner, client_session_control));
 }
 
 }  // namespace remoting
diff --git a/remoting/host/me2me_desktop_environment.cc b/remoting/host/me2me_desktop_environment.cc
index de92383c..d61beb2b 100644
--- a/remoting/host/me2me_desktop_environment.cc
+++ b/remoting/host/me2me_desktop_environment.cc
@@ -36,8 +36,7 @@
 scoped_ptr<ScreenControls> Me2MeDesktopEnvironment::CreateScreenControls() {
   DCHECK(caller_task_runner()->BelongsToCurrentThread());
 
-  return scoped_ptr<ScreenControls>(
-      new ResizingHostObserver(DesktopResizer::Create()));
+  return make_scoped_ptr(new ResizingHostObserver(DesktopResizer::Create()));
 }
 
 std::string Me2MeDesktopEnvironment::GetCapabilities() const {
@@ -61,8 +60,7 @@
   DCHECK(caller_task_runner()->BelongsToCurrentThread());
 
   if (gnubby_auth_enabled_)
-    return scoped_ptr<GnubbyAuthHandler>(
-        GnubbyAuthHandler::Create(client_stub));
+    return GnubbyAuthHandler::Create(client_stub);
 
   HOST_LOG << "gnubby auth is not enabled";
   return nullptr;
diff --git a/remoting/host/pairing_registry_delegate_linux.cc b/remoting/host/pairing_registry_delegate_linux.cc
index 755c910..5082317 100644
--- a/remoting/host/pairing_registry_delegate_linux.cc
+++ b/remoting/host/pairing_registry_delegate_linux.cc
@@ -157,8 +157,7 @@
 
 
 scoped_ptr<PairingRegistry::Delegate> CreatePairingRegistryDelegate() {
-  return scoped_ptr<PairingRegistry::Delegate>(
-      new PairingRegistryDelegateLinux());
+  return make_scoped_ptr(new PairingRegistryDelegateLinux());
 }
 
 }  // namespace remoting
diff --git a/remoting/host/pairing_registry_delegate_win.cc b/remoting/host/pairing_registry_delegate_win.cc
index 6be3fd0af..f4d6f2f 100644
--- a/remoting/host/pairing_registry_delegate_win.cc
+++ b/remoting/host/pairing_registry_delegate_win.cc
@@ -65,8 +65,7 @@
     return nullptr;
   }
 
-  return scoped_ptr<base::DictionaryValue>(
-      static_cast<base::DictionaryValue*>(value.release()));
+  return make_scoped_ptr(static_cast<base::DictionaryValue*>(value.release()));
 }
 
 // Serializes |value| into a JSON string and writes it as value |value_name|
@@ -263,8 +262,7 @@
 }
 
 scoped_ptr<PairingRegistry::Delegate> CreatePairingRegistryDelegate() {
-  return scoped_ptr<PairingRegistry::Delegate>(
-      new PairingRegistryDelegateWin());
+  return make_scoped_ptr(new PairingRegistryDelegateWin());
 }
 
 }  // namespace remoting
diff --git a/remoting/host/pam_authorization_factory_posix.cc b/remoting/host/pam_authorization_factory_posix.cc
index 29be848..9409ac08 100644
--- a/remoting/host/pam_authorization_factory_posix.cc
+++ b/remoting/host/pam_authorization_factory_posix.cc
@@ -171,8 +171,7 @@
     const buzz::XmlElement* first_message) {
   scoped_ptr<protocol::Authenticator> authenticator(
       underlying_->CreateAuthenticator(local_jid, remote_jid, first_message));
-  return scoped_ptr<protocol::Authenticator>(
-      new PamAuthorizer(authenticator.Pass()));
+  return make_scoped_ptr(new PamAuthorizer(authenticator.Pass()));
 }
 
 
diff --git a/remoting/host/resizing_host_observer_unittest.cc b/remoting/host/resizing_host_observer_unittest.cc
index fcba79f..1c8cea0 100644
--- a/remoting/host/resizing_host_observer_unittest.cc
+++ b/remoting/host/resizing_host_observer_unittest.cc
@@ -256,10 +256,9 @@
 TEST_F(ResizingHostObserverTest, NoSetSizeForSameSize) {
   ScreenResolution supported_sizes[] = { MakeResolution(640, 480),
                                          MakeResolution(480, 640) };
-  FakeDesktopResizer* desktop_resizer =
-      new FakeDesktopResizer(MakeResolution(480, 640), false,
-                             supported_sizes, arraysize(supported_sizes), NULL);
-  SetDesktopResizer(scoped_ptr<FakeDesktopResizer>(desktop_resizer));
+  SetDesktopResizer(make_scoped_ptr(new FakeDesktopResizer(
+      MakeResolution(480, 640), false,
+      supported_sizes, arraysize(supported_sizes), NULL)));
 
   ScreenResolution client_sizes[] = { MakeResolution(640, 640),
                                       MakeResolution(1024, 768),
@@ -268,15 +267,14 @@
                                         MakeResolution(640, 480),
                                         MakeResolution(640, 480) };
   VerifySizes(client_sizes, expected_sizes, arraysize(client_sizes));
-  EXPECT_EQ(desktop_resizer->set_resolution_call_count(), 1);
+  EXPECT_EQ(desktop_resizer_->set_resolution_call_count(), 1);
 }
 
 // Check that desktop resizes are rate-limited, and that if multiple resize
 // requests are received in the time-out period, the most recent is respected.
 TEST_F(ResizingHostObserverTest, RateLimited) {
-  FakeDesktopResizer* desktop_resizer =
-      new FakeDesktopResizer(MakeResolution(640, 480), true, NULL, 0, NULL);
-  SetDesktopResizer(scoped_ptr<FakeDesktopResizer>(desktop_resizer));
+  SetDesktopResizer(make_scoped_ptr(
+      new FakeDesktopResizer(MakeResolution(640, 480), true, NULL, 0, NULL)));
   resizing_host_observer_->SetNowFunctionForTesting(
       base::Bind(&ResizingHostObserverTest::GetTime, base::Unretained(this)));
 
diff --git a/remoting/host/sas_injector_win.cc b/remoting/host/sas_injector_win.cc
index 805a743..ca8286d 100644
--- a/remoting/host/sas_injector_win.cc
+++ b/remoting/host/sas_injector_win.cc
@@ -220,9 +220,9 @@
 
 scoped_ptr<SasInjector> SasInjector::Create() {
   if (base::win::GetVersion() < base::win::VERSION_VISTA) {
-    return scoped_ptr<SasInjector>(new SasInjectorXp());
+    return make_scoped_ptr(new SasInjectorXp());
   } else {
-    return scoped_ptr<SasInjector>(new SasInjectorWin());
+    return make_scoped_ptr(new SasInjectorWin());
   }
 }
 
diff --git a/remoting/host/setup/daemon_controller_delegate_win.cc b/remoting/host/setup/daemon_controller_delegate_win.cc
index 34b50a6..36f55e59 100644
--- a/remoting/host/setup/daemon_controller_delegate_win.cc
+++ b/remoting/host/setup/daemon_controller_delegate_win.cc
@@ -191,8 +191,7 @@
   if (!config || !config->IsType(base::Value::TYPE_DICTIONARY))
     return nullptr;
 
-  return scoped_ptr<base::DictionaryValue>(
-      static_cast<base::DictionaryValue*>(config.release()));
+  return make_scoped_ptr(static_cast<base::DictionaryValue*>(config.release()));
 }
 
 void DaemonControllerDelegateWin::InstallHost(
diff --git a/remoting/host/setup/daemon_installer_win.cc b/remoting/host/setup/daemon_installer_win.cc
index decb9dc..c20d4643 100644
--- a/remoting/host/setup/daemon_installer_win.cc
+++ b/remoting/host/setup/daemon_installer_win.cc
@@ -367,23 +367,24 @@
                          IID_IDispatch,
                          update3.ReceiveVoid());
   }
-  if (SUCCEEDED(result)) {
-    // The machine instance of Omaha is available and we successfully passed
-    // the UAC prompt.
-    return scoped_ptr<DaemonInstallerWin>(
-        new DaemonComInstallerWin(update3, done));
-  } else if (result == CO_E_CLASSSTRING) {
+
+  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 scoped_ptr<DaemonInstallerWin>(
-        new DaemonCommandLineInstallerWin(done));
-  } else {
+    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) {
diff --git a/remoting/host/setup/host_starter.cc b/remoting/host/setup/host_starter.cc
index 12467771a..127c4a9 100644
--- a/remoting/host/setup/host_starter.cc
+++ b/remoting/host/setup/host_starter.cc
@@ -46,9 +46,8 @@
           chromoting_hosts_url, url_request_context_getter));
   scoped_refptr<remoting::DaemonController> daemon_controller(
       remoting::DaemonController::Create());
-  return scoped_ptr<HostStarter>(
-      new HostStarter(oauth_client.Pass(), service_client.Pass(),
-                      daemon_controller));
+  return make_scoped_ptr(new HostStarter(
+      oauth_client.Pass(), service_client.Pass(), daemon_controller));
 }
 
 void HostStarter::StartHost(
diff --git a/remoting/host/setup/me2me_native_messaging_host_unittest.cc b/remoting/host/setup/me2me_native_messaging_host_unittest.cc
index 35dcbac..51bee6b 100644
--- a/remoting/host/setup/me2me_native_messaging_host_unittest.cc
+++ b/remoting/host/setup/me2me_native_messaging_host_unittest.cc
@@ -167,7 +167,7 @@
 }
 
 scoped_ptr<base::DictionaryValue> MockDaemonControllerDelegate::GetConfig() {
-  return scoped_ptr<base::DictionaryValue>(new base::DictionaryValue());
+  return make_scoped_ptr(new base::DictionaryValue());
 }
 
 void MockDaemonControllerDelegate::InstallHost(
@@ -316,12 +316,11 @@
 
   daemon_controller_delegate_ = new MockDaemonControllerDelegate();
   scoped_refptr<DaemonController> daemon_controller(
-      new DaemonController(
-          scoped_ptr<DaemonController::Delegate>(daemon_controller_delegate_)));
+      new DaemonController(make_scoped_ptr(daemon_controller_delegate_)));
 
   scoped_refptr<PairingRegistry> pairing_registry =
-      new SynchronousPairingRegistry(scoped_ptr<PairingRegistry::Delegate>(
-          new MockPairingRegistryDelegate()));
+      new SynchronousPairingRegistry(
+          make_scoped_ptr(new MockPairingRegistryDelegate()));
 
   scoped_ptr<extensions::NativeMessagingChannel> channel(
       new PipeMessagingChannel(input_read_file.Pass(),
@@ -399,7 +398,7 @@
     return nullptr;
   }
 
-  return scoped_ptr<base::DictionaryValue>(
+  return make_scoped_ptr(
       static_cast<base::DictionaryValue*>(message.release()));
 }
 
@@ -425,8 +424,7 @@
   WriteMessageToInputPipe(good_message);
 
   // Read from output pipe, and verify responses.
-  scoped_ptr<base::DictionaryValue> response =
-      ReadMessageFromOutputPipe();
+  scoped_ptr<base::DictionaryValue> response = ReadMessageFromOutputPipe();
   VerifyHelloResponse(response.Pass());
 
   response = ReadMessageFromOutputPipe();
@@ -529,8 +527,7 @@
   message.SetString("id", "42");
   WriteMessageToInputPipe(message);
 
-  scoped_ptr<base::DictionaryValue> response =
-      ReadMessageFromOutputPipe();
+  scoped_ptr<base::DictionaryValue> response = ReadMessageFromOutputPipe();
   EXPECT_TRUE(response);
   std::string value;
   EXPECT_FALSE(response->GetString("id", &value));
diff --git a/remoting/host/shaped_desktop_capturer_unittest.cc b/remoting/host/shaped_desktop_capturer_unittest.cc
index d0acc3d..08d78f4 100644
--- a/remoting/host/shaped_desktop_capturer_unittest.cc
+++ b/remoting/host/shaped_desktop_capturer_unittest.cc
@@ -57,8 +57,8 @@
 // Verify that captured frame have shape.
 TEST_F(ShapedDesktopCapturerTest, Basic) {
   ShapedDesktopCapturer capturer(
-      scoped_ptr<webrtc::DesktopCapturer>(new FakeDesktopCapturer()),
-      scoped_ptr<DesktopShapeTracker>(new FakeDesktopShapeTracker()));
+      make_scoped_ptr(new FakeDesktopCapturer()),
+      make_scoped_ptr(new FakeDesktopShapeTracker()));
   capturer.Start(this);
   capturer.Capture(webrtc::DesktopRegion());
   ASSERT_TRUE(last_frame_.get());
diff --git a/remoting/host/token_validator_factory_impl.cc b/remoting/host/token_validator_factory_impl.cc
index 0d7906a..62ccbeb 100644
--- a/remoting/host/token_validator_factory_impl.cc
+++ b/remoting/host/token_validator_factory_impl.cc
@@ -121,7 +121,7 @@
 TokenValidatorFactoryImpl::CreateTokenValidator(
     const std::string& local_jid,
     const std::string& remote_jid) {
-  return scoped_ptr<protocol::TokenValidator>(
+  return make_scoped_ptr(
       new TokenValidatorImpl(third_party_auth_config_,
                              key_pair_, local_jid, remote_jid,
                              request_context_getter_));
diff --git a/remoting/host/video_frame_recorder_host_extension.cc b/remoting/host/video_frame_recorder_host_extension.cc
index 477f74f..0528ce2 100644
--- a/remoting/host/video_frame_recorder_host_extension.cc
+++ b/remoting/host/video_frame_recorder_host_extension.cc
@@ -191,7 +191,7 @@
 VideoFrameRecorderHostExtension::CreateExtensionSession(
     ClientSessionControl* client_session_control,
     protocol::ClientStub* client_stub) {
-  return scoped_ptr<HostExtensionSession>(
+  return make_scoped_ptr(
       new VideoFrameRecorderHostExtensionSession(max_content_bytes_));
 }
 
diff --git a/remoting/host/video_scheduler.cc b/remoting/host/video_scheduler.cc
index b9f1276c..898bd5e 100644
--- a/remoting/host/video_scheduler.cc
+++ b/remoting/host/video_scheduler.cc
@@ -345,7 +345,7 @@
     return;
 
   video_stub_->ProcessVideoPacket(
-      scoped_ptr<VideoPacket>(new VideoPacket()),
+      make_scoped_ptr(new VideoPacket()),
       base::Bind(&VideoScheduler::OnKeepAlivePacketSent, this));
 }
 
diff --git a/remoting/host/video_scheduler_unittest.cc b/remoting/host/video_scheduler_unittest.cc
index d79aa43..2acaa8a 100644
--- a/remoting/host/video_scheduler_unittest.cc
+++ b/remoting/host/video_scheduler_unittest.cc
@@ -66,9 +66,8 @@
   MockVideoEncoder() {}
   virtual ~MockVideoEncoder() {}
 
-  scoped_ptr<VideoPacket> Encode(
-      const webrtc::DesktopFrame& frame) {
-    return scoped_ptr<VideoPacket>(EncodePtr(frame));
+  scoped_ptr<VideoPacket> Encode(const webrtc::DesktopFrame& frame) {
+    return make_scoped_ptr(EncodePtr(frame));
   }
   MOCK_METHOD1(EncodePtr, VideoPacket*(const webrtc::DesktopFrame& frame));
 
diff --git a/remoting/protocol/audio_reader.cc b/remoting/protocol/audio_reader.cc
index 6176409b..0cede0b 100644
--- a/remoting/protocol/audio_reader.cc
+++ b/remoting/protocol/audio_reader.cc
@@ -26,8 +26,7 @@
 scoped_ptr<AudioReader> AudioReader::Create(const SessionConfig& config) {
   if (!config.is_audio_enabled())
     return nullptr;
-  // TODO(kxing): Support different session configurations.
-  return scoped_ptr<AudioReader>(new AudioReader(AudioPacket::ENCODING_RAW));
+  return make_scoped_ptr(new AudioReader(AudioPacket::ENCODING_RAW));
 }
 
 void AudioReader::OnInitialized() {
@@ -36,7 +35,7 @@
 }
 
 void AudioReader::OnNewData(scoped_ptr<AudioPacket> packet,
-                                    const base::Closure& done_task) {
+                            const base::Closure& done_task) {
   audio_stub_->ProcessAudioPacket(packet.Pass(), done_task);
 }
 
diff --git a/remoting/protocol/audio_writer.cc b/remoting/protocol/audio_writer.cc
index 33cabd4..a6c8f4b2 100644
--- a/remoting/protocol/audio_writer.cc
+++ b/remoting/protocol/audio_writer.cc
@@ -37,8 +37,7 @@
 scoped_ptr<AudioWriter> AudioWriter::Create(const SessionConfig& config) {
   if (!config.is_audio_enabled())
     return nullptr;
-  // TODO(kxing): Support different session configurations.
-  return scoped_ptr<AudioWriter>(new AudioWriter());
+  return make_scoped_ptr(new AudioWriter());
 }
 
 }  // namespace protocol
diff --git a/remoting/protocol/authenticator.cc b/remoting/protocol/authenticator.cc
index f1bf8e6..03e176a 100644
--- a/remoting/protocol/authenticator.cc
+++ b/remoting/protocol/authenticator.cc
@@ -22,8 +22,7 @@
 
 // static
 scoped_ptr<buzz::XmlElement> Authenticator::CreateEmptyAuthenticatorMessage() {
-  return scoped_ptr<buzz::XmlElement>(
-      new buzz::XmlElement(kAuthenticationQName));
+  return make_scoped_ptr(new buzz::XmlElement(kAuthenticationQName));
 }
 
 // static
diff --git a/remoting/protocol/content_description.cc b/remoting/protocol/content_description.cc
index ef9dca1..0308fda2 100644
--- a/remoting/protocol/content_description.cc
+++ b/remoting/protocol/content_description.cc
@@ -234,7 +234,7 @@
   if (child)
     authenticator_message.reset(new XmlElement(*child));
 
-  return scoped_ptr<ContentDescription>(
+  return make_scoped_ptr(
       new ContentDescription(config.Pass(), authenticator_message.Pass()));
 }
 
diff --git a/remoting/protocol/fake_authenticator.cc b/remoting/protocol/fake_authenticator.cc
index 9f2b4f6f..c816cfa0 100644
--- a/remoting/protocol/fake_authenticator.cc
+++ b/remoting/protocol/fake_authenticator.cc
@@ -168,7 +168,7 @@
 scoped_ptr<ChannelAuthenticator>
 FakeAuthenticator::CreateChannelAuthenticator() const {
   EXPECT_EQ(ACCEPTED, state());
-  return scoped_ptr<ChannelAuthenticator>(
+  return make_scoped_ptr(
       new FakeChannelAuthenticator(action_ != REJECT_CHANNEL, async_));
 }
 
diff --git a/remoting/protocol/me2me_host_authenticator_factory.cc b/remoting/protocol/me2me_host_authenticator_factory.cc
index 5d97de1..e69f7f9 100644
--- a/remoting/protocol/me2me_host_authenticator_factory.cc
+++ b/remoting/protocol/me2me_host_authenticator_factory.cc
@@ -80,7 +80,7 @@
   result->key_pair_ = key_pair;
   result->shared_secret_hash_ = shared_secret_hash;
   result->pairing_registry_ = pairing_registry;
-  return scoped_ptr<AuthenticatorFactory>(result.Pass());
+  return result.Pass();
 }
 
 
@@ -100,13 +100,13 @@
   result->local_cert_ = local_cert;
   result->key_pair_ = key_pair;
   result->token_validator_factory_ = token_validator_factory.Pass();
-  return scoped_ptr<AuthenticatorFactory>(result.Pass());
+  return result.Pass();
 }
 
 // static
 scoped_ptr<AuthenticatorFactory>
     Me2MeHostAuthenticatorFactory::CreateRejecting() {
-  return scoped_ptr<AuthenticatorFactory>(new Me2MeHostAuthenticatorFactory());
+  return make_scoped_ptr(new Me2MeHostAuthenticatorFactory());
 }
 
 Me2MeHostAuthenticatorFactory::Me2MeHostAuthenticatorFactory() {
@@ -130,7 +130,7 @@
     size_t slash_pos = local_jid.find('/');
     if (slash_pos == std::string::npos) {
       LOG(DFATAL) << "Invalid local JID:" << local_jid;
-      return scoped_ptr<Authenticator>(new RejectingAuthenticator());
+      return make_scoped_ptr(new RejectingAuthenticator());
     }
     remote_jid_prefix = local_jid.substr(0, slash_pos);
   } else {
@@ -144,7 +144,7 @@
   if (!base::IsStringASCII(remote_jid) ||
       !StartsWithASCII(remote_jid, remote_jid_prefix + '/', false)) {
     LOG(ERROR) << "Rejecting incoming connection from " << remote_jid;
-    return scoped_ptr<Authenticator>(new RejectingAuthenticator());
+    return make_scoped_ptr(new RejectingAuthenticator());
   }
 
   if (!local_cert_.empty() && key_pair_.get()) {
@@ -160,7 +160,7 @@
         shared_secret_hash_.hash_function, pairing_registry_);
   }
 
-  return scoped_ptr<Authenticator>(new RejectingAuthenticator());
+  return make_scoped_ptr(new RejectingAuthenticator());
 }
 
 }  // namespace protocol
diff --git a/remoting/protocol/message_reader.cc b/remoting/protocol/message_reader.cc
index 83121092..1284273 100644
--- a/remoting/protocol/message_reader.cc
+++ b/remoting/protocol/message_reader.cc
@@ -99,7 +99,7 @@
         FROM_HERE,
         base::Bind(&MessageReader::RunCallback,
                    weak_factory_.GetWeakPtr(),
-                   base::Passed(scoped_ptr<CompoundBuffer>(buffer))));
+                   base::Passed(make_scoped_ptr(buffer))));
   }
 }
 
diff --git a/remoting/protocol/negotiating_authenticator_unittest.cc b/remoting/protocol/negotiating_authenticator_unittest.cc
index 64afc0cb..5dbc211 100644
--- a/remoting/protocol/negotiating_authenticator_unittest.cc
+++ b/remoting/protocol/negotiating_authenticator_unittest.cc
@@ -85,8 +85,7 @@
 
   void CreatePairingRegistry(bool with_paired_client) {
     pairing_registry_ = new SynchronousPairingRegistry(
-        scoped_ptr<PairingRegistry::Delegate>(
-            new MockPairingRegistryDelegate()));
+        make_scoped_ptr(new MockPairingRegistryDelegate()));
     if (with_paired_client) {
       PairingRegistry::Pairing pairing(
           base::Time(), kTestClientName, kTestClientId, kTestPairedSecret);
diff --git a/remoting/protocol/negotiating_host_authenticator.cc b/remoting/protocol/negotiating_host_authenticator.cc
index 64b6926..37c7a57e5 100644
--- a/remoting/protocol/negotiating_host_authenticator.cc
+++ b/remoting/protocol/negotiating_host_authenticator.cc
@@ -45,7 +45,7 @@
   if (pairing_registry.get()) {
     result->AddMethod(AuthenticationMethod::Spake2Pair());
   }
-  return scoped_ptr<Authenticator>(result.Pass());
+  return result.Pass();
 }
 
 // static
@@ -58,7 +58,7 @@
       new NegotiatingHostAuthenticator(local_cert, key_pair));
   result->token_validator_ = token_validator.Pass();
   result->AddMethod(AuthenticationMethod::ThirdParty());
-  return scoped_ptr<Authenticator>(result.Pass());
+  return result.Pass();
 }
 
 NegotiatingHostAuthenticator::~NegotiatingHostAuthenticator() {
diff --git a/remoting/protocol/pairing_registry_unittest.cc b/remoting/protocol/pairing_registry_unittest.cc
index eefea2a..f713e4cf 100644
--- a/remoting/protocol/pairing_registry_unittest.cc
+++ b/remoting/protocol/pairing_registry_unittest.cc
@@ -91,7 +91,7 @@
 
 TEST_F(PairingRegistryTest, CreateAndGetPairings) {
   scoped_refptr<PairingRegistry> registry = new SynchronousPairingRegistry(
-      scoped_ptr<PairingRegistry::Delegate>(new MockPairingRegistryDelegate()));
+      make_scoped_ptr(new MockPairingRegistryDelegate()));
   PairingRegistry::Pairing pairing_1 = registry->CreatePairing("my_client");
   PairingRegistry::Pairing pairing_2 = registry->CreatePairing("my_client");
 
@@ -113,7 +113,7 @@
 
 TEST_F(PairingRegistryTest, GetAllPairings) {
   scoped_refptr<PairingRegistry> registry = new SynchronousPairingRegistry(
-      scoped_ptr<PairingRegistry::Delegate>(new MockPairingRegistryDelegate()));
+      make_scoped_ptr(new MockPairingRegistryDelegate()));
   PairingRegistry::Pairing pairing_1 = registry->CreatePairing("client1");
   PairingRegistry::Pairing pairing_2 = registry->CreatePairing("client2");
 
@@ -141,7 +141,7 @@
 
 TEST_F(PairingRegistryTest, DeletePairing) {
   scoped_refptr<PairingRegistry> registry = new SynchronousPairingRegistry(
-      scoped_ptr<PairingRegistry::Delegate>(new MockPairingRegistryDelegate()));
+      make_scoped_ptr(new MockPairingRegistryDelegate()));
   PairingRegistry::Pairing pairing_1 = registry->CreatePairing("client1");
   PairingRegistry::Pairing pairing_2 = registry->CreatePairing("client2");
 
@@ -166,7 +166,7 @@
 
 TEST_F(PairingRegistryTest, ClearAllPairings) {
   scoped_refptr<PairingRegistry> registry = new SynchronousPairingRegistry(
-      scoped_ptr<PairingRegistry::Delegate>(new MockPairingRegistryDelegate()));
+      make_scoped_ptr(new MockPairingRegistryDelegate()));
   PairingRegistry::Pairing pairing_1 = registry->CreatePairing("client1");
   PairingRegistry::Pairing pairing_2 = registry->CreatePairing("client2");
 
@@ -217,7 +217,7 @@
 
   scoped_refptr<PairingRegistry> registry = new PairingRegistry(
       base::ThreadTaskRunnerHandle::Get(),
-      scoped_ptr<PairingRegistry::Delegate>(new MockPairingRegistryDelegate()));
+      make_scoped_ptr(new MockPairingRegistryDelegate()));
   PairingRegistry::Pairing pairing_1 = registry->CreatePairing("client1");
   PairingRegistry::Pairing pairing_2 = registry->CreatePairing("client2");
   registry->GetPairing(
diff --git a/remoting/protocol/protocol_mock_objects.h b/remoting/protocol/protocol_mock_objects.h
index 2818604..fc51ac7 100644
--- a/remoting/protocol/protocol_mock_objects.h
+++ b/remoting/protocol/protocol_mock_objects.h
@@ -202,8 +202,8 @@
       const std::string& host_jid,
       scoped_ptr<Authenticator> authenticator,
       scoped_ptr<CandidateSessionConfig> config) {
-    return scoped_ptr<Session>(ConnectPtr(
-        host_jid, authenticator.get(), config.get()));
+    return make_scoped_ptr(
+        ConnectPtr(host_jid, authenticator.get(), config.get()));
   }
   virtual void set_authenticator_factory(
       scoped_ptr<AuthenticatorFactory> authenticator_factory) {
diff --git a/remoting/protocol/session_config.cc b/remoting/protocol/session_config.cc
index f603437..460da28 100644
--- a/remoting/protocol/session_config.cc
+++ b/remoting/protocol/session_config.cc
@@ -145,12 +145,12 @@
 }
 
 scoped_ptr<CandidateSessionConfig> CandidateSessionConfig::Clone() const {
-  return scoped_ptr<CandidateSessionConfig>(new CandidateSessionConfig(*this));
+  return make_scoped_ptr(new CandidateSessionConfig(*this));
 }
 
 // static
 scoped_ptr<CandidateSessionConfig> CandidateSessionConfig::CreateEmpty() {
-  return scoped_ptr<CandidateSessionConfig>(new CandidateSessionConfig());
+  return make_scoped_ptr(new CandidateSessionConfig());
 }
 
 // static
diff --git a/remoting/protocol/v2_authenticator.cc b/remoting/protocol/v2_authenticator.cc
index 2c8d9f97..37652a2 100644
--- a/remoting/protocol/v2_authenticator.cc
+++ b/remoting/protocol/v2_authenticator.cc
@@ -38,7 +38,7 @@
 scoped_ptr<Authenticator> V2Authenticator::CreateForClient(
     const std::string& shared_secret,
     Authenticator::State initial_state) {
-  return scoped_ptr<Authenticator>(new V2Authenticator(
+  return make_scoped_ptr(new V2Authenticator(
       P224EncryptedKeyExchange::kPeerTypeClient, shared_secret, initial_state));
 }
 
@@ -52,7 +52,7 @@
       P224EncryptedKeyExchange::kPeerTypeServer, shared_secret, initial_state));
   result->local_cert_ = local_cert;
   result->local_key_pair_ = key_pair;
-  return scoped_ptr<Authenticator>(result.Pass());
+  return result.Pass();
 }
 
 V2Authenticator::V2Authenticator(
@@ -191,13 +191,11 @@
   CHECK(!auth_key_.empty());
 
   if (is_host_side()) {
-    return scoped_ptr<ChannelAuthenticator>(
-        SslHmacChannelAuthenticator::CreateForHost(
-            local_cert_, local_key_pair_, auth_key_).Pass());
+    return SslHmacChannelAuthenticator::CreateForHost(
+        local_cert_, local_key_pair_, auth_key_);
   } else {
-    return scoped_ptr<ChannelAuthenticator>(
-        SslHmacChannelAuthenticator::CreateForClient(
-            remote_cert_, auth_key_).Pass());
+    return SslHmacChannelAuthenticator::CreateForClient(
+        remote_cert_, auth_key_);
   }
 }
 
diff --git a/remoting/signaling/server_log_entry.cc b/remoting/signaling/server_log_entry.cc
index 9079720..684c74e 100644
--- a/remoting/signaling/server_log_entry.cc
+++ b/remoting/signaling/server_log_entry.cc
@@ -71,7 +71,7 @@
 
 // static
 scoped_ptr<XmlElement> ServerLogEntry::MakeStanza() {
-  return scoped_ptr<XmlElement>(
+  return make_scoped_ptr(
       new XmlElement(QName(kChromotingXmlNamespace, kLogCommand)));
 }
 
diff --git a/remoting/test/fake_port_allocator.cc b/remoting/test/fake_port_allocator.cc
index 64eb08f..0a96f1e 100644
--- a/remoting/test/fake_port_allocator.cc
+++ b/remoting/test/fake_port_allocator.cc
@@ -95,7 +95,7 @@
   scoped_ptr<rtc::NetworkManager> network_manager(
       new FakeNetworkManager(socket_factory->GetAddress()));
 
-  return scoped_ptr<FakePortAllocator>(
+  return make_scoped_ptr(
       new FakePortAllocator(network_manager.Pass(), socket_factory.Pass()));
 }