Rename use_nss to use_nss_certs in gyp and grit.

This matches the gn name and is less confusing with use_openssl and
use_openssl_certs both existing. The preprocessor flag will follow
in another CL. For now, the old name is still defined, but not used
within Chromium.

A follow-up CL will remove deprecated use_nss and USE_NSS #defines
together which will then cause downstream churn. Though from a grep
of known downstreams, the churn seems to be fairly minimal. The
removal is split from this CL so that, if we need to revert, the
CL to revert is small.

BUG=462040
TBR=wez@chromium.org

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

Cr-Commit-Position: refs/heads/master@{#325541}
diff --git a/build/common.gypi b/build/common.gypi
index 42cdf93..3547203f 100644
--- a/build/common.gypi
+++ b/build/common.gypi
@@ -682,8 +682,14 @@
 
         # NSS usage.
         ['(OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris") and use_openssl==0', {
+          'use_nss_certs%': 1,
+          # TODO(davidben): use_nss is deprecated and will be removed. See
+          # https://crbug.com/462040.
           'use_nss%': 1,
         }, {
+          'use_nss_certs%': 0,
+          # TODO(davidben): use_nss is deprecated and will be removed. See
+          # https://crbug.com/462040.
           'use_nss%': 0,
         }],
 
@@ -1086,6 +1092,7 @@
     'use_openssl%': '<(use_openssl)',
     'use_openssl_certs%': '<(use_openssl_certs)',
     'use_nss%': '<(use_nss)',
+    'use_nss_certs%': '<(use_nss_certs)',
     'use_udev%': '<(use_udev)',
     'os_bsd%': '<(os_bsd)',
     'os_posix%': '<(os_posix)',
@@ -2030,8 +2037,8 @@
       ['use_ash==1', {
         'grit_defines': ['-D', 'use_ash'],
       }],
-      ['use_nss==1', {
-        'grit_defines': ['-D', 'use_nss'],
+      ['use_nss_certs==1', {
+        'grit_defines': ['-D', 'use_nss_certs'],
       }],
       ['use_ozone==1', {
         'grit_defines': ['-D', 'use_ozone'],
@@ -3008,7 +3015,8 @@
       ['<(use_glib)==1 and >(nacl_untrusted_build)==0', {
         'defines': ['USE_GLIB=1'],
       }],
-      ['<(use_nss)==1 and >(nacl_untrusted_build)==0', {
+      ['<(use_nss_certs)==1 and >(nacl_untrusted_build)==0', {
+        # TODO(davidben): Rename this to USE_NSS_CERTS. https://crbug.com/462040
         'defines': ['USE_NSS=1'],
       }],
       ['<(chromeos)==1 and >(nacl_untrusted_build)==0', {
diff --git a/build/secondary/tools/grit/grit_rule.gni b/build/secondary/tools/grit/grit_rule.gni
index 28c0eee2..64cfd77a 100644
--- a/build/secondary/tools/grit/grit_rule.gni
+++ b/build/secondary/tools/grit/grit_rule.gni
@@ -146,7 +146,7 @@
 if (use_nss_certs) {
   grit_defines += [
     "-D",
-    "use_nss",
+    "use_nss_certs",
   ]
 }
 
diff --git a/chrome/browser/resources/options/browser_options.html b/chrome/browser/resources/options/browser_options.html
index 5aa5e0fc..5cbe5c4 100644
--- a/chrome/browser/resources/options/browser_options.html
+++ b/chrome/browser/resources/options/browser_options.html
@@ -753,7 +753,7 @@
   <section>
       <h3 i18n-content="advancedSectionTitleCertificates"></h3>
       <div>
-<if expr="use_nss or is_win or is_macosx">
+<if expr="use_nss_certs or is_win or is_macosx">
         <div class="settings-row">
           <button id="certificatesManageButton"
               i18n-content="certificatesManageButton"></button>
diff --git a/chrome/browser/resources/options/options.html b/chrome/browser/resources/options/options.html
index 6e26540d..662762c 100644
--- a/chrome/browser/resources/options/options.html
+++ b/chrome/browser/resources/options/options.html
@@ -65,7 +65,7 @@
 <link rel="stylesheet" href="factory_reset_overlay.css">
 <link rel="stylesheet" href="../help/channel_change_page.css">
 </if>
-<if expr="use_nss">
+<if expr="use_nss_certs">
 <link rel="stylesheet" href="certificate_manager.css">
 <link rel="stylesheet" href="certificate_tree.css">
 </if>
@@ -142,7 +142,7 @@
   <include src="chromeos/power_overlay.html">
   <include src="factory_reset_overlay.html">
 </if>
-<if expr="use_nss">
+<if expr="use_nss_certs">
   <include src="certificate_manager.html">
 </if>
 </div>
diff --git a/chrome/browser/resources/options/options_bundle.js b/chrome/browser/resources/options/options_bundle.js
index f32bf576..6b90d4f5 100644
--- a/chrome/browser/resources/options/options_bundle.js
+++ b/chrome/browser/resources/options/options_bundle.js
@@ -53,7 +53,7 @@
 var PowerOverlay = options.PowerOverlay;
 var UIAccountTweaks = uiAccountTweaks.UIAccountTweaks;
 </if>
-<if expr="use_nss">
+<if expr="use_nss_certs">
 <include src="certificate_tree.js">
 <include src="certificate_manager.js">
 <include src="certificate_restore_overlay.js">
diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi
index 54a888caf..e7fdcfa 100644
--- a/chrome/chrome_browser.gypi
+++ b/chrome/chrome_browser.gypi
@@ -3423,7 +3423,7 @@
             '../components/components.gyp:crash_component',
           ],
         }],
-        ['use_nss==1', {
+        ['use_nss_certs==1', {
           'sources': [ '<@(chrome_browser_nss_sources)' ],
           'conditions': [
             ['chromeos==1', {
diff --git a/chrome/chrome_browser_ui.gypi b/chrome/chrome_browser_ui.gypi
index 5505799..a52698d 100644
--- a/chrome/chrome_browser_ui.gypi
+++ b/chrome/chrome_browser_ui.gypi
@@ -2930,7 +2930,7 @@
             '../ui/gl/gl.gyp:gl',
           ],
         }],
-        ['use_nss==1', {
+        ['use_nss_certs==1', {
           'sources': [ '<@(chrome_browser_ui_nss_sources)' ],
         }],
         ['enable_themes==0', {
diff --git a/chrome/chrome_tests_unit.gypi b/chrome/chrome_tests_unit.gypi
index 9ae0735..348d2ad 100644
--- a/chrome/chrome_tests_unit.gypi
+++ b/chrome/chrome_tests_unit.gypi
@@ -2574,7 +2574,7 @@
             }],
           ],
         }],
-        ['OS != "android" and (use_nss == 1 or use_openssl_certs == 1)', {
+        ['OS != "android" and (use_nss_certs == 1 or use_openssl_certs == 1)', {
           'sources': [
             'common/net/x509_certificate_model_unittest.cc',
           ],
diff --git a/crypto/crypto.gyp b/crypto/crypto.gyp
index a11371f6..c8551e70 100644
--- a/crypto/crypto.gyp
+++ b/crypto/crypto.gyp
@@ -255,7 +255,7 @@
         },
       ],
     }],
-    ['use_nss==1', {
+    ['use_nss_certs==1', {
       'targets': [
         {
           'target_name': 'crypto_test_support',
@@ -273,7 +273,7 @@
             'scoped_test_system_nss_key_slot.h',
           ],
           'conditions': [
-            ['use_nss==0', {
+            ['use_nss_certs==0', {
               'sources!': [
                 'scoped_test_nss_db.cc',
                 'scoped_test_nss_db.h',
@@ -289,7 +289,7 @@
             }],
           ],
         }
-      ]}, {  # use_nss==0
+      ]}, {  # use_nss_certs==0
       'targets': [
         {
           'target_name': 'crypto_test_support',
diff --git a/net/net.gyp b/net/net.gyp
index a322f77..71058af 100644
--- a/net/net.gyp
+++ b/net/net.gyp
@@ -179,7 +179,7 @@
             'net_test_jni_headers',
           ],
         }],
-        [ 'use_nss != 1', {
+        [ 'use_nss_certs != 1', {
           'sources!': [
             'ssl/client_cert_store_chromeos_unittest.cc',
             'ssl/client_cert_store_nss_unittest.cc',
@@ -607,7 +607,7 @@
             '../third_party/protobuf/protobuf.gyp:py_proto',
           ],
         }],
-        ['use_openssl == 0 and (use_nss == 1 or OS == "ios")', {
+        ['use_openssl == 0 and (use_nss_certs == 1 or OS == "ios")', {
           'conditions': [
             [ 'desktop_linux == 1 or chromeos == 1', {
               'dependencies': [
@@ -651,7 +651,7 @@
               'dns/mock_mdns_socket_factory.h'
             ]
         }],
-        [ 'use_nss != 1', {
+        [ 'use_nss_certs != 1', {
             'sources!': [
               'test/cert_test_util_nss.cc',
             ],
diff --git a/net/net_common.gypi b/net/net_common.gypi
index 7411efa4..125e22f 100644
--- a/net/net_common.gypi
+++ b/net/net_common.gypi
@@ -284,7 +284,7 @@
         ],
       },
     ],
-    [ 'use_nss != 1', {
+    [ 'use_nss_certs != 1', {
         'sources!': [
           'cert/cert_verify_proc_nss.cc',
           'cert/cert_verify_proc_nss.h',
@@ -410,7 +410,7 @@
         ['include', '^base/network_config_watcher_mac\\.cc$'],
         ['include', '^base/platform_mime_util_mac\\.mm$'],
         # The iOS implementation only partially uses NSS and thus does not
-        # defines |use_nss|. In particular the |USE_NSS| preprocessor
+        # defines |use_nss_certs|. In particular the |USE_NSS| preprocessor
         # definition is not used. The following files are needed though:
         ['include', '^cert/cert_verify_proc_nss\\.cc$'],
         ['include', '^cert/cert_verify_proc_nss\\.h$'],
diff --git a/remoting/remoting_nacl.gyp b/remoting/remoting_nacl.gyp
index 5412772..b7c7374 100644
--- a/remoting/remoting_nacl.gyp
+++ b/remoting/remoting_nacl.gyp
@@ -12,7 +12,7 @@
     'protoc': '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)protoc<(EXECUTABLE_SUFFIX)',
     'proto_out_base': '<(SHARED_INTERMEDIATE_DIR)/protoc_out',
     'proto_out_dir': '<(proto_out_base)/remoting/proto',
-    'use_nss': 0,
+    'use_nss_certs': 0,
     'nacl_untrusted_build': 1,
     'chromium_code': 1,
   },
diff --git a/tools/gn/docs/cookbook.md b/tools/gn/docs/cookbook.md
index 186b8c3..2337b83 100644
--- a/tools/gn/docs/cookbook.md
+++ b/tools/gn/docs/cookbook.md
@@ -248,7 +248,7 @@
 | `use_glib` (0/1)                        | `is_linux` (true/false)                        | (global)                      |
 | `use_gnome_keyring` (0/1)               | `is_desktop_linux` (true/false)                |                               |
 | `use_goma` (0/1)                        | `use_goma` (true/false)                        | `//build/toolchain/goma.gni`  |
-| `use_nss` (0/1)                         | `use_nss_certs` (true/false)                   | `//build/config/crypto.gni` (Many of these conditions can be deleted, see the "SSL" notes on targets below.) |
+| `use_nss_certs` (0/1)                   | `use_nss_certs` (true/false)                   | `//build/config/crypto.gni` (Many of these conditions can be deleted, see the "SSL" notes on targets below.) |
 | `use_openssl` (0/1)                     | `use_openssl` (true/false)                     | `//build/config/crypto.gni` (Many of these conditions can be deleted, see the "SSL" notes on targets below.) |
 | `use_pango` (0/1)                       | `use_pango` (true/false)                       | `//build/config/ui.gni`       |
 | `use_ozone` (0/1)                       | `use_ozone` (true/false)                       | `//build/config/ui.gni`       |