Content "gn check" work.

Make content/gpu and content/plugin pass GN check. Significant work for most of content/test

Makes most of content/shell and content/test pass check. These are not all enabled yet pending a few remaining issues that are more difficult to solve.

The private content targets now allow content/test to include headers from them for non-component builds. Checking is disabled for content/test in component builds as described in the comment at the top of //content/BUILD.gn

Renames the ui/events/ipc according to GN style.

Annotates all content and gpu visibility declarations with why the're there, and fixes some incorrect ones that people added without understanding.

Reland of https://codereview.chromium.org/1828483002/ with significant changes.
TBR=jschuh (non-security-sensitive ipc build changes)

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

Cr-Commit-Position: refs/heads/master@{#383358}
diff --git a/content/common/BUILD.gn b/content/common/BUILD.gn
index 36c50576..9a0ed5db 100644
--- a/content/common/BUILD.gn
+++ b/content/common/BUILD.gn
@@ -126,9 +126,11 @@
 }
 
 source_set("common") {
-  # Only the public target should depend on this. All other targets (even
-  # internal content ones) should depend on the public one.
-  visibility = [ "//content/public/common:common_sources" ]
+  # Targets external to content should always link to the public API.
+  # In addition, targets outside of the content component (shell and tests)
+  # must not link to this because it will duplicate the code in the component
+  # build.
+  visibility = [ "//content/*" ]
 
   sources = rebase_path(content_common_gypi_values.private_common_sources,
                         ".",
@@ -195,7 +197,7 @@
     "//ui/accessibility",
     "//ui/base",
     "//ui/base/ime",
-    "//ui/events/ipc:events_ipc",
+    "//ui/events/ipc",
     "//ui/gfx",
     "//ui/gfx/geometry",
     "//ui/gfx/ipc",
@@ -519,7 +521,23 @@
   }
 }
 
+# See comment at the top of //content/BUILD.gn for how this works.
+group("for_content_tests") {
+  visibility = [ "//content/test/*" ]
+  if (!is_component_build) {
+    public_deps = [
+      ":common",
+    ]
+  }
+}
+
 mojom("mojo_bindings") {
+  # This interface is internal to content. However, this is not exported from
+  # the content component shared library. Code in content but outside of the
+  # content component (content/test or content/shell) should link to this
+  # directly.
+  visibility = [ "//content/*" ]
+
   sources = [
     "application_setup.mojom",
     "background_sync_service.mojom",