BUILD.gn: Only build dawn_bindings in standalone

The BackendBinding that implement correct interactions between Dawn and
GLFW windows is only needed when compiling the Dawn samples. This only
happen in standalone so move the dawn_bindings there.

This fixes an issue where the ChromeOS build would discover the Dawn
BUILD.gn file and try to build dawn_bindings that depended on a fake
GLFW target, making the GLFW #includes fail.

With dawn_binding moved in dawn_standalone, all targets discoverable by
a Chromium build that use GLFW do so behind the dawn_enable_opengl flag,
which is always false on ChromeOS.

Also reverts https://dawn-review.googlesource.com/c/dawn/+/13620 because
we want to allow building dawn_end2end_tests on ChromeOS even if the
browser doesn't use_dawn.

BUG=1025326

Change-Id: I8ab965c5da68ca422912b21f87f65e32e789ee8a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13820
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Brian Ho <hob@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
diff --git a/BUILD.gn b/BUILD.gn
index fb11705..ca6a8c0 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -21,13 +21,6 @@
 
 import("//testing/test.gni")
 
-if (build_with_chromium) {
-  # Chromium build targets may not depend on dawn unless use_dawn is set. This
-  # assertion helps avoid accidental dependencies creeping into chromium.
-  import("//ui/gl/features.gni")
-  assert(use_dawn)
-}
-
 ###############################################################################
 # dawn_platform
 ###############################################################################
@@ -717,55 +710,6 @@
   ]
 }
 
-static_library("dawn_bindings") {
-  configs += [ "${dawn_root}/src/common:dawn_internal" ]
-
-  sources = [
-    "src/utils/BackendBinding.cpp",
-    "src/utils/BackendBinding.h",
-  ]
-
-  public_deps = [
-    "${dawn_root}/src/dawn:dawn_headers",
-  ]
-
-  deps = [
-    ":dawn_glfw",
-    ":libdawn_native",
-    "${dawn_root}/src/common",
-  ]
-  libs = []
-
-  if (dawn_enable_d3d12) {
-    sources += [ "src/utils/D3D12Binding.cpp" ]
-  }
-
-  if (dawn_enable_metal) {
-    sources += [ "src/utils/MetalBinding.mm" ]
-    libs += [
-      "Metal.framework",
-      "QuartzCore.framework",
-    ]
-
-    # Suppress warnings that Metal isn't in the deployment target of Chrome
-    if (is_mac) {
-      cflags_objcc = [ "-Wno-unguarded-availability" ]
-    }
-  }
-
-  if (dawn_enable_null) {
-    sources += [ "src/utils/NullBinding.cpp" ]
-  }
-
-  if (dawn_enable_opengl) {
-    sources += [ "src/utils/OpenGLBinding.cpp" ]
-  }
-
-  if (dawn_enable_vulkan) {
-    sources += [ "src/utils/VulkanBinding.cpp" ]
-  }
-}
-
 ###############################################################################
 # Dawn test targets
 ###############################################################################
@@ -1103,6 +1047,56 @@
 ###############################################################################
 
 if (dawn_standalone) {
+  # Library to handle the interaction of Dawn with GLFW windows in samples
+  static_library("dawn_bindings") {
+    configs += [ "${dawn_root}/src/common:dawn_internal" ]
+
+    sources = [
+      "src/utils/BackendBinding.cpp",
+      "src/utils/BackendBinding.h",
+    ]
+
+    public_deps = [
+      "${dawn_root}/src/dawn:dawn_headers",
+    ]
+
+    deps = [
+      ":dawn_glfw",
+      ":libdawn_native",
+      "${dawn_root}/src/common",
+    ]
+    libs = []
+
+    if (dawn_enable_d3d12) {
+      sources += [ "src/utils/D3D12Binding.cpp" ]
+    }
+
+    if (dawn_enable_metal) {
+      sources += [ "src/utils/MetalBinding.mm" ]
+      libs += [
+        "Metal.framework",
+        "QuartzCore.framework",
+      ]
+
+      # Suppress warnings that Metal isn't in the deployment target of Chrome
+      if (is_mac) {
+        cflags_objcc = [ "-Wno-unguarded-availability" ]
+      }
+    }
+
+    if (dawn_enable_null) {
+      sources += [ "src/utils/NullBinding.cpp" ]
+    }
+
+    if (dawn_enable_opengl) {
+      sources += [ "src/utils/OpenGLBinding.cpp" ]
+    }
+
+    if (dawn_enable_vulkan) {
+      sources += [ "src/utils/VulkanBinding.cpp" ]
+    }
+  }
+
   # Static library to contain code and dependencies common to all samples
   static_library("dawn_sample_utils") {
     sources = [