summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/resources/net_internals_resources.grd36
-rw-r--r--chrome/chrome.gyp109
-rwxr-xr-xchrome/chrome_browser.gypi1
-rw-r--r--chrome/chrome_dll.gypi18
-rw-r--r--chrome/chrome_exe.gypi3
-rwxr-xr-xchrome/chrome_tests.gypi4
-rw-r--r--tools/grit/grit/format/resource_map.py12
-rw-r--r--tools/grit/grit/node/include.py3
-rw-r--r--tools/grit/grit/node/misc.py2
-rw-r--r--tools/grit/grit/tool/build.py2
10 files changed, 187 insertions, 3 deletions
diff --git a/chrome/browser/resources/net_internals_resources.grd b/chrome/browser/resources/net_internals_resources.grd
new file mode 100644
index 0000000..a6f6da3
--- /dev/null
+++ b/chrome/browser/resources/net_internals_resources.grd
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- This comment is only here because changes to resources are not picked up
+without changes to the corresponding grd file. paaaae -->
+<grit latest_public_release="0" current_release="1">
+ <outputs>
+ <output filename="grit/net_internals_resources.h" type="rc_header">
+ <emit emit_type='prepend'></emit>
+ </output>
+ <output filename="net_internals_resources.pak" type="data_package" />
+ <output filename="grit/net_internals_resources_map.h" type="resource_map_header" />
+ <output filename="grit/net_internals_resources_map.cc" type="resource_file_map_source" />
+ </outputs>
+ <release seq="1">
+ <includes>
+ <include name="IDR_NET_INTERNALS_DATAVIEW" file="net_internals/dataview.js" type="BINDATA" />
+ <include name="IDR_NET_INTERNALS_DETAILSVIEW" file="net_internals/detailsview.js" type="BINDATA" />
+ <include name="IDR_NET_INTERNALS_DNSVIEW" file="net_internals/dnsview.js" type="BINDATA" />
+ <include name="IDR_NET_INTERNALS_HTTPCACHEVIEW" file="net_internals/httpcacheview.js" type="BINDATA" />
+ <include name="IDR_NET_INTERNALS_INDEX_HTML" file="net_internals/index.html" type="BINDATA" />
+ <include name="IDR_NET_INTERNALS_LOGGROUPER" file="net_internals/loggrouper.js" type="BINDATA" />
+ <include name="IDR_NET_INTERNALS_LOGVIEWPAINTER" file="net_internals/logviewpainter.js" type="BINDATA" />
+ <include name="IDR_NET_INTERNALS_MAIN_CSS" file="net_internals/main.css" type="BINDATA" />
+ <include name="IDR_NET_INTERNALS_MAIN" file="net_internals/main.js" type="BINDATA" />
+ <include name="IDR_NET_INTERNALS_PROXYVIEW" file="net_internals/proxyview.js" type="BINDATA" />
+ <include name="IDR_NET_INTERNALS_REQUESTSVIEW" file="net_internals/requestsview.js" type="BINDATA" />
+ <include name="IDR_NET_INTERNALS_RESIZABLEVERTICALSPLITVIEW" file="net_internals/resizableverticalsplitview.js" type="BINDATA" />
+ <include name="IDR_NET_INTERNALS_SOURCEENTRY" file="net_internals/sourceentry.js" type="BINDATA" />
+ <include name="IDR_NET_INTERNALS_TABSWITCHERVIEW" file="net_internals/tabswitcherview.js" type="BINDATA" />
+ <include name="IDR_NET_INTERNALS_TESTVIEW" file="net_internals/testview.js" type="BINDATA" />
+ <include name="IDR_NET_INTERNALS_TIMELINEVIEWPAINTER" file="net_internals/timelineviewpainter.js" type="BINDATA" />
+ <include name="IDR_NET_INTERNALS_TOPMIDBOTTOMVIEW" file="net_internals/topmidbottomview.js" type="BINDATA" />
+ <include name="IDR_NET_INTERNALS_UTIL" file="net_internals/util.js" type="BINDATA" />
+ <include name="IDR_NET_INTERNALS_VIEW" file="net_internals/view.js" type="BINDATA" />
+ </includes>
+ </release>
+</grit>
diff --git a/chrome/chrome.gyp b/chrome/chrome.gyp
index f17ec10..e1dc2b6 100644
--- a/chrome/chrome.gyp
+++ b/chrome/chrome.gyp
@@ -55,6 +55,12 @@
'common/common_resources.grd',
'renderer/renderer_resources.grd',
],
+ 'chrome_extra_resources_grds': [
+ # These resources end up in resources.pak because they are resources
+ # used by internal pages. Putting them in a spearate pak file makes
+ # it easier for us to reference them internally.
+ 'browser/resources/net_internals_resources.grd',
+ ],
'grit_info_cmd': ['python', '../tools/grit/grit_info.py'],
'grit_cmd': ['python', '../tools/grit/grit.py'],
'repack_locales_cmd': ['python', 'tools/build/repack_locales.py'],
@@ -411,6 +417,79 @@
],
},
{
+ 'target_name': 'chrome_extra_resources',
+ 'type': 'none',
+ 'variables': {
+ 'chrome_extra_resources_inputs': [
+ '<!@(<(grit_info_cmd) --inputs <(chrome_extra_resources_grds))',
+ ],
+ },
+ 'rules': [
+ {
+ 'rule_name': 'grit',
+ 'extension': 'grd',
+ 'variables': {
+ 'conditions': [
+ ['branding=="Chrome"', {
+ # TODO(mmoss) The .grd files look for _google_chrome, but for
+ # consistency they should look for GOOGLE_CHROME_BUILD like C++.
+ # Clean this up when Windows moves to gyp.
+ 'chrome_build': '_google_chrome',
+ 'branded_env': 'CHROMIUM_BUILD=google_chrome',
+ }, { # else: branding!="Chrome"
+ 'chrome_build': '_chromium',
+ 'branded_env': 'CHROMIUM_BUILD=chromium',
+ }],
+ ],
+ },
+ 'inputs': [
+ '<@(chrome_extra_resources_inputs)',
+ ],
+ 'outputs': [
+ '<(grit_out_dir)/grit/<(RULE_INPUT_ROOT).h',
+ '<(grit_out_dir)/<(RULE_INPUT_ROOT).pak',
+ # TODO(bradnelson): move to something like this instead
+ #'<!@(<(grit_info_cmd) --outputs \'<(grit_out_dir)\' <(chrome_resources_grds))',
+ # This currently cannot work because gyp only evaluates the
+ # outputs once (rather than per case where the rule applies).
+ # This means you end up with all the outputs from all the grd
+ # files, which angers scons and confuses vstudio.
+ # One alternative would be to turn this into several actions,
+ # but that would be rather verbose.
+ ],
+ 'action': ['<@(grit_cmd)', '-i',
+ '<(RULE_INPUT_PATH)',
+ 'build', '-o', '<(grit_out_dir)',
+ '-D', '<(chrome_build)',
+ '-E', '<(branded_env)',
+ ],
+ 'conditions': [
+ ['chromeos==1', {
+ 'action': ['-D', 'chromeos'],
+ }],
+ ['use_titlecase_in_grd_files==1', {
+ 'action': ['-D', 'use_titlecase'],
+ }],
+ ],
+ 'message': 'Generating resources from <(RULE_INPUT_PATH)',
+ },
+ ],
+ 'sources': [
+ '<@(chrome_extra_resources_grds)',
+ '<@(chrome_extra_resources_inputs)',
+ ],
+ 'direct_dependent_settings': {
+ 'include_dirs': [
+ '<(grit_out_dir)',
+ ],
+ },
+ 'conditions': [
+ ['OS=="win"', {
+ 'dependencies': ['../build/win/system.gyp:cygwin'],
+ }],
+ ],
+ },
+ {
'target_name': 'default_extensions',
'type': 'none',
'msvs_guid': 'DA9BAB64-91DC-419B-AFDE-6FF8C569E83A',
@@ -1344,6 +1423,36 @@
'tools/perf/flush_cache/flush_cache.cc',
],
},
+ {
+ # Mac needs 'process_outputs_as_mac_bundle_resources' to be set,
+ # and the option is only effective when the target type is native
+ # binary. Hence we cannot build the Mac bundle resources here and
+ # the action is duplicated in chrome_dll.gypi.
+ 'target_name': 'packed_extra_resources',
+ 'type': 'none',
+ 'variables': {
+ 'repack_path': '../tools/data_pack/repack.py',
+ },
+ 'actions': [
+ {
+ 'action_name': 'repack_resources',
+ 'variables': {
+ 'pak_inputs': [
+ '<(grit_out_dir)/net_internals_resources.pak',
+ ],
+ },
+ 'inputs': [
+ '<(repack_path)',
+ '<@(pak_inputs)',
+ ],
+ 'outputs': [
+ '<(PRODUCT_DIR)/resources.pak',
+ ],
+ 'action': ['python', '<(repack_path)', '<@(_outputs)',
+ '<@(pak_inputs)'],
+ },
+ ]
+ }
],
},], # OS!="mac"
['OS=="linux"',
diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi
index f9ad2d2..8e87ee0 100755
--- a/chrome/chrome_browser.gypi
+++ b/chrome/chrome_browser.gypi
@@ -11,6 +11,7 @@
'dependencies': [
'common',
'common_net',
+ 'chrome_extra_resources',
'chrome_resources',
'chrome_strings',
'chrome_version_info',
diff --git a/chrome/chrome_dll.gypi b/chrome/chrome_dll.gypi
index 614746f..f892a1f 100644
--- a/chrome/chrome_dll.gypi
+++ b/chrome/chrome_dll.gypi
@@ -371,6 +371,24 @@
'<@(locales)',
],
},
+ {
+ 'action_name': 'repack_resources',
+ 'variables': {
+ 'pak_inputs': [
+ '<(grit_out_dir)/net_internals_resources.pak',
+ ],
+ },
+ 'inputs': [
+ '<(repack_path)',
+ '<@(pak_inputs)',
+ ],
+ 'outputs': [
+ '<(INTERMEDIATE_DIR)/repack/resources.pak',
+ ],
+ 'action': ['python', '<(repack_path)', '<@(_outputs)',
+ '<@(pak_inputs)'],
+ 'process_outputs_as_mac_bundle_resources': 1,
+ },
],
'postbuilds': [
{
diff --git a/chrome/chrome_exe.gypi b/chrome/chrome_exe.gypi
index bf4c6c5..33397ca 100644
--- a/chrome/chrome_exe.gypi
+++ b/chrome/chrome_exe.gypi
@@ -413,6 +413,9 @@
'product_name': 'chrome'
}],
],
+ 'dependencies': [
+ 'packed_extra_resources',
+ ],
}],
['OS=="mac" or OS=="win"', {
'dependencies': [
diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi
index 041c8a2..d7fbb15 100755
--- a/chrome/chrome_tests.gypi
+++ b/chrome/chrome_tests.gypi
@@ -1936,6 +1936,10 @@
'dependencies': [
'helper_app'
],
+ },{ # OS!="mac"
+ 'dependencies': [
+ 'packed_extra_resources',
+ ],
}],
['OS=="linux" and chromeos==1', {
'include_dirs': [
diff --git a/tools/grit/grit/format/resource_map.py b/tools/grit/grit/format/resource_map.py
index 79ce50c..84a31b1 100644
--- a/tools/grit/grit/format/resource_map.py
+++ b/tools/grit/grit/format/resource_map.py
@@ -106,7 +106,7 @@ const size_t %(map_name)sSize = arraysize(%(map_name)s);
class SourceInclude(interface.ItemFormatter):
'''Populate the resource mapping. For each include, we map a string to
- the ID.'''
+ the resource ID.'''
def Format(self, item, lang='en', begin_item=True, output_dir='.'):
if not begin_item:
return ''
@@ -114,3 +114,13 @@ class SourceInclude(interface.ItemFormatter):
if short_name.startswith('idr_'):
short_name = short_name[4:]
return ' {"%s", %s},\n' % (short_name, item.attrs['name'])
+
+
+class SourceFileInclude(interface.ItemFormatter):
+ '''Populate the resource mapping. For each include, we map a filename to
+ the resource ID.'''
+ def Format(self, item, lang='en', begin_item=True, output_dir='.'):
+ if not begin_item:
+ return ''
+ filename = item.attrs['file'].replace("\\", "/")
+ return ' {"%s", %s},\n' % (filename, item.attrs['name'])
diff --git a/tools/grit/grit/node/include.py b/tools/grit/grit/node/include.py
index b304549..0b6eee6 100644
--- a/tools/grit/grit/node/include.py
+++ b/tools/grit/grit/node/include.py
@@ -43,6 +43,9 @@ class IncludeNode(base.Node):
elif t == 'resource_map_source':
from grit.format import resource_map
return resource_map.SourceInclude()
+ elif t == 'resource_file_map_source':
+ from grit.format import resource_map
+ return resource_map.SourceFileInclude()
else:
return super(type(self), self).ItemFormatter(t)
diff --git a/tools/grit/grit/node/misc.py b/tools/grit/grit/node/misc.py
index 9320a67..d41285e 100644
--- a/tools/grit/grit/node/misc.py
+++ b/tools/grit/grit/node/misc.py
@@ -221,7 +221,7 @@ class GritNode(base.Node):
elif t == 'resource_map_header':
from grit.format import resource_map
return resource_map.HeaderTopLevel()
- elif t == 'resource_map_source':
+ elif t in ('resource_map_source', 'resource_file_map_source'):
from grit.format import resource_map
return resource_map.SourceTopLevel()
elif t == 'js_map_format':
diff --git a/tools/grit/grit/tool/build.py b/tools/grit/grit/tool/build.py
index 3d76a06..89c2776 100644
--- a/tools/grit/grit/tool/build.py
+++ b/tools/grit/grit/tool/build.py
@@ -171,7 +171,7 @@ are exported to translation interchange files (e.g. XMB files), etc.
# files (no UTF-8), so we make all RC files UTF-16 to support all
# character sets.
if output.GetType() in ('rc_header', 'resource_map_header',
- 'resource_map_source'):
+ 'resource_map_source', 'resource_file_map_source'):
encoding = 'cp1252'
elif output.GetType() == 'js_map_format':
encoding = 'utf_8'