Remove base::Value::SetStringWithoutPathExpansion

This change removes the deprecated SetStringWithoutPathExpansion from
base::Value. Existing usages are replaced by SetKey(key,
Value(std::string)) and SetKey(key, Value(base::string16)).

Bug: 646113
Change-Id: I3f3ce77d155c0f8f7a65c8fc9c2f62f9807f2a95
Reviewed-on: https://chromium-review.googlesource.com/592368
Commit-Queue: Jan Wilken Dörrie <jdoerrie@chromium.org>
Reviewed-by: Steven Bennetts <stevenjb@chromium.org>
Reviewed-by: Brett Wilson <brettw@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#495172}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: fbb03dd16b7d9a749d127f0252dfea5f324bb954
diff --git a/tools/gn/analyzer.cc b/tools/gn/analyzer.cc
index 43cd137..a4b7004 100644
--- a/tools/gn/analyzer.cc
+++ b/tools/gn/analyzer.cc
@@ -93,7 +93,7 @@
 void WriteString(base::DictionaryValue& dict,
                  const std::string& key,
                  const std::string& value) {
-  dict.SetStringWithoutPathExpansion(key, value);
+  dict.SetKey(key, base::Value(value));
 };
 
 void WriteLabels(const Label& default_toolchain,
diff --git a/tools/gn/desc_builder.cc b/tools/gn/desc_builder.cc
index bcf4dc6..c06317f 100644
--- a/tools/gn/desc_builder.cc
+++ b/tools/gn/desc_builder.cc
@@ -186,9 +186,10 @@
     const ConfigValues& values = config_->resolved_values();
 
     if (what_.empty())
-      res->SetStringWithoutPathExpansion(
+      res->SetKey(
           "toolchain",
-          config_->label().GetToolchainLabel().GetUserVisibleName(false));
+          base::Value(
+              config_->label().GetToolchainLabel().GetUserVisibleName(false)));
 
     if (what(variables::kConfigs) && !config_->configs().empty()) {
       auto configs = base::MakeUnique<base::ListValue>();
@@ -259,12 +260,13 @@
     bool is_binary_output = target_->IsBinary();
 
     if (what_.empty()) {
-      res->SetStringWithoutPathExpansion(
+      res->SetKey(
           "type",
-          Target::GetStringForOutputType(target_->output_type()));
-      res->SetStringWithoutPathExpansion(
+          base::Value(Target::GetStringForOutputType(target_->output_type())));
+      res->SetKey(
           "toolchain",
-          target_->label().GetToolchainLabel().GetUserVisibleName(false));
+          base::Value(
+              target_->label().GetToolchainLabel().GetUserVisibleName(false)));
     }
 
     // General target meta variables.
@@ -295,20 +297,19 @@
                                    RenderValue(target_->sources()));
 
     if (what(variables::kOutputName) && !target_->output_name().empty())
-      res->SetStringWithoutPathExpansion(variables::kOutputName,
-                                         target_->output_name());
+      res->SetKey(variables::kOutputName, base::Value(target_->output_name()));
 
     if (what(variables::kOutputDir) && !target_->output_dir().is_null())
       res->SetWithoutPathExpansion(variables::kOutputDir,
                                    RenderValue(target_->output_dir()));
 
     if (what(variables::kOutputExtension) && target_->output_extension_set())
-      res->SetStringWithoutPathExpansion(variables::kOutputExtension,
-                                         target_->output_extension());
+      res->SetKey(variables::kOutputExtension,
+                  base::Value(target_->output_extension()));
 
     if (what(variables::kPublic)) {
       if (target_->all_headers_public())
-        res->SetStringWithoutPathExpansion(variables::kPublic, "*");
+        res->SetKey(variables::kPublic, base::Value("*"));
       else
         res->SetWithoutPathExpansion(variables::kPublic,
                                      RenderValue(target_->public_headers()));
@@ -344,9 +345,8 @@
     if (target_->output_type() == Target::ACTION ||
         target_->output_type() == Target::ACTION_FOREACH) {
       if (what(variables::kScript))
-        res->SetStringWithoutPathExpansion(
-            variables::kScript,
-            target_->action_values().script().value());
+        res->SetKey(variables::kScript,
+                    base::Value(target_->action_values().script().value()));
 
       if (what(variables::kArgs)) {
         auto args = base::MakeUnique<base::ListValue>();
@@ -357,9 +357,8 @@
       }
       if (what(variables::kDepfile) &&
           !target_->action_values().depfile().empty()) {
-        res->SetStringWithoutPathExpansion(
-            variables::kDepfile,
-            target_->action_values().depfile().AsString());
+        res->SetKey(variables::kDepfile,
+                    base::Value(target_->action_values().depfile().AsString()));
       }
     }
 
@@ -569,9 +568,9 @@
     BundleData::SourceFiles sources;
     bundle_data.GetSourceFiles(&sources);
     data->SetWithoutPathExpansion("source_files", RenderValue(sources));
-    data->SetStringWithoutPathExpansion(
+    data->SetKey(
         "root_dir_output",
-        bundle_data.GetBundleRootDirOutput(settings).value());
+        base::Value(bundle_data.GetBundleRootDirOutput(settings).value()));
     data->SetWithoutPathExpansion("root_dir",
                                   RenderValue(bundle_data.root_dir()));
     data->SetWithoutPathExpansion("resources_dir",
@@ -580,8 +579,7 @@
                                   RenderValue(bundle_data.executable_dir()));
     data->SetWithoutPathExpansion("plugins_dir",
                                   RenderValue(bundle_data.plugins_dir()));
-    data->SetStringWithoutPathExpansion("product_type",
-                                        bundle_data.product_type());
+    data->SetKey("product_type", base::Value(bundle_data.product_type()));
 
     auto deps = base::MakeUnique<base::ListValue>();
     for (const auto* dep : bundle_data.bundle_deps())
diff --git a/tools/gn/json_project_writer.cc b/tools/gn/json_project_writer.cc
index 44576cd..dfb3cdb 100644
--- a/tools/gn/json_project_writer.cc
+++ b/tools/gn/json_project_writer.cc
@@ -106,13 +106,12 @@
   }
 
   auto settings = base::MakeUnique<base::DictionaryValue>();
-  settings->SetStringWithoutPathExpansion("root_path",
-                                          build_settings->root_path_utf8());
-  settings->SetStringWithoutPathExpansion("build_dir",
-                                          build_settings->build_dir().value());
-  settings->SetStringWithoutPathExpansion(
+  settings->SetKey("root_path", base::Value(build_settings->root_path_utf8()));
+  settings->SetKey("build_dir",
+                   base::Value(build_settings->build_dir().value()));
+  settings->SetKey(
       "default_toolchain",
-      default_toolchain_label.GetUserVisibleName(false));
+      base::Value(default_toolchain_label.GetUserVisibleName(false)));
 
   auto output = base::MakeUnique<base::DictionaryValue>();
   output->SetWithoutPathExpansion("targets", std::move(targets));