Replace scoped_ptr with unique_ptr in webrtc/modules/desktop_capture/

BUG=webrtc:5520

Review URL: https://codereview.webrtc.org/1743203002

Cr-Commit-Position: refs/heads/master@{#12023}
diff --git a/webrtc/modules/desktop_capture/cropped_desktop_frame.cc b/webrtc/modules/desktop_capture/cropped_desktop_frame.cc
index 2c70973..f57fc57 100644
--- a/webrtc/modules/desktop_capture/cropped_desktop_frame.cc
+++ b/webrtc/modules/desktop_capture/cropped_desktop_frame.cc
@@ -8,6 +8,8 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
+#include <memory>
+
 #include "webrtc/modules/desktop_capture/cropped_desktop_frame.h"
 
 namespace webrtc {
@@ -18,7 +20,7 @@
   CroppedDesktopFrame(DesktopFrame* frame, const DesktopRect& rect);
 
  private:
-  rtc::scoped_ptr<DesktopFrame> frame_;
+  std::unique_ptr<DesktopFrame> frame_;
 
   RTC_DISALLOW_COPY_AND_ASSIGN(CroppedDesktopFrame);
 };
diff --git a/webrtc/modules/desktop_capture/cropping_window_capturer.cc b/webrtc/modules/desktop_capture/cropping_window_capturer.cc
index 7aab7f8..0dd564f 100644
--- a/webrtc/modules/desktop_capture/cropping_window_capturer.cc
+++ b/webrtc/modules/desktop_capture/cropping_window_capturer.cc
@@ -75,7 +75,7 @@
 }
 
 void CroppingWindowCapturer::OnCaptureCompleted(DesktopFrame* frame) {
-  rtc::scoped_ptr<DesktopFrame> screen_frame(frame);
+  std::unique_ptr<DesktopFrame> screen_frame(frame);
 
   if (!ShouldUseScreenCapturer()) {
     LOG(LS_INFO) << "Window no longer on top when ScreenCapturer finishes";
@@ -96,7 +96,7 @@
     return;
   }
 
-  rtc::scoped_ptr<DesktopFrame> window_frame(
+  std::unique_ptr<DesktopFrame> window_frame(
       CreateCroppedDesktopFrame(screen_frame.release(), window_rect));
   callback_->OnCaptureCompleted(window_frame.release());
 }
diff --git a/webrtc/modules/desktop_capture/cropping_window_capturer.h b/webrtc/modules/desktop_capture/cropping_window_capturer.h
index af456e5..177b544 100644
--- a/webrtc/modules/desktop_capture/cropping_window_capturer.h
+++ b/webrtc/modules/desktop_capture/cropping_window_capturer.h
@@ -11,6 +11,8 @@
 #ifndef WEBRTC_MODULES_DESKTOP_CAPTURE_CROPPING_WINDOW_CAPTURER_H_
 #define WEBRTC_MODULES_DESKTOP_CAPTURE_CROPPING_WINDOW_CAPTURER_H_
 
+#include <memory>
+
 #include "webrtc/base/scoped_ptr.h"
 #include "webrtc/modules/desktop_capture/desktop_capture_options.h"
 #include "webrtc/modules/desktop_capture/screen_capturer.h"
@@ -63,8 +65,8 @@
  private:
   DesktopCaptureOptions options_;
   DesktopCapturer::Callback* callback_;
-  rtc::scoped_ptr<WindowCapturer> window_capturer_;
-  rtc::scoped_ptr<ScreenCapturer> screen_capturer_;
+  std::unique_ptr<WindowCapturer> window_capturer_;
+  std::unique_ptr<ScreenCapturer> screen_capturer_;
   WindowId selected_window_;
   WindowId excluded_window_;
 };
diff --git a/webrtc/modules/desktop_capture/desktop_and_cursor_composer.cc b/webrtc/modules/desktop_capture/desktop_and_cursor_composer.cc
index 5da8bee..55afede 100644
--- a/webrtc/modules/desktop_capture/desktop_and_cursor_composer.cc
+++ b/webrtc/modules/desktop_capture/desktop_and_cursor_composer.cc
@@ -62,10 +62,10 @@
   virtual ~DesktopFrameWithCursor();
 
  private:
-  rtc::scoped_ptr<DesktopFrame> original_frame_;
+  std::unique_ptr<DesktopFrame> original_frame_;
 
   DesktopVector restore_position_;
-  rtc::scoped_ptr<DesktopFrame> restore_frame_;
+  std::unique_ptr<DesktopFrame> restore_frame_;
 
   RTC_DISALLOW_COPY_AND_ASSIGN(DesktopFrameWithCursor);
 };
diff --git a/webrtc/modules/desktop_capture/desktop_and_cursor_composer.h b/webrtc/modules/desktop_capture/desktop_and_cursor_composer.h
index 6d381c8..cd0b2cf 100644
--- a/webrtc/modules/desktop_capture/desktop_and_cursor_composer.h
+++ b/webrtc/modules/desktop_capture/desktop_and_cursor_composer.h
@@ -11,6 +11,8 @@
 #ifndef WEBRTC_MODULES_DESKTOP_CAPTURE_DESKTOP_AND_CURSOR_COMPOSER_H_
 #define WEBRTC_MODULES_DESKTOP_CAPTURE_DESKTOP_AND_CURSOR_COMPOSER_H_
 
+#include <memory>
+
 #include "webrtc/base/scoped_ptr.h"
 #include "webrtc/modules/desktop_capture/desktop_capturer.h"
 #include "webrtc/modules/desktop_capture/mouse_cursor_monitor.h"
@@ -47,12 +49,12 @@
   void OnMouseCursorPosition(MouseCursorMonitor::CursorState state,
                              const DesktopVector& position) override;
 
-  rtc::scoped_ptr<DesktopCapturer> desktop_capturer_;
-  rtc::scoped_ptr<MouseCursorMonitor> mouse_monitor_;
+  std::unique_ptr<DesktopCapturer> desktop_capturer_;
+  std::unique_ptr<MouseCursorMonitor> mouse_monitor_;
 
   DesktopCapturer::Callback* callback_;
 
-  rtc::scoped_ptr<MouseCursor> cursor_;
+  std::unique_ptr<MouseCursor> cursor_;
   MouseCursorMonitor::CursorState cursor_state_;
   DesktopVector cursor_position_;
 
diff --git a/webrtc/modules/desktop_capture/desktop_and_cursor_composer_unittest.cc b/webrtc/modules/desktop_capture/desktop_and_cursor_composer_unittest.cc
index 4835fc5..6652a1a 100644
--- a/webrtc/modules/desktop_capture/desktop_and_cursor_composer_unittest.cc
+++ b/webrtc/modules/desktop_capture/desktop_and_cursor_composer_unittest.cc
@@ -8,10 +8,11 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
+#include <memory>
+
 #include "webrtc/modules/desktop_capture/desktop_and_cursor_composer.h"
 
 #include "testing/gtest/include/gtest/gtest.h"
-#include "webrtc/base/scoped_ptr.h"
 #include "webrtc/modules/desktop_capture/desktop_capture_options.h"
 #include "webrtc/modules/desktop_capture/desktop_frame.h"
 #include "webrtc/modules/desktop_capture/mouse_cursor.h"
@@ -87,7 +88,7 @@
  private:
   Callback* callback_;
 
-  rtc::scoped_ptr<DesktopFrame> next_frame_;
+  std::unique_ptr<DesktopFrame> next_frame_;
 };
 
 class FakeMouseMonitor : public MouseCursorMonitor {
@@ -109,7 +110,7 @@
 
   void Capture() override {
     if (changed_) {
-      rtc::scoped_ptr<DesktopFrame> image(
+      std::unique_ptr<DesktopFrame> image(
           new BasicDesktopFrame(DesktopSize(kCursorWidth, kCursorHeight)));
       uint32_t* data = reinterpret_cast<uint32_t*>(image->data());
       memset(data, 0, image->stride() * kCursorHeight);
@@ -176,7 +177,7 @@
   FakeMouseMonitor* fake_cursor_;
 
   DesktopAndCursorComposer blender_;
-  rtc::scoped_ptr<DesktopFrame> frame_;
+  std::unique_ptr<DesktopFrame> frame_;
 };
 
 // Verify DesktopAndCursorComposer can handle the case when the screen capturer
@@ -190,7 +191,7 @@
 
   blender_.Capture(DesktopRegion());
 
-  EXPECT_EQ(frame_, static_cast<DesktopFrame*>(NULL));
+  EXPECT_FALSE(frame_);
 }
 
 TEST_F(DesktopAndCursorComposerTest, Blend) {
@@ -228,7 +229,7 @@
     DesktopVector pos(tests[i].x, tests[i].y);
     fake_cursor_->SetState(state, pos);
 
-    rtc::scoped_ptr<SharedDesktopFrame> frame(
+    std::unique_ptr<SharedDesktopFrame> frame(
         SharedDesktopFrame::Wrap(CreateTestFrame()));
     fake_screen_->SetNextFrame(frame->Share());
 
diff --git a/webrtc/modules/desktop_capture/desktop_frame.cc b/webrtc/modules/desktop_capture/desktop_frame.cc
index 054427c..6bc7b2e 100644
--- a/webrtc/modules/desktop_capture/desktop_frame.cc
+++ b/webrtc/modules/desktop_capture/desktop_frame.cc
@@ -78,17 +78,18 @@
 }
 
 // static
-rtc::scoped_ptr<DesktopFrame> SharedMemoryDesktopFrame::Create(
+std::unique_ptr<DesktopFrame> SharedMemoryDesktopFrame::Create(
     DesktopSize size,
     SharedMemoryFactory* shared_memory_factory) {
   size_t buffer_size =
       size.width() * size.height() * DesktopFrame::kBytesPerPixel;
-  rtc::scoped_ptr<SharedMemory> shared_memory;
-  shared_memory = shared_memory_factory->CreateSharedMemory(buffer_size);
+  std::unique_ptr<SharedMemory> shared_memory;
+  shared_memory = rtc::ScopedToUnique(
+      shared_memory_factory->CreateSharedMemory(buffer_size));
   if (!shared_memory)
     return nullptr;
 
-  return rtc_make_scoped_ptr(new SharedMemoryDesktopFrame(
+  return std::unique_ptr<DesktopFrame>(new SharedMemoryDesktopFrame(
       size, size.width() * DesktopFrame::kBytesPerPixel,
       std::move(shared_memory)));
 }
@@ -104,7 +105,7 @@
 SharedMemoryDesktopFrame::SharedMemoryDesktopFrame(
     DesktopSize size,
     int stride,
-    rtc::scoped_ptr<SharedMemory> shared_memory)
+    std::unique_ptr<SharedMemory> shared_memory)
     : DesktopFrame(size,
                    stride,
                    reinterpret_cast<uint8_t*>(shared_memory->data()),
diff --git a/webrtc/modules/desktop_capture/desktop_frame.h b/webrtc/modules/desktop_capture/desktop_frame.h
index cdfd829..3cd839c 100644
--- a/webrtc/modules/desktop_capture/desktop_frame.h
+++ b/webrtc/modules/desktop_capture/desktop_frame.h
@@ -11,7 +11,8 @@
 #ifndef WEBRTC_MODULES_DESKTOP_CAPTURE_DESKTOP_FRAME_H_
 #define WEBRTC_MODULES_DESKTOP_CAPTURE_DESKTOP_FRAME_H_
 
-#include "webrtc/base/scoped_ptr.h"
+#include <memory>
+
 #include "webrtc/modules/desktop_capture/desktop_geometry.h"
 #include "webrtc/modules/desktop_capture/desktop_region.h"
 #include "webrtc/modules/desktop_capture/shared_memory.h"
@@ -88,7 +89,7 @@
   DesktopRegion updated_region_;
   DesktopVector dpi_;
   int64_t capture_time_ms_;
-  rtc::scoped_ptr<DesktopRegion> shape_;
+  std::unique_ptr<DesktopRegion> shape_;
 
  private:
   RTC_DISALLOW_COPY_AND_ASSIGN(DesktopFrame);
@@ -110,7 +111,7 @@
 // A DesktopFrame that stores data in shared memory.
 class SharedMemoryDesktopFrame : public DesktopFrame {
  public:
-  static rtc::scoped_ptr<DesktopFrame> Create(
+  static std::unique_ptr<DesktopFrame> Create(
       DesktopSize size,
       SharedMemoryFactory* shared_memory_factory);
 
@@ -121,7 +122,7 @@
                            SharedMemory* shared_memory);
   SharedMemoryDesktopFrame(DesktopSize size,
                            int stride,
-                           rtc::scoped_ptr<SharedMemory> shared_memory);
+                           std::unique_ptr<SharedMemory> shared_memory);
   ~SharedMemoryDesktopFrame() override;
 
  private:
diff --git a/webrtc/modules/desktop_capture/desktop_frame_win.cc b/webrtc/modules/desktop_capture/desktop_frame_win.cc
index 22f9742..f139fb5 100644
--- a/webrtc/modules/desktop_capture/desktop_frame_win.cc
+++ b/webrtc/modules/desktop_capture/desktop_frame_win.cc
@@ -19,7 +19,7 @@
 DesktopFrameWin::DesktopFrameWin(DesktopSize size,
                                  int stride,
                                  uint8_t* data,
-                                 rtc::scoped_ptr<SharedMemory> shared_memory,
+                                 std::unique_ptr<SharedMemory> shared_memory,
                                  HBITMAP bitmap)
     : DesktopFrame(size, stride, data, shared_memory.get()),
       bitmap_(bitmap),
@@ -46,10 +46,11 @@
   bmi.bmiHeader.biSize = sizeof(bmi.bmiHeader);
   bmi.bmiHeader.biSizeImage = bytes_per_row * size.height();
 
-  rtc::scoped_ptr<SharedMemory> shared_memory;
+  std::unique_ptr<SharedMemory> shared_memory;
   HANDLE section_handle = nullptr;
   if (shared_memory_factory) {
-    shared_memory = shared_memory_factory->CreateSharedMemory(buffer_size);
+    shared_memory = rtc::ScopedToUnique(
+        shared_memory_factory->CreateSharedMemory(buffer_size));
     if (shared_memory)
       section_handle = shared_memory->handle();
   }
diff --git a/webrtc/modules/desktop_capture/desktop_frame_win.h b/webrtc/modules/desktop_capture/desktop_frame_win.h
index fffaeab..929d23c 100644
--- a/webrtc/modules/desktop_capture/desktop_frame_win.h
+++ b/webrtc/modules/desktop_capture/desktop_frame_win.h
@@ -11,9 +11,10 @@
 #ifndef WEBRTC_MODULES_DESKTOP_CAPTURE_DESKTOP_FRAME_WIN_H_
 #define WEBRTC_MODULES_DESKTOP_CAPTURE_DESKTOP_FRAME_WIN_H_
 
+#include <memory>
+
 #include <windows.h>
 
-#include "webrtc/base/scoped_ptr.h"
 #include "webrtc/modules/desktop_capture/desktop_frame.h"
 #include "webrtc/typedefs.h"
 
@@ -34,11 +35,11 @@
   DesktopFrameWin(DesktopSize size,
                   int stride,
                   uint8_t* data,
-                  rtc::scoped_ptr<SharedMemory> shared_memory,
+                  std::unique_ptr<SharedMemory> shared_memory,
                   HBITMAP bitmap);
 
   HBITMAP bitmap_;
-  rtc::scoped_ptr<SharedMemory> owned_shared_memory_;
+  std::unique_ptr<SharedMemory> owned_shared_memory_;
 
   RTC_DISALLOW_COPY_AND_ASSIGN(DesktopFrameWin);
 };
diff --git a/webrtc/modules/desktop_capture/differ.h b/webrtc/modules/desktop_capture/differ.h
index b3b0e7c..c3dcd4b 100644
--- a/webrtc/modules/desktop_capture/differ.h
+++ b/webrtc/modules/desktop_capture/differ.h
@@ -11,9 +11,9 @@
 #ifndef WEBRTC_MODULES_DESKTOP_CAPTURE_DIFFER_H_
 #define WEBRTC_MODULES_DESKTOP_CAPTURE_DIFFER_H_
 
+#include <memory>
 #include <vector>
 
-#include "webrtc/base/scoped_ptr.h"
 #include "webrtc/modules/desktop_capture/desktop_region.h"
 
 namespace webrtc {
@@ -74,7 +74,7 @@
   int bytes_per_row_;
 
   // Diff information for each block in the image.
-  rtc::scoped_ptr<bool[]> diff_info_;
+  std::unique_ptr<bool[]> diff_info_;
 
   // Dimensions and total size of diff info array.
   int diff_info_width_;
diff --git a/webrtc/modules/desktop_capture/differ_unittest.cc b/webrtc/modules/desktop_capture/differ_unittest.cc
index 642cb37..df4e6a4 100644
--- a/webrtc/modules/desktop_capture/differ_unittest.cc
+++ b/webrtc/modules/desktop_capture/differ_unittest.cc
@@ -8,8 +8,9 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
+#include <memory>
+
 #include "testing/gmock/include/gmock/gmock.h"
-#include "webrtc/base/scoped_ptr.h"
 #include "webrtc/modules/desktop_capture/differ.h"
 #include "webrtc/modules/desktop_capture/differ_block.h"
 
@@ -188,7 +189,7 @@
   }
 
   // The differ class we're testing.
-  rtc::scoped_ptr<Differ> differ_;
+  std::unique_ptr<Differ> differ_;
 
   // Screen/buffer info.
   int width_;
@@ -200,8 +201,8 @@
   int buffer_size_;
 
   // Previous and current screen buffers.
-  rtc::scoped_ptr<uint8_t[]> prev_;
-  rtc::scoped_ptr<uint8_t[]> curr_;
+  std::unique_ptr<uint8_t[]> prev_;
+  std::unique_ptr<uint8_t[]> curr_;
 
  private:
   RTC_DISALLOW_COPY_AND_ASSIGN(DifferTest);
diff --git a/webrtc/modules/desktop_capture/mac/desktop_configuration_monitor.h b/webrtc/modules/desktop_capture/mac/desktop_configuration_monitor.h
index b2fa81a..2f2dd72 100644
--- a/webrtc/modules/desktop_capture/mac/desktop_configuration_monitor.h
+++ b/webrtc/modules/desktop_capture/mac/desktop_configuration_monitor.h
@@ -13,9 +13,9 @@
 
 #include <ApplicationServices/ApplicationServices.h>
 
+#include <memory>
 #include <set>
 
-#include "webrtc/base/scoped_ptr.h"
 #include "webrtc/modules/desktop_capture/mac/desktop_configuration.h"
 #include "webrtc/system_wrappers/include/atomic32.h"
 
@@ -56,7 +56,7 @@
   Atomic32 ref_count_;
   std::set<CGDirectDisplayID> reconfiguring_displays_;
   MacDesktopConfiguration desktop_configuration_;
-  rtc::scoped_ptr<EventWrapper> display_configuration_capture_event_;
+  std::unique_ptr<EventWrapper> display_configuration_capture_event_;
 
   RTC_DISALLOW_COPY_AND_ASSIGN(DesktopConfigurationMonitor);
 };
diff --git a/webrtc/modules/desktop_capture/mouse_cursor.h b/webrtc/modules/desktop_capture/mouse_cursor.h
index dd5dc0e..4662fea 100644
--- a/webrtc/modules/desktop_capture/mouse_cursor.h
+++ b/webrtc/modules/desktop_capture/mouse_cursor.h
@@ -11,8 +11,9 @@
 #ifndef WEBRTC_MODULES_DESKTOP_CAPTURE_MOUSE_CURSOR_H_
 #define WEBRTC_MODULES_DESKTOP_CAPTURE_MOUSE_CURSOR_H_
 
+#include <memory>
+
 #include "webrtc/base/constructormagic.h"
-#include "webrtc/base/scoped_ptr.h"
 #include "webrtc/modules/desktop_capture/desktop_geometry.h"
 
 namespace webrtc {
@@ -37,7 +38,7 @@
   const DesktopVector& hotspot() const { return hotspot_; }
 
  private:
-  rtc::scoped_ptr<DesktopFrame> image_;
+  std::unique_ptr<DesktopFrame> image_;
   DesktopVector hotspot_;
 
   RTC_DISALLOW_COPY_AND_ASSIGN(MouseCursor);
diff --git a/webrtc/modules/desktop_capture/mouse_cursor_monitor_mac.mm b/webrtc/modules/desktop_capture/mouse_cursor_monitor_mac.mm
index 6033127..5d6a9b0 100644
--- a/webrtc/modules/desktop_capture/mouse_cursor_monitor_mac.mm
+++ b/webrtc/modules/desktop_capture/mouse_cursor_monitor_mac.mm
@@ -11,12 +11,14 @@
 #include "webrtc/modules/desktop_capture/mouse_cursor_monitor.h"
 
 #include <assert.h>
+
+#include <memory>
+
 #include <ApplicationServices/ApplicationServices.h>
 #include <Cocoa/Cocoa.h>
 #include <CoreFoundation/CoreFoundation.h>
 
 #include "webrtc/base/macutils.h"
-#include "webrtc/base/scoped_ptr.h"
 #include "webrtc/base/scoped_ref_ptr.h"
 #include "webrtc/modules/desktop_capture/desktop_capture_options.h"
 #include "webrtc/modules/desktop_capture/desktop_frame.h"
@@ -52,7 +54,7 @@
   ScreenId screen_id_;
   Callback* callback_;
   Mode mode_;
-  rtc::scoped_ptr<MouseCursor> last_cursor_;
+  std::unique_ptr<MouseCursor> last_cursor_;
   rtc::scoped_refptr<FullScreenChromeWindowDetector>
       full_screen_chrome_window_detector_;
 };
@@ -268,14 +270,14 @@
 
   // Create a MouseCursor that describes the cursor and pass it to
   // the client.
-  rtc::scoped_ptr<DesktopFrame> image(
+  std::unique_ptr<DesktopFrame> image(
       new BasicDesktopFrame(DesktopSize(size.width(), size.height())));
   memcpy(image->data(), src_data,
          size.width() * size.height() * DesktopFrame::kBytesPerPixel);
 
   CFRelease(image_data_ref);
 
-  rtc::scoped_ptr<MouseCursor> cursor(
+  std::unique_ptr<MouseCursor> cursor(
       new MouseCursor(image.release(), hotspot));
   last_cursor_.reset(MouseCursor::CopyOf(*cursor));
 
diff --git a/webrtc/modules/desktop_capture/mouse_cursor_monitor_unittest.cc b/webrtc/modules/desktop_capture/mouse_cursor_monitor_unittest.cc
index 5d5a81c..35197ef 100644
--- a/webrtc/modules/desktop_capture/mouse_cursor_monitor_unittest.cc
+++ b/webrtc/modules/desktop_capture/mouse_cursor_monitor_unittest.cc
@@ -8,10 +8,11 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
+#include <memory>
+
 #include "webrtc/modules/desktop_capture/mouse_cursor_monitor.h"
 
 #include "testing/gtest/include/gtest/gtest.h"
-#include "webrtc/base/scoped_ptr.h"
 #include "webrtc/modules/desktop_capture/desktop_capture_options.h"
 #include "webrtc/modules/desktop_capture/desktop_frame.h"
 #include "webrtc/modules/desktop_capture/mouse_cursor.h"
@@ -40,7 +41,7 @@
   }
 
  protected:
-  rtc::scoped_ptr<MouseCursor> cursor_image_;
+  std::unique_ptr<MouseCursor> cursor_image_;
   MouseCursorMonitor::CursorState state_;
   DesktopVector position_;
   bool position_received_;
@@ -62,7 +63,7 @@
 #endif
 
 TEST_F(MouseCursorMonitorTest, MAYBE(FromScreen)) {
-  rtc::scoped_ptr<MouseCursorMonitor> capturer(
+  std::unique_ptr<MouseCursorMonitor> capturer(
       MouseCursorMonitor::CreateForScreen(
           DesktopCaptureOptions::CreateDefault(),
           webrtc::kFullDesktopScreenId));
@@ -86,7 +87,7 @@
   DesktopCaptureOptions options = DesktopCaptureOptions::CreateDefault();
 
   // First get list of windows.
-  rtc::scoped_ptr<WindowCapturer> window_capturer(
+  std::unique_ptr<WindowCapturer> window_capturer(
       WindowCapturer::Create(options));
 
   // If window capturing is not supported then skip this test.
@@ -101,7 +102,7 @@
     cursor_image_.reset();
     position_received_ = false;
 
-    rtc::scoped_ptr<MouseCursorMonitor> capturer(
+    std::unique_ptr<MouseCursorMonitor> capturer(
         MouseCursorMonitor::CreateForWindow(
             DesktopCaptureOptions::CreateDefault(), windows[i].id));
     assert(capturer.get());
@@ -116,7 +117,7 @@
 
 // Make sure that OnMouseCursorPosition() is not called in the SHAPE_ONLY mode.
 TEST_F(MouseCursorMonitorTest, MAYBE(ShapeOnly)) {
-  rtc::scoped_ptr<MouseCursorMonitor> capturer(
+  std::unique_ptr<MouseCursorMonitor> capturer(
       MouseCursorMonitor::CreateForScreen(
           DesktopCaptureOptions::CreateDefault(),
           webrtc::kFullDesktopScreenId));
diff --git a/webrtc/modules/desktop_capture/mouse_cursor_monitor_win.cc b/webrtc/modules/desktop_capture/mouse_cursor_monitor_win.cc
index 54dfba2..204bb00 100644
--- a/webrtc/modules/desktop_capture/mouse_cursor_monitor_win.cc
+++ b/webrtc/modules/desktop_capture/mouse_cursor_monitor_win.cc
@@ -12,6 +12,8 @@
 
 #include <assert.h>
 
+#include <memory>
+
 #include "webrtc/modules/desktop_capture/desktop_frame.h"
 #include "webrtc/modules/desktop_capture/mouse_cursor.h"
 #include "webrtc/modules/desktop_capture/win/cursor.h"
@@ -93,7 +95,7 @@
   if (last_cursor_ != cursor_info.hCursor) {
     last_cursor_ = cursor_info.hCursor;
     // Note that |cursor_info.hCursor| does not need to be freed.
-    rtc::scoped_ptr<MouseCursor> cursor(
+    std::unique_ptr<MouseCursor> cursor(
         CreateMouseCursorFromHCursor(desktop_dc_, cursor_info.hCursor));
     if (cursor.get())
       callback_->OnMouseCursor(cursor.release());
diff --git a/webrtc/modules/desktop_capture/mouse_cursor_monitor_x11.cc b/webrtc/modules/desktop_capture/mouse_cursor_monitor_x11.cc
index fc6d76e..357c7c2 100644
--- a/webrtc/modules/desktop_capture/mouse_cursor_monitor_x11.cc
+++ b/webrtc/modules/desktop_capture/mouse_cursor_monitor_x11.cc
@@ -8,13 +8,14 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
+#include <memory>
+
 #include "webrtc/modules/desktop_capture/mouse_cursor_monitor.h"
 
 #include <X11/extensions/Xfixes.h>
 #include <X11/Xlib.h>
 #include <X11/Xutil.h>
 
-#include "webrtc/base/scoped_ptr.h"
 #include "webrtc/modules/desktop_capture/desktop_capture_options.h"
 #include "webrtc/modules/desktop_capture/desktop_frame.h"
 #include "webrtc/modules/desktop_capture/mouse_cursor.h"
@@ -84,7 +85,7 @@
   int xfixes_event_base_;
   int xfixes_error_base_;
 
-  rtc::scoped_ptr<MouseCursor> cursor_shape_;
+  std::unique_ptr<MouseCursor> cursor_shape_;
 };
 
 MouseCursorMonitorX11::MouseCursorMonitorX11(
@@ -190,7 +191,7 @@
        return;
    }
 
-   rtc::scoped_ptr<DesktopFrame> image(
+   std::unique_ptr<DesktopFrame> image(
        new BasicDesktopFrame(DesktopSize(img->width, img->height)));
 
   // Xlib stores 32-bit data in longs, even if longs are 64-bits long.
diff --git a/webrtc/modules/desktop_capture/screen_capture_frame_queue.h b/webrtc/modules/desktop_capture/screen_capture_frame_queue.h
index 6cd9e3b..21af0f3 100644
--- a/webrtc/modules/desktop_capture/screen_capture_frame_queue.h
+++ b/webrtc/modules/desktop_capture/screen_capture_frame_queue.h
@@ -11,7 +11,8 @@
 #ifndef WEBRTC_MODULES_DESKTOP_CAPTURE_SCREEN_CAPTURE_FRAME_QUEUE_H_
 #define WEBRTC_MODULES_DESKTOP_CAPTURE_SCREEN_CAPTURE_FRAME_QUEUE_H_
 
-#include "webrtc/base/scoped_ptr.h"
+#include <memory>
+
 #include "webrtc/modules/desktop_capture/shared_desktop_frame.h"
 #include "webrtc/typedefs.h"
 
@@ -64,7 +65,7 @@
   int current_;
 
   static const int kQueueLength = 2;
-  rtc::scoped_ptr<SharedDesktopFrame> frames_[kQueueLength];
+  std::unique_ptr<SharedDesktopFrame> frames_[kQueueLength];
 
   RTC_DISALLOW_COPY_AND_ASSIGN(ScreenCaptureFrameQueue);
 };
diff --git a/webrtc/modules/desktop_capture/screen_capturer.h b/webrtc/modules/desktop_capture/screen_capturer.h
index fbfb0e5..b4e3488 100644
--- a/webrtc/modules/desktop_capture/screen_capturer.h
+++ b/webrtc/modules/desktop_capture/screen_capturer.h
@@ -13,7 +13,6 @@
 
 #include <vector>
 
-#include "webrtc/base/scoped_ptr.h"
 #include "webrtc/modules/desktop_capture/desktop_capture_types.h"
 #include "webrtc/modules/desktop_capture/desktop_capturer.h"
 #include "webrtc/typedefs.h"
diff --git a/webrtc/modules/desktop_capture/screen_capturer_helper.h b/webrtc/modules/desktop_capture/screen_capturer_helper.h
index da1f2bf..f912378 100644
--- a/webrtc/modules/desktop_capture/screen_capturer_helper.h
+++ b/webrtc/modules/desktop_capture/screen_capturer_helper.h
@@ -11,7 +11,8 @@
 #ifndef WEBRTC_MODULES_DESKTOP_CAPTURE_SCREEN_CAPTURER_HELPER_H_
 #define WEBRTC_MODULES_DESKTOP_CAPTURE_SCREEN_CAPTURER_HELPER_H_
 
-#include "webrtc/base/scoped_ptr.h"
+#include <memory>
+
 #include "webrtc/modules/desktop_capture/desktop_geometry.h"
 #include "webrtc/modules/desktop_capture/desktop_region.h"
 #include "webrtc/system_wrappers/include/rw_lock_wrapper.h"
@@ -70,7 +71,7 @@
   DesktopRegion invalid_region_;
 
   // A lock protecting |invalid_region_| across threads.
-  rtc::scoped_ptr<RWLockWrapper> invalid_region_lock_;
+  std::unique_ptr<RWLockWrapper> invalid_region_lock_;
 
   // The size of the most recently captured screen.
   DesktopSize size_most_recent_;
diff --git a/webrtc/modules/desktop_capture/screen_capturer_helper_unittest.cc b/webrtc/modules/desktop_capture/screen_capturer_helper_unittest.cc
index 1ebc0af..13388b4 100644
--- a/webrtc/modules/desktop_capture/screen_capturer_helper_unittest.cc
+++ b/webrtc/modules/desktop_capture/screen_capturer_helper_unittest.cc
@@ -11,7 +11,6 @@
 #include "webrtc/modules/desktop_capture/screen_capturer_helper.h"
 
 #include "testing/gtest/include/gtest/gtest.h"
-#include "webrtc/base/scoped_ptr.h"
 
 namespace webrtc {
 
diff --git a/webrtc/modules/desktop_capture/screen_capturer_mac.mm b/webrtc/modules/desktop_capture/screen_capturer_mac.mm
index a0f0e54..7cb468f 100644
--- a/webrtc/modules/desktop_capture/screen_capturer_mac.mm
+++ b/webrtc/modules/desktop_capture/screen_capturer_mac.mm
@@ -11,6 +11,8 @@
 #include "webrtc/modules/desktop_capture/screen_capturer.h"
 
 #include <stddef.h>
+
+#include <memory>
 #include <set>
 
 #include <ApplicationServices/ApplicationServices.h>
@@ -21,7 +23,6 @@
 #include <OpenGL/OpenGL.h>
 
 #include "webrtc/base/macutils.h"
-#include "webrtc/base/scoped_ptr.h"
 #include "webrtc/modules/desktop_capture/desktop_capture_options.h"
 #include "webrtc/modules/desktop_capture/desktop_frame.h"
 #include "webrtc/modules/desktop_capture/desktop_geometry.h"
@@ -301,7 +302,7 @@
   virtual ~InvertedDesktopFrame() {}
 
  private:
-  rtc::scoped_ptr<DesktopFrame> original_frame_;
+  std::unique_ptr<DesktopFrame> original_frame_;
 
   RTC_DISALLOW_COPY_AND_ASSIGN(InvertedDesktopFrame);
 };
@@ -957,7 +958,7 @@
 }
 
 DesktopFrame* ScreenCapturerMac::CreateFrame() {
-  rtc::scoped_ptr<DesktopFrame> frame(
+  std::unique_ptr<DesktopFrame> frame(
       new BasicDesktopFrame(screen_pixel_bounds_.size()));
 
   frame->set_dpi(DesktopVector(kStandardDPI * dip_to_pixel_scale_,
@@ -972,7 +973,7 @@
   if (!options.configuration_monitor())
     return NULL;
 
-  rtc::scoped_ptr<ScreenCapturerMac> capturer(
+  std::unique_ptr<ScreenCapturerMac> capturer(
       new ScreenCapturerMac(options.configuration_monitor()));
   if (!capturer->Init())
     capturer.reset();
diff --git a/webrtc/modules/desktop_capture/screen_capturer_mac_unittest.cc b/webrtc/modules/desktop_capture/screen_capturer_mac_unittest.cc
index 737d539..64d649c 100644
--- a/webrtc/modules/desktop_capture/screen_capturer_mac_unittest.cc
+++ b/webrtc/modules/desktop_capture/screen_capturer_mac_unittest.cc
@@ -12,10 +12,10 @@
 
 #include <ApplicationServices/ApplicationServices.h>
 
+#include <memory>
 #include <ostream>
 
 #include "testing/gtest/include/gtest/gtest.h"
-#include "webrtc/base/scoped_ptr.h"
 #include "webrtc/modules/desktop_capture/desktop_frame.h"
 #include "webrtc/modules/desktop_capture/desktop_geometry.h"
 #include "webrtc/modules/desktop_capture/desktop_region.h"
@@ -40,13 +40,13 @@
  protected:
   void SetUp() override { capturer_.reset(ScreenCapturer::Create()); }
 
-  rtc::scoped_ptr<ScreenCapturer> capturer_;
+  std::unique_ptr<ScreenCapturer> capturer_;
   MockScreenCapturerCallback callback_;
 };
 
 void ScreenCapturerMacTest::CaptureDoneCallback1(
     DesktopFrame* frame) {
-  rtc::scoped_ptr<DesktopFrame> owned_frame(frame);
+  std::unique_ptr<DesktopFrame> owned_frame(frame);
 
   MacDesktopConfiguration config = MacDesktopConfiguration::GetCurrent(
       MacDesktopConfiguration::BottomLeftOrigin);
@@ -58,7 +58,7 @@
 
 void ScreenCapturerMacTest::CaptureDoneCallback2(
     DesktopFrame* frame) {
-  rtc::scoped_ptr<DesktopFrame> owned_frame(frame);
+  std::unique_ptr<DesktopFrame> owned_frame(frame);
 
   MacDesktopConfiguration config = MacDesktopConfiguration::GetCurrent(
       MacDesktopConfiguration::BottomLeftOrigin);
diff --git a/webrtc/modules/desktop_capture/screen_capturer_unittest.cc b/webrtc/modules/desktop_capture/screen_capturer_unittest.cc
index 470baaa..72105ac 100644
--- a/webrtc/modules/desktop_capture/screen_capturer_unittest.cc
+++ b/webrtc/modules/desktop_capture/screen_capturer_unittest.cc
@@ -8,6 +8,8 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
+#include <memory>
+
 #include "webrtc/modules/desktop_capture/screen_capturer.h"
 
 #include "testing/gmock/include/gmock/gmock.h"
@@ -34,7 +36,7 @@
   }
 
  protected:
-  rtc::scoped_ptr<ScreenCapturer> capturer_;
+  std::unique_ptr<ScreenCapturer> capturer_;
   MockScreenCapturerCallback callback_;
 };
 
@@ -58,7 +60,8 @@
   ~FakeSharedMemoryFactory() override {}
 
   rtc::scoped_ptr<SharedMemory> CreateSharedMemory(size_t size) override {
-    return rtc_make_scoped_ptr(new FakeSharedMemory(new char[size], size));
+    return rtc::scoped_ptr<SharedMemory>(
+        new FakeSharedMemory(new char[size], size));
   }
 
  private:
@@ -114,7 +117,7 @@
 
   capturer_->Start(&callback_);
   capturer_->SetSharedMemoryFactory(
-      rtc_make_scoped_ptr(new FakeSharedMemoryFactory()));
+      rtc::scoped_ptr<SharedMemoryFactory>(new FakeSharedMemoryFactory()));
   capturer_->Capture(DesktopRegion());
 
   ASSERT_TRUE(frame);
diff --git a/webrtc/modules/desktop_capture/screen_capturer_win.cc b/webrtc/modules/desktop_capture/screen_capturer_win.cc
index 18be4eb..22113a8 100644
--- a/webrtc/modules/desktop_capture/screen_capturer_win.cc
+++ b/webrtc/modules/desktop_capture/screen_capturer_win.cc
@@ -10,6 +10,7 @@
 
 #include "webrtc/modules/desktop_capture/screen_capturer.h"
 
+#include <memory>
 #include <utility>
 
 #include "webrtc/modules/desktop_capture/desktop_capture_options.h"
@@ -20,7 +21,7 @@
 
 // static
 ScreenCapturer* ScreenCapturer::Create(const DesktopCaptureOptions& options) {
-  rtc::scoped_ptr<ScreenCapturer> gdi_capturer(
+  std::unique_ptr<ScreenCapturer> gdi_capturer(
       new ScreenCapturerWinGdi(options));
 
   if (options.allow_use_magnification_api())
diff --git a/webrtc/modules/desktop_capture/screen_capturer_x11.cc b/webrtc/modules/desktop_capture/screen_capturer_x11.cc
index 3a3c418..65e682b 100644
--- a/webrtc/modules/desktop_capture/screen_capturer_x11.cc
+++ b/webrtc/modules/desktop_capture/screen_capturer_x11.cc
@@ -11,6 +11,8 @@
 #include "webrtc/modules/desktop_capture/screen_capturer.h"
 
 #include <string.h>
+
+#include <memory>
 #include <set>
 
 #include <X11/extensions/Xdamage.h>
@@ -19,7 +21,6 @@
 #include <X11/Xutil.h>
 
 #include "webrtc/base/checks.h"
-#include "webrtc/base/scoped_ptr.h"
 #include "webrtc/modules/desktop_capture/desktop_capture_options.h"
 #include "webrtc/modules/desktop_capture/desktop_frame.h"
 #include "webrtc/modules/desktop_capture/differ.h"
@@ -112,7 +113,7 @@
   DesktopRegion last_invalid_region_;
 
   // |Differ| for use when polling for changes.
-  rtc::scoped_ptr<Differ> differ_;
+  std::unique_ptr<Differ> differ_;
 
   RTC_DISALLOW_COPY_AND_ASSIGN(ScreenCapturerLinux);
 };
@@ -253,7 +254,7 @@
   // Note that we can't reallocate other buffers at this point, since the caller
   // may still be reading from them.
   if (!queue_.current_frame()) {
-    rtc::scoped_ptr<DesktopFrame> frame(
+    std::unique_ptr<DesktopFrame> frame(
         new BasicDesktopFrame(x_server_pixel_buffer_.window_size()));
     queue_.ReplaceCurrentFrame(frame.release());
   }
@@ -435,7 +436,7 @@
   if (!options.x_display())
     return NULL;
 
-  rtc::scoped_ptr<ScreenCapturerLinux> capturer(new ScreenCapturerLinux());
+  std::unique_ptr<ScreenCapturerLinux> capturer(new ScreenCapturerLinux());
   if (!capturer->Init(options))
     capturer.reset();
   return capturer.release();
diff --git a/webrtc/modules/desktop_capture/shared_desktop_frame.cc b/webrtc/modules/desktop_capture/shared_desktop_frame.cc
index 1f1aefa..309bac5 100644
--- a/webrtc/modules/desktop_capture/shared_desktop_frame.cc
+++ b/webrtc/modules/desktop_capture/shared_desktop_frame.cc
@@ -10,7 +10,8 @@
 
 #include "webrtc/modules/desktop_capture/shared_desktop_frame.h"
 
-#include "webrtc/base/scoped_ptr.h"
+#include <memory>
+
 #include "webrtc/system_wrappers/include/atomic32.h"
 
 namespace webrtc {
@@ -39,7 +40,7 @@
   virtual ~Core() {}
 
   Atomic32 ref_count_;
-  rtc::scoped_ptr<DesktopFrame> frame_;
+  std::unique_ptr<DesktopFrame> frame_;
 
   RTC_DISALLOW_COPY_AND_ASSIGN(Core);
 };
diff --git a/webrtc/modules/desktop_capture/shared_memory.h b/webrtc/modules/desktop_capture/shared_memory.h
index 0490bc0..45f531e 100644
--- a/webrtc/modules/desktop_capture/shared_memory.h
+++ b/webrtc/modules/desktop_capture/shared_memory.h
@@ -17,8 +17,8 @@
 #include <windows.h>
 #endif
 
-#include "webrtc/base/scoped_ptr.h"
 #include "webrtc/base/constructormagic.h"
+#include "webrtc/base/scoped_ptr.h"
 #include "webrtc/typedefs.h"
 
 namespace webrtc {
diff --git a/webrtc/modules/desktop_capture/win/cursor.cc b/webrtc/modules/desktop_capture/win/cursor.cc
index a3acaf8..304d596 100644
--- a/webrtc/modules/desktop_capture/win/cursor.cc
+++ b/webrtc/modules/desktop_capture/win/cursor.cc
@@ -11,8 +11,8 @@
 #include "webrtc/modules/desktop_capture/win/cursor.h"
 
 #include <algorithm>
+#include <memory>
 
-#include "webrtc/base/scoped_ptr.h"
 #include "webrtc/modules/desktop_capture/win/scoped_gdi_object.h"
 #include "webrtc/modules/desktop_capture/desktop_frame.h"
 #include "webrtc/modules/desktop_capture/desktop_geometry.h"
@@ -135,7 +135,7 @@
 
   int width = bitmap_info.bmWidth;
   int height = bitmap_info.bmHeight;
-  rtc::scoped_ptr<uint32_t[]> mask_data(new uint32_t[width * height]);
+  std::unique_ptr<uint32_t[]> mask_data(new uint32_t[width * height]);
 
   // Get pixel data from |scoped_mask| converting it to 32bpp along the way.
   // GetDIBits() sets the alpha component of every pixel to 0.
@@ -162,7 +162,7 @@
   }
 
   uint32_t* mask_plane = mask_data.get();
-  rtc::scoped_ptr<DesktopFrame> image(
+  std::unique_ptr<DesktopFrame> image(
       new BasicDesktopFrame(DesktopSize(width, height)));
   bool has_alpha = false;
 
diff --git a/webrtc/modules/desktop_capture/win/cursor_unittest.cc b/webrtc/modules/desktop_capture/win/cursor_unittest.cc
index 32bab13..4d52f70 100644
--- a/webrtc/modules/desktop_capture/win/cursor_unittest.cc
+++ b/webrtc/modules/desktop_capture/win/cursor_unittest.cc
@@ -8,8 +8,9 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
+#include <memory>
+
 #include "testing/gmock/include/gmock/gmock.h"
-#include "webrtc/base/scoped_ptr.h"
 #include "webrtc/modules/desktop_capture/desktop_frame.h"
 #include "webrtc/modules/desktop_capture/desktop_geometry.h"
 #include "webrtc/modules/desktop_capture/mouse_cursor.h"
@@ -34,7 +35,7 @@
 
   // Convert |cursor| to |mouse_shape|.
   HDC dc = GetDC(NULL);
-  rtc::scoped_ptr<MouseCursor> mouse_shape(
+  std::unique_ptr<MouseCursor> mouse_shape(
       CreateMouseCursorFromHCursor(dc, cursor));
   ReleaseDC(NULL, dc);
 
@@ -62,7 +63,7 @@
 
   // Get the pixels from |scoped_color|.
   int size = width * height;
-  rtc::scoped_ptr<uint32_t[]> data(new uint32_t[size]);
+  std::unique_ptr<uint32_t[]> data(new uint32_t[size]);
   EXPECT_TRUE(GetBitmapBits(scoped_color, size * sizeof(uint32_t), data.get()));
 
   // Compare the 32bpp image in |mouse_shape| with the one loaded from |right|.
diff --git a/webrtc/modules/desktop_capture/win/desktop.h b/webrtc/modules/desktop_capture/win/desktop.h
index dc3b8c6..bc4192d 100644
--- a/webrtc/modules/desktop_capture/win/desktop.h
+++ b/webrtc/modules/desktop_capture/win/desktop.h
@@ -15,7 +15,6 @@
 #include <string>
 
 #include "webrtc/base/constructormagic.h"
-#include "webrtc/base/scoped_ptr.h"
 
 namespace webrtc {
 
diff --git a/webrtc/modules/desktop_capture/win/scoped_thread_desktop.cc b/webrtc/modules/desktop_capture/win/scoped_thread_desktop.cc
index 12f9e89..2d829d3 100644
--- a/webrtc/modules/desktop_capture/win/scoped_thread_desktop.cc
+++ b/webrtc/modules/desktop_capture/win/scoped_thread_desktop.cc
@@ -42,7 +42,7 @@
 bool ScopedThreadDesktop::SetThreadDesktop(Desktop* desktop) {
   Revert();
 
-  rtc::scoped_ptr<Desktop> scoped_desktop(desktop);
+  std::unique_ptr<Desktop> scoped_desktop(desktop);
 
   if (initial_->IsSame(*desktop))
     return true;
diff --git a/webrtc/modules/desktop_capture/win/scoped_thread_desktop.h b/webrtc/modules/desktop_capture/win/scoped_thread_desktop.h
index df8652a..023e6df 100644
--- a/webrtc/modules/desktop_capture/win/scoped_thread_desktop.h
+++ b/webrtc/modules/desktop_capture/win/scoped_thread_desktop.h
@@ -11,10 +11,11 @@
 #ifndef WEBRTC_MODULES_DESKTOP_CAPTURE_WIN_SCOPED_THREAD_DESKTOP_H_
 #define WEBRTC_MODULES_DESKTOP_CAPTURE_WIN_SCOPED_THREAD_DESKTOP_H_
 
+#include <memory>
+
 #include <windows.h>
 
 #include "webrtc/base/constructormagic.h"
-#include "webrtc/base/scoped_ptr.h"
 
 namespace webrtc {
 
@@ -40,10 +41,10 @@
 
  private:
   // The desktop handle assigned to the calling thread by Set
-  rtc::scoped_ptr<Desktop> assigned_;
+  std::unique_ptr<Desktop> assigned_;
 
   // The desktop handle assigned to the calling thread at creation.
-  rtc::scoped_ptr<Desktop> initial_;
+  std::unique_ptr<Desktop> initial_;
 
   RTC_DISALLOW_COPY_AND_ASSIGN(ScopedThreadDesktop);
 };
diff --git a/webrtc/modules/desktop_capture/win/screen_capturer_win_gdi.cc b/webrtc/modules/desktop_capture/win/screen_capturer_win_gdi.cc
index 19079bc..d3035a1 100644
--- a/webrtc/modules/desktop_capture/win/screen_capturer_win_gdi.cc
+++ b/webrtc/modules/desktop_capture/win/screen_capturer_win_gdi.cc
@@ -45,7 +45,7 @@
   ~CallbackSharedMemoryFactory() override {}
 
   rtc::scoped_ptr<SharedMemory> CreateSharedMemory(size_t size) override {
-    return rtc_make_scoped_ptr(callback_->CreateSharedMemory(size));
+    return rtc::scoped_ptr<SharedMemory>(callback_->CreateSharedMemory(size));
   }
 
  private:
@@ -90,7 +90,8 @@
 
 void ScreenCapturerWinGdi::SetSharedMemoryFactory(
     rtc::scoped_ptr<SharedMemoryFactory> shared_memory_factory) {
-  shared_memory_factory_ = std::move(shared_memory_factory);
+  shared_memory_factory_ =
+      rtc::ScopedToUnique(std::move(shared_memory_factory));
 }
 
 void ScreenCapturerWinGdi::Capture(const DesktopRegion& region) {
@@ -184,7 +185,7 @@
 void ScreenCapturerWinGdi::PrepareCaptureResources() {
   // Switch to the desktop receiving user input if different from the current
   // one.
-  rtc::scoped_ptr<Desktop> input_desktop(Desktop::GetInputDesktop());
+  std::unique_ptr<Desktop> input_desktop(Desktop::GetInputDesktop());
   if (input_desktop.get() != NULL && !desktop_.IsSame(*input_desktop)) {
     // Release GDI resources otherwise SetThreadDesktop will fail.
     if (desktop_dc_) {
@@ -262,7 +263,7 @@
     assert(desktop_dc_ != NULL);
     assert(memory_dc_ != NULL);
 
-    rtc::scoped_ptr<DesktopFrame> buffer(DesktopFrameWin::Create(
+    std::unique_ptr<DesktopFrame> buffer(DesktopFrameWin::Create(
         size, shared_memory_factory_.get(), desktop_dc_));
     if (!buffer.get())
       return false;
diff --git a/webrtc/modules/desktop_capture/win/screen_capturer_win_gdi.h b/webrtc/modules/desktop_capture/win/screen_capturer_win_gdi.h
index a91e744..17cb0aa 100644
--- a/webrtc/modules/desktop_capture/win/screen_capturer_win_gdi.h
+++ b/webrtc/modules/desktop_capture/win/screen_capturer_win_gdi.h
@@ -11,6 +11,8 @@
 #ifndef WEBRTC_MODULES_DESKTOP_CAPTURE_WIN_SCREEN_CAPTURER_WIN_GDI_H_
 #define WEBRTC_MODULES_DESKTOP_CAPTURE_WIN_SCREEN_CAPTURER_WIN_GDI_H_
 
+#include <memory>
+
 #include "webrtc/modules/desktop_capture/screen_capturer.h"
 
 #include <windows.h>
@@ -54,7 +56,7 @@
   void CaptureCursor();
 
   Callback* callback_;
-  rtc::scoped_ptr<SharedMemoryFactory> shared_memory_factory_;
+  std::unique_ptr<SharedMemoryFactory> shared_memory_factory_;
   ScreenId current_screen_id_;
   std::wstring current_device_key_;
 
@@ -76,7 +78,7 @@
   DesktopRect desktop_dc_rect_;
 
   // Class to calculate the difference between two screen bitmaps.
-  rtc::scoped_ptr<Differ> differ_;
+  std::unique_ptr<Differ> differ_;
 
   HMODULE dwmapi_library_;
   DwmEnableCompositionFunc composition_func_;
diff --git a/webrtc/modules/desktop_capture/win/screen_capturer_win_magnifier.cc b/webrtc/modules/desktop_capture/win/screen_capturer_win_magnifier.cc
index 29f0c74..8af9779 100644
--- a/webrtc/modules/desktop_capture/win/screen_capturer_win_magnifier.cc
+++ b/webrtc/modules/desktop_capture/win/screen_capturer_win_magnifier.cc
@@ -38,7 +38,7 @@
 Atomic32 ScreenCapturerWinMagnifier::tls_index_(TLS_OUT_OF_INDEXES);
 
 ScreenCapturerWinMagnifier::ScreenCapturerWinMagnifier(
-    rtc::scoped_ptr<ScreenCapturer> fallback_capturer)
+    std::unique_ptr<ScreenCapturer> fallback_capturer)
     : fallback_capturer_(std::move(fallback_capturer)),
       fallback_capturer_started_(false),
       callback_(NULL),
@@ -83,7 +83,8 @@
 
 void ScreenCapturerWinMagnifier::SetSharedMemoryFactory(
     rtc::scoped_ptr<SharedMemoryFactory> shared_memory_factory) {
-  shared_memory_factory_ = std::move(shared_memory_factory);
+  shared_memory_factory_ =
+      rtc::ScopedToUnique(std::move(shared_memory_factory));
 }
 
 void ScreenCapturerWinMagnifier::Capture(const DesktopRegion& region) {
@@ -101,7 +102,7 @@
   }
   // Switch to the desktop receiving user input if different from the current
   // one.
-  rtc::scoped_ptr<Desktop> input_desktop(Desktop::GetInputDesktop());
+  std::unique_ptr<Desktop> input_desktop(Desktop::GetInputDesktop());
   if (input_desktop.get() != NULL && !desktop_.IsSame(*input_desktop)) {
     // Release GDI resources otherwise SetThreadDesktop will fail.
     if (desktop_dc_) {
@@ -427,11 +428,11 @@
   // Note that we can't reallocate other buffers at this point, since the caller
   // may still be reading from them.
   if (!queue_.current_frame() || !queue_.current_frame()->size().equals(size)) {
-    rtc::scoped_ptr<DesktopFrame> frame =
+    std::unique_ptr<DesktopFrame> frame =
         shared_memory_factory_
             ? SharedMemoryDesktopFrame::Create(size,
                                                shared_memory_factory_.get())
-            : rtc::scoped_ptr<DesktopFrame>(new BasicDesktopFrame(size));
+            : std::unique_ptr<DesktopFrame>(new BasicDesktopFrame(size));
     queue_.ReplaceCurrentFrame(frame.release());
   }
 }
diff --git a/webrtc/modules/desktop_capture/win/screen_capturer_win_magnifier.h b/webrtc/modules/desktop_capture/win/screen_capturer_win_magnifier.h
index 4a037be..d5e3946 100644
--- a/webrtc/modules/desktop_capture/win/screen_capturer_win_magnifier.h
+++ b/webrtc/modules/desktop_capture/win/screen_capturer_win_magnifier.h
@@ -11,6 +11,8 @@
 #ifndef WEBRTC_MODULES_DESKTOP_CAPTURE_WIN_SCREEN_CAPTURER_WIN_MAGNIFIER_H_
 #define WEBRTC_MODULES_DESKTOP_CAPTURE_WIN_SCREEN_CAPTURER_WIN_MAGNIFIER_H_
 
+#include <memory>
+
 #include <windows.h>
 #include <magnification.h>
 #include <wincodec.h>
@@ -39,7 +41,7 @@
   // screen is being captured, or the OS does not support Magnification API, or
   // the magnifier capturer fails (e.g. in Windows8 Metro mode).
   explicit ScreenCapturerWinMagnifier(
-      rtc::scoped_ptr<ScreenCapturer> fallback_capturer);
+      std::unique_ptr<ScreenCapturer> fallback_capturer);
   virtual ~ScreenCapturerWinMagnifier();
 
   // Overridden from ScreenCapturer:
@@ -103,10 +105,10 @@
 
   static Atomic32 tls_index_;
 
-  rtc::scoped_ptr<ScreenCapturer> fallback_capturer_;
+  std::unique_ptr<ScreenCapturer> fallback_capturer_;
   bool fallback_capturer_started_;
   Callback* callback_;
-  rtc::scoped_ptr<SharedMemoryFactory> shared_memory_factory_;
+  std::unique_ptr<SharedMemoryFactory> shared_memory_factory_;
   ScreenId current_screen_id_;
   std::wstring current_device_key_;
   HWND excluded_window_;
@@ -119,7 +121,7 @@
   ScreenCaptureFrameQueue queue_;
 
   // Class to calculate the difference between two screen bitmaps.
-  rtc::scoped_ptr<Differ> differ_;
+  std::unique_ptr<Differ> differ_;
 
   // Used to suppress duplicate logging of SetThreadExecutionState errors.
   bool set_thread_execution_state_failed_;
diff --git a/webrtc/modules/desktop_capture/window_capturer_unittest.cc b/webrtc/modules/desktop_capture/window_capturer_unittest.cc
index 45f2d1a..32b8b8f 100644
--- a/webrtc/modules/desktop_capture/window_capturer_unittest.cc
+++ b/webrtc/modules/desktop_capture/window_capturer_unittest.cc
@@ -8,10 +8,11 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
+#include <memory>
+
 #include "webrtc/modules/desktop_capture/window_capturer.h"
 
 #include "testing/gtest/include/gtest/gtest.h"
-#include "webrtc/base/scoped_ptr.h"
 #include "webrtc/modules/desktop_capture/desktop_capture_options.h"
 #include "webrtc/modules/desktop_capture/desktop_frame.h"
 #include "webrtc/modules/desktop_capture/desktop_region.h"
@@ -33,8 +34,8 @@
   void OnCaptureCompleted(DesktopFrame* frame) override { frame_.reset(frame); }
 
  protected:
-  rtc::scoped_ptr<WindowCapturer> capturer_;
-  rtc::scoped_ptr<DesktopFrame> frame_;
+  std::unique_ptr<WindowCapturer> capturer_;
+  std::unique_ptr<DesktopFrame> frame_;
 };
 
 // Verify that we can enumerate windows.
diff --git a/webrtc/modules/desktop_capture/window_capturer_win.cc b/webrtc/modules/desktop_capture/window_capturer_win.cc
index 9f0ca40..0d594a2 100644
--- a/webrtc/modules/desktop_capture/window_capturer_win.cc
+++ b/webrtc/modules/desktop_capture/window_capturer_win.cc
@@ -12,7 +12,8 @@
 
 #include <assert.h>
 
-#include "webrtc/base/scoped_ptr.h"
+#include <memory>
+
 #include "webrtc/base/checks.h"
 #include "webrtc/base/win32.h"
 #include "webrtc/modules/desktop_capture/desktop_frame_win.h"
@@ -204,7 +205,7 @@
     return;
   }
 
-  rtc::scoped_ptr<DesktopFrameWin> frame(
+  std::unique_ptr<DesktopFrameWin> frame(
       DesktopFrameWin::Create(cropped_rect.size(), NULL, window_dc));
   if (!frame.get()) {
     ReleaseDC(window_, window_dc);
diff --git a/webrtc/modules/desktop_capture/window_capturer_x11.cc b/webrtc/modules/desktop_capture/window_capturer_x11.cc
index f0d2c12..68e1725 100755
--- a/webrtc/modules/desktop_capture/window_capturer_x11.cc
+++ b/webrtc/modules/desktop_capture/window_capturer_x11.cc
@@ -19,7 +19,6 @@
 
 #include <algorithm>
 
-#include "webrtc/base/scoped_ptr.h"
 #include "webrtc/base/scoped_ref_ptr.h"
 #include "webrtc/modules/desktop_capture/desktop_capture_options.h"
 #include "webrtc/modules/desktop_capture/desktop_frame.h"