From 2a613d8e5e76e6e5c1612276bbc659c3a22cc118 Mon Sep 17 00:00:00 2001 From: tdanderson Date: Mon, 29 Jun 2015 15:30:28 -0700 Subject: [PATCH] Generate resource pak files for top chrome material design assets Generate the pak files theme_resources_material_{100,200}_percent.pak which contain material design versions of the theme resources specified in theme_resources.grd. Note that these data packs do not fall back to non-material resources when the material resource is missing; as a result, the packs do not duplicate the resources contained within theme_resources_{100,200}_percent.pak. This CL also includes gypi and GN changes in order to repack into chrome_material_{100,200}_percent.pak, conditional on the ENABLE_TOPCHROME_MD compile-time flag. BUG=503754 TEST=none Review URL: https://codereview.chromium.org/1197813002 Cr-Commit-Position: refs/heads/master@{#336661} --- chrome/BUILD.gn | 60 ++++++++++++++++++++++ chrome/app/theme/BUILD.gn | 2 + chrome/app/theme/theme_resources.grd | 2 + .../chrome_repack_chrome_material_100_percent.gypi | 14 +++++ .../chrome_repack_chrome_material_200_percent.gypi | 14 +++++ chrome/chrome_resources.gyp | 26 ++++++++++ 6 files changed, 118 insertions(+) create mode 100644 chrome/chrome_repack_chrome_material_100_percent.gypi create mode 100644 chrome/chrome_repack_chrome_material_200_percent.gypi diff --git a/chrome/BUILD.gn b/chrome/BUILD.gn index 994fdc1c418d..74039425cb43 100644 --- a/chrome/BUILD.gn +++ b/chrome/BUILD.gn @@ -474,6 +474,14 @@ group("packed_resources") { if (enable_hidpi) { deps += [ ":repack_chrome_200_percent" ] } + + if (enable_topchrome_md) { + deps += [ ":repack_chrome_material_100_percent" ] + + if (enable_hidpi) { + deps += [ ":repack_chrome_material_200_percent" ] + } + } } repack("packed_extra_resources") { @@ -700,6 +708,58 @@ if (enable_hidpi) { } } +# Generates a rule to repack a set of material design resources for the browser +# top chrome, substituting a given string in for the percentage (e.g. "100", +# "200"). +template("chrome_repack_material_percent") { + percent = invoker.percent + + repack_name = "${target_name}_repack" + repack_output_file = "$root_gen_dir/repack/chrome_material_${percent}_percent.pak" + + copy_name = target_name + + repack(repack_name) { + visibility = [ ":$copy_name" ] + + # All sources should also have deps for completeness. + sources = [ + "$root_gen_dir/chrome/theme_resources_material_${percent}_percent.pak", + ] + + deps = [ + "//chrome/app/theme:theme_resources", + ] + + output = repack_output_file + } + + copy(copy_name) { + visibility = [ ":*" ] + deps = [ + ":$repack_name", + ] + sources = [ + repack_output_file, + ] + outputs = [ + "$root_build_dir/chrome_material_${percent}_percent.pak", + ] + } +} + +if (enable_topchrome_md) { + chrome_repack_material_percent("repack_chrome_material_100_percent") { + percent = "100" + } + + if (enable_hidpi) { + chrome_repack_material_percent("repack_chrome_material_200_percent") { + percent = "200" + } + } +} + # GYP version: chrome/chrome_resources.gyp:chrome_strings group("strings") { deps = [ diff --git a/chrome/app/theme/BUILD.gn b/chrome/app/theme/BUILD.gn index 408100078838..6282024005ea 100644 --- a/chrome/app/theme/BUILD.gn +++ b/chrome/app/theme/BUILD.gn @@ -14,6 +14,8 @@ grit("theme_resources") { "theme_resources_100_percent.pak", "theme_resources_200_percent.pak", "theme_resources_300_percent.pak", + "theme_resources_material_100_percent.pak", + "theme_resources_material_200_percent.pak", ] deps = [ diff --git a/chrome/app/theme/theme_resources.grd b/chrome/app/theme/theme_resources.grd index d831f16a66cd..01723b765bca 100644 --- a/chrome/app/theme/theme_resources.grd +++ b/chrome/app/theme/theme_resources.grd @@ -19,6 +19,8 @@ + + diff --git a/chrome/chrome_repack_chrome_material_100_percent.gypi b/chrome/chrome_repack_chrome_material_100_percent.gypi new file mode 100644 index 000000000000..0d4e9cba32e6 --- /dev/null +++ b/chrome/chrome_repack_chrome_material_100_percent.gypi @@ -0,0 +1,14 @@ +# Copyright 2015 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. +{ + # GN version: //chrome:repack_chrome_material_100_percent + 'action_name': 'repack_chrome_resources_material_100_percent', + 'variables': { + 'pak_inputs': [ + '<(grit_out_dir)/theme_resources_material_100_percent.pak', + ], + 'pak_output': '<(SHARED_INTERMEDIATE_DIR)/repack/chrome_material_100_percent.pak', + }, + 'includes': [ '../build/repack_action.gypi' ], +} diff --git a/chrome/chrome_repack_chrome_material_200_percent.gypi b/chrome/chrome_repack_chrome_material_200_percent.gypi new file mode 100644 index 000000000000..2ab1c3bad6ed --- /dev/null +++ b/chrome/chrome_repack_chrome_material_200_percent.gypi @@ -0,0 +1,14 @@ +# Copyright 2015 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. +{ + # GN version: //chrome:repack_chrome_material_200_percent + 'action_name': 'repack_chrome_resources_material_200_percent', + 'variables': { + 'pak_inputs': [ + '<(grit_out_dir)/theme_resources_material_200_percent.pak', + ], + 'pak_output': '<(SHARED_INTERMEDIATE_DIR)/repack/chrome_material_200_percent.pak', + }, + 'includes': [ '../build/repack_action.gypi' ], +} diff --git a/chrome/chrome_resources.gyp b/chrome/chrome_resources.gyp index 283fe84373bb..910e6a3bb535 100644 --- a/chrome/chrome_resources.gyp +++ b/chrome/chrome_resources.gyp @@ -437,6 +437,12 @@ { 'includes': ['chrome_repack_chrome_200_percent.gypi'] }, + { + 'includes': ['chrome_repack_chrome_material_100_percent.gypi'] + }, + { + 'includes': ['chrome_repack_chrome_material_200_percent.gypi'] + }, ], 'conditions': [ ['OS != "ios"', { @@ -538,6 +544,26 @@ }, ], }], + ['enable_topchrome_md == 1', { + 'copies': [ + { + 'destination': '<(PRODUCT_DIR)', + 'files': [ + '<(SHARED_INTERMEDIATE_DIR)/repack/chrome_material_100_percent.pak', + ], + }, + ], + }], + ['enable_hidpi == 1 and enable_topchrome_md == 1', { + 'copies': [ + { + 'destination': '<(PRODUCT_DIR)', + 'files': [ + '<(SHARED_INTERMEDIATE_DIR)/repack/chrome_material_200_percent.pak', + ], + }, + ], + }], ], # conditions }], # end OS != "mac" and OS != "ios" ], # conditions -- 2.11.4.GIT