summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authortony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-11 07:18:23 +0000
committertony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-11 07:18:23 +0000
commit275538b9af4cc9869b9a80d0e1821b26f206b67c (patch)
treea457c2137b0025cf6d30b711eee533627df6e2dd /tools
parent260d8a09246060bf045982c89adbd2881aac5585 (diff)
downloadchromium_src-275538b9af4cc9869b9a80d0e1821b26f206b67c.zip
chromium_src-275538b9af4cc9869b9a80d0e1821b26f206b67c.tar.gz
chromium_src-275538b9af4cc9869b9a80d0e1821b26f206b67c.tar.bz2
Move the resources used by net-internals into a pak file.
We don't use this yet, but the plan is to move everything in the resources directory into here. BUG=42770 Review URL: http://codereview.chromium.org/2667001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@49507 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools')
-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
4 files changed, 16 insertions, 3 deletions
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'