Add GN build for some chrome common, chrome net, and resources targets.

Slight enhancements to the grit template.

[email protected]

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@277517 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn
new file mode 100644
index 0000000..6049415
--- /dev/null
+++ b/chrome/browser/BUILD.gn
@@ -0,0 +1,60 @@
+# Copyright 2014 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import("//tools/grit/grit_rule.gni")
+
+about_credits_file = "$target_gen_dir/about_credits.html"
+additional_modules_list_file =
+    "$root_gen_dir/chrome/browser/internal/additional_modules_list.txt"
+
+# GYP version: chrome/chrome_resources.gyp:chrome_resources
+# (generate_browser_resources action)
+grit("resources") {
+  source = "browser_resources.grd"
+
+  omnibox_mojom_file = "$root_gen_dir/chrome/browser/ui/webui/omnibox/omnibox.mojom.js"
+
+  grit_flags = [
+    "-E", "about_credits_file=" +
+          rebase_path(about_credits_file, root_build_dir),
+    "-E", "additional_modules_list_file=" +
+          rebase_path(additional_modules_list_file, root_build_dir),
+    "-E", "omnibox_mojom_file=" +
+          rebase_path(omnibox_mojom_file, root_build_dir),
+  ]
+
+  deps = [
+    ":about_credits",
+    ":chrome_internal_resources_gen",
+    "//chrome/browser/ui/webui/omnibox:mojo_bindings",
+  ]
+}
+
+# GYP version: chrome/chrome_resource.gyp:about_credits
+action("about_credits") {
+  script = "//tools/licenses.py"
+
+  # TODO(phajdan.jr): input dependencies so this can be regenerated
+  # automatically when one of the credits changes. The way this should work is
+  # that licenses.py should write a .d file listing the input dependencies (see
+  # "depfile" in GN).
+  outputs = [ about_credits_file ]
+
+  args = [
+    "credits",
+    rebase_path(about_credits_file, root_build_dir),
+  ]
+}
+
+# GYP version: chrome/chrome_resource.gyp:chrome_internal_resources_gen
+# TODO(GYP) write internal action
+if (false) {  #if (is_chrome_branded) {
+  action("chrome_internal_resources_gen") {
+    # TODO(GYP)
+  }
+} else {
+  group("chrome_internal_resources_gen") {
+    # Empty placeholder.
+  }
+}