Convert //tools to use std::unique_ptr

BUG=554298

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

Cr-Original-Commit-Position: refs/heads/master@{#386168}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: a500b69aa06c2bc084a3b1867b9824f4218014de
diff --git a/tools/gn/build_settings.cc b/tools/gn/build_settings.cc
index 72a74c3..14f1aa8 100644
--- a/tools/gn/build_settings.cc
+++ b/tools/gn/build_settings.cc
@@ -59,7 +59,7 @@
   return dir.Resolve(secondary_source_path_).NormalizePathSeparatorsTo('/');
 }
 
-void BuildSettings::ItemDefined(scoped_ptr<Item> item) const {
+void BuildSettings::ItemDefined(std::unique_ptr<Item> item) const {
   DCHECK(item);
   if (!item_defined_callback_.is_null())
     item_defined_callback_.Run(std::move(item));
diff --git a/tools/gn/build_settings.h b/tools/gn/build_settings.h
index 8fe2ce9..5424cf9 100644
--- a/tools/gn/build_settings.h
+++ b/tools/gn/build_settings.h
@@ -6,13 +6,13 @@
 #define TOOLS_GN_BUILD_SETTINGS_H_
 
 #include <map>
+#include <memory>
 #include <set>
 #include <utility>
 
 #include "base/callback.h"
 #include "base/files/file_path.h"
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "tools/gn/args.h"
 #include "tools/gn/scope.h"
 #include "tools/gn/source_dir.h"
@@ -24,7 +24,7 @@
 // may be multiple Settings objects that refer to this, one for each toolchain.
 class BuildSettings {
  public:
-  typedef base::Callback<void(scoped_ptr<Item>)> ItemDefinedCallback;
+  typedef base::Callback<void(std::unique_ptr<Item>)> ItemDefinedCallback;
   typedef base::Callback<void(const std::string&)> PrintCallback;
 
   BuildSettings();
@@ -74,7 +74,7 @@
   base::FilePath GetFullPathSecondary(const SourceDir& dir) const;
 
   // Called when an item is defined from a background thread.
-  void ItemDefined(scoped_ptr<Item> item) const;
+  void ItemDefined(std::unique_ptr<Item> item) const;
   void set_item_defined_callback(ItemDefinedCallback cb) {
     item_defined_callback_ = cb;
   }
@@ -91,7 +91,7 @@
   const std::set<SourceFile>* exec_script_whitelist() const {
     return exec_script_whitelist_.get();
   }
-  void set_exec_script_whitelist(scoped_ptr<std::set<SourceFile>> list) {
+  void set_exec_script_whitelist(std::unique_ptr<std::set<SourceFile>> list) {
     exec_script_whitelist_ = std::move(list);
   }
 
@@ -120,7 +120,7 @@
   ItemDefinedCallback item_defined_callback_;
   PrintCallback print_callback_;
 
-  scoped_ptr<std::set<SourceFile>> exec_script_whitelist_;
+  std::unique_ptr<std::set<SourceFile>> exec_script_whitelist_;
 
   bool check_for_bad_items_;
 
diff --git a/tools/gn/builder.cc b/tools/gn/builder.cc
index a05493b..22b4c47 100644
--- a/tools/gn/builder.cc
+++ b/tools/gn/builder.cc
@@ -58,7 +58,7 @@
 Builder::~Builder() {
 }
 
-void Builder::ItemDefined(scoped_ptr<Item> item) {
+void Builder::ItemDefined(std::unique_ptr<Item> item) {
   ScopedTrace trace(TraceItem::TRACE_DEFINE_TARGET, item->label());
   trace.SetToolchain(item->settings()->toolchain_label());
 
diff --git a/tools/gn/builder.h b/tools/gn/builder.h
index 3a22266..0445976 100644
--- a/tools/gn/builder.h
+++ b/tools/gn/builder.h
@@ -33,7 +33,7 @@
 
   Loader* loader() const { return loader_; }
 
-  void ItemDefined(scoped_ptr<Item> item);
+  void ItemDefined(std::unique_ptr<Item> item);
 
   // Returns NULL if there is not a thing with the corresponding label.
   const Item* GetItem(const Label& label) const;
diff --git a/tools/gn/builder_record.h b/tools/gn/builder_record.h
index 469b1cf..a767c9b 100644
--- a/tools/gn/builder_record.h
+++ b/tools/gn/builder_record.h
@@ -5,11 +5,11 @@
 #ifndef TOOLS_GN_BUILDER_RECORD_H_
 #define TOOLS_GN_BUILDER_RECORD_H_
 
+#include <memory>
 #include <set>
 #include <utility>
 
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "tools/gn/item.h"
 #include "tools/gn/location.h"
 
@@ -55,7 +55,7 @@
 
   Item* item() { return item_.get(); }
   const Item* item() const { return item_.get(); }
-  void set_item(scoped_ptr<Item> item) { item_ = std::move(item); }
+  void set_item(std::unique_ptr<Item> item) { item_ = std::move(item); }
 
   // Indicates from where this item was originally referenced from that caused
   // it to be loaded. For targets for which we encountered the declaration
@@ -97,7 +97,7 @@
  private:
   ItemType type_;
   Label label_;
-  scoped_ptr<Item> item_;
+  std::unique_ptr<Item> item_;
   const ParseNode* originally_referenced_from_;
   bool should_generate_;
   bool resolved_;
diff --git a/tools/gn/builder_unittest.cc b/tools/gn/builder_unittest.cc
index 5129063..96fad7d 100644
--- a/tools/gn/builder_unittest.cc
+++ b/tools/gn/builder_unittest.cc
@@ -78,7 +78,7 @@
   Toolchain* DefineToolchain() {
     Toolchain* tc = new Toolchain(&settings_, settings_.toolchain_label());
     TestWithScope::SetupToolchain(tc);
-    builder_->ItemDefined(scoped_ptr<Item>(tc));
+    builder_->ItemDefined(std::unique_ptr<Item>(tc));
     return tc;
   }
 
@@ -107,7 +107,7 @@
   Target* a = new Target(&settings_, a_label);
   a->public_deps().push_back(LabelTargetPair(b_label));
   a->set_output_type(Target::EXECUTABLE);
-  builder_->ItemDefined(scoped_ptr<Item>(a));
+  builder_->ItemDefined(std::unique_ptr<Item>(a));
 
   // Should have requested that B and the toolchain is loaded.
   EXPECT_TRUE(loader_->HasLoadedTwo(SourceFile("//tc/BUILD.gn"),
@@ -152,7 +152,7 @@
   Target* c = new Target(&settings_, c_label);
   c->set_output_type(Target::STATIC_LIBRARY);
   c->visibility().SetPublic();
-  builder_->ItemDefined(scoped_ptr<Item>(c));
+  builder_->ItemDefined(std::unique_ptr<Item>(c));
 
   // C only depends on the already-loaded toolchain so we shouldn't have
   // requested anything else.
@@ -163,7 +163,7 @@
   a->public_deps().push_back(LabelTargetPair(c_label));
   b->set_output_type(Target::SHARED_LIBRARY);
   b->visibility().SetPublic();
-  builder_->ItemDefined(scoped_ptr<Item>(b));
+  builder_->ItemDefined(std::unique_ptr<Item>(b));
 
   // B depends only on the already-loaded C and toolchain so we shouldn't have
   // requested anything else.
@@ -194,7 +194,7 @@
   settings2.set_toolchain_label(toolchain_label2);
   Toolchain* tc2 = new Toolchain(&settings2, toolchain_label2);
   TestWithScope::SetupToolchain(tc2);
-  builder_->ItemDefined(scoped_ptr<Item>(tc2));
+  builder_->ItemDefined(std::unique_ptr<Item>(tc2));
 
   // Construct a dependency chain: A -> B. A is in the default toolchain, B
   // is not.
@@ -207,7 +207,7 @@
   Target* b = new Target(&settings2, b_label);
   b->visibility().SetPublic();
   b->set_output_type(Target::EXECUTABLE);
-  builder_->ItemDefined(scoped_ptr<Item>(b));
+  builder_->ItemDefined(std::unique_ptr<Item>(b));
 
   // B should not be marked generated by default.
   BuilderRecord* b_record = builder_->GetRecord(b_label);
@@ -217,7 +217,7 @@
   Target* a = new Target(&settings_, a_label);
   a->public_deps().push_back(LabelTargetPair(b_label));
   a->set_output_type(Target::EXECUTABLE);
-  builder_->ItemDefined(scoped_ptr<Item>(a));
+  builder_->ItemDefined(std::unique_ptr<Item>(a));
 
   // A should have the generate bit set since it's in the default toolchain.
   BuilderRecord* a_record = builder_->GetRecord(a_label);
@@ -242,7 +242,7 @@
   // The builder will take ownership of the pointers.
   Config* a = new Config(&settings_, a_label);
   a->configs().push_back(LabelConfigPair(b_label));
-  builder_->ItemDefined(scoped_ptr<Item>(a));
+  builder_->ItemDefined(std::unique_ptr<Item>(a));
 
   // Should have requested that B is loaded.
   EXPECT_TRUE(loader_->HasLoadedOne(SourceFile("//b/BUILD.gn")));
diff --git a/tools/gn/command_format.cc b/tools/gn/command_format.cc
index ae36e37..a054b21 100644
--- a/tools/gn/command_format.cc
+++ b/tools/gn/command_format.cc
@@ -982,7 +982,7 @@
   }
 
   // Parse.
-  scoped_ptr<ParseNode> parse_node = Parser::Parse(tokens, &err);
+  std::unique_ptr<ParseNode> parse_node = Parser::Parse(tokens, &err);
   if (err.has_error()) {
     err.PrintToStdout();
     return false;
diff --git a/tools/gn/eclipse_writer.cc b/tools/gn/eclipse_writer.cc
index e38e247..ee91f61 100644
--- a/tools/gn/eclipse_writer.cc
+++ b/tools/gn/eclipse_writer.cc
@@ -5,9 +5,9 @@
 #include "tools/gn/eclipse_writer.h"
 
 #include <fstream>
+#include <memory>
 
 #include "base/files/file_path.h"
-#include "base/memory/scoped_ptr.h"
 #include "tools/gn/builder.h"
 #include "tools/gn/config_values_extractors.h"
 #include "tools/gn/filesystem_utils.h"
@@ -127,7 +127,7 @@
   {
     const char* kIncludesSectionName =
         "org.eclipse.cdt.internal.ui.wizards.settingswizards.IncludePaths";
-    scoped_ptr<XmlElementWriter> section_element =
+    std::unique_ptr<XmlElementWriter> section_element =
         cdt_properties_element.SubElement(
             "section", XmlAttributes("name", kIncludesSectionName));
 
@@ -135,7 +135,7 @@
         "language", XmlAttributes("name", "holder for library settings"));
 
     for (const std::string& language : languages_) {
-      scoped_ptr<XmlElementWriter> language_element =
+      std::unique_ptr<XmlElementWriter> language_element =
           section_element->SubElement("language",
                                       XmlAttributes("name", language));
       for (const std::string& include_dir : include_dirs_) {
@@ -150,7 +150,7 @@
   {
     const char* kMacrosSectionName =
         "org.eclipse.cdt.internal.ui.wizards.settingswizards.Macros";
-    scoped_ptr<XmlElementWriter> section_element =
+    std::unique_ptr<XmlElementWriter> section_element =
         cdt_properties_element.SubElement(
             "section", XmlAttributes("name", kMacrosSectionName));
 
@@ -158,11 +158,11 @@
         "language", XmlAttributes("name", "holder for library settings"));
 
     for (const std::string& language : languages_) {
-      scoped_ptr<XmlElementWriter> language_element =
+      std::unique_ptr<XmlElementWriter> language_element =
           section_element->SubElement("language",
                                       XmlAttributes("name", language));
       for (const auto& key_val : defines_) {
-        scoped_ptr<XmlElementWriter> macro_element =
+        std::unique_ptr<XmlElementWriter> macro_element =
             language_element->SubElement("macro");
         macro_element->SubElement("name")->Text(EscapeForXML(key_val.first));
         macro_element->SubElement("value")->Text(EscapeForXML(key_val.second));
diff --git a/tools/gn/exec_process.cc b/tools/gn/exec_process.cc
index e5ab248..8a47fbe 100644
--- a/tools/gn/exec_process.cc
+++ b/tools/gn/exec_process.cc
@@ -6,10 +6,11 @@
 
 #include <stddef.h>
 
+#include <memory>
+
 #include "base/command_line.h"
 #include "base/files/file_util.h"
 #include "base/logging.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/process/kill.h"
 #include "base/process/launch.h"
 #include "base/process/process.h"
@@ -157,7 +158,7 @@
   int out_fd[2], err_fd[2];
   pid_t pid;
   base::InjectiveMultimap fd_shuffle1, fd_shuffle2;
-  scoped_ptr<char*[]> argv_cstr(new char*[argv.size() + 1]);
+  std::unique_ptr<char* []> argv_cstr(new char*[argv.size() + 1]);
 
   fd_shuffle1.reserve(3);
   fd_shuffle2.reserve(3);
diff --git a/tools/gn/function_toolchain.cc b/tools/gn/function_toolchain.cc
index 72097f2..f3344ff 100644
--- a/tools/gn/function_toolchain.cc
+++ b/tools/gn/function_toolchain.cc
@@ -324,7 +324,7 @@
 
   // This object will actually be copied into the one owned by the toolchain
   // manager, but that has to be done in the lock.
-  scoped_ptr<Toolchain> toolchain(new Toolchain(scope->settings(), label));
+  std::unique_ptr<Toolchain> toolchain(new Toolchain(scope->settings(), label));
   toolchain->set_defined_from(function);
   toolchain->visibility().SetPublic();
 
@@ -844,7 +844,7 @@
     subst_output_validator = &IsValidToolSubstitution;
   }
 
-  scoped_ptr<Tool> tool(new Tool);
+  std::unique_ptr<Tool> tool(new Tool);
 
   if (!ReadPattern(&block_scope, "command", subst_validator, tool.get(),
                    &Tool::set_command, err) ||
diff --git a/tools/gn/functions.cc b/tools/gn/functions.cc
index fc51cc8..f6d405d 100644
--- a/tools/gn/functions.cc
+++ b/tools/gn/functions.cc
@@ -301,7 +301,7 @@
     g_scheduler->Log("Defining config", label.GetUserVisibleName(true));
 
   // Create the new config.
-  scoped_ptr<Config> config(new Config(scope->settings(), label));
+  std::unique_ptr<Config> config(new Config(scope->settings(), label));
   config->set_defined_from(function);
   if (!Visibility::FillItemVisibility(config.get(), scope, err))
     return Value();
@@ -535,7 +535,7 @@
   if (!EnsureSingleStringArg(function, args, err))
     return Value();
 
-  scoped_ptr<base::Environment> env(base::Environment::Create());
+  std::unique_ptr<base::Environment> env(base::Environment::Create());
 
   std::string result;
   if (!env->GetVar(args[0].string_value().c_str(), &result))
@@ -670,7 +670,7 @@
   if (args.size() != 1) {
     *err = Err(function, "set_sources_assignment_filter takes one argument.");
   } else {
-    scoped_ptr<PatternList> f(new PatternList);
+    std::unique_ptr<PatternList> f(new PatternList);
     f->SetFromValue(args[0], err);
     if (!err->has_error())
       scope->set_sources_assignment_filter(std::move(f));
diff --git a/tools/gn/functions_unittest.cc b/tools/gn/functions_unittest.cc
index e2f6756..2267071 100644
--- a/tools/gn/functions_unittest.cc
+++ b/tools/gn/functions_unittest.cc
@@ -6,6 +6,7 @@
 
 #include <utility>
 
+#include "base/memory/ptr_util.h"
 #include "testing/gtest/include/gtest/gtest.h"
 #include "tools/gn/parse_tree.h"
 #include "tools/gn/test_with_scope.h"
@@ -21,7 +22,7 @@
   Token undefined_token(Location(), Token::IDENTIFIER, "undef");
   ListNode args_list_identifier_undefined;
   args_list_identifier_undefined.append_item(
-      scoped_ptr<ParseNode>(new IdentifierNode(undefined_token)));
+      std::unique_ptr<ParseNode>(new IdentifierNode(undefined_token)));
   Value result = functions::RunDefined(setup.scope(), &function_call,
                                        &args_list_identifier_undefined, &err);
   ASSERT_EQ(Value::BOOLEAN, result.type());
@@ -30,14 +31,14 @@
   // Define a value that's itself a scope value.
   const char kDef[] = "def";  // Defined variable name.
   setup.scope()->SetValue(
-      kDef, Value(nullptr, scoped_ptr<Scope>(new Scope(setup.scope()))),
+      kDef, Value(nullptr, std::unique_ptr<Scope>(new Scope(setup.scope()))),
       nullptr);
 
   // Test the defined identifier.
   Token defined_token(Location(), Token::IDENTIFIER, kDef);
   ListNode args_list_identifier_defined;
   args_list_identifier_defined.append_item(
-      scoped_ptr<ParseNode>(new IdentifierNode(defined_token)));
+      std::unique_ptr<ParseNode>(new IdentifierNode(defined_token)));
   result = functions::RunDefined(setup.scope(), &function_call,
                                  &args_list_identifier_defined, &err);
   ASSERT_EQ(Value::BOOLEAN, result.type());
@@ -45,10 +46,10 @@
 
   // Should also work by passing an accessor node so you can do
   // "defined(def.foo)" to see if foo is defined on the def scope.
-  scoped_ptr<AccessorNode> undef_accessor(new AccessorNode);
+  std::unique_ptr<AccessorNode> undef_accessor(new AccessorNode);
   undef_accessor->set_base(defined_token);
-  undef_accessor->set_member(scoped_ptr<IdentifierNode>(
-      new IdentifierNode(undefined_token)));
+  undef_accessor->set_member(
+      base::WrapUnique(new IdentifierNode(undefined_token)));
   ListNode args_list_accessor_defined;
   args_list_accessor_defined.append_item(std::move(undef_accessor));
   result = functions::RunDefined(setup.scope(), &function_call,
diff --git a/tools/gn/header_checker.cc b/tools/gn/header_checker.cc
index 259f9f6..1002081 100644
--- a/tools/gn/header_checker.cc
+++ b/tools/gn/header_checker.cc
@@ -55,7 +55,7 @@
                                     const LocationRange& range) {
   InputFile* clone_input_file;
   std::vector<Token>* tokens;  // Don't care about this.
-  scoped_ptr<ParseNode>* parse_root;  // Don't care about this.
+  std::unique_ptr<ParseNode>* parse_root;  // Don't care about this.
 
   g_scheduler->input_file_manager()->AddDynamicInput(
       input_file.name(), &clone_input_file, &tokens, &parse_root);
diff --git a/tools/gn/import_manager.cc b/tools/gn/import_manager.cc
index 2d39846..83cc090 100644
--- a/tools/gn/import_manager.cc
+++ b/tools/gn/import_manager.cc
@@ -4,7 +4,8 @@
 
 #include "tools/gn/import_manager.h"
 
-#include "base/memory/scoped_ptr.h"
+#include <memory>
+
 #include "base/stl_util.h"
 #include "tools/gn/parse_tree.h"
 #include "tools/gn/scheduler.h"
@@ -22,7 +23,7 @@
   if (!node)
     return nullptr;
 
-  scoped_ptr<Scope> scope(new Scope(settings->base_config()));
+  std::unique_ptr<Scope> scope(new Scope(settings->base_config()));
   scope->set_source_dir(file.GetDir());
 
   // Don't allow ScopePerFileProvider to provide target-related variables.
diff --git a/tools/gn/input_conversion.cc b/tools/gn/input_conversion.cc
index b43ee12..043737a 100644
--- a/tools/gn/input_conversion.cc
+++ b/tools/gn/input_conversion.cc
@@ -38,7 +38,7 @@
   // so the origin parse nodes for the values will be preserved.
   InputFile* input_file;
   std::vector<Token>* tokens;
-  scoped_ptr<ParseNode>* parse_root_ptr;
+  std::unique_ptr<ParseNode>* parse_root_ptr;
   g_scheduler->input_file_manager()->AddDynamicInput(
       SourceFile(), &input_file, &tokens, &parse_root_ptr);
 
@@ -74,7 +74,7 @@
   if (!parse_root)
     return Value();
 
-  scoped_ptr<Scope> scope(new Scope(settings));
+  std::unique_ptr<Scope> scope(new Scope(settings));
   Value result = parse_root->Execute(scope.get(), err);
   if (err->has_error())
     return Value();
diff --git a/tools/gn/input_file_manager.cc b/tools/gn/input_file_manager.cc
index de84101..a3e6460 100644
--- a/tools/gn/input_file_manager.cc
+++ b/tools/gn/input_file_manager.cc
@@ -27,7 +27,7 @@
                 const SourceFile& name,
                 InputFile* file,
                 std::vector<Token>* tokens,
-                scoped_ptr<ParseNode>* root,
+                std::unique_ptr<ParseNode>* root,
                 Err* err) {
   // Do all of this stuff outside the lock. We should not give out file
   // pointers until the read is complete.
@@ -226,10 +226,11 @@
   return data->parsed_root.get();
 }
 
-void InputFileManager::AddDynamicInput(const SourceFile& name,
-                                       InputFile** file,
-                                       std::vector<Token>** tokens,
-                                       scoped_ptr<ParseNode>** parse_root) {
+void InputFileManager::AddDynamicInput(
+    const SourceFile& name,
+    InputFile** file,
+    std::vector<Token>** tokens,
+    std::unique_ptr<ParseNode>** parse_root) {
   InputFileData* data = new InputFileData(name);
   {
     base::AutoLock lock(lock_);
@@ -270,7 +271,7 @@
                                 InputFile* file,
                                 Err* err) {
   std::vector<Token> tokens;
-  scoped_ptr<ParseNode> root;
+  std::unique_ptr<ParseNode> root;
   bool success = DoLoadFile(origin, build_settings, name, file,
                             &tokens, &root, err);
   // Can't return early. We have to ensure that the completion event is
diff --git a/tools/gn/input_file_manager.h b/tools/gn/input_file_manager.h
index 38ff37e..ba055e2 100644
--- a/tools/gn/input_file_manager.h
+++ b/tools/gn/input_file_manager.h
@@ -82,7 +82,7 @@
   void AddDynamicInput(const SourceFile& name,
                        InputFile** file,
                        std::vector<Token>** tokens,
-                       scoped_ptr<ParseNode>** parse_root);
+                       std::unique_ptr<ParseNode>** parse_root);
 
   // Does not count dynamic input.
   int GetInputFileCount() const;
@@ -111,12 +111,12 @@
     // Event to signal when the load is complete (or fails). This is lazily
     // created only when a thread is synchronously waiting for this load (which
     // only happens for imports).
-    scoped_ptr<base::WaitableEvent> completion_event;
+    std::unique_ptr<base::WaitableEvent> completion_event;
 
     std::vector<Token> tokens;
 
     // Null before the file is loaded or if loading failed.
-    scoped_ptr<ParseNode> parsed_root;
+    std::unique_ptr<ParseNode> parsed_root;
     Err parse_error;
   };
 
diff --git a/tools/gn/loader.cc b/tools/gn/loader.cc
index aebb6af..9061be8 100644
--- a/tools/gn/loader.cc
+++ b/tools/gn/loader.cc
@@ -5,6 +5,7 @@
 #include "tools/gn/loader.h"
 
 #include "base/bind.h"
+#include "base/memory/ptr_util.h"
 #include "base/message_loop/message_loop.h"
 #include "base/stl_util.h"
 #include "tools/gn/build_settings.h"
@@ -266,7 +267,7 @@
 
   // Pass all of the items that were defined off to the builder.
   for (auto& item : collected_items) {
-    settings->build_settings()->ItemDefined(make_scoped_ptr(item));
+    settings->build_settings()->ItemDefined(base::WrapUnique(item));
     item = nullptr;
   }
 
diff --git a/tools/gn/loader_unittest.cc b/tools/gn/loader_unittest.cc
index 6496eaa..47d0f80 100644
--- a/tools/gn/loader_unittest.cc
+++ b/tools/gn/loader_unittest.cc
@@ -40,9 +40,9 @@
 
  private:
   struct CannedResult {
-    scoped_ptr<InputFile> input_file;
+    std::unique_ptr<InputFile> input_file;
     std::vector<Token> tokens;
-    scoped_ptr<ParseNode> root;
+    std::unique_ptr<ParseNode> root;
   };
 
   bool AsyncLoadFile(const LocationRange& origin,
@@ -54,7 +54,7 @@
     return true;
   }
 
-  typedef std::map<SourceFile, scoped_ptr<CannedResult> > CannedResponseMap;
+  typedef std::map<SourceFile, std::unique_ptr<CannedResult>> CannedResponseMap;
   CannedResponseMap canned_responses_;
 
   std::vector< std::pair<SourceFile, Callback> > pending_;
@@ -68,7 +68,7 @@
 // Sets a given response for a given source file.
 void MockInputFileManager::AddCannedResponse(const SourceFile& source_file,
                                              const std::string& source) {
-  scoped_ptr<CannedResult> canned(new CannedResult);
+  std::unique_ptr<CannedResult> canned(new CannedResult);
   canned->input_file.reset(new InputFile(source_file));
   canned->input_file->SetContents(source);
 
diff --git a/tools/gn/ninja_binary_target_writer_unittest.cc b/tools/gn/ninja_binary_target_writer_unittest.cc
index 0b87883..1e02446 100644
--- a/tools/gn/ninja_binary_target_writer_unittest.cc
+++ b/tools/gn/ninja_binary_target_writer_unittest.cc
@@ -476,7 +476,7 @@
   pch_settings.set_default_toolchain_label(setup.toolchain()->label());
 
   // Declare a C++ compiler that supports PCH.
-  scoped_ptr<Tool> cxx_tool(new Tool);
+  std::unique_ptr<Tool> cxx_tool(new Tool);
   TestWithScope::SetCommandForTool(
       "c++ {{source}} {{cflags}} {{cflags_cc}} {{defines}} {{include_dirs}} "
       "-o {{output}}",
@@ -487,7 +487,7 @@
   pch_toolchain.SetTool(Toolchain::TYPE_CXX, std::move(cxx_tool));
 
   // Add a C compiler as well.
-  scoped_ptr<Tool> cc_tool(new Tool);
+  std::unique_ptr<Tool> cc_tool(new Tool);
   TestWithScope::SetCommandForTool(
       "cc {{source}} {{cflags}} {{cflags_c}} {{defines}} {{include_dirs}} "
       "-o {{output}}",
@@ -604,7 +604,7 @@
   pch_settings.set_default_toolchain_label(setup.toolchain()->label());
 
   // Declare a C++ compiler that supports PCH.
-  scoped_ptr<Tool> cxx_tool(new Tool);
+  std::unique_ptr<Tool> cxx_tool(new Tool);
   TestWithScope::SetCommandForTool(
       "c++ {{source}} {{cflags}} {{cflags_cc}} {{defines}} {{include_dirs}} "
       "-o {{output}}",
@@ -616,7 +616,7 @@
   pch_toolchain.ToolchainSetupComplete();
 
   // Add a C compiler as well.
-  scoped_ptr<Tool> cc_tool(new Tool);
+  std::unique_ptr<Tool> cc_tool(new Tool);
   TestWithScope::SetCommandForTool(
       "cc {{source}} {{cflags}} {{cflags_c}} {{defines}} {{include_dirs}} "
       "-o {{output}}",
diff --git a/tools/gn/operators_unittest.cc b/tools/gn/operators_unittest.cc
index 0e7308d..dd31b82 100644
--- a/tools/gn/operators_unittest.cc
+++ b/tools/gn/operators_unittest.cc
@@ -29,9 +29,9 @@
 // Returns a list populated with a single literal Value corresponding to the
 // given token. The token must outlive the list (since the list will just
 // copy the reference).
-scoped_ptr<ListNode> ListWithLiteral(const Token& token) {
-  scoped_ptr<ListNode> list(new ListNode);
-  list->append_item(scoped_ptr<ParseNode>(new LiteralNode(token)));
+std::unique_ptr<ListNode> ListWithLiteral(const Token& token) {
+  std::unique_ptr<ListNode> list(new ListNode);
+  list->append_item(std::unique_ptr<ParseNode>(new LiteralNode(token)));
   return list;
 }
 
@@ -53,10 +53,11 @@
 
   // Append to the sources variable.
   Token identifier_token(Location(), Token::IDENTIFIER, sources);
-  node.set_left(scoped_ptr<ParseNode>(new IdentifierNode(identifier_token)));
+  node.set_left(
+      std::unique_ptr<ParseNode>(new IdentifierNode(identifier_token)));
 
   // Set up the filter on the scope to remove everything ending with "rm"
-  scoped_ptr<PatternList> pattern_list(new PatternList);
+  std::unique_ptr<PatternList> pattern_list(new PatternList);
   pattern_list->Append(Pattern("*rm"));
   setup.scope()->set_sources_assignment_filter(std::move(pattern_list));
 
@@ -83,8 +84,8 @@
 
   // Append a list with the two strings from above.
   ListNode list;
-  list.append_item(scoped_ptr<ParseNode>(new LiteralNode(string_1)));
-  list.append_item(scoped_ptr<ParseNode>(new LiteralNode(string_2)));
+  list.append_item(std::unique_ptr<ParseNode>(new LiteralNode(string_1)));
+  list.append_item(std::unique_ptr<ParseNode>(new LiteralNode(string_2)));
   ExecuteBinaryOperator(setup.scope(), &node, node.left(), &list, &err);
   EXPECT_FALSE(err.has_error());
 
@@ -116,10 +117,11 @@
 
   // Append to the foo variable.
   Token identifier_token(Location(), Token::IDENTIFIER, foo);
-  node.set_left(scoped_ptr<ParseNode>(new IdentifierNode(identifier_token)));
+  node.set_left(
+      std::unique_ptr<ParseNode>(new IdentifierNode(identifier_token)));
 
   // Append a list with a list, the result should be a nested list.
-  scoped_ptr<ListNode> outer_list(new ListNode);
+  std::unique_ptr<ListNode> outer_list(new ListNode);
   const char twelve_str[] = "12";
   Token twelve(Location(), Token::INTEGER, twelve_str);
   outer_list->append_item(ListWithLiteral(twelve));
@@ -146,12 +148,12 @@
   // This should fail.
   const char str_str[] = "\"hi\"";
   Token str(Location(), Token::STRING, str_str);
-  node.set_right(scoped_ptr<ParseNode>(new LiteralNode(str)));
+  node.set_right(std::unique_ptr<ParseNode>(new LiteralNode(str)));
   ExecuteBinaryOperator(setup.scope(), &node, node.left(), node.right(), &err);
   EXPECT_TRUE(err.has_error());
   err = Err();
 
-  node.set_right(scoped_ptr<ParseNode>(new LiteralNode(twelve)));
+  node.set_right(std::unique_ptr<ParseNode>(new LiteralNode(twelve)));
   ExecuteBinaryOperator(setup.scope(), &node, node.left(), node.right(), &err);
   EXPECT_TRUE(err.has_error());
 }
@@ -169,12 +171,13 @@
   // Set the left to false.
   const char false_str[] = "false";
   Token false_tok(Location(), Token::FALSE_TOKEN, false_str);
-  node.set_left(scoped_ptr<ParseNode>(new LiteralNode(false_tok)));
+  node.set_left(std::unique_ptr<ParseNode>(new LiteralNode(false_tok)));
 
   // Set right as foo, but don't define a value for it.
   const char foo[] = "foo";
   Token identifier_token(Location(), Token::IDENTIFIER, foo);
-  node.set_right(scoped_ptr<ParseNode>(new IdentifierNode(identifier_token)));
+  node.set_right(
+      std::unique_ptr<ParseNode>(new IdentifierNode(identifier_token)));
 
   Value ret = ExecuteBinaryOperator(setup.scope(), &node, node.left(),
                                     node.right(), &err);
@@ -194,12 +197,13 @@
   // Set the left to false.
   const char false_str[] = "true";
   Token false_tok(Location(), Token::TRUE_TOKEN, false_str);
-  node.set_left(scoped_ptr<ParseNode>(new LiteralNode(false_tok)));
+  node.set_left(std::unique_ptr<ParseNode>(new LiteralNode(false_tok)));
 
   // Set right as foo, but don't define a value for it.
   const char foo[] = "foo";
   Token identifier_token(Location(), Token::IDENTIFIER, foo);
-  node.set_right(scoped_ptr<ParseNode>(new IdentifierNode(identifier_token)));
+  node.set_right(
+      std::unique_ptr<ParseNode>(new IdentifierNode(identifier_token)));
 
   Value ret = ExecuteBinaryOperator(setup.scope(), &node, node.left(),
                                     node.right(), &err);
diff --git a/tools/gn/parse_tree.h b/tools/gn/parse_tree.h
index 6693bbd..2853799 100644
--- a/tools/gn/parse_tree.h
+++ b/tools/gn/parse_tree.h
@@ -6,11 +6,12 @@
 #define TOOLS_GN_PARSE_TREE_H_
 
 #include <stddef.h>
+
+#include <memory>
 #include <utility>
 #include <vector>
 
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "tools/gn/err.h"
 #include "tools/gn/token.h"
 #include "tools/gn/value.h"
@@ -100,7 +101,7 @@
   void PrintComments(std::ostream& out, int indent) const;
 
  private:
-  scoped_ptr<Comments> comments_;
+  std::unique_ptr<Comments> comments_;
 
   DISALLOW_COPY_AND_ASSIGN(ParseNode);
 };
@@ -150,12 +151,12 @@
 
   // Index is the expression inside the []. Will be null if member is set.
   const ParseNode* index() const { return index_.get(); }
-  void set_index(scoped_ptr<ParseNode> i) { index_ = std::move(i); }
+  void set_index(std::unique_ptr<ParseNode> i) { index_ = std::move(i); }
 
   // The member is the identifier on the right hand side of the dot. Will be
   // null if the index is set.
   const IdentifierNode* member() const { return member_.get(); }
-  void set_member(scoped_ptr<IdentifierNode> i) { member_ = std::move(i); }
+  void set_member(std::unique_ptr<IdentifierNode> i) { member_ = std::move(i); }
 
   void SetNewLocation(int line_number);
 
@@ -167,8 +168,8 @@
 
   // Either index or member will be set according to what type of access this
   // is.
-  scoped_ptr<ParseNode> index_;
-  scoped_ptr<IdentifierNode> member_;
+  std::unique_ptr<ParseNode> index_;
+  std::unique_ptr<IdentifierNode> member_;
 
   DISALLOW_COPY_AND_ASSIGN(AccessorNode);
 };
@@ -192,15 +193,17 @@
   void set_op(const Token& t) { op_ = t; }
 
   const ParseNode* left() const { return left_.get(); }
-  void set_left(scoped_ptr<ParseNode> left) { left_ = std::move(left); }
+  void set_left(std::unique_ptr<ParseNode> left) { left_ = std::move(left); }
 
   const ParseNode* right() const { return right_.get(); }
-  void set_right(scoped_ptr<ParseNode> right) { right_ = std::move(right); }
+  void set_right(std::unique_ptr<ParseNode> right) {
+    right_ = std::move(right);
+  }
 
  private:
-  scoped_ptr<ParseNode> left_;
+  std::unique_ptr<ParseNode> left_;
   Token op_;
-  scoped_ptr<ParseNode> right_;
+  std::unique_ptr<ParseNode> right_;
 
   DISALLOW_COPY_AND_ASSIGN(BinaryOpNode);
 };
@@ -221,11 +224,11 @@
   void Print(std::ostream& out, int indent) const override;
 
   void set_begin_token(const Token& t) { begin_token_ = t; }
-  void set_end(scoped_ptr<EndNode> e) { end_ = std::move(e); }
+  void set_end(std::unique_ptr<EndNode> e) { end_ = std::move(e); }
   const EndNode* End() const { return end_.get(); }
 
   const std::vector<ParseNode*>& statements() const { return statements_; }
-  void append_statement(scoped_ptr<ParseNode> s) {
+  void append_statement(std::unique_ptr<ParseNode> s) {
     statements_.push_back(s.release());
   }
 
@@ -233,7 +236,7 @@
   // Tokens corresponding to { and }, if any (may be NULL). The end is stored
   // in a custom parse node so that it can have comments hung off of it.
   Token begin_token_;
-  scoped_ptr<EndNode> end_;
+  std::unique_ptr<EndNode> end_;
 
   // Owning pointers, use unique_ptr when we can use C++11.
   std::vector<ParseNode*> statements_;
@@ -259,23 +262,25 @@
   void set_if_token(const Token& token) { if_token_ = token; }
 
   const ParseNode* condition() const { return condition_.get(); }
-  void set_condition(scoped_ptr<ParseNode> c) { condition_ = std::move(c); }
+  void set_condition(std::unique_ptr<ParseNode> c) {
+    condition_ = std::move(c);
+  }
 
   const BlockNode* if_true() const { return if_true_.get(); }
-  void set_if_true(scoped_ptr<BlockNode> t) { if_true_ = std::move(t); }
+  void set_if_true(std::unique_ptr<BlockNode> t) { if_true_ = std::move(t); }
 
   // This is either empty, a block (for the else clause), or another
   // condition.
   const ParseNode* if_false() const { return if_false_.get(); }
-  void set_if_false(scoped_ptr<ParseNode> f) { if_false_ = std::move(f); }
+  void set_if_false(std::unique_ptr<ParseNode> f) { if_false_ = std::move(f); }
 
  private:
   // Token corresponding to the "if" string.
   Token if_token_;
 
-  scoped_ptr<ParseNode> condition_;  // Always non-null.
-  scoped_ptr<BlockNode> if_true_;  // Always non-null.
-  scoped_ptr<ParseNode> if_false_;  // May be null.
+  std::unique_ptr<ParseNode> condition_;  // Always non-null.
+  std::unique_ptr<BlockNode> if_true_;    // Always non-null.
+  std::unique_ptr<ParseNode> if_false_;   // May be null.
 
   DISALLOW_COPY_AND_ASSIGN(ConditionNode);
 };
@@ -299,15 +304,15 @@
   void set_function(Token t) { function_ = t; }
 
   const ListNode* args() const { return args_.get(); }
-  void set_args(scoped_ptr<ListNode> a) { args_ = std::move(a); }
+  void set_args(std::unique_ptr<ListNode> a) { args_ = std::move(a); }
 
   const BlockNode* block() const { return block_.get(); }
-  void set_block(scoped_ptr<BlockNode> b) { block_ = std::move(b); }
+  void set_block(std::unique_ptr<BlockNode> b) { block_ = std::move(b); }
 
  private:
   Token function_;
-  scoped_ptr<ListNode> args_;
-  scoped_ptr<BlockNode> block_;  // May be null.
+  std::unique_ptr<ListNode> args_;
+  std::unique_ptr<BlockNode> block_;  // May be null.
 
   DISALLOW_COPY_AND_ASSIGN(FunctionCallNode);
 };
@@ -355,10 +360,10 @@
   void Print(std::ostream& out, int indent) const override;
 
   void set_begin_token(const Token& t) { begin_token_ = t; }
-  void set_end(scoped_ptr<EndNode> e) { end_ = std::move(e); }
+  void set_end(std::unique_ptr<EndNode> e) { end_ = std::move(e); }
   const EndNode* End() const { return end_.get(); }
 
-  void append_item(scoped_ptr<ParseNode> s) {
+  void append_item(std::unique_ptr<ParseNode> s) {
     contents_.push_back(s.release());
   }
   const std::vector<const ParseNode*>& contents() const { return contents_; }
@@ -389,7 +394,7 @@
   // Tokens corresponding to the [ and ]. The end token is stored in inside an
   // custom parse node so that it can have comments hung off of it.
   Token begin_token_;
-  scoped_ptr<EndNode> end_;
+  std::unique_ptr<EndNode> end_;
   bool prefer_multiline_;
 
   // Owning pointers, use unique_ptr when we can use C++11.
@@ -444,13 +449,13 @@
   void set_op(const Token& t) { op_ = t; }
 
   const ParseNode* operand() const { return operand_.get(); }
-  void set_operand(scoped_ptr<ParseNode> operand) {
+  void set_operand(std::unique_ptr<ParseNode> operand) {
     operand_ = std::move(operand);
   }
 
  private:
   Token op_;
-  scoped_ptr<ParseNode> operand_;
+  std::unique_ptr<ParseNode> operand_;
 
   DISALLOW_COPY_AND_ASSIGN(UnaryOpNode);
 };
diff --git a/tools/gn/parse_tree_unittest.cc b/tools/gn/parse_tree_unittest.cc
index fba902a..f5edbc8 100644
--- a/tools/gn/parse_tree_unittest.cc
+++ b/tools/gn/parse_tree_unittest.cc
@@ -24,7 +24,7 @@
   AccessorNode accessor;
   accessor.set_base(base_token);
 
-  scoped_ptr<IdentifierNode> member_identifier(
+  std::unique_ptr<IdentifierNode> member_identifier(
       new IdentifierNode(member_token));
   accessor.set_member(std::move(member_identifier));
 
@@ -37,7 +37,7 @@
   // Define a as a Scope. It should still fail because b isn't defined.
   err = Err();
   setup.scope()->SetValue(
-      "a", Value(nullptr, scoped_ptr<Scope>(new Scope(setup.scope()))),
+      "a", Value(nullptr, std::unique_ptr<Scope>(new Scope(setup.scope()))),
       nullptr);
   result = accessor.Execute(setup.scope(), &err);
   EXPECT_TRUE(err.has_error());
diff --git a/tools/gn/parser.cc b/tools/gn/parser.cc
index d3e2f0f..33abfd0 100644
--- a/tools/gn/parser.cc
+++ b/tools/gn/parser.cc
@@ -7,6 +7,7 @@
 #include <utility>
 
 #include "base/logging.h"
+#include "base/memory/ptr_util.h"
 #include "tools/gn/functions.h"
 #include "tools/gn/operators.h"
 #include "tools/gn/token.h"
@@ -206,17 +207,18 @@
 }
 
 // static
-scoped_ptr<ParseNode> Parser::Parse(const std::vector<Token>& tokens,
-                                    Err* err) {
+std::unique_ptr<ParseNode> Parser::Parse(const std::vector<Token>& tokens,
+                                         Err* err) {
   Parser p(tokens, err);
   return p.ParseFile();
 }
 
 // static
-scoped_ptr<ParseNode> Parser::ParseExpression(const std::vector<Token>& tokens,
-                                              Err* err) {
+std::unique_ptr<ParseNode> Parser::ParseExpression(
+    const std::vector<Token>& tokens,
+    Err* err) {
   Parser p(tokens, err);
-  scoped_ptr<ParseNode> expr = p.ParseExpression();
+  std::unique_ptr<ParseNode> expr = p.ParseExpression();
   if (!p.at_end() && !err->has_error()) {
     *err = Err(p.cur_token(), "Trailing garbage");
     return nullptr;
@@ -225,8 +227,8 @@
 }
 
 // static
-scoped_ptr<ParseNode> Parser::ParseValue(const std::vector<Token>& tokens,
-                                         Err* err) {
+std::unique_ptr<ParseNode> Parser::ParseValue(const std::vector<Token>& tokens,
+                                              Err* err) {
   for (const Token& token : tokens) {
     switch (token.type()) {
       case Token::INTEGER:
@@ -314,13 +316,13 @@
   return tokens_[cur_++];
 }
 
-scoped_ptr<ParseNode> Parser::ParseExpression() {
+std::unique_ptr<ParseNode> Parser::ParseExpression() {
   return ParseExpression(0);
 }
 
-scoped_ptr<ParseNode> Parser::ParseExpression(int precedence) {
+std::unique_ptr<ParseNode> Parser::ParseExpression(int precedence) {
   if (at_end())
-    return scoped_ptr<ParseNode>();
+    return std::unique_ptr<ParseNode>();
 
   Token token = Consume();
   PrefixFunc prefix = expressions_[token.type()].prefix;
@@ -329,10 +331,10 @@
     *err_ = Err(token,
                 std::string("Unexpected token '") + token.value().as_string() +
                     std::string("'"));
-    return scoped_ptr<ParseNode>();
+    return std::unique_ptr<ParseNode>();
   }
 
-  scoped_ptr<ParseNode> left = (this->*prefix)(token);
+  std::unique_ptr<ParseNode> left = (this->*prefix)(token);
   if (has_error())
     return left;
 
@@ -344,84 +346,86 @@
       *err_ = Err(token,
                   std::string("Unexpected token '") +
                       token.value().as_string() + std::string("'"));
-      return scoped_ptr<ParseNode>();
+      return std::unique_ptr<ParseNode>();
     }
     left = (this->*infix)(std::move(left), token);
     if (has_error())
-      return scoped_ptr<ParseNode>();
+      return std::unique_ptr<ParseNode>();
   }
 
   return left;
 }
 
-scoped_ptr<ParseNode> Parser::Literal(Token token) {
-  return make_scoped_ptr(new LiteralNode(token));
+std::unique_ptr<ParseNode> Parser::Literal(Token token) {
+  return base::WrapUnique(new LiteralNode(token));
 }
 
-scoped_ptr<ParseNode> Parser::Name(Token token) {
-  return IdentifierOrCall(scoped_ptr<ParseNode>(), token);
+std::unique_ptr<ParseNode> Parser::Name(Token token) {
+  return IdentifierOrCall(std::unique_ptr<ParseNode>(), token);
 }
 
-scoped_ptr<ParseNode> Parser::BlockComment(Token token) {
-  scoped_ptr<BlockCommentNode> comment(new BlockCommentNode());
+std::unique_ptr<ParseNode> Parser::BlockComment(Token token) {
+  std::unique_ptr<BlockCommentNode> comment(new BlockCommentNode());
   comment->set_comment(token);
   return std::move(comment);
 }
 
-scoped_ptr<ParseNode> Parser::Group(Token token) {
-  scoped_ptr<ParseNode> expr = ParseExpression();
+std::unique_ptr<ParseNode> Parser::Group(Token token) {
+  std::unique_ptr<ParseNode> expr = ParseExpression();
   if (has_error())
-    return scoped_ptr<ParseNode>();
+    return std::unique_ptr<ParseNode>();
   Consume(Token::RIGHT_PAREN, "Expected ')'");
   return expr;
 }
 
-scoped_ptr<ParseNode> Parser::Not(Token token) {
-  scoped_ptr<ParseNode> expr = ParseExpression(PRECEDENCE_PREFIX + 1);
+std::unique_ptr<ParseNode> Parser::Not(Token token) {
+  std::unique_ptr<ParseNode> expr = ParseExpression(PRECEDENCE_PREFIX + 1);
   if (has_error())
-    return scoped_ptr<ParseNode>();
+    return std::unique_ptr<ParseNode>();
   if (!expr) {
     if (!has_error())
       *err_ = Err(token, "Expected right-hand side for '!'.");
-    return scoped_ptr<ParseNode>();
+    return std::unique_ptr<ParseNode>();
   }
-  scoped_ptr<UnaryOpNode> unary_op(new UnaryOpNode);
+  std::unique_ptr<UnaryOpNode> unary_op(new UnaryOpNode);
   unary_op->set_op(token);
   unary_op->set_operand(std::move(expr));
   return std::move(unary_op);
 }
 
-scoped_ptr<ParseNode> Parser::List(Token node) {
-  scoped_ptr<ParseNode> list(ParseList(node, Token::RIGHT_BRACKET, true));
+std::unique_ptr<ParseNode> Parser::List(Token node) {
+  std::unique_ptr<ParseNode> list(ParseList(node, Token::RIGHT_BRACKET, true));
   if (!has_error() && !at_end())
     Consume(Token::RIGHT_BRACKET, "Expected ']'");
   return list;
 }
 
-scoped_ptr<ParseNode> Parser::BinaryOperator(scoped_ptr<ParseNode> left,
-                                             Token token) {
-  scoped_ptr<ParseNode> right =
+std::unique_ptr<ParseNode> Parser::BinaryOperator(
+    std::unique_ptr<ParseNode> left,
+    Token token) {
+  std::unique_ptr<ParseNode> right =
       ParseExpression(expressions_[token.type()].precedence + 1);
   if (!right) {
     if (!has_error()) {
       *err_ = Err(token, "Expected right-hand side for '" +
                              token.value().as_string() + "'");
     }
-    return scoped_ptr<ParseNode>();
+    return std::unique_ptr<ParseNode>();
   }
-  scoped_ptr<BinaryOpNode> binary_op(new BinaryOpNode);
+  std::unique_ptr<BinaryOpNode> binary_op(new BinaryOpNode);
   binary_op->set_op(token);
   binary_op->set_left(std::move(left));
   binary_op->set_right(std::move(right));
   return std::move(binary_op);
 }
 
-scoped_ptr<ParseNode> Parser::IdentifierOrCall(scoped_ptr<ParseNode> left,
-                                               Token token) {
-  scoped_ptr<ListNode> list(new ListNode);
+std::unique_ptr<ParseNode> Parser::IdentifierOrCall(
+    std::unique_ptr<ParseNode> left,
+    Token token) {
+  std::unique_ptr<ListNode> list(new ListNode);
   list->set_begin_token(token);
-  list->set_end(make_scoped_ptr(new EndNode(token)));
-  scoped_ptr<BlockNode> block;
+  list->set_end(base::WrapUnique(new EndNode(token)));
+  std::unique_ptr<BlockNode> block;
   bool has_arg = false;
   if (LookAhead(Token::LEFT_PAREN)) {
     Token start_token = Consume();
@@ -432,22 +436,22 @@
     } else {
       list = ParseList(start_token, Token::RIGHT_PAREN, false);
       if (has_error())
-        return scoped_ptr<ParseNode>();
+        return std::unique_ptr<ParseNode>();
       Consume(Token::RIGHT_PAREN, "Expected ')' after call");
     }
     // Optionally with a scope.
     if (LookAhead(Token::LEFT_BRACE)) {
       block = ParseBlock();
       if (has_error())
-        return scoped_ptr<ParseNode>();
+        return std::unique_ptr<ParseNode>();
     }
   }
 
   if (!left && !has_arg) {
     // Not a function call, just a standalone identifier.
-    return scoped_ptr<ParseNode>(new IdentifierNode(token));
+    return std::unique_ptr<ParseNode>(new IdentifierNode(token));
   }
-  scoped_ptr<FunctionCallNode> func_call(new FunctionCallNode);
+  std::unique_ptr<FunctionCallNode> func_call(new FunctionCallNode);
   func_call->set_function(token);
   func_call->set_args(std::move(list));
   if (block)
@@ -455,27 +459,27 @@
   return std::move(func_call);
 }
 
-scoped_ptr<ParseNode> Parser::Assignment(scoped_ptr<ParseNode> left,
-                                         Token token) {
+std::unique_ptr<ParseNode> Parser::Assignment(std::unique_ptr<ParseNode> left,
+                                              Token token) {
   if (left->AsIdentifier() == nullptr) {
     *err_ = Err(left.get(), "Left-hand side of assignment must be identifier.");
-    return scoped_ptr<ParseNode>();
+    return std::unique_ptr<ParseNode>();
   }
-  scoped_ptr<ParseNode> value = ParseExpression(PRECEDENCE_ASSIGNMENT);
+  std::unique_ptr<ParseNode> value = ParseExpression(PRECEDENCE_ASSIGNMENT);
   if (!value) {
     if (!has_error())
       *err_ = Err(token, "Expected right-hand side for assignment.");
-    return scoped_ptr<ParseNode>();
+    return std::unique_ptr<ParseNode>();
   }
-  scoped_ptr<BinaryOpNode> assign(new BinaryOpNode);
+  std::unique_ptr<BinaryOpNode> assign(new BinaryOpNode);
   assign->set_op(token);
   assign->set_left(std::move(left));
   assign->set_right(std::move(value));
   return std::move(assign);
 }
 
-scoped_ptr<ParseNode> Parser::Subscript(scoped_ptr<ParseNode> left,
-                                        Token token) {
+std::unique_ptr<ParseNode> Parser::Subscript(std::unique_ptr<ParseNode> left,
+                                             Token token) {
   // TODO: Maybe support more complex expressions like a[0][0]. This would
   // require work on the evaluator too.
   if (left->AsIdentifier() == nullptr) {
@@ -483,45 +487,45 @@
         "The thing on the left hand side of the [] must be an identifier\n"
         "and not an expression. If you need this, you'll have to assign the\n"
         "value to a temporary before subscripting. Sorry.");
-    return scoped_ptr<ParseNode>();
+    return std::unique_ptr<ParseNode>();
   }
-  scoped_ptr<ParseNode> value = ParseExpression();
+  std::unique_ptr<ParseNode> value = ParseExpression();
   Consume(Token::RIGHT_BRACKET, "Expecting ']' after subscript.");
-  scoped_ptr<AccessorNode> accessor(new AccessorNode);
+  std::unique_ptr<AccessorNode> accessor(new AccessorNode);
   accessor->set_base(left->AsIdentifier()->value());
   accessor->set_index(std::move(value));
   return std::move(accessor);
 }
 
-scoped_ptr<ParseNode> Parser::DotOperator(scoped_ptr<ParseNode> left,
-                                          Token token) {
+std::unique_ptr<ParseNode> Parser::DotOperator(std::unique_ptr<ParseNode> left,
+                                               Token token) {
   if (left->AsIdentifier() == nullptr) {
     *err_ = Err(left.get(), "May only use \".\" for identifiers.",
         "The thing on the left hand side of the dot must be an identifier\n"
         "and not an expression. If you need this, you'll have to assign the\n"
         "value to a temporary first. Sorry.");
-    return scoped_ptr<ParseNode>();
+    return std::unique_ptr<ParseNode>();
   }
 
-  scoped_ptr<ParseNode> right = ParseExpression(PRECEDENCE_DOT);
+  std::unique_ptr<ParseNode> right = ParseExpression(PRECEDENCE_DOT);
   if (!right || !right->AsIdentifier()) {
     *err_ = Err(token, "Expected identifier for right-hand-side of \".\"",
         "Good: a.cookies\nBad: a.42\nLooks good but still bad: a.cookies()");
-    return scoped_ptr<ParseNode>();
+    return std::unique_ptr<ParseNode>();
   }
 
-  scoped_ptr<AccessorNode> accessor(new AccessorNode);
+  std::unique_ptr<AccessorNode> accessor(new AccessorNode);
   accessor->set_base(left->AsIdentifier()->value());
-  accessor->set_member(scoped_ptr<IdentifierNode>(
+  accessor->set_member(std::unique_ptr<IdentifierNode>(
       static_cast<IdentifierNode*>(right.release())));
   return std::move(accessor);
 }
 
 // Does not Consume the start or end token.
-scoped_ptr<ListNode> Parser::ParseList(Token start_token,
-                                       Token::Type stop_before,
-                                       bool allow_trailing_comma) {
-  scoped_ptr<ListNode> list(new ListNode);
+std::unique_ptr<ListNode> Parser::ParseList(Token start_token,
+                                            Token::Type stop_before,
+                                            bool allow_trailing_comma) {
+  std::unique_ptr<ListNode> list(new ListNode);
   list->set_begin_token(start_token);
   bool just_got_comma = false;
   bool first_time = true;
@@ -530,7 +534,7 @@
       if (!just_got_comma) {
         // Require commas separate things in lists.
         *err_ = Err(cur_token(), "Expected comma between items.");
-        return scoped_ptr<ListNode>();
+        return std::unique_ptr<ListNode>();
       }
     }
     first_time = false;
@@ -540,11 +544,11 @@
     // boolean expressions (the lowest of which is OR), but above assignments.
     list->append_item(ParseExpression(PRECEDENCE_OR));
     if (has_error())
-      return scoped_ptr<ListNode>();
+      return std::unique_ptr<ListNode>();
     if (at_end()) {
       *err_ =
           Err(tokens_[tokens_.size() - 1], "Unexpected end of file in list.");
-      return scoped_ptr<ListNode>();
+      return std::unique_ptr<ListNode>();
     }
     if (list->contents().back()->AsBlockComment()) {
       // If there was a comment inside the list, we don't need a comma to the
@@ -556,18 +560,18 @@
   }
   if (just_got_comma && !allow_trailing_comma) {
     *err_ = Err(cur_token(), "Trailing comma");
-    return scoped_ptr<ListNode>();
+    return std::unique_ptr<ListNode>();
   }
-  list->set_end(make_scoped_ptr(new EndNode(cur_token())));
+  list->set_end(base::WrapUnique(new EndNode(cur_token())));
   return list;
 }
 
-scoped_ptr<ParseNode> Parser::ParseFile() {
-  scoped_ptr<BlockNode> file(new BlockNode);
+std::unique_ptr<ParseNode> Parser::ParseFile() {
+  std::unique_ptr<BlockNode> file(new BlockNode);
   for (;;) {
     if (at_end())
       break;
-    scoped_ptr<ParseNode> statement = ParseStatement();
+    std::unique_ptr<ParseNode> statement = ParseStatement();
     if (!statement)
       break;
     file->append_statement(std::move(statement));
@@ -575,7 +579,7 @@
   if (!at_end() && !has_error())
     *err_ = Err(cur_token(), "Unexpected here, should be newline.");
   if (has_error())
-    return scoped_ptr<ParseNode>();
+    return std::unique_ptr<ParseNode>();
 
   // TODO(scottmg): If this is measurably expensive, it could be done only
   // when necessary (when reformatting, or during tests). Comments are
@@ -586,7 +590,7 @@
   return std::move(file);
 }
 
-scoped_ptr<ParseNode> Parser::ParseStatement() {
+std::unique_ptr<ParseNode> Parser::ParseStatement() {
   if (LookAhead(Token::IF)) {
     return ParseCondition();
   } else if (LookAhead(Token::BLOCK_COMMENT)) {
@@ -594,7 +598,7 @@
   } else {
     // TODO(scottmg): Is this too strict? Just drop all the testing if we want
     // to allow "pointless" expressions and return ParseExpression() directly.
-    scoped_ptr<ParseNode> stmt = ParseExpression();
+    std::unique_ptr<ParseNode> stmt = ParseExpression();
     if (stmt) {
       if (stmt->AsFunctionCall() || IsAssignment(stmt.get()))
         return stmt;
@@ -603,34 +607,34 @@
       Token token = at_end() ? tokens_[tokens_.size() - 1] : cur_token();
       *err_ = Err(token, "Expecting assignment or function call.");
     }
-    return scoped_ptr<ParseNode>();
+    return std::unique_ptr<ParseNode>();
   }
 }
 
-scoped_ptr<BlockNode> Parser::ParseBlock() {
+std::unique_ptr<BlockNode> Parser::ParseBlock() {
   Token begin_token =
       Consume(Token::LEFT_BRACE, "Expected '{' to start a block.");
   if (has_error())
-    return scoped_ptr<BlockNode>();
-  scoped_ptr<BlockNode> block(new BlockNode);
+    return std::unique_ptr<BlockNode>();
+  std::unique_ptr<BlockNode> block(new BlockNode);
   block->set_begin_token(begin_token);
 
   for (;;) {
     if (LookAhead(Token::RIGHT_BRACE)) {
-      block->set_end(make_scoped_ptr(new EndNode(Consume())));
+      block->set_end(base::WrapUnique(new EndNode(Consume())));
       break;
     }
 
-    scoped_ptr<ParseNode> statement = ParseStatement();
+    std::unique_ptr<ParseNode> statement = ParseStatement();
     if (!statement)
-      return scoped_ptr<BlockNode>();
+      return std::unique_ptr<BlockNode>();
     block->append_statement(std::move(statement));
   }
   return block;
 }
 
-scoped_ptr<ParseNode> Parser::ParseCondition() {
-  scoped_ptr<ConditionNode> condition(new ConditionNode);
+std::unique_ptr<ParseNode> Parser::ParseCondition() {
+  std::unique_ptr<ConditionNode> condition(new ConditionNode);
   condition->set_if_token(Consume(Token::IF, "Expected 'if'"));
   Consume(Token::LEFT_PAREN, "Expected '(' after 'if'.");
   condition->set_condition(ParseExpression());
@@ -645,11 +649,11 @@
       condition->set_if_false(ParseStatement());
     } else {
       *err_ = Err(cur_token(), "Expected '{' or 'if' after 'else'.");
-      return scoped_ptr<ParseNode>();
+      return std::unique_ptr<ParseNode>();
     }
   }
   if (has_error())
-    return scoped_ptr<ParseNode>();
+    return std::unique_ptr<ParseNode>();
   return std::move(condition);
 }
 
diff --git a/tools/gn/parser.h b/tools/gn/parser.h
index 42d41ef..de828a4 100644
--- a/tools/gn/parser.h
+++ b/tools/gn/parser.h
@@ -8,18 +8,18 @@
 #include <stddef.h>
 
 #include <map>
+#include <memory>
 #include <vector>
 
 #include "base/gtest_prod_util.h"
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "tools/gn/err.h"
 #include "tools/gn/parse_tree.h"
 
 class Parser;
-typedef scoped_ptr<ParseNode> (Parser::*PrefixFunc)(Token token);
-typedef scoped_ptr<ParseNode> (Parser::*InfixFunc)(scoped_ptr<ParseNode> left,
-                                                   Token token);
+typedef std::unique_ptr<ParseNode> (Parser::*PrefixFunc)(Token token);
+typedef std::unique_ptr<ParseNode> (
+    Parser::*InfixFunc)(std::unique_ptr<ParseNode> left, Token token);
 
 extern const char kGrammar_Help[];
 
@@ -35,53 +35,58 @@
 class Parser {
  public:
   // Will return a null pointer and set the err on error.
-  static scoped_ptr<ParseNode> Parse(const std::vector<Token>& tokens,
-                                     Err* err);
+  static std::unique_ptr<ParseNode> Parse(const std::vector<Token>& tokens,
+                                          Err* err);
 
   // Alternative to parsing that assumes the input is an expression.
-  static scoped_ptr<ParseNode> ParseExpression(const std::vector<Token>& tokens,
-                                               Err* err);
+  static std::unique_ptr<ParseNode> ParseExpression(
+      const std::vector<Token>& tokens,
+      Err* err);
 
   // Alternative to parsing that assumes the input is a literal value.
-  static scoped_ptr<ParseNode> ParseValue(const std::vector<Token>& tokens,
-                                          Err* err);
+  static std::unique_ptr<ParseNode> ParseValue(const std::vector<Token>& tokens,
+                                               Err* err);
 
  private:
   // Vector must be valid for lifetime of call.
   Parser(const std::vector<Token>& tokens, Err* err);
   ~Parser();
 
-  scoped_ptr<ParseNode> ParseExpression();
+  std::unique_ptr<ParseNode> ParseExpression();
 
   // Parses an expression with the given precedence or higher.
-  scoped_ptr<ParseNode> ParseExpression(int precedence);
+  std::unique_ptr<ParseNode> ParseExpression(int precedence);
 
   // |PrefixFunc|s used in parsing expressions.
-  scoped_ptr<ParseNode> Literal(Token token);
-  scoped_ptr<ParseNode> Name(Token token);
-  scoped_ptr<ParseNode> Group(Token token);
-  scoped_ptr<ParseNode> Not(Token token);
-  scoped_ptr<ParseNode> List(Token token);
-  scoped_ptr<ParseNode> BlockComment(Token token);
+  std::unique_ptr<ParseNode> Literal(Token token);
+  std::unique_ptr<ParseNode> Name(Token token);
+  std::unique_ptr<ParseNode> Group(Token token);
+  std::unique_ptr<ParseNode> Not(Token token);
+  std::unique_ptr<ParseNode> List(Token token);
+  std::unique_ptr<ParseNode> BlockComment(Token token);
 
   // |InfixFunc|s used in parsing expressions.
-  scoped_ptr<ParseNode> BinaryOperator(scoped_ptr<ParseNode> left, Token token);
-  scoped_ptr<ParseNode> IdentifierOrCall(scoped_ptr<ParseNode> left,
+  std::unique_ptr<ParseNode> BinaryOperator(std::unique_ptr<ParseNode> left,
+                                            Token token);
+  std::unique_ptr<ParseNode> IdentifierOrCall(std::unique_ptr<ParseNode> left,
+                                              Token token);
+  std::unique_ptr<ParseNode> Assignment(std::unique_ptr<ParseNode> left,
+                                        Token token);
+  std::unique_ptr<ParseNode> Subscript(std::unique_ptr<ParseNode> left,
+                                       Token token);
+  std::unique_ptr<ParseNode> DotOperator(std::unique_ptr<ParseNode> left,
                                          Token token);
-  scoped_ptr<ParseNode> Assignment(scoped_ptr<ParseNode> left, Token token);
-  scoped_ptr<ParseNode> Subscript(scoped_ptr<ParseNode> left, Token token);
-  scoped_ptr<ParseNode> DotOperator(scoped_ptr<ParseNode> left, Token token);
 
   // Helper to parse a comma separated list, optionally allowing trailing
   // commas (allowed in [] lists, not in function calls).
-  scoped_ptr<ListNode> ParseList(Token start_token,
-                                 Token::Type stop_before,
-                                 bool allow_trailing_comma);
+  std::unique_ptr<ListNode> ParseList(Token start_token,
+                                      Token::Type stop_before,
+                                      bool allow_trailing_comma);
 
-  scoped_ptr<ParseNode> ParseFile();
-  scoped_ptr<ParseNode> ParseStatement();
-  scoped_ptr<BlockNode> ParseBlock();
-  scoped_ptr<ParseNode> ParseCondition();
+  std::unique_ptr<ParseNode> ParseFile();
+  std::unique_ptr<ParseNode> ParseStatement();
+  std::unique_ptr<BlockNode> ParseBlock();
+  std::unique_ptr<ParseNode> ParseCondition();
 
   // Generates a pre- and post-order traversal of the tree.
   void TraverseOrder(const ParseNode* root,
diff --git a/tools/gn/parser_unittest.cc b/tools/gn/parser_unittest.cc
index b6c2009..3970373 100644
--- a/tools/gn/parser_unittest.cc
+++ b/tools/gn/parser_unittest.cc
@@ -26,7 +26,7 @@
   ASSERT_TRUE(GetTokens(&input_file, &tokens));
 
   Err err;
-  scoped_ptr<ParseNode> result = Parser::Parse(tokens, &err);
+  std::unique_ptr<ParseNode> result = Parser::Parse(tokens, &err);
   if (!result)
     err.PrintToStdout();
   ASSERT_TRUE(result);
@@ -44,7 +44,7 @@
   ASSERT_TRUE(GetTokens(&input_file, &tokens));
 
   Err err;
-  scoped_ptr<ParseNode> result = Parser::ParseExpression(tokens, &err);
+  std::unique_ptr<ParseNode> result = Parser::ParseExpression(tokens, &err);
   ASSERT_TRUE(result);
 
   std::ostringstream collector;
@@ -62,7 +62,7 @@
   Err err;
   std::vector<Token> tokens = Tokenizer::Tokenize(&input_file, &err);
   if (!err.has_error()) {
-    scoped_ptr<ParseNode> result = Parser::Parse(tokens, &err);
+    std::unique_ptr<ParseNode> result = Parser::Parse(tokens, &err);
     ASSERT_FALSE(result);
     ASSERT_TRUE(err.has_error());
   }
@@ -80,7 +80,7 @@
   Err err;
   std::vector<Token> tokens = Tokenizer::Tokenize(&input_file, &err);
   if (!err.has_error()) {
-    scoped_ptr<ParseNode> result = Parser::ParseExpression(tokens, &err);
+    std::unique_ptr<ParseNode> result = Parser::ParseExpression(tokens, &err);
     ASSERT_FALSE(result);
     ASSERT_TRUE(err.has_error());
   }
diff --git a/tools/gn/scope.cc b/tools/gn/scope.cc
index dc22367..d3d29d4 100644
--- a/tools/gn/scope.cc
+++ b/tools/gn/scope.cc
@@ -380,8 +380,8 @@
   return true;
 }
 
-scoped_ptr<Scope> Scope::MakeClosure() const {
-  scoped_ptr<Scope> result;
+std::unique_ptr<Scope> Scope::MakeClosure() const {
+  std::unique_ptr<Scope> result;
   if (const_containing_) {
     // We reached the top of the mutable scope stack. The result scope just
     // references the const scope (which will never change).
diff --git a/tools/gn/scope.h b/tools/gn/scope.h
index 96b3939..72aa0c3 100644
--- a/tools/gn/scope.h
+++ b/tools/gn/scope.h
@@ -6,13 +6,13 @@
 #define TOOLS_GN_SCOPE_H_
 
 #include <map>
+#include <memory>
 #include <set>
 #include <utility>
 
 #include "base/containers/hash_tables.h"
 #include "base/macros.h"
 #include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/memory/scoped_vector.h"
 #include "tools/gn/err.h"
 #include "tools/gn/pattern.h"
@@ -227,7 +227,7 @@
   // be included. The resulting closure will reference the const containing
   // scope as its containing scope (since we assume the const scope won't
   // change, we don't have to copy its values).
-  scoped_ptr<Scope> MakeClosure() const;
+  std::unique_ptr<Scope> MakeClosure() const;
 
   // Makes an empty scope with the given name. Returns NULL if the name is
   // already set.
@@ -239,8 +239,7 @@
 
   // Filter to apply when the sources variable is assigned. May return NULL.
   const PatternList* GetSourcesAssignmentFilter() const;
-  void set_sources_assignment_filter(
-      scoped_ptr<PatternList> f) {
+  void set_sources_assignment_filter(std::unique_ptr<PatternList> f) {
     sources_assignment_filter_ = std::move(f);
   }
 
@@ -342,7 +341,7 @@
 
   // Null indicates not set and that we should fallback to the containing
   // scope's filter.
-  scoped_ptr<PatternList> sources_assignment_filter_;
+  std::unique_ptr<PatternList> sources_assignment_filter_;
 
   // Owning pointers, must be deleted.
   typedef std::map<std::string, scoped_refptr<const Template> > TemplateMap;
diff --git a/tools/gn/scope_per_file_provider.h b/tools/gn/scope_per_file_provider.h
index 8cdfa6c..ac0d872 100644
--- a/tools/gn/scope_per_file_provider.h
+++ b/tools/gn/scope_per_file_provider.h
@@ -5,8 +5,9 @@
 #ifndef TOOLS_GN_SCOPE_PER_FILE_PROVIDER_H_
 #define TOOLS_GN_SCOPE_PER_FILE_PROVIDER_H_
 
+#include <memory>
+
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "tools/gn/scope.h"
 
 // ProgrammaticProvider for a scope to provide it with per-file built-in
@@ -35,14 +36,14 @@
   bool allow_target_vars_;
 
   // All values are lazily created.
-  scoped_ptr<Value> current_toolchain_;
-  scoped_ptr<Value> default_toolchain_;
-  scoped_ptr<Value> python_path_;
-  scoped_ptr<Value> root_build_dir_;
-  scoped_ptr<Value> root_gen_dir_;
-  scoped_ptr<Value> root_out_dir_;
-  scoped_ptr<Value> target_gen_dir_;
-  scoped_ptr<Value> target_out_dir_;
+  std::unique_ptr<Value> current_toolchain_;
+  std::unique_ptr<Value> default_toolchain_;
+  std::unique_ptr<Value> python_path_;
+  std::unique_ptr<Value> root_build_dir_;
+  std::unique_ptr<Value> root_gen_dir_;
+  std::unique_ptr<Value> root_out_dir_;
+  std::unique_ptr<Value> target_gen_dir_;
+  std::unique_ptr<Value> target_out_dir_;
 
   DISALLOW_COPY_AND_ASSIGN(ScopePerFileProvider);
 };
diff --git a/tools/gn/scope_unittest.cc b/tools/gn/scope_unittest.cc
index ce79973..de2005a 100644
--- a/tools/gn/scope_unittest.cc
+++ b/tools/gn/scope_unittest.cc
@@ -217,7 +217,7 @@
   nested2.SetValue("on_two", Value(&assignment, "on_two2"), &assignment);
 
   // Making a closure from the root scope.
-  scoped_ptr<Scope> result = setup.scope()->MakeClosure();
+  std::unique_ptr<Scope> result = setup.scope()->MakeClosure();
   EXPECT_FALSE(result->containing());  // Should have no containing scope.
   EXPECT_TRUE(result->GetValue("on_root"));  // Value should be copied.
 
diff --git a/tools/gn/setup.cc b/tools/gn/setup.cc
index 9661506..384a2af 100644
--- a/tools/gn/setup.cc
+++ b/tools/gn/setup.cc
@@ -140,7 +140,7 @@
 // Called on any thread. Post the item to the builder on the main thread.
 void ItemDefinedCallback(base::MessageLoop* main_loop,
                          scoped_refptr<Builder> builder,
-                         scoped_ptr<Item> item) {
+                         std::unique_ptr<Item> item) {
   DCHECK(item);
   main_loop->PostTask(FROM_HERE, base::Bind(&Builder::ItemDefined, builder,
                                             base::Passed(&item)));
@@ -199,7 +199,7 @@
   DWORD path_length = ::GetEnvironmentVariable(kPathEnvVarName, nullptr, 0);
   if (path_length == 0)
     return base::FilePath();
-  scoped_ptr<base::char16[]> full_path(new base::char16[path_length]);
+  std::unique_ptr<base::char16[]> full_path(new base::char16[path_length]);
   DWORD actual_path_length =
       ::GetEnvironmentVariable(kPathEnvVarName, full_path.get(), path_length);
   CHECK_EQ(path_length, actual_path_length + 1);
@@ -712,7 +712,7 @@
       err.PrintToStdout();
       return false;
     }
-    scoped_ptr<std::set<SourceFile>> whitelist(new std::set<SourceFile>);
+    std::unique_ptr<std::set<SourceFile>> whitelist(new std::set<SourceFile>);
     for (const auto& item : exec_script_whitelist_value->list_value()) {
       if (!item.VerifyTypeIs(Value::STRING, &err)) {
         err.PrintToStdout();
diff --git a/tools/gn/setup.h b/tools/gn/setup.h
index 5b81a55..4f2d885 100644
--- a/tools/gn/setup.h
+++ b/tools/gn/setup.h
@@ -5,11 +5,11 @@
 #ifndef TOOLS_GN_SETUP_H_
 #define TOOLS_GN_SETUP_H_
 
+#include <memory>
 #include <vector>
 
 #include "base/files/file_path.h"
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "tools/gn/build_settings.h"
 #include "tools/gn/builder.h"
 #include "tools/gn/label_pattern.h"
@@ -135,7 +135,7 @@
   bool check_public_headers_;
 
   // See getter for info.
-  scoped_ptr<std::vector<LabelPattern>> check_patterns_;
+  std::unique_ptr<std::vector<LabelPattern>> check_patterns_;
 
   Scheduler scheduler_;
 
@@ -146,9 +146,9 @@
 
   // State for invoking the dotfile.
   base::FilePath dotfile_name_;
-  scoped_ptr<InputFile> dotfile_input_file_;
+  std::unique_ptr<InputFile> dotfile_input_file_;
   std::vector<Token> dotfile_tokens_;
-  scoped_ptr<ParseNode> dotfile_root_;
+  std::unique_ptr<ParseNode> dotfile_root_;
 
   // Set to true when we should populate the build arguments from the command
   // line or build argument file. See setter above.
@@ -157,9 +157,9 @@
   // State for invoking the command line args. We specifically want to keep
   // this around for the entire run so that Values can blame to the command
   // line when we issue errors about them.
-  scoped_ptr<InputFile> args_input_file_;
+  std::unique_ptr<InputFile> args_input_file_;
   std::vector<Token> args_tokens_;
-  scoped_ptr<ParseNode> args_root_;
+  std::unique_ptr<ParseNode> args_root_;
 
   DISALLOW_COPY_AND_ASSIGN(Setup);
 };
diff --git a/tools/gn/string_utils.cc b/tools/gn/string_utils.cc
index 6f47b91..5e80681 100644
--- a/tools/gn/string_utils.cc
+++ b/tools/gn/string_utils.cc
@@ -81,7 +81,7 @@
   }
 
   // Parse.
-  scoped_ptr<ParseNode> node = Parser::ParseExpression(tokens, err);
+  std::unique_ptr<ParseNode> node = Parser::ParseExpression(tokens, err);
   if (err->has_error()) {
     // Rewrite error as above.
     *err = ErrInsideStringToken(token, begin_offset, end_offset - begin_offset,
diff --git a/tools/gn/string_utils_unittest.cc b/tools/gn/string_utils_unittest.cc
index 570997f..eb021a8 100644
--- a/tools/gn/string_utils_unittest.cc
+++ b/tools/gn/string_utils_unittest.cc
@@ -23,7 +23,8 @@
   scope.SetValue("onestring", Value(nullptr, "one"), nullptr);
 
   // Nested scope called "onescope" with a value "one" inside it.
-  scoped_ptr<Scope> onescope(new Scope(static_cast<const Settings*>(nullptr)));
+  std::unique_ptr<Scope> onescope(
+      new Scope(static_cast<const Settings*>(nullptr)));
   onescope->SetValue("one", Value(nullptr, one), nullptr);
   scope.SetValue("onescope", Value(nullptr, std::move(onescope)), nullptr);
 
diff --git a/tools/gn/target_generator.cc b/tools/gn/target_generator.cc
index 4a84bcd..2132a5b 100644
--- a/tools/gn/target_generator.cc
+++ b/tools/gn/target_generator.cc
@@ -88,7 +88,7 @@
   if (g_scheduler->verbose_logging())
     g_scheduler->Log("Defining target", label.GetUserVisibleName(true));
 
-  scoped_ptr<Target> target(new Target(scope->settings(), label));
+  std::unique_ptr<Target> target(new Target(scope->settings(), label));
   target->set_defined_from(function_call);
 
   // Create and call out to the proper generator.
diff --git a/tools/gn/target_unittest.cc b/tools/gn/target_unittest.cc
index 8629ff2..e2e41a8 100644
--- a/tools/gn/target_unittest.cc
+++ b/tools/gn/target_unittest.cc
@@ -431,7 +431,7 @@
 
   Toolchain toolchain(setup.settings(), Label(SourceDir("//tc/"), "tc"));
 
-  scoped_ptr<Tool> solink_tool(new Tool());
+  std::unique_ptr<Tool> solink_tool(new Tool());
   solink_tool->set_output_prefix("lib");
   solink_tool->set_default_output_extension(".so");
 
@@ -470,7 +470,7 @@
 
   Toolchain toolchain(setup.settings(), Label(SourceDir("//tc/"), "tc"));
 
-  scoped_ptr<Tool> solink_tool(new Tool());
+  std::unique_ptr<Tool> solink_tool(new Tool());
   solink_tool->set_output_prefix("");
   solink_tool->set_default_output_extension(".dll");
 
diff --git a/tools/gn/template.cc b/tools/gn/template.cc
index 012e716..8b8ae69 100644
--- a/tools/gn/template.cc
+++ b/tools/gn/template.cc
@@ -18,7 +18,7 @@
       definition_(def) {
 }
 
-Template::Template(scoped_ptr<Scope> scope, const FunctionCallNode* def)
+Template::Template(std::unique_ptr<Scope> scope, const FunctionCallNode* def)
     : closure_(std::move(scope)), definition_(def) {}
 
 Template::~Template() {
@@ -36,7 +36,7 @@
 
   // First run the invocation's block. Need to allocate the scope on the heap
   // so we can pass ownership to the template.
-  scoped_ptr<Scope> invocation_scope(new Scope(scope));
+  std::unique_ptr<Scope> invocation_scope(new Scope(scope));
   if (!FillTargetBlockScope(scope, invocation,
                             invocation->function().value().as_string(),
                             block, args, invocation_scope.get(), err))
@@ -78,7 +78,7 @@
   // if we instead create a value and then set the scope on it, the copy can
   // be avoided.
   const char kInvoker[] = "invoker";
-  template_scope.SetValue(kInvoker, Value(nullptr, scoped_ptr<Scope>()),
+  template_scope.SetValue(kInvoker, Value(nullptr, std::unique_ptr<Scope>()),
                           invocation);
   Value* invoker_value = template_scope.GetMutableValue(kInvoker, false);
   invoker_value->SetScopeValue(std::move(invocation_scope));
diff --git a/tools/gn/template.h b/tools/gn/template.h
index 43aaf7f..a79d82f 100644
--- a/tools/gn/template.h
+++ b/tools/gn/template.h
@@ -5,10 +5,10 @@
 #ifndef TOOLS_GN_TEMPLATE_H_
 #define TOOLS_GN_TEMPLATE_H_
 
+#include <memory>
 #include <vector>
 
 #include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
 
 class BlockNode;
 class Err;
@@ -30,7 +30,7 @@
   Template(const Scope* scope, const FunctionCallNode* def);
 
   // Takes ownership of a previously-constructed closure.
-  Template(scoped_ptr<Scope> closure, const FunctionCallNode* def);
+  Template(std::unique_ptr<Scope> closure, const FunctionCallNode* def);
 
   // Invoke the template. The values correspond to the state of the code
   // invoking the template.
@@ -49,7 +49,7 @@
   Template();
   ~Template();
 
-  scoped_ptr<Scope> closure_;
+  std::unique_ptr<Scope> closure_;
   const FunctionCallNode* definition_;
 };
 
diff --git a/tools/gn/test_with_scope.cc b/tools/gn/test_with_scope.cc
index 2be27fa..32d5dd6 100644
--- a/tools/gn/test_with_scope.cc
+++ b/tools/gn/test_with_scope.cc
@@ -42,7 +42,7 @@
   Err err;
 
   // CC
-  scoped_ptr<Tool> cc_tool(new Tool);
+  std::unique_ptr<Tool> cc_tool(new Tool);
   SetCommandForTool(
       "cc {{source}} {{cflags}} {{cflags_c}} {{defines}} {{include_dirs}} "
       "-o {{output}}",
@@ -52,7 +52,7 @@
   toolchain->SetTool(Toolchain::TYPE_CC, std::move(cc_tool));
 
   // CXX
-  scoped_ptr<Tool> cxx_tool(new Tool);
+  std::unique_ptr<Tool> cxx_tool(new Tool);
   SetCommandForTool(
       "c++ {{source}} {{cflags}} {{cflags_cc}} {{defines}} {{include_dirs}} "
       "-o {{output}}",
@@ -62,7 +62,7 @@
   toolchain->SetTool(Toolchain::TYPE_CXX, std::move(cxx_tool));
 
   // OBJC
-  scoped_ptr<Tool> objc_tool(new Tool);
+  std::unique_ptr<Tool> objc_tool(new Tool);
   SetCommandForTool(
       "objcc {{source}} {{cflags}} {{cflags_objc}} {{defines}} "
       "{{include_dirs}} -o {{output}}",
@@ -72,7 +72,7 @@
   toolchain->SetTool(Toolchain::TYPE_OBJC, std::move(objc_tool));
 
   // OBJC
-  scoped_ptr<Tool> objcxx_tool(new Tool);
+  std::unique_ptr<Tool> objcxx_tool(new Tool);
   SetCommandForTool(
       "objcxx {{source}} {{cflags}} {{cflags_objcc}} {{defines}} "
       "{{include_dirs}} -o {{output}}",
@@ -84,7 +84,7 @@
   // Don't use RC and ASM tools in unit tests yet. Add here if needed.
 
   // ALINK
-  scoped_ptr<Tool> alink_tool(new Tool);
+  std::unique_ptr<Tool> alink_tool(new Tool);
   SetCommandForTool("ar {{output}} {{source}}", alink_tool.get());
   alink_tool->set_lib_switch("-l");
   alink_tool->set_lib_dir_switch("-L");
@@ -94,7 +94,7 @@
   toolchain->SetTool(Toolchain::TYPE_ALINK, std::move(alink_tool));
 
   // SOLINK
-  scoped_ptr<Tool> solink_tool(new Tool);
+  std::unique_ptr<Tool> solink_tool(new Tool);
   SetCommandForTool("ld -shared -o {{target_output_name}}.so {{inputs}} "
       "{{ldflags}} {{libs}}", solink_tool.get());
   solink_tool->set_lib_switch("-l");
@@ -106,7 +106,7 @@
   toolchain->SetTool(Toolchain::TYPE_SOLINK, std::move(solink_tool));
 
   // SOLINK_MODULE
-  scoped_ptr<Tool> solink_module_tool(new Tool);
+  std::unique_ptr<Tool> solink_module_tool(new Tool);
   SetCommandForTool("ld -bundle -o {{target_output_name}}.so {{inputs}} "
       "{{ldflags}} {{libs}}", solink_module_tool.get());
   solink_module_tool->set_lib_switch("-l");
@@ -119,7 +119,7 @@
                      std::move(solink_module_tool));
 
   // LINK
-  scoped_ptr<Tool> link_tool(new Tool);
+  std::unique_ptr<Tool> link_tool(new Tool);
   SetCommandForTool("ld -o {{target_output_name}} {{source}} "
       "{{ldflags}} {{libs}}", link_tool.get());
   link_tool->set_lib_switch("-l");
@@ -129,23 +129,23 @@
   toolchain->SetTool(Toolchain::TYPE_LINK, std::move(link_tool));
 
   // STAMP
-  scoped_ptr<Tool> stamp_tool(new Tool);
+  std::unique_ptr<Tool> stamp_tool(new Tool);
   SetCommandForTool("touch {{output}}", stamp_tool.get());
   toolchain->SetTool(Toolchain::TYPE_STAMP, std::move(stamp_tool));
 
   // COPY
-  scoped_ptr<Tool> copy_tool(new Tool);
+  std::unique_ptr<Tool> copy_tool(new Tool);
   SetCommandForTool("cp {{source}} {{output}}", copy_tool.get());
   toolchain->SetTool(Toolchain::TYPE_COPY, std::move(copy_tool));
 
   // COPY_BUNDLE_DATA
-  scoped_ptr<Tool> copy_bundle_data_tool(new Tool);
+  std::unique_ptr<Tool> copy_bundle_data_tool(new Tool);
   SetCommandForTool("cp {{source}} {{output}}", copy_bundle_data_tool.get());
   toolchain->SetTool(Toolchain::TYPE_COPY_BUNDLE_DATA,
                      std::move(copy_bundle_data_tool));
 
   // COMPILE_XCASSETS
-  scoped_ptr<Tool> compile_xcassets_tool(new Tool);
+  std::unique_ptr<Tool> compile_xcassets_tool(new Tool);
   SetCommandForTool("touch {{output}}", compile_xcassets_tool.get());
   toolchain->SetTool(Toolchain::TYPE_COMPILE_XCASSETS,
                      std::move(compile_xcassets_tool));
diff --git a/tools/gn/test_with_scope.h b/tools/gn/test_with_scope.h
index 75b0899..fa6fb4b 100644
--- a/tools/gn/test_with_scope.h
+++ b/tools/gn/test_with_scope.h
@@ -92,7 +92,7 @@
   InputFile input_file_;
 
   std::vector<Token> tokens_;
-  scoped_ptr<ParseNode> parsed_;
+  std::unique_ptr<ParseNode> parsed_;
 
   Err parse_err_;
 
diff --git a/tools/gn/toolchain.cc b/tools/gn/toolchain.cc
index 280fb12..14d2bfd 100644
--- a/tools/gn/toolchain.cc
+++ b/tools/gn/toolchain.cc
@@ -91,7 +91,7 @@
   return tools_[static_cast<size_t>(type)].get();
 }
 
-void Toolchain::SetTool(ToolType type, scoped_ptr<Tool> t) {
+void Toolchain::SetTool(ToolType type, std::unique_ptr<Tool> t) {
   DCHECK(type != TYPE_NONE);
   DCHECK(!tools_[type].get());
   t->SetComplete();
diff --git a/tools/gn/toolchain.h b/tools/gn/toolchain.h
index 47a3a44..0c20726 100644
--- a/tools/gn/toolchain.h
+++ b/tools/gn/toolchain.h
@@ -5,8 +5,9 @@
 #ifndef TOOLS_GN_TOOLCHAIN_H_
 #define TOOLS_GN_TOOLCHAIN_H_
 
+#include <memory>
+
 #include "base/logging.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/strings/string_piece.h"
 #include "tools/gn/item.h"
 #include "tools/gn/label_ptr.h"
@@ -81,7 +82,7 @@
 
   // Set a tool. When all tools are configured, you should call
   // ToolchainSetupComplete().
-  void SetTool(ToolType type, scoped_ptr<Tool> t);
+  void SetTool(ToolType type, std::unique_ptr<Tool> t);
 
   // Does final setup on the toolchain once all tools are known.
   void ToolchainSetupComplete();
@@ -117,7 +118,7 @@
   int concurrent_links() const { return concurrent_links_; }
 
  private:
-  scoped_ptr<Tool> tools_[TYPE_NUMTYPES];
+  std::unique_ptr<Tool> tools_[TYPE_NUMTYPES];
 
   // How many links to run in parallel. Only the default toolchain's version of
   // this variable applies.
diff --git a/tools/gn/value.cc b/tools/gn/value.cc
index 57f23b0..1bf0bb7 100644
--- a/tools/gn/value.cc
+++ b/tools/gn/value.cc
@@ -56,7 +56,7 @@
       origin_(origin) {
 }
 
-Value::Value(const ParseNode* origin, scoped_ptr<Scope> scope)
+Value::Value(const ParseNode* origin, std::unique_ptr<Scope> scope)
     : type_(SCOPE),
       string_value_(),
       boolean_value_(false),
@@ -111,7 +111,7 @@
   }
 }
 
-void Value::SetScopeValue(scoped_ptr<Scope> scope) {
+void Value::SetScopeValue(std::unique_ptr<Scope> scope) {
   DCHECK(type_ == SCOPE);
   scope_value_ = std::move(scope);
 }
diff --git a/tools/gn/value.h b/tools/gn/value.h
index 44fba4a..a8a83fb 100644
--- a/tools/gn/value.h
+++ b/tools/gn/value.h
@@ -6,11 +6,12 @@
 #define TOOLS_GN_VALUE_H_
 
 #include <stdint.h>
+
 #include <map>
+#include <memory>
 
 #include "base/logging.h"
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "tools/gn/err.h"
 
 class ParseNode;
@@ -39,7 +40,7 @@
   // use-cases for creating values and immediately setting the scope on it. So
   // you can pass a null scope here if you promise to set it before any other
   // code gets it (code will generally assume the scope is not null).
-  Value(const ParseNode* origin, scoped_ptr<Scope> scope);
+  Value(const ParseNode* origin, std::unique_ptr<Scope> scope);
 
   Value(const Value& other);
   ~Value();
@@ -99,7 +100,7 @@
     DCHECK(type_ == SCOPE);
     return scope_value_.get();
   }
-  void SetScopeValue(scoped_ptr<Scope> scope);
+  void SetScopeValue(std::unique_ptr<Scope> scope);
 
   // Converts the given value to a string. Returns true if strings should be
   // quoted or the ToString of a string should be the string itself. If the
@@ -124,7 +125,7 @@
   bool boolean_value_;
   int64_t int_value_;
   std::vector<Value> list_value_;
-  scoped_ptr<Scope> scope_value_;
+  std::unique_ptr<Scope> scope_value_;
 
   const ParseNode* origin_;
 };
diff --git a/tools/gn/value_unittest.cc b/tools/gn/value_unittest.cc
index 75f9f60..9fefaf7 100644
--- a/tools/gn/value_unittest.cc
+++ b/tools/gn/value_unittest.cc
@@ -34,7 +34,7 @@
   // Scopes.
   TestWithScope setup;
   Scope* scope = new Scope(setup.scope());
-  Value scopeval(nullptr, scoped_ptr<Scope>(scope));
+  Value scopeval(nullptr, std::unique_ptr<Scope>(scope));
   EXPECT_EQ("{ }", scopeval.ToString(false));
 
   scope->SetValue("a", Value(nullptr, static_cast<int64_t>(42)), nullptr);
diff --git a/tools/gn/visual_studio_writer.cc b/tools/gn/visual_studio_writer.cc
index 4c88f35..e048346 100644
--- a/tools/gn/visual_studio_writer.cc
+++ b/tools/gn/visual_studio_writer.cc
@@ -6,11 +6,11 @@
 
 #include <algorithm>
 #include <map>
+#include <memory>
 #include <set>
 #include <string>
 
 #include "base/logging.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/strings/string_split.h"
 #include "base/strings/string_util.h"
 #include "base/strings/utf_string_conversions.h"
@@ -352,19 +352,20 @@
           .add("xmlns", "http://schemas.microsoft.com/developer/msbuild/2003"));
 
   {
-    scoped_ptr<XmlElementWriter> configurations = project.SubElement(
+    std::unique_ptr<XmlElementWriter> configurations = project.SubElement(
         "ItemGroup", XmlAttributes("Label", "ProjectConfigurations"));
-    scoped_ptr<XmlElementWriter> project_config = configurations->SubElement(
-        "ProjectConfiguration",
-        XmlAttributes("Include", std::string(kConfigurationName) + '|' +
-                                     solution_project.config_platform));
+    std::unique_ptr<XmlElementWriter> project_config =
+        configurations->SubElement(
+            "ProjectConfiguration",
+            XmlAttributes("Include", std::string(kConfigurationName) + '|' +
+                                         solution_project.config_platform));
     project_config->SubElement("Configuration")->Text(kConfigurationName);
     project_config->SubElement("Platform")
         ->Text(solution_project.config_platform);
   }
 
   {
-    scoped_ptr<XmlElementWriter> globals =
+    std::unique_ptr<XmlElementWriter> globals =
         project.SubElement("PropertyGroup", XmlAttributes("Label", "Globals"));
     globals->SubElement("ProjectGuid")->Text(solution_project.guid);
     globals->SubElement("Keyword")->Text("Win32Proj");
@@ -378,7 +379,7 @@
                               "$(VCTargetsPath)\\Microsoft.Cpp.Default.props"));
 
   {
-    scoped_ptr<XmlElementWriter> configuration = project.SubElement(
+    std::unique_ptr<XmlElementWriter> configuration = project.SubElement(
         "PropertyGroup", XmlAttributes("Label", "Configuration"));
     configuration->SubElement("CharacterSet")->Text("Unicode");
     std::string configuration_type = GetConfigurationType(target, err);
@@ -388,7 +389,7 @@
   }
 
   {
-    scoped_ptr<XmlElementWriter> locals =
+    std::unique_ptr<XmlElementWriter> locals =
         project.SubElement("PropertyGroup", XmlAttributes("Label", "Locals"));
     locals->SubElement("PlatformToolset")->Text(toolset_version_);
   }
@@ -404,7 +405,7 @@
                      XmlAttributes("Label", "ExtensionSettings"));
 
   {
-    scoped_ptr<XmlElementWriter> property_sheets = project.SubElement(
+    std::unique_ptr<XmlElementWriter> property_sheets = project.SubElement(
         "ImportGroup", XmlAttributes("Label", "PropertySheets"));
     property_sheets->SubElement(
         "Import",
@@ -419,10 +420,11 @@
   project.SubElement("PropertyGroup", XmlAttributes("Label", "UserMacros"));
 
   {
-    scoped_ptr<XmlElementWriter> properties =
+    std::unique_ptr<XmlElementWriter> properties =
         project.SubElement("PropertyGroup");
     {
-      scoped_ptr<XmlElementWriter> out_dir = properties->SubElement("OutDir");
+      std::unique_ptr<XmlElementWriter> out_dir =
+          properties->SubElement("OutDir");
       path_output.WriteDir(out_dir->StartContent(false),
                            build_settings_->build_dir(),
                            PathOutput::DIR_NO_LAST_SLASH);
@@ -435,13 +437,13 @@
   }
 
   {
-    scoped_ptr<XmlElementWriter> item_definitions =
+    std::unique_ptr<XmlElementWriter> item_definitions =
         project.SubElement("ItemDefinitionGroup");
     {
-      scoped_ptr<XmlElementWriter> cl_compile =
+      std::unique_ptr<XmlElementWriter> cl_compile =
           item_definitions->SubElement("ClCompile");
       {
-        scoped_ptr<XmlElementWriter> include_dirs =
+        std::unique_ptr<XmlElementWriter> include_dirs =
             cl_compile->SubElement("AdditionalIncludeDirectories");
         RecursiveTargetConfigToStream<SourceDir>(
             target, &ConfigValues::include_dirs, IncludeDirWriter(path_output),
@@ -483,7 +485,7 @@
         cl_compile->SubElement("PrecompiledHeader")->Text("NotUsing");
       }
       {
-        scoped_ptr<XmlElementWriter> preprocessor_definitions =
+        std::unique_ptr<XmlElementWriter> preprocessor_definitions =
             cl_compile->SubElement("PreprocessorDefinitions");
         RecursiveTargetConfigToStream<std::string>(
             target, &ConfigValues::defines, SemicolonSeparatedWriter(),
@@ -505,7 +507,7 @@
   }
 
   {
-    scoped_ptr<XmlElementWriter> group = project.SubElement("ItemGroup");
+    std::unique_ptr<XmlElementWriter> group = project.SubElement("ItemGroup");
     if (!target->config_values().precompiled_source().is_null()) {
       group
           ->SubElement(
@@ -537,7 +539,7 @@
   std::string ninja_target = GetNinjaTarget(target);
 
   {
-    scoped_ptr<XmlElementWriter> build =
+    std::unique_ptr<XmlElementWriter> build =
         project.SubElement("Target", XmlAttributes("Name", "Build"));
     build->SubElement(
         "Exec", XmlAttributes("Command",
@@ -545,7 +547,7 @@
   }
 
   {
-    scoped_ptr<XmlElementWriter> clean =
+    std::unique_ptr<XmlElementWriter> clean =
         project.SubElement("Target", XmlAttributes("Name", "Clean"));
     clean->SubElement(
         "Exec",
@@ -567,7 +569,7 @@
   std::ostringstream files_out;
 
   {
-    scoped_ptr<XmlElementWriter> filters_group =
+    std::unique_ptr<XmlElementWriter> filters_group =
         project.SubElement("ItemGroup");
     XmlElementWriter files_group(files_out, "ItemGroup", XmlAttributes(), 2);
 
@@ -586,7 +588,7 @@
     for (const SourceFile& file : target->sources()) {
       SourceFileType type = GetSourceFileType(file);
       if (type == SOURCE_H || type == SOURCE_CPP || type == SOURCE_C) {
-        scoped_ptr<XmlElementWriter> cl_item = files_group.SubElement(
+        std::unique_ptr<XmlElementWriter> cl_item = files_group.SubElement(
             type == SOURCE_H ? "ClInclude" : "ClCompile", "Include",
             SourceFileWriter(file_path_output, file));
 
diff --git a/tools/gn/xml_element_writer.cc b/tools/gn/xml_element_writer.cc
index a608ee3..fcf34b2 100644
--- a/tools/gn/xml_element_writer.cc
+++ b/tools/gn/xml_element_writer.cc
@@ -4,6 +4,8 @@
 
 #include "tools/gn/xml_element_writer.h"
 
+#include "base/memory/ptr_util.h"
+
 XmlAttributes::XmlAttributes() {}
 
 XmlAttributes::XmlAttributes(const base::StringPiece& attr_key,
@@ -53,16 +55,16 @@
   out_ << content;
 }
 
-scoped_ptr<XmlElementWriter> XmlElementWriter::SubElement(
+std::unique_ptr<XmlElementWriter> XmlElementWriter::SubElement(
     const std::string& tag) {
   return SubElement(tag, XmlAttributes());
 }
 
-scoped_ptr<XmlElementWriter> XmlElementWriter::SubElement(
+std::unique_ptr<XmlElementWriter> XmlElementWriter::SubElement(
     const std::string& tag,
     const XmlAttributes& attributes) {
   StartContent(true);
-  return make_scoped_ptr(
+  return base::WrapUnique(
       new XmlElementWriter(out_, tag, attributes, indent_ + 2));
 }
 
diff --git a/tools/gn/xml_element_writer.h b/tools/gn/xml_element_writer.h
index 186bd35..8a83df0 100644
--- a/tools/gn/xml_element_writer.h
+++ b/tools/gn/xml_element_writer.h
@@ -6,12 +6,13 @@
 #define TOOLS_GN_XML_ELEMENT_WRITER_H_
 
 #include <iosfwd>
+#include <memory>
 #include <string>
 #include <utility>
 #include <vector>
 
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
+#include "base/memory/ptr_util.h"
 #include "base/strings/string_piece.h"
 
 // Vector of XML attribute key-value pairs.
@@ -58,13 +59,14 @@
 
   // Starts new XML sub-element. Caller must ensure that parent element outlives
   // its children.
-  scoped_ptr<XmlElementWriter> SubElement(const std::string& tag);
-  scoped_ptr<XmlElementWriter> SubElement(const std::string& tag,
-                                          const XmlAttributes& attributes);
+  std::unique_ptr<XmlElementWriter> SubElement(const std::string& tag);
+  std::unique_ptr<XmlElementWriter> SubElement(const std::string& tag,
+                                               const XmlAttributes& attributes);
   template <class Writer>
-  scoped_ptr<XmlElementWriter> SubElement(const std::string& tag,
-                                          const std::string& attribute_name,
-                                          const Writer& attribute_value_writer);
+  std::unique_ptr<XmlElementWriter> SubElement(
+      const std::string& tag,
+      const std::string& attribute_name,
+      const Writer& attribute_value_writer);
 
   // Finishes opening tag if it isn't finished yet and optionally starts new
   // document line. Returns the stream where XML element content can be written.
@@ -109,12 +111,12 @@
 }
 
 template <class Writer>
-scoped_ptr<XmlElementWriter> XmlElementWriter::SubElement(
+std::unique_ptr<XmlElementWriter> XmlElementWriter::SubElement(
     const std::string& tag,
     const std::string& attribute_name,
     const Writer& attribute_value_writer) {
   StartContent(true);
-  return make_scoped_ptr(new XmlElementWriter(
+  return base::WrapUnique(new XmlElementWriter(
       out_, tag, attribute_name, attribute_value_writer, indent_ + 2));
 }