summaryrefslogtreecommitdiffstats
path: root/third_party/libwebrtc/moz-patch-stack/0096.patch
blob: 1faafdf8cf61bd0bf80eca7a5daefb50c2362193 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
5603
5604
5605
5606
5607
5608
5609
5610
5611
5612
5613
5614
5615
5616
5617
5618
5619
5620
5621
5622
5623
5624
5625
5626
5627
5628
5629
5630
5631
5632
5633
5634
5635
5636
5637
5638
5639
5640
5641
5642
5643
5644
5645
5646
5647
5648
5649
5650
5651
5652
5653
5654
5655
5656
5657
5658
5659
5660
5661
5662
5663
5664
5665
5666
5667
5668
5669
5670
5671
5672
5673
5674
5675
5676
5677
5678
5679
5680
5681
5682
5683
5684
5685
5686
5687
5688
5689
5690
5691
5692
5693
5694
5695
5696
5697
5698
5699
5700
5701
5702
5703
5704
5705
5706
5707
5708
5709
5710
5711
5712
5713
5714
5715
5716
5717
5718
5719
5720
5721
5722
5723
5724
5725
5726
5727
5728
5729
5730
5731
5732
5733
5734
5735
5736
5737
5738
5739
5740
5741
5742
5743
5744
5745
5746
5747
5748
5749
5750
5751
5752
5753
5754
5755
5756
5757
5758
5759
5760
5761
5762
5763
5764
5765
5766
5767
5768
5769
5770
5771
5772
5773
5774
5775
5776
5777
5778
5779
5780
5781
5782
5783
5784
5785
5786
5787
5788
5789
5790
5791
5792
5793
5794
5795
5796
5797
5798
5799
5800
5801
5802
5803
5804
5805
5806
5807
5808
5809
5810
5811
5812
5813
5814
5815
5816
5817
5818
5819
5820
5821
5822
5823
5824
5825
5826
5827
5828
5829
5830
5831
5832
5833
5834
5835
5836
5837
5838
5839
5840
5841
5842
5843
5844
5845
5846
5847
5848
5849
5850
5851
5852
5853
5854
5855
5856
5857
5858
5859
5860
5861
5862
5863
5864
5865
5866
5867
5868
5869
5870
5871
5872
5873
5874
5875
5876
5877
5878
5879
5880
5881
5882
5883
5884
5885
5886
5887
5888
5889
5890
5891
5892
5893
5894
5895
5896
5897
5898
5899
5900
5901
5902
5903
5904
5905
5906
5907
5908
5909
5910
5911
5912
5913
5914
5915
5916
5917
5918
5919
5920
5921
5922
5923
5924
5925
5926
5927
5928
5929
5930
5931
5932
5933
5934
5935
5936
5937
5938
5939
5940
5941
5942
5943
5944
5945
5946
5947
5948
5949
5950
5951
5952
5953
5954
5955
5956
5957
5958
5959
5960
5961
5962
5963
5964
5965
5966
5967
5968
5969
5970
5971
5972
5973
5974
5975
5976
5977
5978
5979
5980
5981
5982
5983
5984
5985
5986
5987
5988
5989
5990
5991
5992
5993
5994
5995
5996
5997
5998
5999
6000
6001
6002
6003
6004
6005
6006
6007
6008
6009
6010
6011
6012
6013
6014
6015
6016
6017
6018
6019
6020
6021
6022
6023
6024
6025
6026
6027
6028
6029
6030
6031
6032
6033
6034
6035
6036
6037
6038
6039
6040
6041
6042
6043
6044
6045
6046
6047
6048
6049
6050
6051
6052
6053
6054
6055
6056
6057
6058
6059
6060
6061
6062
6063
6064
6065
6066
6067
6068
6069
6070
6071
6072
6073
6074
6075
6076
6077
6078
6079
6080
6081
6082
6083
6084
6085
6086
6087
6088
6089
6090
6091
6092
6093
6094
6095
6096
6097
6098
6099
6100
6101
6102
6103
6104
6105
6106
6107
6108
6109
6110
6111
6112
6113
6114
6115
6116
6117
6118
6119
6120
6121
6122
6123
6124
6125
6126
6127
6128
6129
6130
6131
6132
6133
6134
6135
6136
6137
6138
6139
6140
6141
6142
6143
6144
6145
6146
6147
6148
6149
6150
6151
6152
6153
6154
6155
6156
6157
6158
6159
6160
6161
6162
6163
6164
6165
6166
6167
6168
6169
6170
6171
6172
6173
6174
6175
6176
6177
6178
6179
6180
6181
6182
6183
6184
6185
6186
6187
6188
6189
6190
6191
6192
6193
6194
6195
6196
6197
6198
6199
6200
6201
6202
6203
6204
6205
6206
6207
6208
6209
6210
6211
6212
6213
6214
6215
6216
6217
6218
6219
6220
6221
6222
6223
6224
6225
6226
6227
6228
6229
6230
6231
6232
6233
6234
6235
6236
6237
6238
6239
6240
6241
6242
6243
6244
6245
6246
6247
6248
6249
6250
6251
6252
6253
6254
6255
6256
6257
6258
6259
6260
6261
6262
6263
6264
6265
6266
6267
6268
6269
6270
6271
6272
6273
6274
6275
6276
6277
6278
6279
6280
6281
6282
6283
6284
6285
6286
6287
6288
6289
6290
6291
6292
6293
6294
6295
6296
6297
6298
6299
6300
6301
6302
6303
6304
6305
6306
6307
6308
6309
6310
6311
6312
6313
6314
6315
6316
6317
6318
6319
6320
6321
6322
6323
6324
6325
6326
6327
6328
6329
6330
6331
6332
6333
6334
6335
6336
6337
6338
6339
6340
6341
6342
6343
6344
6345
6346
6347
6348
6349
6350
6351
6352
6353
6354
6355
6356
6357
6358
6359
6360
6361
6362
6363
6364
6365
6366
6367
6368
6369
6370
6371
6372
6373
6374
6375
6376
6377
6378
6379
6380
6381
6382
6383
6384
6385
6386
6387
6388
6389
6390
6391
6392
6393
6394
6395
6396
6397
6398
6399
6400
6401
6402
6403
6404
6405
6406
6407
6408
6409
6410
6411
6412
6413
6414
6415
6416
6417
6418
6419
6420
6421
6422
6423
6424
6425
6426
6427
6428
6429
6430
6431
6432
6433
6434
6435
6436
6437
6438
6439
6440
6441
6442
6443
6444
6445
6446
6447
6448
6449
6450
6451
6452
6453
6454
6455
6456
6457
6458
6459
6460
6461
6462
6463
6464
6465
6466
6467
6468
6469
6470
6471
6472
6473
6474
6475
6476
6477
6478
6479
6480
6481
6482
6483
6484
6485
6486
6487
6488
6489
6490
6491
6492
6493
6494
6495
6496
6497
6498
6499
6500
6501
6502
6503
6504
6505
6506
6507
6508
6509
6510
6511
6512
6513
6514
6515
6516
6517
6518
6519
6520
6521
6522
6523
6524
6525
6526
6527
6528
6529
6530
6531
6532
6533
6534
6535
6536
6537
6538
6539
6540
6541
6542
6543
6544
6545
6546
6547
6548
6549
6550
6551
6552
6553
6554
6555
6556
6557
6558
6559
6560
6561
6562
6563
6564
6565
6566
6567
6568
6569
6570
6571
6572
6573
6574
6575
6576
6577
6578
6579
6580
6581
6582
6583
6584
6585
6586
6587
6588
6589
6590
6591
6592
6593
6594
6595
6596
6597
6598
6599
6600
6601
6602
6603
6604
6605
6606
6607
6608
6609
6610
6611
6612
6613
6614
6615
6616
6617
6618
6619
6620
6621
6622
6623
6624
6625
6626
6627
6628
6629
6630
6631
6632
6633
6634
6635
6636
6637
6638
6639
6640
6641
6642
6643
6644
6645
6646
6647
6648
6649
6650
6651
6652
6653
6654
6655
6656
6657
6658
6659
6660
6661
6662
6663
6664
6665
6666
6667
6668
6669
6670
6671
6672
6673
6674
6675
6676
6677
6678
6679
6680
6681
6682
6683
6684
6685
6686
6687
6688
6689
6690
6691
6692
6693
6694
6695
6696
6697
6698
6699
6700
6701
6702
6703
6704
6705
6706
6707
6708
6709
6710
6711
6712
6713
6714
6715
6716
6717
6718
6719
6720
6721
6722
6723
6724
6725
6726
6727
6728
6729
6730
6731
6732
6733
6734
6735
6736
6737
6738
6739
6740
6741
6742
6743
6744
6745
6746
6747
6748
6749
6750
6751
6752
6753
6754
6755
6756
6757
6758
6759
6760
6761
6762
6763
6764
6765
6766
6767
6768
6769
6770
6771
6772
6773
6774
6775
6776
6777
6778
6779
6780
6781
6782
6783
6784
6785
6786
6787
6788
6789
6790
6791
6792
6793
6794
6795
6796
6797
6798
6799
6800
6801
6802
6803
6804
6805
6806
6807
6808
6809
6810
6811
6812
6813
6814
6815
6816
6817
6818
6819
6820
6821
6822
6823
6824
6825
6826
6827
6828
6829
6830
6831
6832
6833
6834
6835
6836
6837
6838
6839
6840
6841
6842
6843
6844
6845
6846
6847
6848
6849
6850
6851
6852
6853
6854
6855
6856
6857
6858
6859
6860
6861
6862
6863
6864
6865
6866
6867
6868
6869
6870
6871
6872
6873
6874
6875
6876
6877
6878
6879
6880
6881
6882
6883
6884
6885
6886
6887
6888
6889
6890
6891
6892
6893
6894
6895
6896
6897
6898
6899
6900
6901
6902
6903
6904
6905
6906
6907
6908
6909
6910
6911
6912
6913
6914
6915
6916
6917
6918
6919
6920
6921
6922
6923
6924
6925
6926
6927
6928
6929
6930
6931
6932
6933
6934
6935
6936
6937
6938
6939
6940
6941
6942
6943
6944
6945
6946
6947
6948
6949
6950
6951
6952
6953
6954
6955
6956
6957
6958
6959
6960
6961
6962
6963
6964
6965
6966
6967
6968
6969
6970
6971
6972
6973
6974
6975
6976
6977
6978
6979
6980
6981
6982
6983
6984
6985
6986
6987
6988
6989
6990
6991
6992
6993
6994
6995
6996
6997
6998
6999
7000
7001
7002
7003
7004
7005
7006
7007
7008
7009
7010
7011
7012
7013
7014
7015
7016
7017
7018
7019
7020
7021
7022
7023
7024
7025
7026
7027
7028
7029
7030
7031
7032
7033
7034
7035
7036
7037
7038
7039
7040
7041
7042
7043
7044
7045
7046
7047
7048
7049
7050
7051
7052
7053
7054
7055
7056
7057
7058
7059
7060
7061
7062
7063
7064
7065
7066
7067
7068
7069
7070
7071
7072
7073
7074
7075
7076
7077
7078
7079
7080
7081
7082
7083
7084
7085
7086
7087
7088
7089
7090
7091
7092
7093
7094
7095
7096
7097
7098
7099
7100
7101
7102
7103
7104
7105
7106
7107
7108
7109
7110
7111
7112
7113
7114
7115
7116
7117
7118
7119
7120
7121
7122
7123
7124
7125
7126
7127
7128
7129
7130
7131
7132
7133
7134
7135
7136
7137
7138
7139
7140
7141
7142
7143
7144
7145
7146
7147
7148
7149
7150
7151
7152
7153
7154
7155
7156
7157
7158
7159
7160
7161
7162
7163
7164
7165
7166
7167
7168
7169
7170
7171
7172
7173
7174
7175
7176
7177
7178
7179
7180
7181
7182
7183
7184
7185
7186
7187
7188
7189
7190
7191
7192
7193
7194
7195
7196
7197
7198
7199
7200
7201
7202
7203
7204
7205
7206
7207
7208
7209
7210
7211
7212
7213
7214
7215
7216
7217
7218
7219
7220
7221
7222
7223
7224
7225
7226
7227
7228
7229
7230
7231
7232
7233
7234
7235
7236
7237
7238
7239
7240
7241
7242
7243
7244
7245
7246
7247
7248
7249
7250
7251
7252
7253
7254
7255
7256
7257
7258
7259
7260
7261
7262
7263
7264
7265
7266
7267
7268
7269
7270
7271
7272
7273
7274
7275
7276
7277
7278
7279
7280
7281
7282
7283
7284
7285
7286
7287
7288
7289
7290
7291
7292
7293
7294
7295
7296
7297
7298
7299
7300
7301
7302
7303
7304
7305
7306
7307
7308
7309
7310
7311
7312
7313
7314
7315
7316
7317
7318
7319
7320
7321
7322
7323
7324
7325
7326
7327
7328
7329
7330
7331
7332
7333
7334
7335
7336
7337
7338
7339
7340
7341
7342
7343
7344
7345
7346
7347
7348
7349
7350
7351
7352
7353
7354
7355
7356
7357
7358
7359
7360
7361
7362
7363
7364
7365
7366
7367
7368
7369
7370
7371
7372
7373
7374
7375
7376
7377
7378
7379
7380
7381
7382
7383
7384
7385
7386
7387
7388
7389
7390
7391
7392
7393
7394
7395
7396
7397
7398
7399
7400
7401
7402
7403
7404
7405
7406
7407
7408
7409
7410
7411
7412
7413
7414
7415
7416
7417
7418
7419
7420
7421
7422
7423
7424
7425
7426
7427
7428
7429
7430
7431
7432
7433
7434
7435
7436
7437
7438
7439
7440
7441
7442
7443
7444
7445
7446
7447
7448
7449
7450
7451
7452
7453
7454
7455
7456
7457
7458
7459
7460
7461
7462
7463
7464
7465
7466
7467
7468
7469
7470
7471
7472
7473
7474
7475
7476
7477
7478
7479
7480
7481
7482
7483
7484
7485
7486
7487
7488
7489
7490
7491
7492
7493
7494
7495
7496
7497
7498
7499
7500
7501
7502
7503
7504
7505
7506
7507
7508
7509
7510
7511
7512
7513
7514
7515
7516
7517
7518
7519
7520
7521
7522
7523
7524
7525
7526
7527
7528
7529
7530
7531
7532
7533
7534
7535
7536
7537
7538
7539
7540
7541
7542
7543
7544
7545
7546
7547
7548
7549
7550
7551
7552
7553
7554
7555
7556
7557
7558
7559
7560
7561
7562
7563
7564
7565
7566
7567
7568
7569
7570
7571
7572
7573
7574
7575
7576
7577
7578
7579
7580
7581
7582
7583
7584
7585
7586
7587
7588
7589
7590
7591
7592
7593
7594
7595
7596
7597
7598
7599
7600
7601
7602
7603
7604
7605
7606
7607
7608
7609
7610
7611
7612
7613
7614
7615
7616
7617
7618
7619
7620
7621
7622
7623
7624
7625
7626
7627
7628
7629
7630
7631
7632
7633
7634
7635
7636
7637
7638
7639
7640
7641
7642
7643
7644
7645
7646
7647
7648
7649
7650
7651
7652
7653
7654
7655
7656
7657
7658
7659
7660
7661
7662
7663
7664
7665
7666
7667
7668
7669
7670
7671
7672
7673
7674
7675
7676
7677
7678
7679
7680
7681
7682
7683
7684
7685
7686
7687
7688
7689
7690
7691
7692
7693
7694
7695
7696
7697
7698
7699
7700
7701
7702
7703
7704
7705
7706
7707
7708
7709
7710
7711
7712
7713
7714
7715
7716
7717
7718
7719
7720
7721
7722
7723
7724
7725
7726
7727
7728
7729
7730
7731
7732
7733
7734
7735
7736
7737
7738
7739
7740
7741
7742
7743
7744
7745
7746
7747
7748
7749
7750
7751
7752
7753
7754
7755
7756
7757
7758
7759
7760
7761
7762
7763
7764
7765
7766
7767
7768
7769
7770
7771
7772
7773
7774
7775
7776
7777
7778
7779
7780
7781
7782
7783
7784
7785
7786
7787
7788
7789
7790
7791
7792
7793
7794
7795
7796
7797
7798
7799
7800
7801
7802
7803
7804
7805
7806
7807
7808
7809
7810
7811
7812
7813
7814
7815
7816
7817
7818
7819
7820
7821
7822
7823
7824
7825
7826
7827
7828
7829
7830
7831
7832
7833
7834
7835
7836
7837
7838
7839
7840
7841
7842
7843
7844
7845
7846
7847
7848
7849
7850
7851
7852
7853
7854
7855
7856
7857
7858
7859
7860
7861
7862
7863
7864
7865
7866
7867
7868
7869
7870
7871
7872
7873
7874
7875
7876
7877
7878
7879
7880
7881
7882
7883
7884
7885
7886
7887
7888
7889
7890
7891
7892
7893
7894
7895
7896
7897
7898
7899
7900
7901
7902
7903
7904
7905
7906
7907
7908
7909
7910
7911
7912
7913
7914
7915
7916
7917
7918
7919
7920
7921
7922
7923
7924
7925
7926
7927
7928
7929
7930
7931
7932
7933
7934
7935
7936
7937
7938
7939
7940
7941
7942
7943
7944
7945
7946
7947
7948
7949
7950
7951
7952
7953
7954
7955
7956
7957
7958
7959
7960
7961
7962
7963
7964
7965
7966
7967
7968
7969
7970
7971
7972
7973
7974
7975
7976
7977
7978
7979
7980
7981
7982
7983
7984
7985
7986
7987
7988
7989
7990
7991
7992
7993
7994
7995
7996
7997
7998
7999
8000
8001
8002
8003
8004
8005
8006
8007
8008
8009
8010
8011
8012
8013
8014
8015
8016
8017
8018
8019
8020
8021
8022
8023
8024
8025
8026
8027
8028
8029
8030
8031
8032
8033
8034
8035
8036
8037
8038
8039
8040
8041
8042
8043
8044
8045
8046
8047
8048
8049
8050
8051
8052
8053
8054
8055
8056
8057
8058
8059
8060
8061
8062
8063
8064
8065
8066
8067
8068
8069
8070
8071
8072
8073
8074
8075
8076
8077
8078
8079
8080
8081
8082
8083
8084
8085
8086
8087
8088
8089
8090
8091
8092
8093
8094
8095
8096
8097
8098
8099
8100
8101
8102
8103
8104
8105
8106
8107
8108
8109
8110
8111
8112
8113
8114
8115
8116
8117
8118
8119
8120
8121
8122
8123
8124
8125
8126
8127
8128
8129
8130
8131
8132
8133
8134
8135
8136
8137
8138
8139
8140
8141
8142
8143
8144
8145
8146
8147
8148
8149
8150
8151
8152
8153
8154
8155
8156
8157
8158
8159
8160
8161
8162
8163
8164
8165
8166
8167
8168
8169
8170
8171
8172
8173
8174
8175
8176
8177
8178
8179
8180
8181
8182
8183
8184
8185
8186
8187
8188
8189
8190
8191
8192
8193
8194
8195
8196
8197
8198
8199
8200
8201
8202
8203
8204
8205
8206
8207
8208
8209
8210
8211
8212
8213
8214
8215
8216
8217
8218
8219
8220
8221
8222
8223
8224
8225
8226
8227
8228
8229
8230
8231
8232
8233
8234
8235
8236
8237
8238
8239
8240
8241
8242
8243
8244
8245
8246
8247
8248
8249
8250
8251
8252
8253
8254
8255
8256
8257
8258
8259
8260
8261
8262
8263
8264
8265
8266
8267
8268
8269
8270
8271
8272
8273
8274
8275
8276
8277
8278
8279
8280
8281
8282
8283
8284
8285
8286
8287
8288
8289
8290
8291
8292
8293
8294
8295
8296
8297
8298
8299
8300
8301
8302
8303
8304
8305
8306
8307
8308
8309
8310
8311
8312
8313
8314
8315
8316
8317
8318
8319
8320
8321
8322
8323
8324
8325
8326
8327
8328
8329
8330
8331
8332
8333
8334
8335
8336
8337
8338
8339
8340
8341
8342
8343
8344
8345
8346
8347
8348
8349
8350
8351
8352
8353
8354
8355
8356
8357
8358
8359
8360
8361
8362
8363
8364
8365
8366
8367
8368
8369
8370
8371
8372
8373
8374
8375
8376
8377
8378
8379
8380
8381
8382
8383
8384
8385
8386
8387
8388
8389
8390
8391
8392
8393
8394
8395
8396
8397
8398
8399
8400
8401
8402
8403
8404
8405
8406
8407
8408
8409
8410
8411
8412
8413
8414
8415
8416
8417
8418
8419
8420
8421
8422
8423
8424
8425
8426
8427
8428
8429
8430
8431
8432
8433
8434
8435
8436
8437
8438
8439
8440
8441
8442
8443
8444
8445
8446
8447
8448
8449
8450
8451
8452
8453
8454
8455
8456
8457
8458
8459
8460
8461
8462
8463
8464
8465
8466
8467
8468
8469
8470
8471
8472
8473
8474
8475
8476
8477
8478
8479
8480
8481
8482
8483
8484
8485
8486
8487
8488
8489
8490
8491
8492
8493
8494
8495
8496
8497
8498
8499
8500
8501
8502
8503
8504
8505
8506
8507
8508
8509
8510
8511
8512
8513
8514
8515
8516
8517
8518
8519
8520
8521
8522
8523
8524
8525
8526
8527
8528
8529
8530
8531
8532
8533
8534
8535
8536
8537
8538
8539
8540
8541
8542
8543
8544
8545
8546
8547
8548
8549
8550
8551
8552
8553
8554
8555
8556
8557
8558
8559
8560
8561
8562
8563
8564
8565
8566
8567
8568
8569
8570
8571
8572
8573
8574
8575
8576
8577
8578
8579
8580
8581
8582
8583
8584
8585
8586
8587
8588
8589
8590
8591
8592
8593
8594
8595
8596
8597
8598
8599
8600
8601
8602
8603
8604
8605
8606
8607
8608
8609
8610
8611
8612
8613
8614
8615
8616
8617
8618
8619
8620
8621
8622
8623
8624
8625
8626
8627
8628
8629
8630
8631
8632
8633
8634
8635
8636
8637
8638
8639
8640
8641
8642
8643
8644
8645
8646
8647
8648
8649
8650
8651
8652
8653
8654
8655
8656
8657
8658
8659
8660
8661
8662
8663
8664
8665
8666
8667
8668
8669
8670
8671
8672
8673
8674
8675
8676
8677
8678
8679
8680
8681
8682
8683
8684
8685
8686
8687
8688
8689
8690
8691
8692
8693
8694
8695
8696
8697
8698
8699
8700
8701
8702
8703
8704
8705
8706
8707
8708
8709
8710
8711
8712
8713
8714
8715
8716
8717
8718
8719
8720
8721
8722
8723
8724
8725
8726
8727
8728
8729
8730
8731
8732
8733
8734
8735
8736
8737
8738
8739
8740
8741
8742
8743
8744
8745
8746
8747
8748
8749
8750
8751
8752
8753
8754
8755
8756
8757
8758
8759
8760
8761
8762
8763
8764
8765
8766
8767
8768
8769
8770
8771
8772
8773
8774
8775
8776
8777
8778
8779
8780
8781
8782
8783
8784
8785
8786
8787
8788
8789
8790
8791
8792
8793
8794
8795
8796
8797
8798
8799
8800
8801
8802
8803
8804
8805
8806
8807
8808
8809
8810
8811
8812
8813
8814
8815
8816
8817
8818
8819
8820
8821
8822
8823
8824
8825
8826
8827
8828
8829
8830
8831
8832
8833
8834
8835
8836
8837
8838
8839
8840
8841
8842
8843
8844
8845
8846
8847
8848
8849
8850
8851
8852
8853
8854
8855
8856
8857
8858
8859
8860
8861
8862
8863
8864
8865
8866
8867
8868
8869
8870
8871
8872
8873
8874
8875
8876
8877
8878
8879
8880
8881
8882
8883
8884
8885
8886
8887
8888
8889
8890
8891
8892
8893
8894
8895
8896
8897
8898
8899
8900
8901
8902
8903
8904
8905
8906
8907
8908
8909
8910
8911
8912
8913
8914
8915
8916
8917
8918
8919
8920
8921
8922
8923
8924
8925
8926
8927
8928
8929
8930
8931
8932
8933
8934
8935
8936
8937
8938
8939
8940
8941
8942
8943
8944
8945
8946
8947
8948
8949
8950
8951
8952
8953
8954
8955
8956
8957
8958
8959
8960
8961
8962
8963
8964
8965
8966
8967
8968
8969
8970
8971
8972
8973
8974
8975
8976
8977
8978
8979
8980
8981
8982
8983
8984
8985
8986
8987
8988
8989
8990
8991
8992
8993
8994
8995
8996
8997
8998
8999
9000
9001
9002
9003
9004
9005
9006
9007
9008
9009
9010
9011
9012
9013
9014
9015
9016
9017
9018
9019
9020
9021
9022
9023
9024
9025
9026
9027
9028
9029
9030
9031
9032
9033
9034
9035
9036
9037
9038
9039
9040
9041
9042
9043
9044
9045
9046
9047
9048
9049
9050
9051
9052
9053
9054
9055
9056
9057
9058
9059
9060
9061
9062
9063
9064
9065
9066
9067
9068
9069
9070
9071
9072
9073
9074
9075
9076
9077
9078
9079
9080
9081
9082
9083
9084
9085
9086
9087
9088
9089
9090
9091
9092
9093
9094
9095
9096
9097
9098
9099
9100
9101
9102
9103
9104
9105
9106
9107
9108
9109
9110
9111
9112
9113
9114
9115
9116
9117
9118
9119
9120
9121
9122
9123
9124
9125
9126
9127
9128
9129
9130
9131
9132
9133
9134
9135
9136
9137
9138
9139
9140
9141
9142
9143
9144
9145
9146
9147
9148
9149
9150
9151
9152
9153
9154
9155
9156
9157
9158
9159
9160
9161
9162
9163
9164
9165
9166
9167
9168
9169
9170
9171
9172
9173
9174
9175
9176
9177
9178
9179
9180
9181
9182
9183
9184
9185
9186
9187
9188
9189
9190
9191
9192
9193
9194
9195
9196
9197
9198
9199
9200
9201
9202
9203
9204
9205
9206
9207
9208
9209
9210
9211
9212
9213
9214
9215
9216
9217
9218
9219
9220
9221
9222
9223
9224
9225
9226
9227
9228
9229
9230
9231
9232
9233
9234
9235
9236
9237
9238
9239
9240
9241
9242
9243
9244
9245
9246
9247
9248
9249
9250
9251
9252
9253
9254
9255
9256
9257
9258
9259
9260
9261
9262
9263
9264
9265
9266
9267
9268
9269
9270
9271
9272
9273
9274
9275
9276
9277
9278
9279
9280
9281
9282
9283
9284
9285
9286
9287
9288
9289
9290
9291
9292
9293
9294
9295
9296
9297
9298
9299
9300
9301
9302
9303
9304
9305
9306
9307
9308
9309
9310
9311
9312
9313
9314
9315
9316
9317
9318
9319
9320
9321
9322
9323
9324
9325
9326
9327
9328
9329
9330
9331
9332
9333
9334
9335
9336
9337
9338
9339
9340
9341
9342
9343
9344
9345
9346
9347
9348
9349
9350
9351
9352
9353
9354
9355
9356
9357
9358
9359
9360
9361
9362
9363
9364
9365
9366
9367
9368
9369
9370
9371
9372
9373
9374
9375
9376
9377
9378
9379
9380
9381
9382
9383
9384
9385
9386
9387
9388
9389
9390
9391
9392
9393
9394
9395
9396
9397
9398
9399
9400
9401
9402
9403
9404
9405
9406
9407
9408
9409
9410
9411
9412
9413
9414
9415
9416
9417
9418
9419
9420
9421
9422
9423
9424
9425
9426
9427
9428
9429
9430
9431
9432
9433
9434
9435
9436
9437
9438
9439
9440
9441
9442
9443
9444
9445
9446
9447
9448
9449
9450
9451
9452
9453
9454
9455
9456
9457
9458
9459
9460
9461
9462
9463
9464
9465
9466
9467
9468
9469
9470
9471
9472
9473
9474
9475
9476
9477
9478
9479
9480
9481
9482
9483
9484
9485
9486
9487
9488
9489
9490
9491
9492
9493
9494
9495
9496
9497
9498
9499
9500
9501
9502
9503
9504
9505
9506
9507
9508
9509
9510
9511
9512
9513
9514
9515
9516
9517
9518
9519
9520
9521
9522
9523
9524
9525
9526
9527
9528
9529
9530
9531
9532
9533
9534
9535
9536
9537
9538
9539
9540
9541
9542
9543
9544
9545
9546
9547
9548
9549
9550
9551
9552
9553
9554
9555
9556
9557
9558
9559
9560
9561
9562
9563
9564
9565
9566
9567
9568
9569
9570
9571
9572
9573
9574
9575
9576
9577
9578
9579
9580
9581
9582
9583
9584
9585
9586
9587
9588
9589
9590
9591
9592
9593
9594
9595
9596
9597
9598
9599
9600
9601
9602
9603
9604
9605
9606
9607
9608
9609
9610
9611
9612
9613
9614
9615
9616
9617
9618
9619
9620
9621
9622
9623
9624
9625
9626
9627
9628
9629
9630
9631
9632
9633
9634
9635
9636
9637
9638
9639
9640
9641
9642
9643
9644
9645
9646
9647
9648
9649
9650
9651
9652
9653
9654
9655
9656
9657
9658
9659
9660
9661
9662
9663
9664
9665
9666
9667
9668
9669
9670
9671
9672
9673
9674
9675
9676
9677
9678
9679
9680
9681
9682
9683
9684
9685
9686
9687
9688
9689
9690
9691
9692
9693
9694
9695
9696
9697
9698
9699
9700
9701
9702
9703
9704
9705
9706
9707
9708
9709
9710
9711
9712
9713
9714
9715
9716
9717
9718
9719
9720
9721
9722
9723
9724
9725
9726
9727
9728
9729
9730
9731
9732
9733
9734
9735
9736
9737
9738
9739
9740
9741
9742
9743
9744
9745
9746
9747
9748
9749
9750
9751
9752
9753
9754
9755
9756
9757
9758
9759
9760
9761
9762
9763
9764
9765
9766
9767
9768
9769
9770
9771
9772
9773
9774
9775
9776
9777
9778
9779
9780
9781
9782
9783
9784
9785
9786
9787
9788
9789
9790
9791
9792
9793
9794
9795
9796
9797
9798
9799
9800
9801
9802
9803
9804
9805
9806
9807
9808
9809
9810
9811
9812
9813
9814
9815
9816
9817
9818
9819
9820
9821
9822
9823
9824
9825
9826
9827
9828
9829
9830
9831
9832
9833
9834
9835
9836
9837
9838
9839
9840
9841
9842
9843
9844
9845
9846
9847
9848
9849
9850
9851
9852
9853
9854
9855
9856
9857
9858
9859
9860
9861
9862
9863
9864
9865
9866
9867
9868
9869
9870
9871
9872
9873
9874
9875
9876
9877
9878
9879
9880
9881
9882
9883
9884
9885
9886
9887
9888
9889
9890
9891
9892
9893
9894
9895
9896
9897
9898
9899
9900
9901
9902
9903
9904
9905
9906
9907
9908
9909
9910
9911
9912
9913
9914
9915
9916
9917
9918
9919
9920
9921
9922
9923
9924
9925
9926
9927
9928
9929
9930
9931
9932
9933
9934
9935
9936
9937
9938
9939
9940
9941
9942
9943
9944
9945
9946
9947
9948
9949
9950
9951
9952
9953
9954
9955
9956
9957
9958
9959
9960
9961
9962
9963
9964
9965
9966
9967
9968
9969
9970
9971
9972
9973
9974
9975
9976
9977
9978
9979
9980
9981
9982
9983
9984
9985
9986
9987
9988
9989
9990
9991
9992
9993
9994
9995
9996
9997
9998
9999
10000
10001
10002
10003
10004
10005
10006
10007
10008
10009
10010
10011
10012
10013
10014
10015
10016
10017
10018
10019
10020
10021
10022
10023
10024
10025
10026
10027
10028
10029
10030
10031
10032
10033
10034
10035
10036
10037
10038
10039
10040
10041
10042
10043
10044
10045
10046
10047
10048
10049
10050
10051
10052
10053
10054
10055
10056
10057
10058
10059
10060
10061
10062
10063
10064
10065
10066
10067
10068
10069
10070
10071
10072
10073
10074
10075
10076
10077
10078
10079
10080
10081
10082
10083
10084
10085
10086
10087
10088
10089
10090
10091
10092
10093
10094
10095
10096
10097
10098
10099
10100
10101
10102
10103
10104
10105
10106
10107
10108
10109
10110
10111
10112
10113
10114
10115
10116
10117
10118
10119
10120
10121
10122
10123
10124
10125
10126
10127
10128
10129
10130
10131
10132
10133
10134
10135
10136
10137
10138
10139
10140
10141
10142
10143
10144
10145
10146
10147
10148
10149
10150
10151
10152
10153
10154
10155
10156
10157
10158
10159
10160
10161
10162
10163
10164
10165
10166
10167
10168
10169
10170
10171
10172
10173
10174
10175
10176
10177
10178
10179
10180
10181
10182
10183
10184
10185
10186
10187
10188
10189
10190
10191
10192
10193
10194
10195
10196
10197
10198
10199
10200
10201
10202
10203
10204
10205
10206
10207
10208
10209
10210
10211
10212
10213
10214
10215
10216
10217
10218
10219
10220
10221
10222
10223
10224
10225
10226
10227
10228
10229
10230
10231
10232
10233
10234
10235
10236
10237
10238
10239
10240
10241
10242
10243
10244
10245
10246
10247
10248
10249
10250
10251
10252
10253
10254
10255
10256
10257
10258
10259
10260
10261
10262
10263
10264
10265
10266
10267
10268
10269
10270
10271
10272
10273
10274
10275
10276
10277
10278
10279
10280
10281
10282
10283
10284
10285
10286
10287
10288
10289
10290
10291
10292
10293
10294
10295
10296
10297
10298
10299
10300
10301
10302
10303
10304
10305
10306
10307
10308
10309
10310
10311
10312
10313
10314
10315
10316
10317
10318
10319
10320
10321
10322
10323
10324
10325
10326
10327
10328
10329
10330
10331
10332
10333
10334
10335
10336
10337
10338
10339
10340
10341
10342
10343
10344
10345
10346
10347
10348
10349
10350
10351
10352
10353
10354
10355
10356
10357
10358
10359
10360
10361
10362
10363
10364
10365
10366
10367
10368
10369
10370
10371
10372
10373
10374
10375
10376
10377
10378
10379
10380
10381
10382
10383
10384
10385
10386
10387
10388
10389
10390
10391
10392
10393
10394
10395
10396
10397
10398
10399
10400
10401
10402
10403
10404
10405
10406
10407
10408
10409
10410
10411
10412
10413
10414
10415
10416
10417
10418
10419
10420
10421
10422
10423
10424
10425
10426
10427
10428
10429
10430
10431
10432
10433
10434
10435
10436
10437
10438
10439
10440
10441
10442
10443
10444
10445
10446
10447
10448
10449
10450
10451
10452
10453
10454
10455
10456
10457
10458
10459
10460
10461
10462
10463
10464
10465
10466
10467
10468
10469
10470
10471
10472
10473
10474
10475
10476
10477
10478
10479
10480
10481
10482
10483
10484
10485
10486
10487
10488
10489
10490
10491
10492
10493
10494
10495
10496
10497
10498
10499
10500
10501
10502
10503
10504
10505
10506
10507
10508
10509
10510
10511
10512
10513
10514
10515
10516
10517
10518
10519
10520
10521
10522
10523
10524
10525
10526
10527
10528
10529
10530
10531
10532
10533
10534
10535
10536
10537
10538
10539
10540
10541
10542
10543
10544
10545
10546
10547
10548
10549
10550
10551
10552
10553
10554
10555
10556
10557
10558
10559
10560
10561
10562
10563
10564
10565
10566
10567
10568
10569
10570
10571
10572
10573
10574
10575
10576
10577
10578
10579
10580
10581
10582
10583
10584
10585
10586
10587
10588
10589
10590
10591
10592
10593
10594
10595
10596
10597
10598
10599
10600
10601
10602
10603
10604
10605
10606
10607
10608
10609
10610
10611
10612
10613
10614
10615
10616
10617
10618
10619
10620
10621
10622
10623
10624
10625
10626
10627
10628
10629
10630
10631
10632
10633
10634
10635
10636
10637
10638
10639
10640
10641
10642
10643
10644
10645
10646
10647
10648
10649
10650
10651
10652
10653
10654
10655
10656
10657
10658
10659
10660
10661
10662
10663
10664
10665
10666
10667
10668
10669
10670
10671
10672
10673
10674
10675
10676
10677
10678
10679
10680
10681
10682
10683
10684
10685
10686
10687
10688
10689
10690
10691
10692
10693
10694
10695
10696
10697
10698
10699
10700
10701
10702
10703
10704
10705
10706
10707
10708
10709
10710
10711
10712
10713
10714
10715
10716
10717
10718
10719
10720
10721
10722
10723
10724
10725
10726
10727
10728
10729
10730
10731
10732
10733
10734
10735
10736
10737
10738
10739
10740
10741
10742
10743
10744
10745
10746
10747
10748
10749
10750
10751
10752
10753
10754
10755
10756
10757
10758
10759
10760
10761
10762
10763
10764
10765
10766
10767
10768
10769
10770
10771
10772
10773
10774
10775
10776
10777
10778
10779
10780
10781
10782
10783
10784
10785
10786
10787
10788
10789
10790
10791
10792
10793
10794
10795
10796
10797
10798
10799
10800
10801
10802
10803
10804
10805
10806
10807
10808
10809
10810
10811
10812
10813
10814
10815
10816
10817
10818
10819
10820
10821
10822
10823
10824
10825
10826
10827
10828
10829
10830
10831
10832
10833
10834
10835
10836
10837
10838
10839
10840
10841
10842
10843
10844
10845
10846
10847
10848
10849
10850
10851
10852
10853
10854
10855
10856
10857
10858
10859
10860
10861
10862
10863
10864
10865
10866
10867
10868
10869
10870
10871
10872
10873
10874
10875
10876
10877
10878
10879
10880
10881
10882
10883
10884
10885
10886
10887
10888
10889
10890
10891
10892
10893
10894
10895
10896
10897
10898
10899
10900
10901
10902
10903
10904
10905
10906
10907
10908
10909
10910
10911
10912
10913
10914
10915
10916
10917
10918
10919
10920
10921
10922
10923
10924
10925
10926
10927
10928
10929
10930
10931
10932
10933
10934
10935
10936
10937
10938
10939
10940
10941
10942
10943
10944
10945
10946
10947
10948
10949
10950
10951
10952
10953
10954
10955
10956
10957
10958
10959
10960
10961
10962
10963
10964
10965
10966
10967
10968
10969
10970
10971
10972
10973
10974
10975
10976
10977
10978
10979
10980
10981
10982
10983
10984
10985
10986
10987
10988
10989
10990
10991
10992
10993
10994
10995
10996
10997
10998
10999
11000
11001
11002
11003
11004
11005
11006
11007
11008
11009
11010
11011
11012
11013
11014
11015
11016
11017
11018
11019
11020
11021
11022
11023
11024
11025
11026
11027
11028
11029
11030
11031
11032
11033
11034
11035
11036
11037
11038
11039
11040
11041
11042
11043
11044
11045
11046
11047
11048
11049
11050
11051
11052
11053
11054
11055
11056
11057
11058
11059
11060
11061
11062
11063
11064
11065
11066
11067
11068
11069
11070
11071
11072
11073
11074
11075
11076
11077
11078
11079
11080
11081
11082
11083
11084
11085
11086
11087
11088
11089
11090
11091
11092
11093
11094
11095
11096
11097
11098
11099
11100
11101
11102
11103
11104
11105
11106
11107
11108
11109
11110
11111
11112
11113
11114
11115
11116
11117
11118
11119
11120
11121
11122
11123
11124
11125
11126
11127
11128
11129
11130
11131
11132
11133
11134
11135
11136
11137
11138
11139
11140
11141
11142
11143
11144
11145
11146
11147
11148
11149
11150
11151
11152
11153
11154
11155
11156
11157
11158
11159
11160
11161
11162
11163
11164
11165
11166
11167
11168
11169
11170
11171
11172
11173
11174
11175
11176
11177
11178
11179
11180
11181
11182
11183
11184
11185
11186
11187
11188
11189
11190
11191
11192
11193
11194
11195
11196
11197
11198
11199
11200
11201
11202
11203
11204
11205
11206
11207
11208
11209
11210
11211
11212
11213
11214
11215
11216
11217
11218
11219
11220
11221
11222
11223
11224
11225
11226
11227
11228
11229
11230
11231
11232
11233
11234
11235
11236
11237
11238
11239
11240
11241
11242
11243
11244
11245
11246
11247
11248
11249
11250
11251
11252
11253
11254
11255
11256
11257
11258
11259
11260
11261
11262
11263
11264
11265
11266
11267
11268
11269
11270
11271
11272
11273
11274
11275
11276
11277
11278
11279
11280
11281
11282
11283
11284
11285
11286
11287
11288
11289
11290
11291
11292
11293
11294
11295
11296
11297
11298
11299
11300
11301
11302
11303
11304
11305
11306
11307
11308
11309
11310
11311
11312
11313
11314
11315
11316
11317
11318
11319
11320
11321
11322
11323
11324
11325
11326
11327
11328
11329
11330
11331
11332
11333
11334
11335
11336
11337
11338
11339
11340
11341
11342
11343
11344
11345
11346
11347
11348
11349
11350
11351
11352
11353
11354
11355
11356
11357
11358
11359
11360
11361
11362
11363
11364
11365
11366
11367
11368
11369
11370
11371
11372
11373
11374
11375
11376
11377
11378
11379
11380
11381
11382
11383
11384
11385
11386
11387
11388
11389
11390
11391
11392
11393
11394
11395
11396
11397
11398
11399
11400
11401
11402
11403
11404
11405
11406
11407
11408
11409
11410
11411
11412
11413
11414
11415
11416
11417
11418
11419
11420
11421
11422
11423
11424
11425
11426
11427
11428
11429
11430
11431
11432
11433
11434
11435
11436
11437
11438
11439
11440
11441
11442
11443
11444
11445
11446
11447
11448
11449
11450
11451
11452
11453
11454
11455
11456
11457
11458
11459
11460
11461
11462
11463
11464
11465
11466
11467
11468
11469
11470
11471
11472
11473
11474
11475
11476
11477
11478
11479
11480
11481
11482
11483
11484
11485
11486
11487
11488
11489
11490
11491
11492
11493
11494
11495
11496
11497
11498
11499
11500
11501
11502
11503
11504
11505
11506
11507
11508
11509
11510
11511
11512
11513
11514
11515
11516
11517
11518
11519
11520
11521
11522
11523
11524
11525
11526
11527
11528
11529
11530
11531
11532
11533
11534
11535
11536
11537
11538
11539
11540
11541
11542
11543
11544
11545
11546
11547
11548
11549
11550
11551
11552
11553
11554
11555
11556
11557
11558
11559
11560
11561
11562
11563
11564
11565
11566
11567
11568
11569
11570
11571
11572
11573
11574
11575
11576
11577
11578
11579
11580
11581
11582
11583
11584
11585
11586
11587
11588
11589
11590
11591
11592
11593
11594
11595
11596
11597
11598
11599
11600
11601
11602
11603
11604
11605
11606
11607
11608
11609
11610
11611
11612
11613
11614
11615
11616
11617
11618
11619
11620
11621
11622
11623
11624
11625
11626
11627
11628
11629
11630
11631
11632
11633
11634
11635
11636
11637
11638
11639
11640
11641
11642
11643
11644
11645
11646
11647
11648
11649
11650
11651
11652
11653
11654
11655
11656
11657
11658
11659
11660
11661
11662
11663
11664
11665
11666
11667
11668
11669
11670
11671
11672
11673
11674
11675
11676
11677
11678
11679
11680
11681
11682
11683
11684
11685
11686
11687
11688
11689
11690
11691
11692
11693
11694
11695
11696
11697
11698
11699
11700
11701
11702
11703
11704
11705
11706
11707
11708
11709
11710
11711
11712
11713
11714
11715
11716
11717
11718
11719
11720
11721
11722
11723
11724
11725
11726
11727
11728
11729
11730
11731
11732
11733
11734
11735
11736
11737
11738
11739
11740
11741
11742
11743
11744
11745
11746
11747
11748
11749
11750
11751
11752
11753
11754
11755
11756
11757
11758
11759
11760
11761
11762
11763
11764
11765
11766
11767
11768
11769
11770
11771
11772
11773
11774
11775
11776
11777
11778
11779
11780
11781
11782
11783
11784
11785
11786
11787
11788
11789
11790
11791
11792
11793
11794
11795
11796
11797
11798
11799
11800
11801
11802
11803
11804
11805
11806
11807
11808
11809
11810
11811
11812
11813
11814
11815
11816
11817
11818
11819
11820
11821
11822
11823
11824
11825
11826
11827
11828
11829
11830
11831
11832
11833
11834
11835
11836
11837
11838
11839
11840
11841
11842
11843
11844
11845
11846
11847
11848
11849
11850
11851
11852
11853
11854
11855
11856
11857
11858
11859
11860
11861
11862
11863
11864
11865
11866
11867
11868
11869
11870
11871
11872
11873
11874
11875
11876
11877
11878
11879
11880
11881
11882
11883
11884
11885
11886
11887
11888
11889
11890
11891
11892
11893
11894
11895
11896
11897
11898
11899
11900
11901
11902
11903
11904
11905
11906
11907
11908
11909
11910
11911
11912
11913
11914
11915
11916
11917
11918
11919
11920
11921
11922
11923
11924
11925
11926
11927
11928
11929
11930
11931
11932
11933
11934
11935
11936
11937
11938
11939
11940
11941
11942
11943
11944
11945
11946
11947
11948
11949
11950
11951
11952
11953
11954
11955
11956
11957
11958
11959
11960
11961
11962
11963
11964
11965
11966
11967
11968
11969
11970
11971
11972
11973
11974
11975
11976
11977
11978
11979
11980
11981
11982
11983
11984
11985
11986
11987
11988
11989
11990
11991
11992
11993
11994
11995
11996
11997
11998
11999
12000
12001
12002
12003
12004
12005
12006
12007
12008
12009
12010
12011
12012
12013
12014
12015
12016
12017
12018
12019
12020
12021
12022
12023
12024
12025
12026
12027
12028
12029
12030
12031
12032
12033
12034
12035
12036
12037
12038
12039
12040
12041
12042
12043
12044
12045
12046
12047
12048
12049
12050
12051
12052
12053
12054
12055
12056
12057
12058
12059
12060
12061
12062
12063
12064
12065
12066
12067
12068
12069
12070
12071
12072
12073
12074
12075
12076
12077
12078
12079
12080
12081
12082
12083
12084
12085
12086
12087
12088
12089
12090
12091
12092
12093
12094
12095
12096
12097
12098
12099
12100
12101
12102
12103
12104
12105
12106
12107
12108
12109
12110
12111
12112
12113
12114
12115
12116
12117
12118
12119
12120
12121
12122
12123
12124
12125
12126
12127
12128
12129
12130
12131
12132
12133
12134
12135
12136
12137
12138
12139
12140
12141
12142
12143
12144
12145
12146
12147
12148
12149
12150
12151
12152
12153
12154
12155
12156
12157
12158
12159
12160
12161
12162
12163
12164
12165
12166
12167
12168
12169
12170
12171
12172
12173
12174
12175
12176
12177
12178
12179
12180
12181
12182
12183
12184
12185
12186
12187
12188
12189
12190
12191
12192
12193
12194
12195
12196
12197
12198
12199
12200
12201
12202
12203
12204
12205
12206
12207
12208
12209
12210
12211
12212
12213
12214
12215
12216
12217
12218
12219
12220
12221
12222
12223
12224
12225
12226
12227
12228
12229
12230
12231
12232
12233
12234
12235
12236
12237
12238
12239
12240
12241
12242
12243
12244
12245
12246
12247
12248
12249
12250
12251
12252
12253
12254
12255
12256
12257
12258
12259
12260
12261
12262
12263
12264
12265
12266
12267
12268
12269
12270
12271
12272
12273
12274
12275
12276
12277
12278
12279
12280
12281
12282
12283
12284
12285
12286
12287
12288
12289
12290
12291
12292
12293
12294
12295
12296
12297
12298
12299
12300
12301
12302
12303
12304
12305
12306
12307
12308
12309
12310
12311
12312
12313
12314
12315
12316
12317
12318
12319
12320
12321
12322
12323
12324
12325
12326
12327
12328
12329
12330
12331
12332
12333
12334
12335
12336
12337
12338
12339
12340
12341
12342
12343
12344
12345
12346
12347
12348
12349
12350
12351
12352
12353
12354
12355
12356
12357
12358
12359
12360
12361
12362
12363
12364
12365
12366
12367
12368
12369
12370
12371
12372
12373
12374
12375
12376
12377
12378
12379
12380
12381
12382
12383
12384
12385
12386
12387
12388
12389
12390
12391
12392
12393
12394
12395
12396
12397
12398
12399
12400
12401
12402
12403
12404
12405
12406
12407
12408
12409
12410
12411
12412
12413
12414
12415
12416
12417
12418
12419
12420
12421
12422
12423
12424
12425
12426
12427
12428
12429
12430
12431
12432
12433
12434
12435
12436
12437
12438
12439
12440
12441
12442
12443
12444
12445
12446
12447
12448
12449
12450
12451
12452
12453
12454
12455
12456
12457
12458
12459
12460
12461
12462
12463
12464
12465
12466
12467
12468
12469
12470
12471
12472
12473
12474
12475
12476
12477
12478
12479
12480
12481
12482
12483
12484
12485
12486
12487
12488
12489
12490
12491
12492
12493
12494
12495
12496
12497
12498
12499
12500
12501
12502
12503
12504
12505
12506
12507
12508
12509
12510
12511
12512
12513
12514
12515
12516
12517
12518
12519
12520
12521
12522
12523
12524
12525
12526
12527
12528
12529
12530
12531
12532
12533
12534
12535
12536
12537
12538
12539
12540
12541
12542
12543
12544
12545
12546
12547
12548
12549
12550
12551
12552
12553
12554
12555
12556
12557
12558
12559
12560
12561
12562
12563
12564
12565
12566
12567
12568
12569
12570
12571
12572
12573
12574
12575
12576
12577
12578
12579
12580
12581
12582
12583
12584
12585
12586
12587
12588
12589
12590
12591
12592
12593
12594
12595
12596
12597
12598
12599
12600
12601
12602
12603
12604
12605
12606
12607
12608
12609
12610
12611
12612
12613
12614
12615
12616
12617
12618
12619
12620
12621
12622
12623
12624
12625
12626
12627
12628
12629
12630
12631
12632
12633
12634
12635
12636
12637
12638
12639
12640
12641
12642
12643
12644
12645
12646
12647
12648
12649
12650
12651
12652
12653
12654
12655
12656
12657
12658
12659
12660
12661
12662
12663
12664
12665
12666
12667
12668
12669
12670
12671
12672
12673
12674
12675
12676
12677
12678
12679
12680
12681
12682
12683
12684
12685
12686
12687
12688
12689
12690
12691
12692
12693
12694
12695
12696
12697
12698
12699
12700
12701
12702
12703
12704
12705
12706
12707
12708
12709
12710
12711
12712
12713
12714
12715
12716
12717
12718
12719
12720
12721
12722
12723
12724
12725
12726
12727
12728
12729
12730
12731
12732
12733
12734
12735
12736
12737
12738
12739
12740
12741
12742
12743
12744
12745
12746
12747
12748
12749
12750
12751
12752
12753
12754
12755
12756
12757
12758
12759
12760
12761
12762
12763
12764
12765
12766
12767
12768
12769
12770
12771
12772
12773
12774
12775
12776
12777
12778
12779
12780
12781
12782
12783
12784
12785
12786
12787
12788
12789
12790
12791
12792
12793
12794
12795
12796
12797
12798
12799
12800
12801
12802
12803
12804
12805
12806
12807
12808
12809
12810
12811
12812
12813
12814
12815
12816
12817
12818
12819
12820
12821
12822
12823
12824
12825
12826
12827
12828
12829
12830
12831
12832
12833
12834
12835
12836
12837
12838
12839
12840
12841
12842
12843
12844
12845
12846
12847
12848
12849
12850
12851
12852
12853
12854
12855
12856
12857
12858
12859
12860
12861
12862
12863
12864
12865
12866
12867
12868
12869
12870
12871
12872
12873
12874
12875
12876
12877
12878
12879
12880
12881
12882
12883
12884
12885
12886
12887
12888
12889
12890
12891
12892
12893
12894
12895
12896
12897
12898
12899
12900
12901
12902
12903
12904
12905
12906
12907
12908
12909
12910
12911
12912
12913
12914
12915
12916
12917
12918
12919
12920
12921
12922
12923
12924
12925
12926
12927
12928
12929
12930
12931
12932
12933
12934
12935
12936
12937
12938
12939
12940
12941
12942
12943
12944
12945
12946
12947
12948
12949
12950
12951
12952
12953
12954
12955
12956
12957
12958
12959
12960
12961
12962
12963
12964
12965
12966
12967
12968
12969
12970
12971
12972
12973
12974
12975
12976
12977
12978
12979
12980
12981
12982
12983
12984
12985
12986
12987
12988
12989
12990
12991
12992
12993
12994
12995
12996
12997
12998
12999
13000
13001
13002
13003
13004
13005
13006
13007
13008
13009
13010
13011
13012
13013
13014
13015
13016
13017
13018
13019
13020
13021
13022
13023
13024
13025
13026
13027
13028
13029
13030
13031
13032
13033
13034
13035
13036
13037
13038
13039
13040
13041
13042
13043
13044
13045
13046
13047
13048
13049
13050
13051
13052
13053
13054
13055
13056
13057
13058
13059
13060
13061
13062
13063
13064
13065
13066
13067
13068
13069
13070
13071
13072
13073
13074
13075
13076
13077
13078
13079
13080
13081
13082
13083
13084
13085
13086
13087
13088
13089
13090
13091
13092
13093
13094
13095
13096
13097
13098
13099
13100
13101
13102
13103
13104
13105
13106
13107
13108
13109
13110
13111
13112
13113
13114
13115
13116
13117
13118
13119
13120
13121
13122
13123
13124
13125
13126
13127
13128
13129
13130
13131
13132
13133
13134
13135
13136
13137
13138
13139
13140
13141
13142
13143
13144
13145
13146
13147
13148
13149
13150
13151
13152
13153
13154
13155
13156
13157
13158
13159
13160
13161
13162
13163
13164
13165
13166
13167
13168
13169
13170
13171
13172
13173
13174
13175
13176
13177
13178
13179
13180
13181
13182
13183
13184
13185
13186
13187
13188
13189
13190
13191
13192
13193
13194
13195
13196
13197
13198
13199
13200
13201
13202
13203
13204
13205
13206
13207
13208
13209
13210
13211
13212
13213
13214
13215
13216
13217
13218
13219
13220
13221
13222
13223
13224
13225
13226
13227
13228
13229
13230
13231
13232
13233
13234
13235
13236
13237
13238
13239
13240
13241
13242
13243
13244
13245
13246
13247
13248
13249
13250
13251
13252
13253
13254
13255
13256
13257
13258
13259
13260
13261
13262
13263
13264
13265
13266
13267
13268
13269
13270
13271
13272
13273
13274
13275
13276
13277
13278
13279
13280
13281
13282
13283
13284
13285
13286
13287
13288
13289
13290
13291
13292
13293
13294
13295
13296
13297
13298
13299
13300
13301
13302
13303
13304
13305
13306
13307
13308
13309
13310
13311
13312
13313
13314
13315
13316
13317
13318
13319
13320
13321
13322
13323
13324
13325
13326
13327
13328
13329
13330
13331
13332
13333
13334
13335
13336
13337
13338
13339
13340
13341
13342
13343
13344
13345
13346
13347
13348
13349
13350
13351
13352
13353
13354
13355
13356
13357
13358
13359
13360
13361
13362
13363
13364
13365
13366
13367
13368
13369
13370
13371
13372
13373
13374
13375
13376
13377
13378
13379
13380
13381
13382
13383
13384
13385
13386
13387
13388
13389
13390
13391
13392
13393
13394
13395
13396
13397
13398
13399
13400
13401
13402
13403
13404
13405
13406
13407
13408
13409
13410
13411
13412
13413
13414
13415
13416
13417
13418
13419
13420
13421
13422
13423
13424
13425
13426
13427
13428
13429
13430
13431
13432
13433
13434
13435
13436
13437
13438
13439
13440
13441
13442
13443
13444
13445
13446
13447
13448
13449
13450
13451
13452
13453
13454
13455
13456
13457
13458
13459
13460
13461
13462
13463
13464
13465
13466
13467
13468
13469
13470
13471
13472
13473
13474
13475
13476
13477
13478
13479
13480
13481
13482
13483
13484
13485
13486
13487
13488
13489
13490
13491
13492
13493
13494
13495
13496
13497
13498
13499
13500
13501
13502
13503
13504
13505
13506
13507
13508
13509
13510
13511
13512
13513
13514
13515
13516
13517
13518
13519
13520
13521
13522
13523
13524
13525
13526
13527
13528
13529
13530
13531
13532
13533
13534
13535
13536
13537
13538
13539
13540
13541
13542
13543
13544
13545
13546
13547
13548
13549
13550
13551
13552
13553
13554
13555
13556
13557
13558
13559
13560
13561
13562
13563
13564
13565
13566
13567
13568
13569
13570
13571
13572
13573
13574
13575
13576
13577
13578
13579
13580
13581
13582
13583
13584
13585
13586
13587
13588
13589
13590
13591
13592
13593
13594
13595
13596
13597
13598
13599
13600
13601
13602
13603
13604
13605
13606
13607
13608
13609
13610
13611
13612
13613
13614
13615
13616
13617
13618
13619
13620
13621
13622
13623
13624
13625
13626
13627
13628
13629
13630
13631
13632
13633
13634
13635
13636
13637
13638
13639
13640
13641
13642
13643
13644
13645
13646
13647
13648
13649
13650
13651
13652
13653
13654
13655
13656
13657
13658
13659
13660
13661
13662
13663
13664
13665
13666
13667
13668
13669
13670
13671
13672
13673
13674
13675
13676
13677
13678
13679
13680
13681
13682
13683
13684
13685
13686
13687
13688
13689
13690
13691
13692
13693
13694
13695
13696
13697
13698
13699
13700
13701
13702
13703
13704
13705
13706
13707
13708
13709
13710
13711
13712
13713
13714
13715
13716
13717
13718
13719
13720
13721
13722
13723
13724
13725
13726
13727
13728
13729
13730
13731
13732
13733
13734
13735
13736
13737
13738
13739
13740
13741
13742
13743
13744
13745
13746
13747
13748
13749
13750
13751
13752
13753
13754
13755
13756
13757
13758
13759
13760
13761
13762
13763
13764
13765
13766
13767
13768
13769
13770
13771
13772
13773
13774
13775
13776
13777
13778
13779
13780
13781
13782
13783
13784
13785
13786
13787
13788
13789
13790
13791
13792
13793
13794
13795
13796
13797
13798
13799
13800
13801
13802
13803
13804
13805
13806
13807
13808
13809
13810
13811
13812
13813
13814
13815
13816
13817
13818
13819
13820
13821
13822
13823
13824
13825
13826
13827
13828
13829
13830
13831
13832
13833
13834
13835
13836
13837
13838
13839
13840
13841
13842
13843
13844
13845
13846
13847
13848
13849
13850
13851
13852
13853
13854
13855
13856
13857
13858
13859
13860
13861
13862
13863
13864
13865
13866
13867
13868
13869
13870
13871
13872
13873
13874
13875
13876
13877
13878
13879
13880
13881
13882
13883
13884
13885
13886
13887
13888
13889
13890
13891
13892
13893
13894
13895
13896
13897
13898
13899
13900
13901
13902
13903
13904
13905
13906
13907
13908
13909
13910
13911
13912
13913
13914
13915
13916
13917
13918
13919
13920
13921
13922
13923
13924
13925
13926
13927
13928
13929
13930
13931
13932
13933
13934
13935
13936
13937
13938
13939
13940
13941
13942
13943
13944
13945
13946
13947
13948
13949
13950
13951
13952
13953
13954
13955
13956
13957
13958
13959
13960
13961
13962
13963
13964
13965
13966
13967
13968
13969
13970
13971
13972
13973
13974
13975
13976
13977
13978
13979
13980
13981
13982
13983
13984
13985
13986
13987
13988
13989
13990
13991
13992
13993
13994
13995
13996
13997
13998
13999
14000
14001
14002
14003
14004
14005
14006
14007
14008
14009
14010
14011
14012
14013
14014
14015
14016
14017
14018
14019
14020
14021
14022
14023
14024
14025
14026
14027
14028
14029
14030
14031
14032
14033
14034
14035
14036
14037
14038
14039
14040
14041
14042
14043
14044
14045
14046
14047
14048
14049
14050
14051
14052
14053
14054
14055
14056
14057
14058
14059
14060
14061
14062
14063
14064
14065
14066
14067
14068
14069
14070
14071
14072
14073
14074
14075
14076
14077
14078
14079
14080
14081
14082
14083
14084
14085
14086
14087
14088
14089
14090
14091
14092
14093
14094
14095
14096
14097
14098
14099
14100
14101
14102
14103
14104
14105
14106
14107
14108
14109
14110
14111
14112
14113
14114
14115
14116
14117
14118
14119
14120
14121
14122
14123
14124
14125
14126
14127
14128
14129
14130
14131
14132
14133
14134
14135
14136
14137
14138
14139
14140
14141
14142
14143
14144
14145
14146
14147
14148
14149
14150
14151
14152
14153
14154
14155
14156
14157
14158
14159
14160
14161
14162
14163
14164
14165
14166
14167
14168
14169
14170
14171
14172
14173
14174
14175
14176
14177
14178
14179
14180
14181
14182
14183
14184
14185
14186
14187
14188
14189
14190
14191
14192
14193
14194
14195
14196
14197
14198
14199
14200
14201
14202
14203
14204
14205
14206
14207
14208
14209
14210
14211
14212
14213
14214
14215
14216
14217
14218
14219
14220
14221
14222
14223
14224
14225
14226
14227
14228
14229
14230
14231
14232
14233
14234
14235
14236
14237
14238
14239
14240
14241
14242
14243
14244
14245
14246
14247
14248
14249
14250
14251
14252
14253
14254
14255
14256
14257
14258
14259
14260
14261
14262
14263
14264
14265
14266
14267
14268
14269
14270
14271
14272
14273
14274
14275
14276
14277
14278
14279
14280
14281
14282
14283
14284
14285
14286
14287
14288
14289
14290
14291
14292
14293
14294
14295
14296
14297
14298
14299
14300
14301
14302
14303
14304
14305
14306
14307
14308
14309
14310
14311
14312
14313
14314
14315
14316
14317
14318
14319
14320
14321
14322
14323
14324
14325
14326
14327
14328
14329
14330
14331
14332
14333
14334
14335
14336
14337
14338
14339
14340
14341
14342
14343
14344
14345
14346
14347
14348
14349
14350
14351
14352
14353
14354
14355
14356
14357
14358
14359
14360
14361
14362
14363
14364
14365
14366
14367
14368
14369
14370
14371
14372
14373
14374
14375
14376
14377
14378
14379
14380
14381
14382
14383
14384
14385
14386
14387
14388
14389
14390
14391
14392
14393
14394
14395
14396
14397
14398
14399
14400
14401
14402
14403
14404
14405
14406
14407
14408
14409
14410
14411
14412
14413
14414
14415
14416
14417
14418
14419
14420
14421
14422
14423
14424
14425
14426
14427
14428
14429
14430
14431
14432
14433
14434
14435
14436
14437
14438
14439
14440
14441
14442
14443
14444
14445
14446
14447
14448
14449
14450
14451
14452
14453
14454
14455
14456
14457
14458
14459
14460
14461
14462
14463
14464
14465
14466
14467
14468
14469
14470
14471
14472
14473
14474
14475
14476
14477
14478
14479
14480
14481
14482
14483
14484
14485
14486
14487
14488
14489
14490
14491
14492
14493
14494
14495
14496
14497
14498
14499
14500
14501
14502
14503
14504
14505
14506
14507
14508
14509
14510
14511
14512
14513
14514
14515
14516
14517
14518
14519
14520
14521
14522
14523
14524
14525
14526
14527
14528
14529
14530
14531
14532
14533
14534
14535
14536
14537
14538
14539
14540
14541
14542
14543
14544
14545
14546
14547
14548
14549
14550
14551
14552
14553
14554
14555
14556
14557
14558
14559
14560
14561
14562
14563
14564
14565
14566
14567
14568
14569
14570
14571
14572
14573
14574
14575
14576
14577
14578
14579
14580
14581
14582
14583
14584
14585
14586
14587
14588
14589
14590
14591
14592
14593
14594
14595
14596
14597
14598
14599
14600
14601
14602
14603
14604
14605
14606
14607
14608
14609
14610
14611
14612
14613
14614
14615
14616
14617
14618
14619
14620
14621
14622
14623
14624
14625
14626
14627
14628
14629
14630
14631
14632
14633
14634
14635
14636
14637
14638
14639
14640
14641
14642
14643
14644
14645
14646
14647
14648
14649
14650
14651
14652
14653
14654
14655
14656
14657
14658
14659
14660
14661
14662
14663
14664
14665
14666
14667
14668
14669
14670
14671
14672
14673
14674
14675
14676
14677
14678
14679
14680
14681
14682
14683
14684
14685
14686
14687
14688
14689
14690
14691
14692
14693
14694
14695
14696
14697
14698
14699
14700
14701
14702
14703
14704
14705
14706
14707
14708
14709
14710
14711
14712
14713
14714
14715
14716
14717
14718
14719
14720
14721
14722
14723
14724
14725
14726
14727
14728
14729
14730
14731
14732
14733
14734
14735
14736
14737
14738
14739
14740
14741
14742
14743
14744
14745
14746
14747
14748
14749
14750
14751
14752
14753
14754
14755
14756
14757
14758
14759
14760
14761
14762
14763
14764
14765
14766
14767
14768
14769
14770
14771
14772
14773
14774
14775
14776
14777
14778
14779
14780
14781
14782
14783
14784
14785
14786
14787
14788
14789
14790
14791
14792
14793
14794
14795
14796
14797
14798
14799
14800
14801
14802
14803
14804
14805
14806
14807
14808
14809
14810
14811
14812
14813
14814
14815
14816
14817
14818
14819
14820
14821
14822
14823
14824
14825
14826
14827
14828
14829
14830
14831
14832
14833
14834
14835
14836
14837
14838
14839
14840
14841
14842
14843
14844
14845
14846
14847
14848
14849
14850
14851
14852
14853
14854
14855
14856
14857
14858
14859
14860
14861
14862
14863
14864
14865
14866
14867
14868
14869
14870
14871
14872
14873
14874
14875
14876
14877
14878
14879
14880
14881
14882
14883
14884
14885
14886
14887
14888
14889
14890
14891
14892
14893
14894
14895
14896
14897
14898
14899
14900
14901
14902
14903
14904
14905
14906
14907
14908
14909
14910
14911
14912
14913
14914
14915
14916
14917
14918
14919
14920
14921
14922
14923
14924
14925
14926
14927
14928
14929
14930
14931
14932
14933
14934
14935
14936
14937
14938
14939
14940
14941
14942
14943
14944
14945
14946
14947
14948
14949
14950
14951
14952
14953
14954
14955
14956
14957
14958
14959
14960
14961
14962
14963
14964
14965
14966
14967
14968
14969
14970
14971
14972
14973
14974
14975
14976
14977
14978
14979
14980
14981
14982
14983
14984
14985
14986
14987
14988
14989
14990
14991
14992
14993
14994
14995
14996
14997
14998
14999
15000
15001
15002
15003
15004
15005
15006
15007
15008
15009
15010
15011
15012
15013
15014
15015
15016
15017
15018
15019
15020
15021
15022
15023
15024
15025
15026
15027
15028
15029
15030
15031
15032
15033
15034
15035
15036
15037
15038
15039
15040
15041
15042
15043
15044
15045
15046
15047
15048
15049
15050
15051
15052
15053
15054
15055
15056
15057
15058
15059
15060
15061
15062
15063
15064
15065
15066
15067
15068
15069
15070
15071
15072
15073
15074
15075
15076
15077
15078
15079
15080
15081
15082
15083
15084
15085
15086
15087
15088
15089
15090
15091
15092
15093
15094
15095
15096
15097
15098
15099
15100
15101
15102
15103
15104
15105
15106
15107
15108
15109
15110
15111
15112
15113
15114
15115
15116
15117
15118
15119
15120
15121
15122
15123
15124
15125
15126
15127
15128
15129
15130
15131
15132
15133
15134
15135
15136
15137
15138
15139
15140
15141
15142
15143
15144
15145
15146
15147
15148
15149
15150
15151
15152
15153
15154
15155
15156
15157
15158
15159
15160
15161
15162
15163
15164
15165
15166
15167
15168
15169
15170
15171
15172
15173
15174
15175
15176
15177
15178
15179
15180
15181
15182
15183
15184
15185
15186
15187
15188
15189
15190
15191
15192
15193
15194
15195
15196
15197
15198
15199
15200
15201
15202
15203
15204
15205
15206
15207
15208
15209
15210
15211
15212
15213
15214
15215
15216
15217
15218
15219
15220
15221
15222
15223
15224
15225
15226
15227
15228
15229
15230
15231
15232
15233
15234
15235
15236
15237
15238
15239
15240
15241
15242
15243
15244
15245
15246
15247
15248
15249
15250
15251
15252
15253
15254
15255
15256
15257
15258
15259
15260
15261
15262
15263
15264
15265
15266
15267
15268
15269
15270
15271
15272
15273
15274
15275
15276
15277
15278
15279
15280
15281
15282
15283
15284
15285
15286
15287
15288
15289
15290
15291
15292
15293
15294
15295
15296
15297
15298
15299
15300
15301
15302
15303
15304
15305
15306
15307
15308
15309
15310
15311
15312
15313
15314
15315
15316
15317
15318
15319
15320
15321
15322
15323
15324
15325
15326
15327
15328
15329
15330
15331
15332
15333
15334
15335
15336
15337
15338
15339
15340
15341
15342
15343
15344
15345
15346
15347
15348
15349
15350
15351
15352
15353
15354
15355
15356
15357
15358
15359
15360
15361
15362
15363
15364
15365
15366
15367
15368
15369
15370
15371
15372
15373
15374
15375
15376
15377
15378
15379
15380
15381
15382
15383
15384
15385
15386
15387
15388
15389
15390
15391
15392
15393
15394
15395
15396
15397
15398
15399
15400
15401
15402
15403
15404
15405
15406
15407
15408
15409
15410
15411
15412
15413
15414
15415
15416
15417
15418
15419
15420
15421
15422
15423
15424
15425
15426
15427
15428
15429
15430
15431
15432
15433
15434
15435
15436
15437
15438
15439
15440
15441
15442
15443
15444
15445
15446
15447
15448
15449
15450
15451
15452
15453
15454
15455
15456
15457
15458
15459
15460
15461
15462
15463
15464
15465
15466
15467
15468
15469
15470
15471
15472
15473
15474
15475
15476
15477
15478
15479
15480
15481
15482
15483
15484
15485
15486
15487
15488
15489
15490
15491
15492
15493
15494
15495
15496
15497
15498
15499
15500
15501
15502
15503
15504
15505
15506
15507
15508
15509
15510
15511
15512
15513
15514
15515
15516
15517
15518
15519
15520
15521
15522
15523
15524
15525
15526
15527
15528
15529
15530
15531
15532
15533
15534
15535
15536
15537
15538
15539
15540
15541
15542
15543
15544
15545
15546
15547
15548
15549
15550
15551
15552
15553
15554
15555
15556
15557
15558
15559
15560
15561
15562
15563
15564
15565
15566
15567
15568
15569
15570
15571
15572
15573
15574
15575
15576
15577
15578
15579
15580
15581
15582
15583
15584
15585
15586
15587
15588
15589
15590
15591
15592
15593
15594
15595
15596
15597
15598
15599
15600
15601
15602
15603
15604
15605
15606
15607
15608
15609
15610
15611
15612
15613
15614
15615
15616
15617
15618
15619
15620
15621
15622
15623
15624
15625
15626
15627
15628
15629
15630
15631
15632
15633
15634
15635
15636
15637
15638
15639
15640
15641
15642
15643
15644
15645
15646
15647
15648
15649
15650
15651
15652
15653
15654
15655
15656
15657
15658
15659
15660
15661
15662
15663
15664
15665
15666
15667
15668
15669
15670
15671
15672
15673
15674
15675
15676
15677
15678
15679
15680
15681
15682
15683
15684
15685
15686
15687
15688
15689
15690
15691
15692
15693
15694
15695
15696
15697
15698
15699
15700
15701
15702
15703
15704
15705
15706
15707
15708
15709
15710
15711
15712
15713
15714
15715
15716
15717
15718
15719
15720
15721
15722
15723
15724
15725
15726
15727
15728
15729
15730
15731
15732
15733
15734
15735
15736
15737
15738
15739
15740
15741
15742
15743
15744
15745
15746
15747
15748
15749
15750
15751
15752
15753
15754
15755
15756
15757
15758
15759
15760
15761
15762
15763
15764
15765
15766
15767
15768
15769
15770
15771
15772
15773
15774
15775
15776
15777
15778
15779
15780
15781
15782
15783
15784
15785
15786
15787
15788
15789
15790
15791
15792
15793
15794
15795
15796
15797
15798
15799
15800
15801
15802
15803
15804
15805
15806
15807
15808
15809
15810
15811
15812
15813
15814
15815
15816
15817
15818
15819
15820
15821
15822
15823
15824
15825
15826
15827
15828
15829
15830
15831
15832
15833
15834
15835
15836
15837
15838
15839
15840
15841
15842
15843
15844
15845
15846
15847
15848
15849
15850
15851
15852
15853
15854
15855
15856
15857
15858
15859
15860
15861
15862
15863
15864
15865
15866
15867
15868
15869
15870
15871
15872
15873
15874
15875
15876
15877
15878
15879
15880
15881
15882
15883
15884
15885
15886
15887
15888
15889
15890
15891
15892
15893
15894
15895
15896
15897
15898
15899
15900
15901
15902
15903
15904
15905
15906
15907
15908
15909
15910
15911
15912
15913
15914
15915
15916
15917
15918
15919
15920
15921
15922
15923
15924
15925
15926
15927
15928
15929
15930
15931
15932
15933
15934
15935
15936
15937
15938
15939
15940
15941
15942
15943
15944
15945
15946
15947
15948
15949
15950
15951
15952
15953
15954
15955
15956
15957
15958
15959
15960
15961
15962
15963
15964
15965
15966
15967
15968
15969
15970
15971
15972
15973
15974
15975
15976
15977
15978
15979
15980
15981
15982
15983
15984
15985
15986
15987
15988
15989
15990
15991
15992
15993
15994
15995
15996
15997
15998
15999
16000
16001
16002
16003
16004
16005
16006
16007
16008
16009
16010
16011
16012
16013
16014
16015
16016
16017
16018
16019
16020
16021
16022
16023
16024
16025
16026
16027
16028
16029
16030
16031
16032
16033
16034
16035
16036
16037
16038
16039
16040
16041
16042
16043
16044
16045
16046
16047
16048
16049
16050
16051
16052
16053
16054
16055
16056
16057
16058
16059
16060
16061
16062
16063
16064
16065
16066
16067
16068
16069
16070
16071
16072
16073
16074
16075
16076
16077
16078
16079
16080
16081
16082
16083
16084
16085
16086
16087
16088
16089
16090
16091
16092
16093
16094
16095
16096
16097
16098
16099
16100
16101
16102
16103
16104
16105
16106
16107
16108
16109
16110
16111
16112
16113
16114
16115
16116
16117
16118
16119
16120
16121
16122
16123
16124
16125
16126
16127
16128
16129
16130
16131
16132
16133
16134
16135
16136
16137
16138
16139
16140
16141
16142
16143
16144
16145
16146
16147
16148
16149
16150
16151
16152
16153
16154
16155
16156
16157
16158
16159
16160
16161
16162
16163
16164
16165
16166
16167
16168
16169
16170
16171
16172
16173
16174
16175
16176
16177
16178
16179
16180
16181
16182
16183
16184
16185
16186
16187
16188
16189
16190
16191
16192
16193
16194
16195
16196
16197
16198
16199
16200
16201
16202
16203
16204
16205
16206
16207
16208
16209
16210
16211
16212
16213
16214
16215
16216
16217
16218
16219
16220
16221
16222
16223
16224
16225
16226
16227
16228
16229
16230
16231
16232
16233
16234
16235
16236
16237
16238
16239
16240
16241
16242
16243
16244
16245
16246
16247
16248
16249
16250
16251
16252
16253
16254
16255
16256
16257
16258
16259
16260
16261
16262
16263
16264
16265
16266
16267
16268
16269
16270
16271
16272
16273
16274
16275
16276
16277
16278
16279
16280
16281
16282
16283
16284
16285
16286
16287
16288
16289
16290
16291
16292
16293
16294
16295
16296
16297
16298
16299
16300
16301
16302
16303
16304
16305
16306
16307
16308
16309
16310
16311
16312
16313
16314
16315
16316
16317
16318
16319
16320
16321
16322
16323
16324
16325
16326
16327
16328
16329
16330
16331
16332
16333
16334
16335
16336
16337
16338
16339
16340
16341
16342
16343
16344
16345
16346
16347
16348
16349
16350
16351
16352
16353
16354
16355
16356
16357
16358
16359
16360
16361
16362
16363
16364
16365
16366
16367
16368
16369
16370
16371
16372
16373
16374
16375
16376
16377
16378
16379
16380
16381
16382
16383
16384
16385
16386
16387
16388
16389
16390
16391
16392
16393
16394
16395
16396
16397
16398
16399
16400
16401
16402
16403
16404
16405
16406
16407
16408
16409
16410
16411
16412
16413
16414
16415
16416
16417
16418
16419
16420
16421
16422
16423
16424
16425
16426
16427
16428
16429
16430
16431
16432
16433
16434
16435
16436
16437
16438
16439
16440
16441
16442
16443
16444
16445
16446
16447
16448
16449
16450
16451
16452
16453
16454
16455
16456
16457
16458
16459
16460
16461
16462
16463
16464
16465
16466
16467
16468
16469
16470
16471
16472
16473
16474
16475
16476
16477
16478
16479
16480
16481
16482
16483
16484
16485
16486
16487
16488
16489
16490
16491
16492
16493
16494
16495
16496
16497
16498
16499
16500
16501
16502
16503
16504
16505
16506
16507
16508
16509
16510
16511
16512
16513
16514
16515
16516
16517
16518
16519
16520
16521
16522
16523
16524
16525
16526
16527
16528
16529
16530
16531
16532
16533
16534
16535
16536
16537
16538
16539
16540
16541
16542
16543
16544
16545
16546
16547
16548
16549
16550
16551
16552
16553
16554
16555
16556
16557
16558
16559
16560
16561
16562
16563
16564
16565
16566
16567
16568
16569
16570
16571
16572
16573
16574
16575
16576
16577
16578
16579
16580
16581
16582
16583
16584
16585
16586
16587
16588
16589
16590
16591
16592
16593
16594
16595
16596
16597
16598
16599
16600
16601
16602
16603
16604
16605
16606
16607
16608
16609
16610
16611
16612
16613
16614
16615
16616
16617
16618
16619
16620
16621
16622
16623
16624
16625
16626
16627
16628
16629
16630
16631
16632
16633
16634
16635
16636
16637
16638
16639
16640
16641
16642
16643
16644
16645
16646
16647
16648
16649
16650
16651
16652
16653
16654
16655
16656
16657
16658
16659
16660
16661
16662
16663
16664
16665
16666
16667
16668
16669
16670
16671
16672
16673
16674
16675
16676
16677
16678
16679
16680
16681
16682
16683
16684
16685
16686
16687
16688
16689
16690
16691
16692
16693
16694
16695
16696
16697
16698
16699
16700
16701
16702
16703
16704
16705
16706
16707
16708
16709
16710
16711
16712
16713
16714
16715
16716
16717
16718
16719
16720
16721
16722
16723
16724
16725
16726
16727
16728
16729
16730
16731
16732
16733
16734
16735
16736
16737
16738
16739
16740
16741
16742
16743
16744
16745
16746
16747
16748
16749
16750
16751
16752
16753
16754
16755
16756
16757
16758
16759
16760
16761
16762
16763
16764
16765
16766
16767
16768
16769
16770
16771
16772
16773
16774
16775
16776
16777
16778
16779
16780
16781
16782
16783
16784
16785
16786
16787
16788
16789
16790
16791
16792
16793
16794
16795
16796
16797
16798
16799
16800
16801
16802
16803
16804
16805
16806
16807
16808
16809
16810
16811
16812
16813
16814
16815
16816
16817
16818
16819
16820
16821
16822
16823
16824
16825
16826
16827
16828
16829
16830
16831
16832
16833
16834
16835
16836
16837
16838
16839
16840
16841
16842
16843
16844
16845
16846
16847
16848
16849
16850
16851
16852
16853
16854
16855
16856
16857
16858
16859
16860
16861
16862
16863
16864
16865
16866
16867
16868
16869
16870
16871
16872
16873
16874
16875
16876
16877
16878
16879
16880
16881
16882
16883
16884
16885
16886
16887
16888
16889
16890
16891
16892
16893
16894
16895
16896
16897
16898
16899
16900
16901
16902
16903
16904
16905
16906
16907
16908
16909
16910
16911
16912
16913
16914
16915
16916
16917
16918
16919
16920
16921
16922
16923
16924
16925
16926
16927
16928
16929
16930
16931
16932
16933
16934
16935
16936
16937
16938
16939
16940
16941
16942
16943
16944
16945
16946
16947
16948
16949
16950
16951
16952
16953
16954
16955
16956
16957
16958
16959
16960
16961
16962
16963
16964
16965
16966
16967
16968
16969
16970
16971
16972
16973
16974
16975
16976
16977
16978
16979
16980
16981
16982
16983
16984
16985
16986
16987
16988
16989
16990
16991
16992
16993
16994
16995
16996
16997
16998
16999
17000
17001
17002
17003
17004
17005
17006
17007
17008
17009
17010
17011
17012
17013
17014
17015
17016
17017
17018
17019
17020
17021
17022
17023
17024
17025
17026
17027
17028
17029
17030
17031
17032
17033
17034
17035
17036
17037
17038
17039
17040
17041
17042
17043
17044
17045
17046
17047
17048
17049
17050
17051
17052
17053
17054
17055
17056
17057
17058
17059
17060
17061
17062
17063
17064
17065
17066
17067
17068
17069
17070
17071
17072
17073
17074
17075
17076
17077
17078
17079
17080
17081
17082
17083
17084
17085
17086
17087
17088
17089
17090
17091
17092
17093
17094
17095
17096
17097
17098
17099
17100
17101
17102
17103
17104
17105
17106
17107
17108
17109
17110
17111
17112
17113
17114
17115
17116
17117
17118
17119
17120
17121
17122
17123
17124
17125
17126
17127
17128
17129
17130
17131
17132
17133
17134
17135
17136
17137
17138
17139
17140
17141
17142
17143
17144
17145
17146
17147
17148
17149
17150
17151
17152
17153
17154
17155
17156
17157
17158
17159
17160
17161
17162
17163
17164
17165
17166
17167
17168
17169
17170
17171
17172
17173
17174
17175
17176
17177
17178
17179
17180
17181
17182
17183
17184
17185
17186
17187
17188
17189
17190
17191
17192
17193
17194
17195
17196
17197
17198
17199
17200
17201
17202
17203
17204
17205
17206
17207
17208
17209
17210
17211
17212
17213
17214
17215
17216
17217
17218
17219
17220
17221
17222
17223
17224
17225
17226
17227
17228
17229
17230
17231
17232
17233
17234
17235
17236
17237
17238
17239
17240
17241
17242
17243
17244
17245
17246
17247
17248
17249
17250
17251
17252
17253
17254
17255
17256
17257
17258
17259
17260
17261
17262
17263
17264
17265
17266
17267
17268
17269
17270
17271
17272
17273
17274
17275
17276
17277
17278
17279
17280
17281
17282
17283
17284
17285
17286
17287
17288
17289
17290
17291
17292
17293
17294
17295
17296
17297
17298
17299
17300
17301
17302
17303
17304
17305
17306
17307
17308
17309
17310
17311
17312
17313
17314
17315
17316
17317
17318
17319
17320
17321
17322
17323
17324
17325
17326
17327
17328
17329
17330
17331
17332
17333
17334
17335
17336
17337
17338
17339
17340
17341
17342
17343
17344
17345
17346
17347
17348
17349
17350
17351
17352
17353
17354
17355
17356
17357
17358
17359
17360
17361
17362
17363
17364
17365
17366
17367
17368
17369
17370
17371
17372
17373
17374
17375
17376
17377
17378
17379
17380
17381
17382
17383
17384
17385
17386
17387
17388
17389
17390
17391
17392
17393
17394
17395
17396
17397
17398
17399
17400
17401
17402
17403
17404
17405
17406
17407
17408
17409
17410
17411
17412
17413
17414
17415
17416
17417
17418
17419
17420
17421
17422
17423
17424
17425
17426
17427
17428
17429
17430
17431
17432
17433
17434
17435
17436
17437
17438
17439
17440
17441
17442
17443
17444
17445
17446
17447
17448
17449
17450
17451
17452
17453
17454
17455
17456
17457
17458
17459
17460
17461
17462
17463
17464
17465
17466
17467
17468
17469
17470
17471
17472
17473
17474
17475
17476
17477
17478
17479
17480
17481
17482
17483
17484
17485
17486
17487
17488
17489
17490
17491
17492
17493
17494
17495
17496
17497
17498
17499
17500
17501
17502
17503
17504
17505
17506
17507
17508
17509
17510
17511
17512
17513
17514
17515
17516
17517
17518
17519
17520
17521
17522
17523
17524
17525
17526
17527
17528
17529
17530
17531
17532
17533
17534
17535
17536
17537
17538
17539
17540
17541
17542
17543
17544
17545
17546
17547
17548
17549
17550
17551
17552
17553
17554
17555
17556
17557
17558
17559
17560
17561
17562
17563
17564
17565
17566
17567
17568
17569
17570
17571
17572
17573
17574
17575
17576
17577
17578
17579
17580
17581
17582
17583
17584
17585
17586
17587
17588
17589
17590
17591
17592
17593
17594
17595
17596
17597
17598
17599
17600
17601
17602
17603
17604
17605
17606
17607
17608
17609
17610
17611
17612
17613
17614
17615
17616
17617
17618
17619
17620
17621
17622
17623
17624
17625
17626
17627
17628
17629
17630
17631
17632
17633
17634
17635
17636
17637
17638
17639
17640
17641
17642
17643
17644
17645
17646
17647
17648
17649
17650
17651
17652
17653
17654
17655
17656
17657
17658
17659
17660
17661
17662
17663
17664
17665
17666
17667
17668
17669
17670
17671
17672
17673
17674
17675
17676
17677
17678
17679
17680
17681
17682
17683
17684
17685
17686
17687
17688
17689
17690
17691
17692
17693
17694
17695
17696
17697
17698
17699
17700
17701
17702
17703
17704
17705
17706
17707
17708
17709
17710
17711
17712
17713
17714
17715
17716
17717
17718
17719
17720
17721
17722
17723
17724
17725
17726
17727
17728
17729
17730
17731
17732
17733
17734
17735
17736
17737
17738
17739
17740
17741
17742
17743
17744
17745
17746
17747
17748
17749
17750
17751
17752
17753
17754
17755
17756
17757
17758
17759
17760
17761
17762
17763
17764
17765
17766
17767
17768
17769
17770
17771
17772
17773
17774
17775
17776
17777
17778
17779
17780
17781
17782
17783
17784
17785
17786
17787
17788
17789
17790
17791
17792
17793
17794
17795
17796
17797
17798
17799
17800
17801
17802
17803
17804
17805
17806
17807
17808
17809
17810
17811
17812
17813
17814
17815
17816
17817
17818
17819
17820
17821
17822
17823
17824
17825
17826
17827
17828
17829
17830
17831
17832
17833
17834
17835
17836
17837
17838
17839
17840
17841
17842
17843
17844
17845
17846
17847
17848
17849
17850
17851
17852
17853
17854
17855
17856
17857
17858
17859
17860
17861
17862
17863
17864
17865
17866
17867
17868
17869
17870
17871
17872
17873
17874
17875
17876
17877
17878
17879
17880
17881
17882
17883
17884
17885
17886
17887
17888
17889
17890
17891
17892
17893
17894
17895
17896
17897
17898
17899
17900
17901
17902
17903
17904
17905
17906
17907
17908
17909
17910
17911
17912
17913
17914
17915
17916
17917
17918
17919
17920
17921
17922
17923
17924
17925
17926
17927
17928
17929
17930
17931
17932
17933
17934
17935
17936
17937
17938
17939
17940
17941
17942
17943
17944
17945
17946
17947
17948
17949
17950
17951
17952
17953
17954
17955
17956
17957
17958
17959
17960
17961
17962
17963
17964
17965
17966
17967
17968
17969
17970
17971
17972
17973
17974
17975
17976
17977
17978
17979
17980
17981
17982
17983
17984
17985
17986
17987
17988
17989
17990
17991
17992
17993
17994
17995
17996
17997
17998
17999
18000
18001
18002
18003
18004
18005
18006
18007
18008
18009
18010
18011
18012
18013
18014
18015
18016
18017
18018
18019
18020
18021
18022
18023
18024
18025
18026
18027
18028
18029
18030
18031
18032
18033
18034
18035
18036
18037
18038
18039
18040
18041
18042
18043
18044
18045
18046
18047
18048
18049
18050
18051
18052
18053
18054
18055
18056
18057
18058
18059
18060
18061
18062
18063
18064
18065
18066
18067
18068
18069
18070
18071
18072
18073
18074
18075
18076
18077
18078
18079
18080
18081
18082
18083
18084
18085
18086
18087
18088
18089
18090
18091
18092
18093
18094
18095
18096
18097
18098
18099
18100
18101
18102
18103
18104
18105
18106
18107
18108
18109
18110
18111
18112
18113
18114
18115
18116
18117
18118
18119
18120
18121
18122
18123
18124
18125
18126
18127
18128
18129
18130
18131
18132
18133
18134
18135
18136
18137
18138
18139
18140
18141
18142
18143
18144
18145
18146
18147
18148
18149
18150
18151
18152
18153
18154
18155
18156
18157
18158
18159
18160
18161
18162
18163
18164
18165
18166
18167
18168
18169
18170
18171
18172
18173
18174
18175
18176
18177
18178
18179
18180
18181
18182
18183
18184
18185
18186
18187
18188
18189
18190
18191
18192
18193
18194
18195
18196
18197
18198
18199
18200
18201
18202
18203
18204
18205
18206
18207
18208
18209
18210
18211
18212
18213
18214
18215
18216
18217
18218
18219
18220
18221
18222
18223
18224
18225
18226
18227
18228
18229
18230
18231
18232
18233
18234
18235
18236
18237
18238
18239
18240
18241
18242
18243
18244
18245
18246
18247
18248
18249
18250
18251
18252
18253
18254
18255
18256
18257
18258
18259
18260
18261
18262
18263
18264
18265
18266
18267
18268
18269
18270
18271
18272
18273
18274
18275
18276
18277
18278
18279
18280
18281
18282
18283
18284
18285
18286
18287
18288
18289
18290
18291
18292
18293
18294
18295
18296
18297
18298
18299
18300
18301
18302
18303
18304
18305
18306
18307
18308
18309
18310
18311
18312
18313
18314
18315
18316
18317
18318
18319
18320
18321
18322
18323
18324
18325
18326
18327
18328
18329
18330
18331
18332
18333
18334
18335
18336
18337
18338
18339
18340
18341
18342
18343
18344
18345
18346
18347
18348
18349
18350
18351
18352
18353
18354
18355
18356
18357
18358
18359
18360
18361
18362
18363
18364
18365
18366
18367
18368
18369
18370
18371
18372
18373
18374
18375
18376
18377
18378
18379
18380
18381
18382
18383
18384
18385
18386
18387
18388
18389
18390
18391
18392
18393
18394
18395
18396
18397
18398
18399
18400
18401
18402
18403
18404
18405
18406
18407
18408
18409
18410
18411
18412
18413
18414
18415
18416
18417
18418
18419
18420
18421
18422
18423
18424
18425
18426
18427
18428
18429
18430
18431
18432
18433
18434
18435
18436
18437
18438
18439
18440
18441
18442
18443
18444
18445
18446
18447
18448
18449
18450
18451
18452
18453
18454
18455
18456
18457
18458
18459
18460
18461
18462
18463
18464
18465
18466
18467
18468
18469
18470
18471
18472
18473
18474
18475
18476
18477
18478
18479
18480
18481
18482
18483
18484
18485
18486
18487
18488
18489
18490
18491
18492
18493
18494
18495
18496
18497
18498
18499
18500
18501
18502
18503
18504
18505
18506
18507
18508
18509
18510
18511
18512
18513
18514
18515
18516
18517
18518
18519
18520
18521
18522
18523
18524
18525
18526
18527
18528
18529
18530
18531
18532
18533
18534
18535
18536
18537
18538
18539
18540
18541
18542
18543
18544
18545
18546
18547
18548
18549
18550
18551
18552
18553
18554
18555
18556
18557
18558
18559
18560
18561
18562
18563
18564
18565
18566
18567
18568
18569
18570
18571
18572
18573
18574
18575
18576
18577
18578
18579
18580
18581
18582
18583
18584
18585
18586
18587
18588
18589
18590
18591
18592
18593
18594
18595
18596
18597
18598
18599
18600
18601
18602
18603
18604
18605
18606
18607
18608
18609
18610
18611
18612
18613
18614
18615
18616
18617
18618
18619
18620
18621
18622
18623
18624
18625
18626
18627
18628
18629
18630
18631
18632
18633
18634
18635
18636
18637
18638
18639
18640
18641
18642
18643
18644
18645
18646
18647
18648
18649
18650
18651
18652
18653
18654
18655
18656
18657
18658
18659
18660
18661
18662
18663
18664
18665
18666
18667
18668
18669
18670
18671
18672
18673
18674
18675
18676
18677
18678
18679
18680
18681
18682
18683
18684
18685
18686
18687
18688
18689
18690
18691
18692
18693
18694
18695
18696
18697
18698
18699
18700
18701
18702
18703
18704
18705
18706
18707
18708
18709
18710
18711
18712
18713
18714
18715
18716
18717
18718
18719
18720
18721
18722
18723
18724
18725
18726
18727
18728
18729
18730
18731
18732
18733
18734
18735
18736
18737
18738
18739
18740
18741
18742
18743
18744
18745
18746
18747
18748
18749
18750
18751
18752
18753
18754
18755
18756
18757
18758
18759
18760
18761
18762
18763
18764
18765
18766
18767
18768
18769
18770
18771
18772
18773
18774
18775
18776
18777
18778
18779
18780
18781
18782
18783
18784
18785
18786
18787
18788
18789
18790
18791
18792
18793
18794
18795
18796
18797
18798
18799
18800
18801
18802
18803
18804
18805
18806
18807
18808
18809
18810
18811
18812
18813
18814
18815
18816
18817
18818
18819
18820
18821
18822
18823
18824
18825
18826
18827
18828
18829
18830
18831
18832
18833
18834
18835
18836
18837
18838
18839
18840
18841
18842
18843
18844
18845
18846
18847
18848
18849
18850
18851
18852
18853
18854
18855
18856
18857
18858
18859
18860
18861
18862
18863
18864
18865
18866
18867
18868
18869
18870
18871
18872
18873
18874
18875
18876
18877
18878
18879
18880
18881
18882
18883
18884
18885
18886
18887
18888
18889
18890
18891
18892
18893
18894
18895
18896
18897
18898
18899
18900
18901
18902
18903
18904
18905
18906
18907
18908
18909
18910
18911
18912
18913
18914
18915
18916
18917
18918
18919
18920
18921
18922
18923
18924
18925
18926
18927
18928
18929
18930
18931
18932
18933
18934
18935
18936
18937
18938
18939
18940
18941
18942
18943
18944
18945
18946
18947
18948
18949
18950
18951
18952
18953
18954
18955
18956
18957
18958
18959
18960
18961
18962
18963
18964
18965
18966
18967
18968
18969
18970
18971
18972
18973
18974
18975
18976
18977
18978
18979
18980
18981
18982
18983
18984
18985
18986
18987
18988
18989
18990
18991
18992
18993
18994
18995
18996
18997
18998
18999
19000
19001
19002
19003
19004
19005
19006
19007
19008
19009
19010
19011
19012
19013
19014
19015
19016
19017
19018
19019
19020
19021
19022
19023
19024
19025
19026
19027
19028
19029
19030
19031
19032
19033
19034
19035
19036
19037
19038
19039
19040
19041
19042
19043
19044
19045
19046
19047
19048
19049
19050
19051
19052
19053
19054
19055
19056
19057
19058
19059
19060
19061
19062
19063
19064
19065
19066
19067
19068
19069
19070
19071
19072
19073
19074
19075
19076
19077
19078
19079
19080
19081
19082
19083
19084
19085
19086
19087
19088
19089
19090
19091
19092
19093
19094
19095
19096
19097
19098
19099
19100
19101
19102
19103
19104
19105
19106
19107
19108
19109
19110
19111
19112
19113
19114
19115
19116
19117
19118
19119
19120
19121
19122
19123
19124
19125
19126
19127
19128
19129
19130
19131
19132
19133
19134
19135
19136
19137
19138
19139
19140
19141
19142
19143
19144
19145
19146
19147
19148
19149
19150
19151
19152
19153
19154
19155
19156
19157
19158
19159
19160
19161
19162
19163
19164
19165
19166
19167
19168
19169
19170
19171
19172
19173
19174
19175
19176
19177
19178
19179
19180
19181
19182
19183
19184
19185
19186
19187
19188
19189
19190
19191
19192
19193
19194
19195
19196
19197
19198
19199
19200
19201
19202
19203
19204
19205
19206
19207
19208
19209
19210
19211
19212
19213
19214
19215
19216
19217
19218
19219
19220
19221
19222
19223
19224
19225
19226
19227
19228
19229
19230
19231
19232
19233
19234
19235
19236
19237
19238
19239
19240
19241
19242
19243
19244
19245
19246
19247
19248
19249
19250
19251
19252
19253
19254
19255
19256
19257
19258
19259
19260
19261
19262
19263
19264
19265
19266
19267
19268
19269
19270
19271
19272
19273
19274
19275
19276
19277
19278
19279
19280
19281
19282
19283
19284
19285
19286
19287
19288
19289
19290
19291
19292
19293
19294
19295
19296
19297
19298
19299
19300
19301
19302
19303
19304
19305
19306
19307
19308
19309
19310
19311
19312
19313
19314
19315
19316
19317
19318
19319
19320
19321
19322
19323
19324
19325
19326
19327
19328
19329
19330
19331
19332
19333
19334
19335
19336
19337
19338
19339
19340
19341
19342
19343
19344
19345
19346
19347
19348
19349
19350
19351
19352
19353
19354
19355
19356
19357
19358
19359
19360
19361
19362
19363
19364
19365
19366
19367
19368
19369
19370
19371
19372
19373
19374
19375
19376
19377
19378
19379
19380
19381
19382
19383
19384
19385
19386
19387
19388
19389
19390
19391
19392
19393
19394
19395
19396
19397
19398
19399
19400
19401
19402
19403
19404
19405
19406
19407
19408
19409
19410
19411
19412
19413
19414
19415
19416
19417
19418
19419
19420
19421
19422
19423
19424
19425
19426
19427
19428
19429
19430
19431
19432
19433
19434
19435
19436
19437
19438
19439
19440
19441
19442
19443
19444
19445
19446
19447
19448
19449
19450
19451
19452
19453
19454
19455
19456
19457
19458
19459
19460
19461
19462
19463
19464
19465
19466
19467
19468
19469
19470
19471
19472
19473
19474
19475
19476
19477
19478
19479
19480
19481
19482
19483
19484
19485
19486
19487
19488
19489
19490
19491
19492
19493
19494
19495
19496
19497
19498
19499
19500
19501
19502
19503
19504
19505
19506
19507
19508
19509
19510
19511
19512
19513
19514
19515
19516
19517
19518
19519
19520
19521
19522
19523
19524
19525
19526
19527
19528
19529
19530
19531
19532
19533
19534
19535
19536
19537
19538
19539
19540
19541
19542
19543
19544
19545
19546
19547
19548
19549
19550
19551
19552
19553
19554
19555
19556
19557
19558
19559
19560
19561
19562
19563
19564
19565
19566
19567
19568
19569
19570
19571
19572
19573
19574
19575
19576
19577
19578
19579
19580
19581
19582
19583
19584
19585
19586
19587
19588
19589
19590
19591
19592
19593
19594
19595
19596
19597
19598
19599
19600
19601
19602
19603
19604
19605
19606
19607
19608
19609
19610
19611
19612
19613
19614
19615
19616
19617
19618
19619
19620
19621
19622
19623
19624
19625
19626
19627
19628
19629
19630
19631
19632
19633
19634
19635
19636
19637
19638
19639
19640
19641
19642
19643
19644
19645
19646
19647
19648
19649
19650
19651
19652
19653
19654
19655
19656
19657
19658
19659
19660
19661
19662
19663
19664
19665
19666
19667
19668
19669
19670
19671
19672
19673
19674
19675
19676
19677
19678
19679
19680
19681
19682
19683
19684
19685
19686
19687
19688
19689
19690
19691
19692
19693
19694
19695
19696
19697
19698
19699
19700
19701
19702
19703
19704
19705
19706
19707
19708
19709
19710
19711
19712
19713
19714
19715
19716
19717
19718
19719
19720
19721
19722
19723
19724
19725
19726
19727
19728
19729
19730
19731
19732
19733
19734
19735
19736
19737
19738
19739
19740
19741
19742
19743
19744
19745
19746
19747
19748
19749
19750
19751
19752
19753
19754
19755
19756
19757
19758
19759
19760
19761
19762
19763
19764
19765
19766
19767
19768
19769
19770
19771
19772
19773
19774
19775
19776
19777
19778
19779
19780
19781
19782
19783
19784
19785
19786
19787
19788
19789
19790
19791
19792
19793
19794
19795
19796
19797
19798
19799
19800
19801
19802
19803
19804
19805
19806
19807
19808
19809
19810
19811
19812
19813
19814
19815
19816
19817
19818
19819
19820
19821
19822
19823
19824
19825
19826
19827
19828
19829
19830
19831
19832
19833
19834
19835
19836
19837
19838
19839
19840
19841
19842
19843
19844
19845
19846
19847
19848
19849
19850
19851
19852
19853
19854
19855
19856
19857
19858
19859
19860
19861
19862
19863
19864
19865
19866
19867
19868
19869
19870
19871
19872
19873
19874
19875
19876
19877
19878
19879
19880
19881
19882
19883
19884
19885
19886
19887
19888
19889
19890
19891
19892
19893
19894
19895
19896
19897
19898
19899
19900
19901
19902
19903
19904
19905
19906
19907
19908
19909
19910
19911
19912
19913
19914
19915
19916
19917
19918
19919
19920
19921
19922
19923
19924
19925
19926
19927
19928
19929
19930
19931
19932
19933
19934
19935
19936
19937
19938
19939
19940
19941
19942
19943
19944
19945
19946
19947
19948
19949
19950
19951
19952
19953
19954
19955
19956
19957
19958
19959
19960
19961
19962
19963
19964
19965
19966
19967
19968
19969
19970
19971
19972
19973
19974
19975
19976
19977
19978
19979
19980
19981
19982
19983
19984
19985
19986
19987
19988
19989
19990
19991
19992
19993
19994
19995
19996
19997
19998
19999
20000
20001
20002
20003
20004
20005
20006
20007
20008
20009
20010
20011
20012
20013
20014
20015
20016
20017
20018
20019
20020
20021
20022
20023
20024
20025
20026
20027
20028
20029
20030
20031
20032
20033
20034
20035
20036
20037
20038
20039
20040
20041
20042
20043
20044
20045
20046
20047
20048
20049
20050
20051
20052
20053
20054
20055
20056
20057
20058
20059
20060
20061
20062
20063
20064
20065
20066
20067
20068
20069
20070
20071
20072
20073
20074
20075
20076
20077
20078
20079
20080
20081
20082
20083
20084
20085
20086
20087
20088
20089
20090
20091
20092
20093
20094
20095
20096
20097
20098
20099
20100
20101
20102
20103
20104
20105
20106
20107
20108
20109
20110
20111
20112
20113
20114
20115
20116
20117
20118
20119
20120
20121
20122
20123
20124
20125
20126
20127
20128
20129
20130
20131
20132
20133
20134
20135
20136
20137
20138
20139
20140
20141
20142
20143
20144
20145
20146
20147
20148
20149
20150
20151
20152
20153
20154
20155
20156
20157
20158
20159
20160
20161
20162
20163
20164
20165
20166
20167
20168
20169
20170
20171
20172
20173
20174
20175
20176
20177
20178
20179
20180
20181
20182
20183
20184
20185
20186
20187
20188
20189
20190
20191
20192
20193
20194
20195
20196
20197
20198
20199
20200
20201
20202
20203
20204
20205
20206
20207
20208
20209
20210
20211
20212
20213
20214
20215
20216
20217
20218
20219
20220
20221
20222
20223
20224
20225
20226
20227
20228
20229
20230
20231
20232
20233
20234
20235
20236
20237
20238
20239
20240
20241
20242
20243
20244
20245
20246
20247
20248
20249
20250
20251
20252
20253
20254
20255
20256
20257
20258
20259
20260
20261
20262
20263
20264
20265
20266
20267
20268
20269
20270
20271
20272
20273
20274
20275
20276
20277
20278
20279
20280
20281
20282
20283
20284
20285
20286
20287
20288
20289
20290
20291
20292
20293
20294
20295
20296
20297
20298
20299
20300
20301
20302
20303
20304
20305
20306
20307
20308
20309
20310
20311
20312
20313
20314
20315
20316
20317
20318
20319
20320
20321
20322
20323
20324
20325
20326
20327
20328
20329
20330
20331
20332
20333
20334
20335
20336
20337
20338
20339
20340
20341
20342
20343
20344
20345
20346
20347
20348
20349
20350
20351
20352
20353
20354
20355
20356
20357
20358
20359
20360
20361
20362
20363
20364
20365
20366
20367
20368
20369
20370
20371
20372
20373
20374
20375
20376
20377
20378
20379
20380
20381
20382
20383
20384
20385
20386
20387
20388
20389
20390
20391
20392
20393
20394
20395
20396
20397
20398
20399
20400
20401
20402
20403
20404
20405
20406
20407
20408
20409
20410
20411
20412
20413
20414
20415
20416
20417
20418
20419
20420
20421
20422
20423
20424
20425
20426
20427
20428
20429
20430
20431
20432
20433
20434
20435
20436
20437
20438
20439
20440
20441
20442
20443
20444
20445
20446
20447
20448
20449
20450
20451
20452
20453
20454
20455
20456
20457
20458
20459
20460
20461
20462
20463
20464
20465
20466
20467
20468
20469
20470
20471
20472
20473
20474
20475
20476
20477
20478
20479
20480
20481
20482
20483
20484
20485
20486
20487
20488
20489
20490
20491
20492
20493
20494
20495
20496
20497
20498
20499
20500
20501
20502
20503
20504
20505
20506
20507
20508
20509
20510
20511
20512
20513
20514
20515
20516
20517
20518
20519
20520
20521
20522
20523
20524
20525
20526
20527
20528
20529
20530
20531
20532
20533
20534
20535
20536
20537
20538
20539
20540
20541
20542
20543
20544
20545
20546
20547
20548
20549
20550
20551
20552
20553
20554
20555
20556
20557
20558
20559
20560
20561
20562
20563
20564
20565
20566
20567
20568
20569
20570
20571
20572
20573
20574
20575
20576
20577
20578
20579
20580
20581
20582
20583
20584
20585
20586
20587
20588
20589
20590
20591
20592
20593
20594
20595
20596
20597
20598
20599
20600
20601
20602
20603
20604
20605
20606
20607
20608
20609
20610
20611
20612
20613
20614
20615
20616
20617
20618
20619
20620
20621
20622
20623
20624
20625
20626
20627
20628
20629
20630
20631
20632
20633
20634
20635
20636
20637
20638
20639
20640
20641
20642
20643
20644
20645
20646
20647
20648
20649
20650
20651
20652
20653
20654
20655
20656
20657
20658
20659
20660
20661
20662
20663
20664
20665
20666
20667
20668
20669
20670
20671
20672
20673
20674
20675
20676
20677
20678
20679
20680
20681
20682
20683
20684
20685
20686
20687
20688
20689
20690
20691
20692
20693
20694
20695
20696
20697
20698
20699
20700
20701
20702
20703
20704
20705
20706
20707
20708
20709
20710
20711
20712
20713
20714
20715
20716
20717
20718
20719
20720
20721
20722
20723
20724
20725
20726
20727
20728
20729
20730
20731
20732
20733
20734
20735
20736
20737
20738
20739
20740
20741
20742
20743
20744
20745
20746
20747
20748
20749
20750
20751
20752
20753
20754
20755
20756
20757
20758
20759
20760
20761
20762
20763
20764
20765
20766
20767
20768
20769
20770
20771
20772
20773
20774
20775
20776
20777
20778
20779
20780
20781
20782
20783
20784
20785
20786
20787
20788
20789
20790
20791
20792
20793
20794
20795
20796
20797
20798
20799
20800
20801
20802
20803
20804
20805
20806
20807
20808
20809
20810
20811
20812
20813
20814
20815
20816
20817
20818
20819
20820
20821
20822
20823
20824
20825
20826
20827
20828
20829
20830
20831
20832
20833
20834
20835
20836
20837
20838
20839
20840
20841
20842
20843
20844
20845
20846
20847
20848
20849
20850
20851
20852
20853
20854
20855
20856
20857
20858
20859
20860
20861
20862
20863
20864
20865
20866
20867
20868
20869
20870
20871
20872
20873
20874
20875
20876
20877
20878
20879
20880
20881
20882
20883
20884
20885
20886
20887
20888
20889
20890
20891
20892
20893
20894
20895
20896
20897
20898
20899
20900
20901
20902
20903
20904
20905
20906
20907
20908
20909
20910
20911
20912
20913
20914
20915
20916
20917
20918
20919
20920
20921
20922
20923
20924
20925
20926
20927
20928
20929
20930
20931
20932
20933
20934
20935
20936
20937
20938
20939
20940
20941
20942
20943
20944
20945
20946
20947
20948
20949
20950
20951
20952
20953
20954
20955
20956
20957
20958
20959
20960
20961
20962
20963
20964
20965
20966
20967
20968
20969
20970
20971
20972
20973
20974
20975
20976
20977
20978
20979
20980
20981
20982
20983
20984
20985
20986
20987
20988
20989
20990
20991
20992
20993
20994
20995
20996
20997
20998
20999
21000
21001
21002
21003
21004
21005
21006
21007
21008
21009
21010
21011
21012
21013
21014
21015
21016
21017
21018
21019
21020
21021
21022
21023
21024
21025
21026
21027
21028
21029
21030
21031
21032
21033
21034
21035
21036
21037
21038
21039
21040
21041
21042
21043
21044
21045
21046
21047
21048
21049
21050
21051
21052
21053
21054
21055
21056
21057
21058
21059
21060
21061
21062
21063
21064
21065
21066
21067
21068
21069
21070
21071
21072
21073
21074
21075
21076
21077
21078
21079
21080
21081
21082
21083
21084
21085
21086
21087
21088
21089
21090
21091
21092
21093
21094
21095
21096
21097
21098
21099
21100
21101
21102
21103
21104
21105
21106
21107
21108
21109
21110
21111
21112
21113
21114
21115
21116
21117
21118
21119
21120
21121
21122
21123
21124
21125
21126
21127
21128
21129
21130
21131
21132
21133
21134
21135
21136
21137
21138
21139
21140
21141
21142
21143
21144
21145
21146
21147
21148
21149
21150
21151
21152
21153
21154
21155
21156
21157
21158
21159
21160
21161
21162
21163
21164
21165
21166
21167
21168
21169
21170
21171
21172
21173
21174
21175
21176
21177
21178
21179
21180
21181
21182
21183
21184
21185
21186
21187
21188
21189
21190
21191
21192
21193
21194
21195
21196
21197
21198
21199
21200
21201
21202
21203
21204
21205
21206
21207
21208
21209
21210
21211
21212
21213
21214
21215
21216
21217
21218
21219
21220
21221
21222
21223
21224
21225
21226
21227
21228
21229
21230
21231
21232
21233
21234
21235
21236
21237
21238
21239
21240
21241
21242
21243
21244
21245
21246
21247
21248
21249
21250
21251
21252
21253
21254
21255
21256
21257
21258
21259
21260
21261
21262
21263
21264
21265
21266
21267
21268
21269
21270
21271
21272
21273
21274
21275
21276
21277
21278
21279
21280
21281
21282
21283
21284
21285
21286
21287
21288
21289
21290
21291
21292
21293
21294
21295
21296
21297
21298
21299
21300
21301
21302
21303
21304
21305
21306
21307
21308
21309
21310
21311
21312
21313
21314
21315
21316
21317
21318
21319
21320
21321
21322
21323
21324
21325
21326
21327
21328
21329
21330
21331
21332
21333
21334
21335
21336
21337
21338
21339
21340
21341
21342
21343
21344
21345
21346
21347
21348
21349
21350
21351
21352
21353
21354
21355
21356
21357
21358
21359
21360
21361
21362
21363
21364
21365
21366
21367
21368
21369
21370
21371
21372
21373
21374
21375
21376
21377
21378
21379
21380
21381
21382
21383
21384
21385
21386
21387
21388
21389
21390
21391
21392
21393
21394
21395
21396
21397
21398
21399
21400
21401
21402
21403
21404
21405
21406
21407
21408
21409
21410
21411
21412
21413
21414
21415
21416
21417
21418
21419
21420
21421
21422
21423
21424
21425
21426
21427
21428
21429
21430
21431
21432
21433
21434
21435
21436
21437
21438
21439
21440
21441
21442
21443
21444
21445
21446
21447
21448
21449
21450
21451
21452
21453
21454
21455
21456
21457
21458
21459
21460
21461
21462
21463
21464
21465
21466
21467
21468
21469
21470
21471
21472
21473
21474
21475
21476
21477
21478
21479
21480
21481
21482
21483
21484
21485
21486
21487
21488
21489
21490
21491
21492
21493
21494
21495
21496
21497
21498
21499
21500
21501
21502
21503
21504
21505
21506
21507
21508
21509
21510
21511
21512
21513
21514
21515
21516
21517
21518
21519
21520
21521
21522
21523
21524
21525
21526
21527
21528
21529
21530
21531
21532
21533
21534
21535
21536
21537
21538
21539
21540
21541
21542
21543
21544
21545
21546
21547
21548
21549
21550
21551
21552
21553
21554
21555
21556
21557
21558
21559
21560
21561
21562
21563
21564
21565
21566
21567
21568
21569
21570
21571
21572
21573
21574
21575
21576
21577
21578
21579
21580
21581
21582
21583
21584
21585
21586
21587
21588
21589
21590
21591
21592
21593
21594
21595
21596
21597
21598
21599
21600
21601
21602
21603
21604
21605
21606
21607
21608
21609
21610
21611
21612
21613
21614
21615
21616
21617
21618
21619
21620
21621
21622
21623
21624
21625
21626
21627
21628
21629
21630
21631
21632
21633
21634
21635
21636
21637
21638
21639
21640
21641
21642
21643
21644
21645
21646
21647
21648
21649
21650
21651
21652
21653
21654
21655
21656
21657
21658
21659
21660
21661
21662
21663
21664
21665
21666
21667
21668
21669
21670
21671
21672
21673
21674
21675
21676
21677
21678
21679
21680
21681
21682
21683
21684
21685
21686
21687
21688
21689
21690
21691
21692
21693
21694
21695
21696
21697
21698
21699
21700
21701
21702
21703
21704
21705
21706
21707
21708
21709
21710
21711
21712
21713
21714
21715
21716
21717
21718
21719
21720
21721
21722
21723
21724
21725
21726
21727
21728
21729
21730
21731
21732
21733
21734
21735
21736
21737
21738
21739
21740
21741
21742
21743
21744
21745
21746
21747
21748
21749
21750
21751
21752
21753
21754
21755
21756
21757
21758
21759
21760
21761
21762
21763
21764
21765
21766
21767
21768
21769
21770
21771
21772
21773
21774
21775
21776
21777
21778
21779
21780
21781
21782
21783
21784
21785
21786
21787
21788
21789
21790
21791
21792
21793
21794
21795
21796
21797
21798
21799
21800
21801
21802
21803
21804
21805
21806
21807
21808
21809
21810
21811
21812
21813
21814
21815
21816
21817
21818
21819
21820
21821
21822
21823
21824
21825
21826
21827
21828
21829
21830
21831
21832
21833
21834
21835
21836
21837
21838
21839
21840
21841
21842
21843
21844
21845
21846
21847
21848
21849
21850
21851
21852
21853
21854
21855
21856
21857
21858
21859
21860
21861
21862
21863
21864
21865
21866
21867
21868
21869
21870
21871
21872
21873
21874
21875
21876
21877
21878
21879
21880
21881
21882
21883
21884
21885
21886
21887
21888
21889
21890
21891
21892
21893
21894
21895
21896
21897
21898
21899
21900
21901
21902
21903
21904
21905
21906
21907
21908
21909
21910
21911
21912
21913
21914
21915
21916
21917
21918
21919
21920
21921
21922
21923
21924
21925
21926
21927
21928
21929
21930
21931
21932
21933
21934
21935
21936
21937
21938
21939
21940
21941
21942
21943
21944
21945
21946
21947
21948
21949
21950
21951
21952
21953
21954
21955
21956
21957
21958
21959
21960
21961
21962
21963
21964
21965
21966
21967
21968
21969
21970
21971
21972
21973
21974
21975
21976
21977
21978
21979
21980
21981
21982
21983
21984
21985
21986
21987
21988
21989
21990
21991
21992
21993
21994
21995
21996
21997
21998
21999
22000
22001
22002
22003
22004
22005
22006
22007
22008
22009
22010
22011
22012
22013
22014
22015
22016
22017
22018
22019
22020
22021
22022
22023
22024
22025
22026
22027
22028
22029
22030
22031
22032
22033
22034
22035
22036
22037
22038
22039
22040
22041
22042
22043
22044
22045
22046
22047
22048
22049
22050
22051
22052
22053
22054
22055
22056
22057
22058
22059
22060
22061
22062
22063
22064
22065
22066
22067
22068
22069
22070
22071
22072
22073
22074
22075
22076
22077
22078
22079
22080
22081
22082
22083
22084
22085
22086
22087
22088
22089
22090
22091
22092
22093
22094
22095
22096
22097
22098
22099
22100
22101
22102
22103
22104
22105
22106
22107
22108
22109
22110
22111
22112
22113
22114
22115
22116
22117
22118
22119
22120
22121
22122
22123
22124
22125
22126
22127
22128
22129
22130
22131
22132
22133
22134
22135
22136
22137
22138
22139
22140
22141
22142
22143
22144
22145
22146
22147
22148
22149
22150
22151
22152
22153
22154
22155
22156
22157
22158
22159
22160
22161
22162
22163
22164
22165
22166
22167
22168
22169
22170
22171
22172
22173
22174
22175
22176
22177
22178
22179
22180
22181
22182
22183
22184
22185
22186
22187
22188
22189
22190
22191
22192
22193
22194
22195
22196
22197
22198
22199
22200
22201
22202
22203
22204
22205
22206
22207
22208
22209
22210
22211
22212
22213
22214
22215
22216
22217
22218
22219
22220
22221
22222
22223
22224
22225
22226
22227
22228
22229
22230
22231
22232
22233
22234
22235
22236
22237
22238
22239
22240
22241
22242
22243
22244
22245
22246
22247
22248
22249
22250
22251
22252
22253
22254
22255
22256
22257
22258
22259
22260
22261
22262
22263
22264
22265
22266
22267
22268
22269
22270
22271
22272
22273
22274
22275
22276
22277
22278
22279
22280
22281
22282
22283
22284
22285
22286
22287
22288
22289
22290
22291
22292
22293
22294
22295
22296
22297
22298
22299
22300
22301
22302
22303
22304
22305
22306
22307
22308
22309
22310
22311
22312
22313
22314
22315
22316
22317
22318
22319
22320
22321
22322
22323
22324
22325
22326
22327
22328
22329
22330
22331
22332
22333
22334
22335
22336
22337
22338
22339
22340
22341
22342
22343
22344
22345
22346
22347
22348
22349
22350
22351
22352
22353
22354
22355
22356
22357
22358
22359
22360
22361
22362
22363
22364
22365
22366
22367
22368
22369
22370
22371
22372
22373
22374
22375
22376
22377
22378
22379
22380
22381
22382
22383
22384
22385
22386
22387
22388
22389
22390
22391
22392
22393
22394
22395
22396
22397
22398
22399
22400
22401
22402
22403
22404
22405
22406
22407
22408
22409
22410
22411
22412
22413
22414
22415
22416
22417
22418
22419
22420
22421
22422
22423
22424
22425
22426
22427
22428
22429
22430
22431
22432
22433
22434
22435
22436
22437
22438
22439
22440
22441
22442
22443
22444
22445
22446
22447
22448
22449
22450
22451
22452
22453
22454
22455
22456
22457
22458
22459
22460
22461
22462
22463
22464
22465
22466
22467
22468
22469
22470
22471
22472
22473
22474
22475
22476
22477
22478
22479
22480
22481
22482
22483
22484
22485
22486
22487
22488
22489
22490
22491
22492
22493
22494
22495
22496
22497
22498
22499
22500
22501
22502
22503
22504
22505
22506
22507
22508
22509
22510
22511
22512
22513
22514
22515
22516
22517
22518
22519
22520
22521
22522
22523
22524
22525
22526
22527
22528
22529
22530
22531
22532
22533
22534
22535
22536
22537
22538
22539
22540
22541
22542
22543
22544
22545
22546
22547
22548
22549
22550
22551
22552
22553
22554
22555
22556
22557
22558
22559
22560
22561
22562
22563
22564
22565
22566
22567
22568
22569
22570
22571
22572
22573
22574
22575
22576
22577
22578
22579
22580
22581
22582
22583
22584
22585
22586
22587
22588
22589
22590
22591
22592
22593
22594
22595
22596
22597
22598
22599
22600
22601
22602
22603
22604
22605
22606
22607
22608
22609
22610
22611
22612
22613
22614
22615
22616
22617
22618
22619
22620
22621
22622
22623
22624
22625
22626
22627
22628
22629
22630
22631
22632
22633
22634
22635
22636
22637
22638
22639
22640
22641
22642
22643
22644
22645
22646
22647
22648
22649
22650
22651
22652
22653
22654
22655
22656
22657
22658
22659
22660
22661
22662
22663
22664
22665
22666
22667
22668
22669
22670
22671
22672
22673
22674
22675
22676
22677
22678
22679
22680
22681
22682
22683
22684
22685
22686
22687
22688
22689
22690
22691
22692
22693
22694
22695
22696
22697
22698
22699
22700
22701
22702
22703
22704
22705
22706
22707
22708
22709
22710
22711
22712
22713
22714
22715
22716
22717
22718
22719
22720
22721
22722
22723
22724
22725
22726
22727
22728
22729
22730
22731
22732
22733
22734
22735
22736
22737
22738
22739
22740
22741
22742
22743
22744
22745
22746
22747
22748
22749
22750
22751
22752
22753
22754
22755
22756
22757
22758
22759
22760
22761
22762
22763
22764
22765
22766
22767
22768
22769
22770
22771
22772
22773
22774
22775
22776
22777
22778
22779
22780
22781
22782
22783
22784
22785
22786
22787
22788
22789
22790
22791
22792
22793
22794
22795
22796
22797
22798
22799
22800
22801
22802
22803
22804
22805
22806
22807
22808
22809
22810
22811
22812
22813
22814
22815
22816
22817
22818
22819
22820
22821
22822
22823
22824
22825
22826
22827
22828
22829
22830
22831
22832
22833
22834
22835
22836
22837
22838
22839
22840
22841
22842
22843
22844
22845
22846
22847
22848
22849
22850
22851
22852
22853
22854
22855
22856
22857
22858
22859
22860
22861
22862
22863
22864
22865
22866
22867
22868
22869
22870
22871
22872
22873
22874
22875
22876
22877
22878
22879
22880
22881
22882
22883
22884
22885
22886
22887
22888
22889
22890
22891
22892
22893
22894
22895
22896
22897
22898
22899
22900
22901
22902
22903
22904
22905
22906
22907
22908
22909
22910
22911
22912
22913
22914
22915
22916
22917
22918
22919
22920
22921
22922
22923
22924
22925
22926
22927
22928
22929
22930
22931
22932
22933
22934
22935
22936
22937
22938
22939
22940
22941
22942
22943
22944
22945
22946
22947
22948
22949
22950
22951
22952
22953
22954
22955
22956
22957
22958
22959
22960
22961
22962
22963
22964
22965
22966
22967
22968
22969
22970
22971
22972
22973
22974
22975
22976
22977
22978
22979
22980
22981
22982
22983
22984
22985
22986
22987
22988
22989
22990
22991
22992
22993
22994
22995
22996
22997
22998
22999
23000
23001
23002
23003
23004
23005
23006
23007
23008
23009
23010
23011
23012
23013
23014
23015
23016
23017
23018
23019
23020
23021
23022
23023
23024
23025
23026
23027
23028
23029
23030
23031
23032
23033
23034
23035
23036
23037
23038
23039
23040
23041
23042
23043
23044
23045
23046
23047
23048
23049
23050
23051
23052
23053
23054
23055
23056
23057
23058
23059
23060
23061
23062
23063
23064
23065
23066
23067
23068
23069
23070
23071
23072
23073
23074
23075
23076
23077
23078
23079
23080
23081
23082
23083
23084
23085
23086
23087
23088
23089
23090
23091
23092
23093
23094
23095
23096
23097
23098
23099
23100
23101
23102
23103
23104
23105
23106
23107
23108
23109
23110
23111
23112
23113
23114
23115
23116
23117
23118
23119
23120
23121
23122
23123
23124
23125
23126
23127
23128
23129
23130
23131
23132
23133
23134
23135
23136
23137
23138
23139
23140
23141
23142
23143
23144
23145
23146
23147
23148
23149
23150
23151
23152
23153
23154
23155
23156
23157
23158
23159
23160
23161
23162
23163
23164
23165
23166
23167
23168
23169
23170
23171
23172
23173
23174
23175
23176
23177
23178
23179
23180
23181
23182
23183
23184
23185
23186
23187
23188
23189
23190
23191
23192
23193
23194
23195
23196
23197
23198
23199
23200
23201
23202
23203
23204
23205
23206
23207
23208
23209
23210
23211
23212
23213
23214
23215
23216
23217
23218
23219
23220
23221
23222
23223
23224
23225
23226
23227
23228
23229
23230
23231
23232
23233
23234
23235
23236
23237
23238
23239
23240
23241
23242
23243
23244
23245
23246
23247
23248
23249
23250
23251
23252
23253
23254
23255
23256
23257
23258
23259
23260
23261
23262
23263
23264
23265
23266
23267
23268
23269
23270
23271
23272
23273
23274
23275
23276
23277
23278
23279
23280
23281
23282
23283
23284
23285
23286
23287
23288
23289
23290
23291
23292
23293
23294
23295
23296
23297
23298
23299
23300
23301
23302
23303
23304
23305
23306
23307
23308
23309
23310
23311
23312
23313
23314
23315
23316
23317
23318
23319
23320
23321
23322
23323
23324
23325
23326
23327
23328
23329
23330
23331
23332
23333
23334
23335
23336
23337
23338
23339
23340
23341
23342
23343
23344
23345
23346
23347
23348
23349
23350
23351
23352
23353
23354
23355
23356
23357
23358
23359
23360
23361
23362
23363
23364
23365
23366
23367
23368
23369
23370
23371
23372
23373
23374
23375
23376
23377
23378
23379
23380
23381
23382
23383
23384
23385
23386
23387
23388
23389
23390
23391
23392
23393
23394
23395
23396
23397
23398
23399
23400
23401
23402
23403
23404
23405
23406
23407
23408
23409
23410
23411
23412
23413
23414
23415
23416
23417
23418
23419
23420
23421
23422
23423
23424
23425
23426
23427
23428
23429
23430
23431
23432
23433
23434
23435
23436
23437
23438
23439
23440
23441
23442
23443
23444
23445
23446
23447
23448
23449
23450
23451
23452
23453
23454
23455
23456
23457
23458
23459
23460
23461
23462
23463
23464
23465
23466
23467
23468
23469
23470
23471
23472
23473
23474
23475
23476
23477
23478
23479
23480
23481
23482
23483
23484
23485
23486
23487
23488
23489
23490
23491
23492
23493
23494
23495
23496
23497
23498
23499
23500
23501
23502
23503
23504
23505
23506
23507
23508
23509
23510
23511
23512
23513
23514
23515
23516
23517
23518
23519
23520
23521
23522
23523
23524
23525
23526
23527
23528
23529
23530
23531
23532
23533
23534
23535
23536
23537
23538
23539
23540
23541
23542
23543
23544
23545
23546
23547
23548
23549
23550
23551
23552
23553
23554
23555
23556
23557
23558
23559
23560
23561
23562
23563
23564
23565
23566
23567
23568
23569
23570
23571
23572
23573
23574
23575
23576
23577
23578
23579
23580
23581
23582
23583
23584
23585
23586
23587
23588
23589
23590
23591
23592
23593
23594
23595
23596
23597
23598
23599
23600
23601
23602
23603
23604
23605
23606
23607
23608
23609
23610
23611
23612
23613
23614
23615
23616
23617
23618
23619
23620
23621
23622
23623
23624
23625
23626
23627
23628
23629
23630
23631
23632
23633
23634
23635
23636
23637
23638
23639
23640
23641
23642
23643
23644
23645
23646
23647
23648
23649
23650
23651
23652
23653
23654
23655
23656
23657
23658
23659
23660
23661
23662
23663
23664
23665
23666
23667
23668
23669
23670
23671
23672
23673
23674
23675
23676
23677
23678
23679
23680
23681
23682
23683
23684
23685
23686
23687
23688
23689
23690
23691
23692
23693
23694
23695
23696
23697
23698
23699
23700
23701
23702
23703
23704
23705
23706
23707
23708
23709
23710
23711
23712
23713
23714
23715
23716
23717
23718
23719
23720
23721
23722
23723
23724
23725
23726
23727
23728
23729
23730
23731
23732
23733
23734
23735
23736
23737
23738
23739
23740
23741
23742
23743
23744
23745
23746
23747
23748
23749
23750
23751
23752
23753
23754
23755
23756
23757
23758
23759
23760
23761
23762
23763
23764
23765
23766
23767
23768
23769
23770
23771
23772
23773
23774
23775
23776
23777
23778
23779
23780
23781
23782
23783
23784
23785
23786
23787
23788
23789
23790
23791
23792
23793
23794
23795
23796
23797
23798
23799
23800
23801
23802
23803
23804
23805
23806
23807
23808
23809
23810
23811
23812
23813
23814
23815
23816
23817
23818
23819
23820
23821
23822
23823
23824
23825
23826
23827
23828
23829
23830
23831
23832
23833
23834
23835
23836
23837
23838
23839
23840
23841
23842
23843
23844
23845
23846
23847
23848
23849
23850
23851
23852
23853
23854
23855
23856
23857
23858
23859
23860
23861
23862
23863
23864
23865
23866
23867
23868
23869
23870
23871
23872
23873
23874
23875
23876
23877
23878
23879
23880
23881
23882
23883
23884
23885
23886
23887
23888
23889
23890
23891
23892
23893
23894
23895
23896
23897
23898
23899
23900
23901
23902
23903
23904
23905
23906
23907
23908
23909
23910
23911
23912
23913
23914
23915
23916
23917
23918
23919
23920
23921
23922
23923
23924
23925
23926
23927
23928
23929
23930
23931
23932
23933
23934
23935
23936
23937
23938
23939
23940
23941
23942
23943
23944
23945
23946
23947
23948
23949
23950
23951
23952
23953
23954
23955
23956
23957
23958
23959
23960
23961
23962
23963
23964
23965
23966
23967
23968
23969
23970
23971
23972
23973
23974
23975
23976
23977
23978
23979
23980
23981
23982
23983
23984
23985
23986
23987
23988
23989
23990
23991
23992
23993
23994
23995
23996
23997
23998
23999
24000
24001
24002
24003
24004
24005
24006
24007
24008
24009
24010
24011
24012
24013
24014
24015
24016
24017
24018
24019
24020
24021
24022
24023
24024
24025
24026
24027
24028
24029
24030
24031
24032
24033
24034
24035
24036
24037
24038
24039
24040
24041
24042
24043
24044
24045
24046
24047
24048
24049
24050
24051
24052
24053
24054
24055
24056
24057
24058
24059
24060
24061
24062
24063
24064
24065
24066
24067
24068
24069
24070
24071
24072
24073
24074
24075
24076
24077
24078
24079
24080
24081
24082
24083
24084
24085
24086
24087
24088
24089
24090
24091
24092
24093
24094
24095
24096
24097
24098
24099
24100
24101
24102
24103
24104
24105
24106
24107
24108
24109
24110
24111
24112
24113
24114
24115
24116
24117
24118
24119
24120
24121
24122
24123
24124
24125
24126
24127
24128
24129
24130
24131
24132
24133
24134
24135
24136
24137
24138
24139
24140
24141
24142
24143
24144
24145
24146
24147
24148
24149
24150
24151
24152
24153
24154
24155
24156
24157
24158
24159
24160
24161
24162
24163
24164
24165
24166
24167
24168
24169
24170
24171
24172
24173
24174
24175
24176
24177
24178
24179
24180
24181
24182
24183
24184
24185
24186
24187
24188
24189
24190
24191
24192
24193
24194
24195
24196
24197
24198
24199
24200
24201
24202
24203
24204
24205
24206
24207
24208
24209
24210
24211
24212
24213
24214
24215
24216
24217
24218
24219
24220
24221
24222
24223
24224
24225
24226
24227
24228
24229
24230
24231
24232
24233
24234
24235
24236
24237
24238
24239
24240
24241
24242
24243
24244
24245
24246
24247
24248
24249
24250
24251
24252
24253
24254
24255
24256
24257
24258
24259
24260
24261
24262
24263
24264
24265
24266
24267
24268
24269
24270
24271
24272
24273
24274
24275
24276
24277
24278
24279
24280
24281
24282
24283
24284
24285
24286
24287
24288
24289
24290
24291
24292
24293
24294
24295
24296
24297
24298
24299
24300
24301
24302
24303
24304
24305
24306
24307
24308
24309
24310
24311
24312
24313
24314
24315
24316
24317
24318
24319
24320
24321
24322
24323
24324
24325
24326
24327
24328
24329
24330
24331
24332
24333
24334
24335
24336
24337
24338
24339
24340
24341
24342
24343
24344
24345
24346
24347
24348
24349
24350
24351
24352
24353
24354
24355
24356
24357
24358
24359
24360
24361
24362
24363
24364
24365
24366
24367
24368
24369
24370
24371
24372
24373
24374
24375
24376
24377
24378
24379
24380
24381
24382
24383
24384
24385
24386
24387
24388
24389
24390
24391
24392
24393
24394
24395
24396
24397
24398
24399
24400
24401
24402
24403
24404
24405
24406
24407
24408
24409
24410
24411
24412
24413
24414
24415
24416
24417
24418
24419
24420
24421
24422
24423
24424
24425
24426
24427
24428
24429
24430
24431
24432
24433
24434
24435
24436
24437
24438
24439
24440
24441
24442
24443
24444
24445
24446
24447
24448
24449
24450
24451
24452
24453
24454
24455
24456
24457
24458
24459
24460
24461
24462
24463
24464
24465
24466
24467
24468
24469
24470
24471
24472
24473
24474
24475
24476
24477
24478
24479
24480
24481
24482
24483
24484
24485
24486
24487
24488
24489
24490
24491
24492
24493
24494
24495
24496
24497
24498
24499
24500
24501
24502
24503
24504
24505
24506
24507
24508
24509
24510
24511
24512
24513
24514
24515
24516
24517
24518
24519
24520
24521
24522
24523
24524
24525
24526
24527
24528
24529
24530
24531
24532
24533
24534
24535
24536
24537
24538
24539
24540
24541
24542
24543
24544
24545
24546
24547
24548
24549
24550
24551
24552
24553
24554
24555
24556
24557
24558
24559
24560
24561
24562
24563
24564
24565
24566
24567
24568
24569
24570
24571
24572
24573
24574
24575
24576
24577
24578
24579
24580
24581
24582
24583
24584
24585
24586
24587
24588
24589
24590
24591
24592
24593
24594
24595
24596
24597
24598
24599
24600
24601
24602
24603
24604
24605
24606
24607
24608
24609
24610
24611
24612
24613
24614
24615
24616
24617
24618
24619
24620
24621
24622
24623
24624
24625
24626
24627
24628
24629
24630
24631
24632
24633
24634
24635
24636
24637
24638
24639
24640
24641
24642
24643
24644
24645
24646
24647
24648
24649
24650
24651
24652
24653
24654
24655
24656
24657
24658
24659
24660
24661
24662
24663
24664
24665
24666
24667
24668
24669
24670
24671
24672
24673
24674
24675
24676
24677
24678
24679
24680
24681
24682
24683
24684
24685
24686
24687
24688
24689
24690
24691
24692
24693
24694
24695
24696
24697
24698
24699
24700
24701
24702
24703
24704
24705
24706
24707
24708
24709
24710
24711
24712
24713
24714
24715
24716
24717
24718
24719
24720
24721
24722
24723
24724
24725
24726
24727
24728
24729
24730
24731
24732
24733
24734
24735
24736
24737
24738
24739
24740
24741
24742
24743
24744
24745
24746
24747
24748
24749
24750
24751
24752
24753
24754
24755
24756
24757
24758
24759
24760
24761
24762
24763
24764
24765
24766
24767
24768
24769
24770
24771
24772
24773
24774
24775
24776
24777
24778
24779
24780
24781
24782
24783
24784
24785
24786
24787
24788
24789
24790
24791
24792
24793
24794
24795
24796
24797
24798
24799
24800
24801
24802
24803
24804
24805
24806
24807
24808
24809
24810
24811
24812
24813
24814
24815
24816
24817
24818
24819
24820
24821
24822
24823
24824
24825
24826
24827
24828
24829
24830
24831
24832
24833
24834
24835
24836
24837
24838
24839
24840
24841
24842
24843
24844
24845
24846
24847
24848
24849
24850
24851
24852
24853
24854
24855
24856
24857
24858
24859
24860
24861
24862
24863
24864
24865
24866
24867
24868
24869
24870
24871
24872
24873
24874
24875
24876
24877
24878
24879
24880
24881
24882
24883
24884
24885
24886
24887
24888
24889
24890
24891
24892
24893
24894
24895
24896
24897
24898
24899
24900
24901
24902
24903
24904
24905
24906
24907
24908
24909
24910
24911
24912
24913
24914
24915
24916
24917
24918
24919
24920
24921
24922
24923
24924
24925
24926
24927
24928
24929
24930
24931
24932
24933
24934
24935
24936
24937
24938
24939
24940
24941
24942
24943
24944
24945
24946
24947
24948
24949
24950
24951
24952
24953
24954
24955
24956
24957
24958
24959
24960
24961
24962
24963
24964
24965
24966
24967
24968
24969
24970
24971
24972
24973
24974
24975
24976
24977
24978
24979
24980
24981
24982
24983
24984
24985
24986
24987
24988
24989
24990
24991
24992
24993
24994
24995
24996
24997
24998
24999
25000
25001
25002
25003
25004
25005
25006
25007
25008
25009
25010
25011
25012
25013
25014
25015
25016
25017
25018
25019
25020
25021
25022
25023
25024
25025
25026
25027
25028
25029
25030
25031
25032
25033
25034
25035
25036
25037
25038
25039
25040
25041
25042
25043
25044
25045
25046
25047
25048
25049
25050
25051
25052
25053
25054
25055
25056
25057
25058
25059
25060
25061
25062
25063
25064
25065
25066
25067
25068
25069
25070
25071
25072
25073
25074
25075
25076
25077
25078
25079
25080
25081
25082
25083
25084
25085
25086
25087
25088
25089
25090
25091
25092
25093
25094
25095
25096
25097
25098
25099
25100
25101
25102
25103
25104
25105
25106
25107
25108
25109
25110
25111
25112
25113
25114
25115
25116
25117
25118
25119
25120
25121
25122
25123
25124
25125
25126
25127
25128
25129
25130
25131
25132
25133
25134
25135
25136
25137
25138
25139
25140
25141
25142
25143
25144
25145
25146
25147
25148
25149
25150
25151
25152
25153
25154
25155
25156
25157
25158
25159
25160
25161
25162
25163
25164
25165
25166
25167
25168
25169
25170
25171
25172
25173
25174
25175
25176
25177
25178
25179
25180
25181
25182
25183
25184
25185
25186
25187
25188
25189
25190
25191
25192
25193
25194
25195
25196
25197
25198
25199
25200
25201
25202
25203
25204
25205
25206
25207
25208
25209
25210
25211
25212
25213
25214
25215
25216
25217
25218
25219
25220
25221
25222
25223
25224
25225
25226
25227
25228
25229
25230
25231
25232
25233
25234
25235
25236
25237
25238
25239
25240
25241
25242
25243
25244
25245
25246
25247
25248
25249
25250
25251
25252
25253
25254
25255
25256
25257
25258
25259
25260
25261
25262
25263
25264
25265
25266
25267
25268
25269
25270
25271
25272
25273
25274
25275
25276
25277
25278
25279
25280
25281
25282
25283
25284
25285
25286
25287
25288
25289
25290
25291
25292
25293
25294
25295
25296
25297
25298
25299
25300
25301
25302
25303
25304
25305
25306
25307
25308
25309
25310
25311
25312
25313
25314
25315
25316
25317
25318
25319
25320
25321
25322
25323
25324
25325
25326
25327
25328
25329
25330
25331
25332
25333
25334
25335
25336
25337
25338
25339
25340
25341
25342
25343
25344
25345
25346
25347
25348
25349
25350
25351
25352
25353
25354
25355
25356
25357
25358
25359
25360
25361
25362
25363
25364
25365
25366
25367
25368
25369
25370
25371
25372
25373
25374
25375
25376
25377
25378
25379
25380
25381
25382
25383
25384
25385
25386
25387
25388
25389
25390
25391
25392
25393
25394
25395
25396
25397
25398
25399
25400
25401
25402
25403
25404
25405
25406
25407
25408
25409
25410
25411
25412
25413
25414
25415
25416
25417
25418
25419
25420
25421
25422
25423
25424
25425
25426
25427
25428
25429
25430
25431
25432
25433
25434
25435
25436
25437
25438
25439
25440
25441
25442
25443
25444
25445
25446
25447
25448
25449
25450
25451
25452
25453
25454
25455
25456
25457
25458
25459
25460
25461
25462
25463
25464
25465
25466
25467
25468
25469
25470
25471
25472
25473
25474
25475
25476
25477
25478
25479
25480
25481
25482
25483
25484
25485
25486
25487
25488
25489
25490
25491
25492
25493
25494
25495
25496
25497
25498
25499
25500
25501
25502
25503
25504
25505
25506
25507
25508
25509
25510
25511
25512
25513
25514
25515
25516
25517
25518
25519
25520
25521
25522
25523
25524
25525
25526
25527
25528
25529
25530
25531
25532
25533
25534
25535
25536
25537
25538
25539
25540
25541
25542
25543
25544
25545
25546
25547
25548
25549
25550
25551
25552
25553
25554
25555
25556
25557
25558
25559
25560
25561
25562
25563
25564
25565
25566
25567
25568
25569
25570
25571
25572
25573
25574
25575
25576
25577
25578
25579
25580
25581
25582
25583
25584
25585
25586
25587
25588
25589
25590
25591
25592
25593
25594
25595
25596
25597
25598
25599
25600
25601
25602
25603
25604
25605
25606
25607
25608
25609
25610
25611
25612
25613
25614
25615
25616
25617
25618
25619
25620
25621
25622
25623
25624
25625
25626
25627
25628
25629
25630
25631
25632
25633
25634
25635
25636
25637
25638
25639
25640
25641
25642
25643
25644
25645
25646
25647
25648
25649
25650
25651
25652
25653
25654
25655
25656
25657
25658
25659
25660
25661
25662
25663
25664
25665
25666
25667
25668
25669
25670
25671
25672
25673
25674
25675
25676
25677
25678
25679
25680
25681
25682
25683
25684
25685
25686
25687
25688
25689
25690
25691
25692
25693
25694
25695
25696
25697
25698
25699
25700
25701
25702
25703
25704
25705
25706
25707
25708
25709
25710
25711
25712
25713
25714
25715
25716
25717
25718
25719
25720
25721
25722
25723
25724
25725
25726
25727
25728
25729
25730
25731
25732
25733
25734
25735
25736
25737
25738
25739
25740
25741
25742
25743
25744
25745
25746
25747
25748
25749
25750
25751
25752
25753
25754
25755
25756
25757
25758
25759
25760
25761
25762
25763
25764
25765
25766
25767
25768
25769
25770
25771
25772
25773
25774
25775
25776
25777
25778
25779
25780
25781
25782
25783
25784
25785
25786
25787
25788
25789
25790
25791
25792
25793
25794
25795
25796
25797
25798
25799
25800
25801
25802
25803
25804
25805
25806
25807
25808
25809
25810
25811
25812
25813
25814
25815
25816
25817
25818
25819
25820
25821
25822
25823
25824
25825
25826
25827
25828
25829
25830
25831
25832
25833
25834
25835
25836
25837
25838
25839
25840
25841
25842
25843
25844
25845
25846
25847
25848
25849
25850
25851
25852
25853
25854
25855
25856
25857
25858
25859
25860
25861
25862
25863
25864
25865
25866
25867
25868
25869
25870
25871
25872
25873
25874
25875
25876
25877
25878
25879
25880
25881
25882
25883
25884
25885
25886
25887
25888
25889
25890
25891
25892
25893
25894
25895
25896
25897
25898
25899
25900
25901
25902
25903
25904
25905
25906
25907
25908
25909
25910
25911
25912
25913
25914
25915
25916
25917
25918
25919
25920
25921
25922
25923
25924
25925
25926
25927
25928
25929
25930
25931
25932
25933
25934
25935
25936
25937
25938
25939
25940
25941
25942
25943
25944
25945
25946
25947
25948
25949
25950
25951
25952
25953
25954
25955
25956
25957
25958
25959
25960
25961
25962
25963
25964
25965
25966
25967
25968
25969
25970
25971
25972
25973
25974
25975
25976
25977
25978
25979
25980
25981
25982
25983
25984
25985
25986
25987
25988
25989
25990
25991
25992
25993
25994
25995
25996
25997
25998
25999
26000
26001
26002
26003
26004
26005
26006
26007
26008
26009
26010
26011
26012
26013
26014
26015
26016
26017
26018
26019
26020
26021
26022
26023
26024
26025
26026
26027
26028
26029
26030
26031
26032
26033
26034
26035
26036
26037
26038
26039
26040
26041
26042
26043
26044
26045
26046
26047
26048
26049
26050
26051
26052
26053
26054
26055
26056
26057
26058
26059
26060
26061
26062
26063
26064
26065
26066
26067
26068
26069
26070
26071
26072
26073
26074
26075
26076
26077
26078
26079
26080
26081
26082
26083
26084
26085
26086
26087
26088
26089
26090
26091
26092
26093
26094
26095
26096
26097
26098
26099
26100
26101
26102
26103
26104
26105
26106
26107
26108
26109
26110
26111
26112
26113
26114
26115
26116
26117
26118
26119
26120
26121
26122
26123
26124
26125
26126
26127
26128
26129
26130
26131
26132
26133
26134
26135
26136
26137
26138
26139
26140
26141
26142
26143
26144
26145
26146
26147
26148
26149
26150
26151
26152
26153
26154
26155
26156
26157
26158
26159
26160
26161
26162
26163
26164
26165
26166
26167
26168
26169
26170
26171
26172
26173
26174
26175
26176
26177
26178
26179
26180
26181
26182
26183
26184
26185
26186
26187
26188
26189
26190
26191
26192
26193
26194
26195
26196
26197
26198
26199
26200
26201
26202
26203
26204
26205
26206
26207
26208
26209
26210
26211
26212
26213
26214
26215
26216
26217
26218
26219
26220
26221
26222
26223
26224
26225
26226
26227
26228
26229
26230
26231
26232
26233
26234
26235
26236
26237
26238
26239
26240
26241
26242
26243
26244
26245
26246
26247
26248
26249
26250
26251
26252
26253
26254
26255
26256
26257
26258
26259
26260
26261
26262
26263
26264
26265
26266
26267
26268
26269
26270
26271
26272
26273
26274
26275
26276
26277
26278
26279
26280
26281
26282
26283
26284
26285
26286
26287
26288
26289
26290
26291
26292
26293
26294
26295
26296
26297
26298
26299
26300
26301
26302
26303
26304
26305
26306
26307
26308
26309
26310
26311
26312
26313
26314
26315
26316
26317
26318
26319
26320
26321
26322
26323
26324
26325
26326
26327
26328
26329
26330
26331
26332
26333
26334
26335
26336
26337
26338
26339
26340
26341
26342
26343
26344
26345
26346
26347
26348
26349
26350
26351
26352
26353
26354
26355
26356
26357
26358
26359
26360
26361
26362
26363
26364
26365
26366
26367
26368
26369
26370
26371
26372
26373
26374
26375
26376
26377
26378
26379
26380
26381
26382
26383
26384
26385
26386
26387
26388
26389
26390
26391
26392
26393
26394
26395
26396
26397
26398
26399
26400
26401
26402
26403
26404
26405
26406
26407
26408
26409
26410
26411
26412
26413
26414
26415
26416
26417
26418
26419
26420
26421
26422
26423
26424
26425
26426
26427
26428
26429
26430
26431
26432
26433
26434
26435
26436
26437
26438
26439
26440
26441
26442
26443
26444
26445
26446
26447
26448
26449
26450
26451
26452
26453
26454
26455
26456
26457
26458
26459
26460
26461
26462
26463
26464
26465
26466
26467
26468
26469
26470
26471
26472
26473
26474
26475
26476
26477
26478
26479
26480
26481
26482
26483
26484
26485
26486
26487
26488
26489
26490
26491
26492
26493
26494
26495
26496
26497
26498
26499
26500
26501
26502
26503
26504
26505
26506
26507
26508
26509
26510
26511
26512
26513
26514
26515
26516
26517
26518
26519
26520
26521
26522
26523
26524
26525
26526
26527
26528
26529
26530
26531
26532
26533
26534
26535
26536
26537
26538
26539
26540
26541
26542
26543
26544
26545
26546
26547
26548
26549
26550
26551
26552
26553
26554
26555
26556
26557
26558
26559
26560
26561
26562
26563
26564
26565
26566
26567
26568
26569
26570
26571
26572
26573
26574
26575
26576
26577
26578
26579
26580
26581
26582
26583
26584
26585
26586
26587
26588
26589
26590
26591
26592
26593
26594
26595
26596
26597
26598
26599
26600
26601
26602
26603
26604
26605
26606
26607
26608
26609
26610
26611
26612
26613
26614
26615
26616
26617
26618
26619
26620
26621
26622
26623
26624
26625
26626
26627
26628
26629
26630
26631
26632
26633
26634
26635
26636
26637
26638
26639
26640
26641
26642
26643
26644
26645
26646
26647
26648
26649
26650
26651
26652
26653
26654
26655
26656
26657
26658
26659
26660
26661
26662
26663
26664
26665
26666
26667
26668
26669
26670
26671
26672
26673
26674
26675
26676
26677
26678
26679
26680
26681
26682
26683
26684
26685
26686
26687
26688
26689
26690
26691
26692
26693
26694
26695
26696
26697
26698
26699
26700
26701
26702
26703
26704
26705
26706
26707
26708
26709
26710
26711
26712
26713
26714
26715
26716
26717
26718
26719
26720
26721
26722
26723
26724
26725
26726
26727
26728
26729
26730
26731
26732
26733
26734
26735
26736
26737
26738
26739
26740
26741
26742
26743
26744
26745
26746
26747
26748
26749
26750
26751
26752
26753
26754
26755
26756
26757
26758
26759
26760
26761
26762
26763
26764
26765
26766
26767
26768
26769
26770
26771
26772
26773
26774
26775
26776
26777
26778
26779
26780
26781
26782
26783
26784
26785
26786
26787
26788
26789
26790
26791
26792
26793
26794
26795
26796
26797
26798
26799
26800
26801
26802
26803
26804
26805
26806
26807
26808
26809
26810
26811
26812
26813
26814
26815
26816
26817
26818
26819
26820
26821
26822
26823
26824
26825
26826
26827
26828
26829
26830
26831
26832
26833
26834
26835
26836
26837
26838
26839
26840
26841
26842
26843
26844
26845
26846
26847
26848
26849
26850
26851
26852
26853
26854
26855
26856
26857
26858
26859
26860
26861
26862
26863
26864
26865
26866
26867
26868
26869
26870
26871
26872
26873
26874
26875
26876
26877
26878
26879
26880
26881
26882
26883
26884
26885
26886
26887
26888
26889
26890
26891
26892
26893
26894
26895
26896
26897
26898
26899
26900
26901
26902
26903
26904
26905
26906
26907
26908
26909
26910
26911
26912
26913
26914
26915
26916
26917
26918
26919
26920
26921
26922
26923
26924
26925
26926
26927
26928
26929
26930
26931
26932
26933
26934
26935
26936
26937
26938
26939
26940
26941
26942
26943
26944
26945
26946
26947
26948
26949
26950
26951
26952
26953
26954
26955
26956
26957
26958
26959
26960
26961
26962
26963
26964
26965
26966
26967
26968
26969
26970
26971
26972
26973
26974
26975
26976
26977
26978
26979
26980
26981
26982
26983
26984
26985
26986
26987
26988
26989
26990
26991
26992
26993
26994
26995
26996
26997
26998
26999
27000
27001
27002
27003
27004
27005
27006
27007
27008
27009
27010
27011
27012
27013
27014
27015
27016
27017
27018
27019
27020
27021
27022
27023
27024
27025
27026
27027
27028
27029
27030
27031
27032
27033
27034
27035
27036
27037
27038
27039
27040
27041
27042
27043
27044
27045
27046
27047
27048
27049
27050
27051
27052
27053
27054
27055
27056
27057
27058
27059
27060
27061
27062
27063
27064
27065
27066
27067
27068
27069
27070
27071
27072
27073
27074
27075
27076
27077
27078
27079
27080
27081
27082
27083
27084
27085
27086
27087
27088
27089
27090
27091
27092
27093
27094
27095
27096
27097
27098
27099
27100
27101
27102
27103
27104
27105
27106
27107
27108
27109
27110
27111
27112
27113
27114
27115
27116
27117
27118
27119
27120
27121
27122
27123
27124
27125
27126
27127
27128
27129
27130
27131
27132
27133
27134
27135
27136
27137
27138
27139
27140
27141
27142
27143
27144
27145
27146
27147
27148
27149
27150
27151
27152
27153
27154
27155
27156
27157
27158
27159
27160
27161
27162
27163
27164
27165
27166
27167
27168
27169
27170
27171
27172
27173
27174
27175
27176
27177
27178
27179
27180
27181
27182
27183
27184
27185
27186
27187
27188
27189
27190
27191
27192
27193
27194
27195
27196
27197
27198
27199
27200
27201
27202
27203
27204
27205
27206
27207
27208
27209
27210
27211
27212
27213
27214
27215
27216
27217
27218
27219
27220
27221
27222
27223
27224
27225
27226
27227
27228
27229
27230
27231
27232
27233
27234
27235
27236
27237
27238
27239
27240
27241
27242
27243
27244
27245
27246
27247
27248
27249
27250
27251
27252
27253
27254
27255
27256
27257
27258
27259
27260
27261
27262
27263
27264
27265
27266
27267
27268
27269
27270
27271
27272
27273
27274
27275
27276
27277
27278
27279
27280
27281
27282
27283
27284
27285
27286
27287
27288
27289
27290
27291
27292
27293
27294
27295
27296
27297
27298
27299
27300
27301
27302
27303
27304
27305
27306
27307
27308
27309
27310
27311
27312
27313
27314
27315
27316
27317
27318
27319
27320
27321
27322
27323
27324
27325
27326
27327
27328
27329
27330
27331
27332
27333
27334
27335
27336
27337
27338
27339
27340
27341
27342
27343
27344
27345
27346
27347
27348
27349
27350
27351
27352
27353
27354
27355
27356
27357
27358
27359
27360
27361
27362
27363
27364
27365
27366
27367
27368
27369
27370
27371
27372
27373
27374
27375
27376
27377
27378
27379
27380
27381
27382
27383
27384
27385
27386
27387
27388
27389
27390
27391
27392
27393
27394
27395
27396
27397
27398
27399
27400
27401
27402
27403
27404
27405
27406
27407
27408
27409
27410
27411
27412
27413
27414
27415
27416
27417
27418
27419
27420
27421
27422
27423
27424
27425
27426
27427
27428
27429
27430
27431
27432
27433
27434
27435
27436
27437
27438
27439
27440
27441
27442
27443
27444
27445
27446
27447
27448
27449
27450
27451
27452
27453
27454
27455
27456
27457
27458
27459
27460
27461
27462
27463
27464
27465
27466
27467
27468
27469
27470
27471
27472
27473
27474
27475
27476
27477
27478
27479
27480
27481
27482
27483
27484
27485
27486
27487
27488
27489
27490
27491
27492
27493
27494
27495
27496
27497
27498
27499
27500
27501
27502
27503
27504
27505
27506
27507
27508
27509
27510
27511
27512
27513
27514
27515
27516
27517
27518
27519
27520
27521
27522
27523
27524
27525
27526
27527
27528
27529
27530
27531
27532
27533
27534
27535
27536
27537
27538
27539
27540
27541
27542
27543
27544
27545
27546
27547
27548
27549
27550
27551
27552
27553
27554
27555
27556
27557
27558
27559
27560
27561
27562
27563
27564
27565
27566
27567
27568
27569
27570
27571
27572
27573
27574
27575
27576
27577
27578
27579
27580
27581
27582
27583
27584
27585
27586
27587
27588
27589
27590
27591
27592
27593
27594
27595
27596
27597
27598
27599
27600
27601
27602
27603
27604
27605
27606
27607
27608
27609
27610
27611
27612
27613
27614
27615
27616
27617
27618
27619
27620
27621
27622
27623
27624
27625
27626
27627
27628
27629
27630
27631
27632
27633
27634
27635
27636
27637
27638
27639
27640
27641
27642
27643
27644
27645
27646
27647
27648
27649
27650
27651
27652
27653
27654
27655
27656
27657
27658
27659
27660
27661
27662
27663
27664
27665
27666
27667
27668
27669
27670
27671
27672
27673
27674
27675
27676
27677
27678
27679
27680
27681
27682
27683
27684
27685
27686
27687
27688
27689
27690
27691
27692
27693
27694
27695
27696
27697
27698
27699
27700
27701
27702
27703
27704
27705
27706
27707
27708
27709
27710
27711
27712
27713
27714
27715
27716
27717
27718
27719
27720
27721
27722
27723
27724
27725
27726
27727
27728
27729
27730
27731
27732
27733
27734
27735
27736
27737
27738
27739
27740
27741
27742
27743
27744
27745
27746
27747
27748
27749
27750
27751
27752
27753
27754
27755
27756
27757
27758
27759
27760
27761
27762
27763
27764
27765
27766
27767
27768
27769
27770
27771
27772
27773
27774
27775
27776
27777
27778
27779
27780
27781
27782
27783
27784
27785
27786
27787
27788
27789
27790
27791
27792
27793
27794
27795
27796
27797
27798
27799
27800
27801
27802
27803
27804
27805
27806
27807
27808
27809
27810
27811
27812
27813
27814
27815
27816
27817
27818
27819
27820
27821
27822
27823
27824
27825
27826
27827
27828
27829
27830
27831
27832
27833
27834
27835
27836
27837
27838
27839
27840
27841
27842
27843
27844
27845
27846
27847
27848
27849
27850
27851
27852
27853
27854
27855
27856
27857
27858
27859
27860
27861
27862
27863
27864
27865
27866
27867
27868
27869
27870
27871
27872
27873
27874
27875
27876
27877
27878
27879
27880
27881
27882
27883
27884
27885
27886
27887
27888
27889
27890
27891
27892
27893
27894
27895
27896
27897
27898
27899
27900
27901
27902
27903
27904
27905
27906
27907
27908
27909
27910
27911
27912
27913
27914
27915
27916
27917
27918
27919
27920
27921
27922
27923
27924
27925
27926
27927
27928
27929
27930
27931
27932
27933
27934
27935
27936
27937
27938
27939
27940
27941
27942
27943
27944
27945
27946
27947
27948
27949
27950
27951
27952
27953
27954
27955
27956
27957
27958
27959
27960
27961
27962
27963
27964
27965
27966
27967
27968
27969
27970
27971
27972
27973
27974
27975
27976
27977
27978
27979
27980
27981
27982
27983
27984
27985
27986
27987
27988
27989
27990
27991
27992
27993
27994
27995
27996
27997
27998
27999
28000
28001
28002
28003
28004
28005
28006
28007
28008
28009
28010
28011
28012
28013
28014
28015
28016
28017
28018
28019
28020
28021
28022
28023
28024
28025
28026
28027
28028
28029
28030
28031
28032
28033
28034
28035
28036
28037
28038
28039
28040
28041
28042
28043
28044
28045
28046
28047
28048
28049
28050
28051
28052
28053
28054
28055
28056
28057
28058
28059
28060
28061
28062
28063
28064
28065
28066
28067
28068
28069
28070
28071
28072
28073
28074
28075
28076
28077
28078
28079
28080
28081
28082
28083
28084
28085
28086
28087
28088
28089
28090
28091
28092
28093
28094
28095
28096
28097
28098
28099
28100
28101
28102
28103
28104
28105
28106
28107
28108
28109
28110
28111
28112
28113
28114
28115
28116
28117
28118
28119
28120
28121
28122
28123
28124
28125
28126
28127
28128
28129
28130
28131
28132
28133
28134
28135
28136
28137
28138
28139
28140
28141
28142
28143
28144
28145
28146
28147
28148
28149
28150
28151
28152
28153
28154
28155
28156
28157
28158
28159
28160
28161
28162
28163
28164
28165
28166
28167
28168
28169
28170
28171
28172
28173
28174
28175
28176
28177
28178
28179
28180
28181
28182
28183
28184
28185
28186
28187
28188
28189
28190
28191
28192
28193
28194
28195
28196
28197
28198
28199
28200
28201
28202
28203
28204
28205
28206
28207
28208
28209
28210
28211
28212
28213
28214
28215
28216
28217
28218
28219
28220
28221
28222
28223
28224
28225
28226
28227
28228
28229
28230
28231
28232
28233
28234
28235
28236
28237
28238
28239
28240
28241
28242
28243
28244
28245
28246
28247
28248
28249
28250
28251
28252
28253
28254
28255
28256
28257
28258
28259
28260
28261
28262
28263
28264
28265
28266
28267
28268
28269
28270
28271
28272
28273
28274
28275
28276
28277
28278
28279
28280
28281
28282
28283
28284
28285
28286
28287
28288
28289
28290
28291
28292
28293
28294
28295
28296
28297
28298
28299
28300
28301
28302
28303
28304
28305
28306
28307
28308
28309
28310
28311
28312
28313
28314
28315
28316
28317
28318
28319
28320
28321
28322
28323
28324
28325
28326
28327
28328
28329
28330
28331
28332
28333
28334
28335
28336
28337
28338
28339
28340
28341
28342
28343
28344
28345
28346
28347
28348
28349
28350
28351
28352
28353
28354
28355
28356
28357
28358
28359
28360
28361
28362
28363
28364
28365
28366
28367
28368
28369
28370
28371
28372
28373
28374
28375
28376
28377
28378
28379
28380
28381
28382
28383
28384
28385
28386
28387
28388
28389
28390
28391
28392
28393
28394
28395
28396
28397
28398
28399
28400
28401
28402
28403
28404
28405
28406
28407
28408
28409
28410
28411
28412
28413
28414
28415
28416
28417
28418
28419
28420
28421
28422
28423
28424
28425
28426
28427
28428
28429
28430
28431
28432
28433
28434
28435
28436
28437
28438
28439
28440
28441
28442
28443
28444
28445
28446
28447
28448
28449
28450
28451
28452
28453
28454
28455
28456
28457
28458
28459
28460
28461
28462
28463
28464
28465
28466
28467
28468
28469
28470
28471
28472
28473
28474
28475
28476
28477
28478
28479
28480
28481
28482
28483
28484
28485
28486
28487
28488
28489
28490
28491
28492
28493
28494
28495
28496
28497
28498
28499
28500
28501
28502
28503
28504
28505
28506
28507
28508
28509
28510
28511
28512
28513
28514
28515
28516
28517
28518
28519
28520
28521
28522
28523
28524
28525
28526
28527
28528
28529
28530
28531
28532
28533
28534
28535
28536
28537
28538
28539
28540
28541
28542
28543
28544
28545
28546
28547
28548
28549
28550
28551
28552
28553
28554
28555
28556
28557
28558
28559
28560
28561
28562
28563
28564
28565
28566
28567
28568
28569
28570
28571
28572
28573
28574
28575
28576
28577
28578
28579
28580
28581
28582
28583
28584
28585
28586
28587
28588
28589
28590
28591
28592
28593
28594
28595
28596
28597
28598
28599
28600
28601
28602
28603
28604
28605
28606
28607
28608
28609
28610
28611
28612
28613
28614
28615
28616
28617
28618
28619
28620
28621
28622
28623
28624
28625
28626
28627
28628
28629
28630
28631
28632
28633
28634
28635
28636
28637
28638
28639
28640
28641
28642
28643
28644
28645
28646
28647
28648
28649
28650
28651
28652
28653
28654
28655
28656
28657
28658
28659
28660
28661
28662
28663
28664
28665
28666
28667
28668
28669
28670
28671
28672
28673
28674
28675
28676
28677
28678
28679
28680
28681
28682
28683
28684
28685
28686
28687
28688
28689
28690
28691
28692
28693
28694
28695
28696
28697
28698
28699
28700
28701
28702
28703
28704
28705
28706
28707
28708
28709
28710
28711
28712
28713
28714
28715
28716
28717
28718
28719
28720
28721
28722
28723
28724
28725
28726
28727
28728
28729
28730
28731
28732
28733
28734
28735
28736
28737
28738
28739
28740
28741
28742
28743
28744
28745
28746
28747
28748
28749
28750
28751
28752
28753
28754
28755
28756
28757
28758
28759
28760
28761
28762
28763
28764
28765
28766
28767
28768
28769
28770
28771
28772
28773
28774
28775
28776
28777
28778
28779
28780
28781
28782
28783
28784
28785
28786
28787
28788
28789
28790
28791
28792
28793
28794
28795
28796
28797
28798
28799
28800
28801
28802
28803
28804
28805
28806
28807
28808
28809
28810
28811
28812
28813
28814
28815
28816
28817
28818
28819
28820
28821
28822
28823
28824
28825
28826
28827
28828
28829
28830
28831
28832
28833
28834
28835
28836
28837
28838
28839
28840
28841
28842
28843
28844
28845
28846
28847
28848
28849
28850
28851
28852
28853
28854
28855
28856
28857
28858
28859
28860
28861
28862
28863
28864
28865
28866
28867
28868
28869
28870
28871
28872
28873
28874
28875
28876
28877
28878
28879
28880
28881
28882
28883
28884
28885
28886
28887
28888
28889
28890
28891
28892
28893
28894
28895
28896
28897
28898
28899
28900
28901
28902
28903
28904
28905
28906
28907
28908
28909
28910
28911
28912
28913
28914
28915
28916
28917
28918
28919
28920
28921
28922
28923
28924
28925
28926
28927
28928
28929
28930
28931
28932
28933
28934
28935
28936
28937
28938
28939
28940
28941
28942
28943
28944
28945
28946
28947
28948
28949
28950
28951
28952
28953
28954
28955
28956
28957
28958
28959
28960
28961
28962
28963
28964
28965
28966
28967
28968
28969
28970
28971
28972
28973
28974
28975
28976
28977
28978
28979
28980
28981
28982
28983
28984
28985
28986
28987
28988
28989
28990
28991
28992
28993
28994
28995
28996
28997
28998
28999
29000
29001
29002
29003
29004
29005
29006
29007
29008
29009
29010
29011
29012
29013
29014
29015
29016
29017
29018
29019
29020
29021
29022
29023
29024
29025
29026
29027
29028
29029
29030
29031
29032
29033
29034
29035
29036
29037
29038
29039
29040
29041
29042
29043
29044
29045
29046
29047
29048
29049
29050
29051
29052
29053
29054
29055
29056
29057
29058
29059
29060
29061
29062
29063
29064
29065
29066
29067
29068
29069
29070
29071
29072
29073
29074
29075
29076
29077
29078
29079
29080
29081
29082
29083
29084
29085
29086
29087
29088
29089
29090
29091
29092
29093
29094
29095
29096
29097
29098
29099
29100
29101
29102
29103
29104
29105
29106
29107
29108
29109
29110
29111
29112
29113
29114
29115
29116
29117
29118
29119
29120
29121
29122
29123
29124
29125
29126
29127
29128
29129
29130
29131
29132
29133
29134
29135
29136
29137
29138
29139
29140
29141
29142
29143
29144
29145
29146
29147
29148
29149
29150
29151
29152
29153
29154
29155
29156
29157
29158
29159
29160
29161
29162
29163
29164
29165
29166
29167
29168
29169
29170
29171
29172
29173
29174
29175
29176
29177
29178
29179
29180
29181
29182
29183
29184
29185
29186
29187
29188
29189
29190
29191
29192
29193
29194
29195
29196
29197
29198
29199
29200
29201
29202
29203
29204
29205
29206
29207
29208
29209
29210
29211
29212
29213
29214
29215
29216
29217
29218
29219
29220
29221
29222
29223
29224
29225
29226
29227
29228
29229
29230
29231
29232
29233
29234
29235
29236
29237
29238
29239
29240
29241
29242
29243
29244
29245
29246
29247
29248
29249
29250
29251
29252
29253
29254
29255
29256
29257
29258
29259
29260
29261
29262
29263
29264
29265
29266
29267
29268
29269
29270
29271
29272
29273
29274
29275
29276
29277
29278
29279
29280
29281
29282
29283
29284
29285
29286
29287
29288
29289
29290
29291
29292
29293
29294
29295
29296
29297
29298
29299
29300
29301
29302
29303
29304
29305
29306
29307
29308
29309
29310
29311
29312
29313
29314
29315
29316
29317
29318
29319
29320
29321
29322
29323
29324
29325
29326
29327
29328
29329
29330
29331
29332
29333
29334
29335
29336
29337
29338
29339
29340
29341
29342
29343
29344
29345
29346
29347
29348
29349
29350
29351
29352
29353
29354
29355
29356
29357
29358
29359
29360
29361
29362
29363
29364
29365
29366
29367
29368
29369
29370
29371
29372
29373
29374
29375
29376
29377
29378
29379
29380
29381
29382
29383
29384
29385
29386
29387
29388
29389
29390
29391
29392
29393
29394
29395
29396
29397
29398
29399
29400
29401
29402
29403
29404
29405
29406
29407
29408
29409
29410
29411
29412
29413
29414
29415
29416
29417
29418
29419
29420
29421
29422
29423
29424
29425
29426
29427
29428
29429
29430
29431
29432
29433
29434
29435
29436
29437
29438
29439
29440
29441
29442
29443
29444
29445
29446
29447
29448
29449
29450
29451
29452
29453
29454
29455
29456
29457
29458
29459
29460
29461
29462
29463
29464
29465
29466
29467
29468
29469
29470
29471
29472
29473
29474
29475
29476
29477
29478
29479
29480
29481
29482
29483
29484
29485
29486
29487
29488
29489
29490
29491
29492
29493
29494
29495
29496
29497
29498
29499
29500
29501
29502
29503
29504
29505
29506
29507
29508
29509
29510
29511
29512
29513
29514
29515
29516
29517
29518
29519
29520
29521
29522
29523
29524
29525
29526
29527
29528
29529
29530
29531
29532
29533
29534
29535
29536
29537
29538
29539
29540
29541
29542
29543
29544
29545
29546
29547
29548
29549
29550
29551
29552
29553
29554
29555
29556
29557
29558
29559
29560
29561
29562
29563
29564
29565
29566
29567
29568
29569
29570
29571
29572
29573
29574
29575
29576
29577
29578
29579
29580
29581
29582
29583
29584
29585
29586
29587
29588
29589
29590
29591
29592
29593
29594
29595
29596
29597
29598
29599
29600
29601
29602
29603
29604
29605
29606
29607
29608
29609
29610
29611
29612
29613
29614
29615
29616
29617
29618
29619
29620
29621
29622
29623
29624
29625
29626
29627
29628
29629
29630
29631
29632
29633
29634
29635
29636
29637
29638
29639
29640
29641
29642
29643
29644
29645
29646
29647
29648
29649
29650
29651
29652
29653
29654
29655
29656
29657
29658
29659
29660
29661
29662
29663
29664
29665
29666
29667
29668
29669
29670
29671
29672
29673
29674
29675
29676
29677
29678
29679
29680
29681
29682
29683
29684
29685
29686
29687
29688
29689
29690
29691
29692
29693
29694
29695
29696
29697
29698
29699
29700
29701
29702
29703
29704
29705
29706
29707
29708
29709
29710
29711
29712
29713
29714
29715
29716
29717
29718
29719
29720
29721
29722
29723
29724
29725
29726
29727
29728
29729
29730
29731
29732
29733
29734
29735
29736
29737
29738
29739
29740
29741
29742
29743
29744
29745
29746
29747
29748
29749
29750
29751
29752
29753
29754
29755
29756
29757
29758
29759
29760
29761
29762
29763
29764
29765
29766
29767
29768
29769
29770
29771
29772
29773
29774
29775
29776
29777
29778
29779
29780
29781
29782
29783
29784
29785
29786
29787
29788
29789
29790
29791
29792
29793
29794
29795
29796
29797
29798
29799
29800
29801
29802
29803
29804
29805
29806
29807
29808
29809
29810
29811
29812
29813
29814
29815
29816
29817
29818
29819
29820
29821
29822
29823
29824
29825
29826
29827
29828
29829
29830
29831
29832
29833
29834
29835
29836
29837
29838
29839
29840
29841
29842
29843
29844
29845
29846
29847
29848
29849
29850
29851
29852
29853
29854
29855
29856
29857
29858
29859
29860
29861
29862
29863
29864
29865
29866
29867
29868
29869
29870
29871
29872
29873
29874
29875
29876
29877
29878
29879
29880
29881
29882
29883
29884
29885
29886
29887
29888
29889
29890
29891
29892
29893
29894
29895
29896
29897
29898
29899
29900
29901
29902
29903
29904
29905
29906
29907
29908
29909
29910
29911
29912
29913
29914
29915
29916
29917
29918
29919
29920
29921
29922
29923
29924
29925
29926
29927
29928
29929
29930
29931
29932
29933
29934
29935
29936
29937
29938
29939
29940
29941
29942
29943
29944
29945
29946
29947
29948
29949
29950
29951
29952
29953
29954
29955
29956
29957
29958
29959
29960
29961
29962
29963
29964
29965
29966
29967
29968
29969
29970
29971
29972
29973
29974
29975
29976
29977
29978
29979
29980
29981
29982
29983
29984
29985
29986
29987
29988
29989
29990
29991
29992
29993
29994
29995
29996
29997
29998
29999
30000
30001
30002
30003
30004
30005
30006
30007
30008
30009
30010
30011
30012
30013
30014
30015
30016
30017
30018
30019
30020
30021
30022
30023
30024
30025
30026
30027
30028
30029
30030
30031
30032
30033
30034
30035
30036
30037
30038
30039
30040
30041
30042
30043
30044
30045
30046
30047
30048
30049
30050
30051
30052
30053
30054
30055
30056
30057
30058
30059
30060
30061
30062
30063
30064
30065
30066
30067
30068
30069
30070
30071
30072
30073
30074
30075
30076
30077
30078
30079
30080
30081
30082
30083
30084
30085
30086
30087
30088
30089
30090
30091
30092
30093
30094
30095
30096
30097
30098
30099
30100
30101
30102
30103
30104
30105
30106
30107
30108
30109
30110
30111
30112
30113
30114
30115
30116
30117
30118
30119
30120
30121
30122
30123
30124
30125
30126
30127
30128
30129
30130
30131
30132
30133
30134
30135
30136
30137
30138
30139
30140
30141
30142
30143
30144
30145
30146
30147
30148
30149
30150
30151
30152
30153
30154
30155
30156
30157
30158
30159
30160
30161
30162
30163
30164
30165
30166
30167
30168
30169
30170
30171
30172
30173
30174
30175
30176
30177
30178
30179
30180
30181
30182
30183
30184
30185
30186
30187
30188
30189
30190
30191
30192
30193
30194
30195
30196
30197
30198
30199
30200
30201
30202
30203
30204
30205
30206
30207
30208
30209
30210
30211
30212
30213
30214
30215
30216
30217
30218
30219
30220
30221
30222
30223
30224
30225
30226
30227
30228
30229
30230
30231
30232
30233
30234
30235
30236
30237
30238
30239
30240
30241
30242
30243
30244
30245
30246
30247
30248
30249
30250
30251
30252
30253
30254
30255
30256
30257
30258
30259
30260
30261
30262
30263
30264
30265
30266
30267
30268
30269
30270
30271
30272
30273
30274
30275
30276
30277
30278
30279
30280
30281
30282
30283
30284
30285
30286
30287
30288
30289
30290
30291
30292
30293
30294
30295
30296
30297
30298
30299
30300
30301
30302
30303
30304
30305
30306
30307
30308
30309
30310
30311
30312
30313
30314
30315
30316
30317
30318
30319
30320
30321
30322
30323
30324
30325
30326
30327
30328
30329
30330
30331
30332
30333
30334
30335
30336
30337
30338
30339
30340
30341
30342
30343
30344
30345
30346
30347
30348
30349
30350
30351
30352
30353
30354
30355
30356
30357
30358
30359
30360
30361
30362
30363
30364
30365
30366
30367
30368
30369
30370
30371
30372
30373
30374
30375
30376
30377
30378
30379
30380
30381
30382
30383
30384
30385
30386
30387
30388
30389
30390
30391
30392
30393
30394
30395
30396
30397
30398
30399
30400
30401
30402
30403
30404
30405
30406
30407
30408
30409
30410
30411
30412
30413
30414
30415
30416
30417
30418
30419
30420
30421
30422
30423
30424
30425
30426
30427
30428
30429
30430
30431
30432
30433
30434
30435
30436
30437
30438
30439
30440
30441
30442
30443
30444
30445
30446
30447
30448
30449
30450
30451
30452
30453
30454
30455
30456
30457
30458
30459
30460
30461
30462
30463
30464
30465
30466
30467
30468
30469
30470
30471
30472
30473
30474
30475
30476
30477
30478
30479
30480
30481
30482
30483
30484
30485
30486
30487
30488
30489
30490
30491
30492
30493
30494
30495
30496
30497
30498
30499
30500
30501
30502
30503
30504
30505
30506
30507
30508
30509
30510
30511
30512
30513
30514
30515
30516
30517
30518
30519
30520
30521
30522
30523
30524
30525
30526
30527
30528
30529
30530
30531
30532
30533
30534
30535
30536
30537
30538
30539
30540
30541
30542
30543
30544
30545
30546
30547
30548
30549
30550
30551
30552
30553
30554
30555
30556
30557
30558
30559
30560
30561
30562
30563
30564
30565
30566
30567
30568
30569
30570
30571
30572
30573
30574
30575
30576
30577
30578
30579
30580
30581
30582
30583
30584
30585
30586
30587
30588
30589
30590
30591
30592
30593
30594
30595
30596
30597
30598
30599
30600
30601
30602
30603
30604
30605
30606
30607
30608
30609
30610
30611
30612
30613
30614
30615
30616
30617
30618
30619
30620
30621
30622
30623
30624
30625
30626
30627
30628
30629
30630
30631
30632
30633
30634
30635
30636
30637
30638
30639
30640
30641
30642
30643
30644
30645
30646
30647
30648
30649
30650
30651
30652
30653
30654
30655
30656
30657
30658
30659
30660
30661
30662
30663
30664
30665
30666
30667
30668
30669
30670
30671
30672
30673
30674
30675
30676
30677
30678
30679
30680
30681
30682
30683
30684
30685
30686
30687
30688
30689
30690
30691
30692
30693
30694
30695
30696
30697
30698
30699
30700
30701
30702
30703
30704
30705
30706
30707
30708
30709
30710
30711
30712
30713
30714
30715
30716
30717
30718
30719
30720
30721
30722
30723
30724
30725
30726
30727
30728
30729
30730
30731
30732
30733
30734
30735
30736
30737
30738
30739
30740
30741
30742
30743
30744
30745
30746
30747
30748
30749
30750
30751
30752
30753
30754
30755
30756
30757
30758
30759
30760
30761
30762
30763
30764
30765
30766
30767
30768
30769
30770
30771
30772
30773
30774
30775
30776
30777
30778
30779
30780
30781
30782
30783
30784
30785
30786
30787
30788
30789
30790
30791
30792
30793
30794
30795
30796
30797
30798
30799
30800
30801
30802
30803
30804
30805
30806
30807
30808
30809
30810
30811
30812
30813
30814
30815
30816
30817
30818
30819
30820
30821
30822
30823
30824
30825
30826
30827
30828
30829
30830
30831
30832
30833
30834
30835
30836
30837
30838
30839
30840
30841
30842
30843
30844
30845
30846
30847
30848
30849
30850
30851
30852
30853
30854
30855
30856
30857
30858
30859
30860
30861
30862
30863
30864
30865
30866
30867
30868
30869
30870
30871
30872
30873
30874
30875
30876
30877
30878
30879
30880
30881
30882
30883
30884
30885
30886
30887
30888
30889
30890
30891
30892
30893
30894
30895
30896
30897
30898
30899
30900
30901
30902
30903
30904
30905
30906
30907
30908
30909
30910
30911
30912
30913
30914
30915
30916
30917
30918
30919
30920
30921
30922
30923
30924
30925
30926
30927
30928
30929
30930
30931
30932
30933
30934
30935
30936
30937
30938
30939
30940
30941
30942
30943
30944
30945
30946
30947
30948
30949
30950
30951
30952
30953
30954
30955
30956
30957
30958
30959
30960
30961
30962
30963
30964
30965
30966
30967
30968
30969
30970
30971
30972
30973
30974
30975
30976
30977
30978
30979
30980
30981
30982
30983
30984
30985
30986
30987
30988
30989
30990
30991
30992
30993
30994
30995
30996
30997
30998
30999
31000
31001
31002
31003
31004
31005
31006
31007
31008
31009
31010
31011
31012
31013
31014
31015
31016
31017
31018
31019
31020
31021
31022
31023
31024
31025
31026
31027
31028
31029
31030
31031
31032
31033
31034
31035
31036
31037
31038
31039
31040
31041
31042
31043
31044
31045
31046
31047
31048
31049
31050
31051
31052
31053
31054
31055
31056
31057
31058
31059
31060
31061
31062
31063
31064
31065
31066
31067
31068
31069
31070
31071
31072
31073
31074
31075
31076
31077
31078
31079
31080
31081
31082
31083
31084
31085
31086
31087
31088
31089
31090
31091
31092
31093
31094
31095
31096
31097
31098
31099
31100
31101
31102
31103
31104
31105
31106
31107
31108
31109
31110
31111
31112
31113
31114
31115
31116
31117
31118
31119
31120
31121
31122
31123
31124
31125
31126
31127
31128
31129
31130
31131
31132
31133
31134
31135
31136
31137
31138
31139
31140
31141
31142
31143
31144
31145
31146
31147
31148
31149
31150
31151
31152
31153
31154
31155
31156
31157
31158
31159
31160
31161
31162
31163
31164
31165
31166
31167
31168
31169
31170
31171
31172
31173
31174
31175
31176
31177
31178
31179
31180
31181
31182
31183
31184
31185
31186
31187
31188
31189
31190
31191
31192
31193
31194
31195
31196
31197
31198
31199
31200
31201
31202
31203
31204
31205
31206
31207
31208
31209
31210
31211
31212
31213
31214
31215
31216
31217
31218
31219
31220
31221
31222
31223
31224
31225
31226
31227
31228
31229
31230
31231
31232
31233
31234
31235
31236
31237
31238
31239
31240
31241
31242
31243
31244
31245
31246
31247
31248
31249
31250
31251
31252
31253
31254
31255
31256
31257
31258
31259
31260
31261
31262
31263
31264
31265
31266
31267
31268
31269
31270
31271
31272
31273
31274
31275
31276
31277
31278
31279
31280
31281
31282
31283
31284
31285
31286
31287
31288
31289
31290
31291
31292
31293
31294
31295
31296
31297
31298
31299
31300
31301
31302
31303
31304
31305
31306
31307
31308
31309
31310
31311
31312
31313
31314
31315
31316
31317
31318
31319
31320
31321
31322
31323
31324
31325
31326
31327
31328
31329
31330
31331
31332
31333
31334
31335
31336
31337
31338
31339
31340
31341
31342
31343
31344
31345
31346
31347
31348
31349
31350
31351
31352
31353
31354
31355
31356
31357
31358
31359
31360
31361
31362
31363
31364
31365
31366
31367
31368
31369
31370
31371
31372
31373
31374
31375
31376
31377
31378
31379
31380
31381
31382
31383
31384
31385
31386
31387
31388
31389
31390
31391
31392
31393
31394
31395
31396
31397
31398
31399
31400
31401
31402
31403
31404
31405
31406
31407
31408
31409
31410
31411
31412
31413
31414
31415
31416
31417
31418
31419
31420
31421
31422
31423
31424
31425
31426
31427
31428
31429
31430
31431
31432
31433
31434
31435
31436
31437
31438
31439
31440
31441
31442
31443
31444
31445
31446
31447
31448
31449
31450
31451
31452
31453
31454
31455
31456
31457
31458
31459
31460
31461
31462
31463
31464
31465
31466
31467
31468
31469
31470
31471
31472
31473
31474
31475
31476
31477
31478
31479
31480
31481
31482
31483
31484
31485
31486
31487
31488
31489
31490
31491
31492
31493
31494
31495
31496
31497
31498
31499
31500
31501
31502
31503
31504
31505
31506
31507
31508
31509
31510
31511
31512
31513
31514
31515
31516
31517
31518
31519
31520
31521
31522
31523
31524
31525
31526
31527
31528
31529
31530
31531
31532
31533
31534
31535
31536
31537
31538
31539
31540
31541
31542
31543
31544
31545
31546
31547
31548
31549
31550
31551
31552
31553
31554
31555
31556
31557
31558
31559
31560
31561
31562
31563
31564
31565
31566
31567
31568
31569
31570
31571
31572
31573
31574
31575
31576
31577
31578
31579
31580
31581
31582
31583
31584
31585
31586
31587
31588
31589
31590
31591
31592
31593
31594
31595
31596
31597
31598
31599
31600
31601
31602
31603
31604
31605
31606
31607
31608
31609
31610
31611
31612
31613
31614
31615
31616
31617
31618
31619
31620
31621
31622
31623
31624
31625
31626
31627
31628
31629
31630
31631
31632
31633
31634
31635
31636
31637
31638
31639
31640
31641
31642
31643
31644
31645
31646
31647
31648
31649
31650
31651
31652
31653
31654
31655
31656
31657
31658
31659
31660
31661
31662
31663
31664
31665
31666
31667
31668
31669
31670
31671
31672
31673
31674
31675
31676
31677
31678
31679
31680
31681
31682
31683
31684
31685
31686
31687
31688
31689
31690
31691
31692
31693
31694
31695
31696
31697
31698
31699
31700
31701
31702
31703
31704
31705
31706
31707
31708
31709
31710
31711
31712
31713
31714
31715
31716
31717
31718
31719
31720
31721
31722
31723
31724
31725
31726
31727
31728
31729
31730
31731
31732
31733
31734
31735
31736
31737
31738
31739
31740
31741
31742
31743
31744
31745
31746
31747
31748
31749
31750
31751
31752
31753
31754
31755
31756
31757
31758
31759
31760
31761
31762
31763
31764
31765
31766
31767
31768
31769
31770
31771
31772
31773
31774
31775
31776
31777
31778
31779
31780
31781
31782
31783
31784
31785
31786
31787
31788
31789
31790
31791
31792
31793
31794
31795
31796
31797
31798
31799
31800
31801
31802
31803
31804
31805
31806
31807
31808
31809
31810
31811
31812
31813
31814
31815
31816
31817
31818
31819
31820
31821
31822
31823
31824
31825
31826
31827
31828
31829
31830
31831
31832
31833
31834
31835
31836
31837
31838
31839
31840
31841
31842
31843
31844
31845
31846
31847
31848
31849
31850
31851
31852
31853
31854
31855
31856
31857
31858
31859
31860
31861
31862
31863
31864
31865
31866
31867
31868
31869
31870
31871
31872
31873
31874
31875
31876
31877
31878
31879
31880
31881
31882
31883
31884
31885
31886
31887
31888
31889
31890
31891
31892
31893
31894
31895
31896
31897
31898
31899
31900
31901
31902
31903
31904
31905
31906
31907
31908
31909
31910
31911
31912
31913
31914
31915
31916
31917
31918
31919
31920
31921
31922
31923
31924
31925
31926
31927
31928
31929
31930
31931
31932
31933
31934
31935
31936
31937
31938
31939
31940
31941
31942
31943
31944
31945
31946
31947
31948
31949
31950
31951
31952
31953
31954
31955
31956
31957
31958
31959
31960
31961
31962
31963
31964
31965
31966
31967
31968
31969
31970
31971
31972
31973
31974
31975
31976
31977
31978
31979
31980
31981
31982
31983
31984
31985
31986
31987
31988
31989
31990
31991
31992
31993
31994
31995
31996
31997
31998
31999
32000
32001
32002
32003
32004
32005
32006
32007
32008
32009
32010
32011
32012
32013
32014
32015
32016
32017
32018
32019
32020
32021
32022
32023
32024
32025
32026
32027
32028
32029
32030
32031
32032
32033
32034
32035
32036
32037
32038
32039
32040
32041
32042
32043
32044
32045
32046
32047
32048
32049
32050
32051
32052
32053
32054
32055
32056
32057
32058
32059
32060
32061
32062
32063
32064
32065
32066
32067
32068
32069
32070
32071
32072
32073
32074
32075
32076
32077
32078
32079
32080
32081
32082
32083
32084
32085
32086
32087
32088
32089
32090
32091
32092
32093
32094
32095
32096
32097
32098
32099
32100
32101
32102
32103
32104
32105
32106
32107
32108
32109
32110
32111
32112
32113
32114
32115
32116
32117
32118
32119
32120
32121
32122
32123
32124
32125
32126
32127
32128
32129
32130
32131
32132
32133
32134
32135
32136
32137
32138
32139
32140
32141
32142
32143
32144
32145
32146
32147
32148
32149
32150
32151
32152
32153
32154
32155
32156
32157
32158
32159
32160
32161
32162
32163
32164
32165
32166
32167
32168
32169
32170
32171
32172
32173
32174
32175
32176
32177
32178
32179
32180
32181
32182
32183
32184
32185
32186
32187
32188
32189
32190
32191
32192
32193
32194
32195
32196
32197
32198
32199
32200
32201
32202
32203
32204
32205
32206
32207
32208
32209
32210
32211
32212
32213
32214
32215
32216
32217
32218
32219
32220
32221
32222
32223
32224
32225
32226
32227
32228
32229
32230
32231
32232
32233
32234
32235
32236
32237
32238
32239
32240
32241
32242
32243
32244
32245
32246
32247
32248
32249
32250
32251
32252
32253
32254
32255
32256
32257
32258
32259
32260
32261
32262
32263
32264
32265
32266
32267
32268
32269
32270
32271
32272
32273
32274
32275
32276
32277
32278
32279
32280
32281
32282
32283
32284
32285
32286
32287
32288
32289
32290
32291
32292
32293
32294
32295
32296
32297
32298
32299
32300
32301
32302
32303
32304
32305
32306
32307
32308
32309
32310
32311
32312
32313
32314
32315
32316
32317
32318
32319
32320
32321
32322
32323
32324
32325
32326
32327
32328
32329
32330
32331
32332
32333
32334
32335
32336
32337
32338
32339
32340
32341
32342
32343
32344
32345
32346
32347
32348
32349
32350
32351
32352
32353
32354
32355
32356
32357
32358
32359
32360
32361
32362
32363
32364
32365
32366
32367
32368
32369
32370
32371
32372
32373
32374
32375
32376
32377
32378
32379
32380
32381
32382
32383
32384
32385
32386
32387
32388
32389
32390
32391
32392
32393
32394
32395
32396
32397
32398
32399
32400
32401
32402
32403
32404
32405
32406
32407
32408
32409
32410
32411
32412
32413
32414
32415
32416
32417
32418
32419
32420
32421
32422
32423
32424
32425
32426
32427
32428
32429
32430
32431
32432
32433
32434
32435
32436
32437
32438
32439
32440
32441
32442
32443
32444
32445
32446
32447
32448
32449
32450
32451
32452
32453
32454
32455
32456
32457
32458
32459
32460
32461
32462
32463
32464
32465
32466
32467
32468
32469
32470
32471
32472
32473
32474
32475
32476
32477
32478
32479
32480
32481
32482
32483
32484
32485
32486
32487
32488
32489
32490
32491
32492
32493
32494
32495
32496
32497
32498
32499
32500
32501
32502
32503
32504
32505
32506
32507
32508
32509
32510
32511
32512
32513
32514
32515
32516
32517
32518
32519
32520
32521
32522
32523
32524
32525
32526
32527
32528
32529
32530
32531
32532
32533
32534
32535
32536
32537
32538
32539
32540
32541
32542
32543
32544
32545
32546
32547
32548
32549
32550
32551
32552
32553
32554
32555
32556
32557
32558
32559
32560
32561
32562
32563
32564
32565
32566
32567
32568
32569
32570
32571
32572
32573
32574
32575
32576
32577
32578
32579
32580
32581
32582
32583
32584
32585
32586
32587
32588
32589
32590
32591
32592
32593
32594
32595
32596
32597
32598
32599
32600
32601
32602
32603
32604
32605
32606
32607
32608
32609
32610
32611
32612
32613
32614
32615
32616
32617
32618
32619
32620
32621
32622
32623
32624
32625
32626
32627
32628
32629
32630
32631
32632
32633
32634
32635
32636
32637
32638
32639
32640
32641
32642
32643
32644
32645
32646
32647
32648
32649
32650
32651
32652
32653
32654
32655
32656
32657
32658
32659
32660
32661
32662
32663
32664
32665
32666
32667
32668
32669
32670
32671
32672
32673
32674
32675
32676
32677
32678
32679
32680
32681
32682
32683
32684
32685
32686
32687
32688
32689
32690
32691
32692
32693
32694
32695
32696
32697
32698
32699
32700
32701
32702
32703
32704
32705
32706
32707
32708
32709
32710
32711
32712
32713
32714
32715
32716
32717
32718
32719
32720
32721
32722
32723
32724
32725
32726
32727
32728
32729
32730
32731
32732
32733
32734
32735
32736
32737
32738
32739
32740
32741
32742
32743
32744
32745
32746
32747
32748
32749
32750
32751
32752
32753
32754
32755
32756
32757
32758
32759
32760
32761
32762
32763
32764
32765
32766
32767
32768
32769
32770
32771
32772
32773
32774
32775
32776
32777
32778
32779
32780
32781
32782
32783
32784
32785
32786
32787
32788
32789
32790
32791
32792
32793
32794
32795
32796
32797
32798
32799
32800
32801
32802
32803
32804
32805
32806
32807
32808
32809
32810
32811
32812
32813
32814
32815
32816
32817
32818
32819
32820
32821
32822
32823
32824
32825
32826
32827
32828
32829
32830
32831
32832
32833
32834
32835
32836
32837
32838
32839
32840
32841
32842
32843
32844
32845
32846
32847
32848
32849
32850
32851
32852
32853
32854
32855
32856
32857
32858
32859
32860
32861
32862
32863
32864
32865
32866
32867
32868
32869
32870
32871
32872
32873
32874
32875
32876
32877
32878
32879
32880
32881
32882
32883
32884
32885
32886
32887
32888
32889
32890
32891
32892
32893
32894
32895
32896
32897
32898
32899
32900
32901
32902
32903
32904
32905
32906
32907
32908
32909
32910
32911
32912
32913
32914
32915
32916
32917
32918
32919
32920
32921
32922
32923
32924
32925
32926
32927
32928
32929
32930
32931
32932
32933
32934
32935
32936
32937
32938
32939
32940
32941
32942
32943
32944
32945
32946
32947
32948
32949
32950
32951
32952
32953
32954
32955
32956
32957
32958
32959
32960
32961
32962
32963
32964
32965
32966
32967
32968
32969
32970
32971
32972
32973
32974
32975
32976
32977
32978
32979
32980
32981
32982
32983
32984
32985
32986
32987
32988
32989
32990
32991
32992
32993
32994
32995
32996
32997
32998
32999
33000
33001
33002
33003
33004
33005
33006
33007
33008
33009
33010
33011
33012
33013
33014
33015
33016
33017
33018
33019
33020
33021
33022
33023
33024
33025
33026
33027
33028
33029
33030
33031
33032
33033
33034
33035
33036
33037
33038
33039
33040
33041
33042
33043
33044
33045
33046
33047
33048
33049
33050
33051
33052
33053
33054
33055
33056
33057
33058
33059
33060
33061
33062
33063
33064
33065
33066
33067
33068
33069
33070
33071
33072
33073
33074
33075
33076
33077
33078
33079
33080
33081
33082
33083
33084
33085
33086
33087
33088
33089
33090
33091
33092
33093
33094
33095
33096
33097
33098
33099
33100
33101
33102
33103
33104
33105
33106
33107
33108
33109
33110
33111
33112
33113
33114
33115
33116
33117
33118
33119
33120
33121
33122
33123
33124
33125
33126
33127
33128
33129
33130
33131
33132
33133
33134
33135
33136
33137
33138
33139
33140
33141
33142
33143
33144
33145
33146
33147
33148
33149
33150
33151
33152
33153
33154
33155
33156
33157
33158
33159
33160
33161
33162
33163
33164
33165
33166
33167
33168
33169
33170
33171
33172
33173
33174
33175
33176
33177
33178
33179
33180
33181
33182
33183
33184
33185
33186
33187
33188
33189
33190
33191
33192
33193
33194
33195
33196
33197
33198
33199
33200
33201
33202
33203
33204
33205
33206
33207
33208
33209
33210
33211
33212
33213
33214
33215
33216
33217
33218
33219
33220
33221
33222
33223
33224
33225
33226
33227
33228
33229
33230
33231
33232
33233
33234
33235
33236
33237
33238
33239
33240
33241
33242
33243
33244
33245
33246
33247
33248
33249
33250
33251
33252
33253
33254
33255
33256
33257
33258
33259
33260
33261
33262
33263
33264
33265
33266
33267
33268
33269
33270
33271
33272
33273
33274
33275
33276
33277
33278
33279
33280
33281
33282
33283
33284
33285
33286
33287
33288
33289
33290
33291
33292
33293
33294
33295
33296
33297
33298
33299
33300
33301
33302
33303
33304
33305
33306
33307
33308
33309
33310
33311
33312
33313
33314
33315
33316
33317
33318
33319
33320
33321
33322
33323
33324
33325
33326
33327
33328
33329
33330
33331
33332
33333
33334
33335
33336
33337
33338
33339
33340
33341
33342
33343
33344
33345
33346
33347
33348
33349
33350
33351
33352
33353
33354
33355
33356
33357
33358
33359
33360
33361
33362
33363
33364
33365
33366
33367
33368
33369
33370
33371
33372
33373
33374
33375
33376
33377
33378
33379
33380
33381
33382
33383
33384
33385
33386
33387
33388
33389
33390
33391
33392
33393
33394
33395
33396
33397
33398
33399
33400
33401
33402
33403
33404
33405
33406
33407
33408
33409
33410
33411
33412
33413
33414
33415
33416
33417
33418
33419
33420
33421
33422
33423
33424
33425
33426
33427
33428
33429
33430
33431
33432
33433
33434
33435
33436
33437
33438
33439
33440
33441
33442
33443
33444
33445
33446
33447
33448
33449
33450
33451
33452
33453
33454
33455
33456
33457
33458
33459
33460
33461
33462
33463
33464
33465
33466
33467
33468
33469
33470
33471
33472
33473
33474
33475
33476
33477
33478
33479
33480
33481
33482
33483
33484
33485
33486
33487
33488
33489
33490
33491
33492
33493
33494
33495
33496
33497
33498
33499
33500
33501
33502
33503
33504
33505
33506
33507
33508
33509
33510
33511
33512
33513
33514
33515
33516
33517
33518
33519
33520
33521
33522
33523
33524
33525
33526
33527
33528
33529
33530
33531
33532
33533
33534
33535
33536
33537
33538
33539
33540
33541
33542
33543
33544
33545
33546
33547
33548
33549
33550
33551
33552
33553
33554
33555
33556
33557
33558
33559
33560
33561
33562
33563
33564
33565
33566
33567
33568
33569
33570
33571
33572
33573
33574
33575
33576
33577
33578
33579
33580
33581
33582
33583
33584
33585
33586
33587
33588
33589
33590
33591
33592
33593
33594
33595
33596
33597
33598
33599
33600
33601
33602
33603
33604
33605
33606
33607
33608
33609
33610
33611
33612
33613
33614
33615
33616
33617
33618
33619
33620
33621
33622
33623
33624
33625
33626
33627
33628
33629
33630
33631
33632
33633
33634
33635
33636
33637
33638
33639
33640
33641
33642
33643
33644
33645
33646
33647
33648
33649
33650
33651
33652
33653
33654
33655
33656
33657
33658
33659
33660
33661
33662
33663
33664
33665
33666
33667
33668
33669
33670
33671
33672
33673
33674
33675
33676
33677
33678
33679
33680
33681
33682
33683
33684
33685
33686
33687
33688
33689
33690
33691
33692
33693
33694
33695
33696
33697
33698
33699
33700
33701
33702
33703
33704
33705
33706
33707
33708
33709
33710
33711
33712
33713
33714
33715
33716
33717
33718
33719
33720
33721
33722
33723
33724
33725
33726
33727
33728
33729
33730
33731
33732
33733
33734
33735
33736
33737
33738
33739
33740
33741
33742
33743
33744
33745
33746
33747
33748
33749
33750
33751
33752
33753
33754
33755
33756
33757
33758
33759
33760
33761
33762
33763
33764
33765
33766
33767
33768
33769
33770
33771
33772
33773
33774
33775
33776
33777
33778
33779
33780
33781
33782
33783
33784
33785
33786
33787
33788
33789
33790
33791
33792
33793
33794
33795
33796
33797
33798
33799
33800
33801
33802
33803
33804
33805
33806
33807
33808
33809
33810
33811
33812
33813
33814
33815
33816
33817
33818
33819
33820
33821
33822
33823
33824
33825
33826
33827
33828
33829
33830
33831
33832
33833
33834
33835
33836
33837
33838
33839
33840
33841
33842
33843
33844
33845
33846
33847
33848
33849
33850
33851
33852
33853
33854
33855
33856
33857
33858
33859
33860
33861
33862
33863
33864
33865
33866
33867
33868
33869
33870
33871
33872
33873
33874
33875
33876
33877
33878
33879
33880
33881
33882
33883
33884
33885
33886
33887
33888
33889
33890
33891
33892
33893
33894
33895
33896
33897
33898
33899
33900
33901
33902
33903
33904
33905
33906
33907
33908
33909
33910
33911
33912
33913
33914
33915
33916
33917
33918
33919
33920
33921
33922
33923
33924
33925
33926
33927
33928
33929
33930
33931
33932
33933
33934
33935
33936
33937
33938
33939
33940
33941
33942
33943
33944
33945
33946
33947
33948
33949
33950
33951
33952
33953
33954
33955
33956
33957
33958
33959
33960
33961
33962
33963
33964
33965
33966
33967
33968
33969
33970
33971
33972
33973
33974
33975
33976
33977
33978
33979
33980
33981
33982
33983
33984
33985
33986
33987
33988
33989
33990
33991
33992
33993
33994
33995
33996
33997
33998
33999
34000
34001
34002
34003
34004
34005
34006
34007
34008
34009
34010
34011
34012
34013
34014
34015
34016
34017
34018
34019
34020
34021
34022
34023
34024
34025
34026
34027
34028
34029
34030
34031
34032
34033
34034
34035
34036
34037
34038
34039
34040
34041
34042
34043
34044
34045
34046
34047
34048
34049
34050
34051
34052
34053
34054
34055
34056
34057
34058
34059
34060
34061
34062
34063
34064
34065
34066
34067
34068
34069
34070
34071
34072
34073
34074
34075
34076
34077
34078
34079
34080
34081
34082
34083
34084
34085
34086
34087
34088
34089
34090
34091
34092
34093
34094
34095
34096
34097
34098
34099
34100
34101
34102
34103
34104
34105
34106
34107
34108
34109
34110
34111
34112
34113
34114
34115
34116
34117
34118
34119
34120
34121
34122
34123
34124
34125
34126
34127
34128
34129
34130
34131
34132
34133
34134
34135
34136
34137
34138
34139
34140
34141
34142
34143
34144
34145
34146
34147
34148
34149
34150
34151
34152
34153
34154
34155
34156
34157
34158
34159
34160
34161
34162
34163
34164
34165
34166
34167
34168
34169
34170
34171
34172
34173
34174
34175
34176
34177
34178
34179
34180
34181
34182
34183
34184
34185
34186
34187
34188
34189
34190
34191
34192
34193
34194
34195
34196
34197
34198
34199
34200
34201
34202
34203
34204
34205
34206
34207
34208
34209
34210
34211
34212
34213
34214
34215
34216
34217
34218
34219
34220
34221
34222
34223
34224
34225
34226
34227
34228
34229
34230
34231
34232
34233
34234
34235
34236
34237
34238
34239
34240
34241
34242
34243
34244
34245
34246
34247
34248
34249
34250
34251
34252
34253
34254
34255
34256
34257
34258
34259
34260
34261
34262
34263
34264
34265
34266
34267
34268
34269
34270
34271
34272
34273
34274
34275
34276
34277
34278
34279
34280
34281
34282
34283
34284
34285
34286
34287
34288
34289
34290
34291
34292
34293
34294
34295
34296
34297
34298
34299
34300
34301
34302
34303
34304
34305
34306
34307
34308
34309
34310
34311
34312
34313
34314
34315
34316
34317
34318
34319
34320
34321
34322
34323
34324
34325
34326
34327
34328
34329
34330
34331
34332
34333
34334
34335
34336
34337
34338
34339
34340
34341
34342
34343
34344
34345
34346
34347
34348
34349
34350
34351
34352
34353
34354
34355
34356
34357
34358
34359
34360
34361
34362
34363
34364
34365
34366
34367
34368
34369
34370
34371
34372
34373
34374
34375
34376
34377
34378
34379
34380
34381
34382
34383
34384
34385
34386
34387
34388
34389
34390
34391
34392
34393
34394
34395
34396
34397
34398
34399
34400
34401
34402
34403
34404
34405
34406
34407
34408
34409
34410
34411
34412
34413
34414
34415
34416
34417
34418
34419
34420
34421
34422
34423
34424
34425
34426
34427
34428
34429
34430
34431
34432
34433
34434
34435
34436
34437
34438
34439
34440
34441
34442
34443
34444
34445
34446
34447
34448
34449
34450
34451
34452
34453
34454
34455
34456
34457
34458
34459
34460
34461
34462
34463
34464
34465
34466
34467
34468
34469
34470
34471
34472
34473
34474
34475
34476
34477
34478
34479
34480
34481
34482
34483
34484
34485
34486
34487
34488
34489
34490
34491
34492
34493
34494
34495
34496
34497
34498
34499
34500
34501
34502
34503
34504
34505
34506
34507
34508
34509
34510
34511
34512
34513
34514
34515
34516
34517
34518
34519
34520
34521
34522
34523
34524
34525
34526
34527
34528
34529
34530
34531
34532
34533
34534
34535
34536
34537
34538
34539
34540
34541
34542
34543
34544
34545
34546
34547
34548
34549
34550
34551
34552
34553
34554
34555
34556
34557
34558
34559
34560
34561
34562
34563
34564
34565
34566
34567
34568
34569
34570
34571
34572
34573
34574
34575
34576
34577
34578
34579
34580
34581
34582
34583
34584
34585
34586
34587
34588
34589
34590
34591
34592
34593
34594
34595
34596
34597
34598
34599
34600
34601
34602
34603
34604
34605
34606
34607
34608
34609
34610
34611
34612
34613
34614
34615
34616
34617
34618
34619
34620
34621
34622
34623
34624
34625
34626
34627
34628
34629
34630
34631
34632
34633
34634
34635
34636
34637
34638
34639
34640
34641
34642
34643
34644
34645
34646
34647
34648
34649
34650
34651
34652
34653
34654
34655
34656
34657
34658
34659
34660
34661
34662
34663
34664
34665
34666
34667
34668
34669
34670
34671
34672
34673
34674
34675
34676
34677
34678
34679
34680
34681
34682
34683
34684
34685
34686
34687
34688
34689
34690
34691
34692
34693
34694
34695
34696
34697
34698
34699
34700
34701
34702
34703
34704
34705
34706
34707
34708
34709
34710
34711
34712
34713
34714
34715
34716
34717
34718
34719
34720
34721
34722
34723
34724
34725
34726
34727
34728
34729
34730
34731
34732
34733
34734
34735
34736
34737
34738
34739
34740
34741
34742
34743
34744
34745
34746
34747
34748
34749
34750
34751
34752
34753
34754
34755
34756
34757
34758
34759
34760
34761
34762
34763
34764
34765
34766
34767
34768
34769
34770
34771
34772
34773
34774
34775
34776
34777
34778
34779
34780
34781
34782
34783
34784
34785
34786
34787
34788
34789
34790
34791
34792
34793
34794
34795
34796
34797
34798
34799
34800
34801
34802
34803
34804
34805
34806
34807
34808
34809
34810
34811
34812
34813
34814
34815
34816
34817
34818
34819
34820
34821
34822
34823
34824
34825
34826
34827
34828
34829
34830
34831
34832
34833
34834
34835
34836
34837
34838
34839
34840
34841
34842
34843
34844
34845
34846
34847
34848
34849
34850
34851
34852
34853
34854
34855
34856
34857
34858
34859
34860
34861
34862
34863
34864
34865
34866
34867
34868
34869
34870
34871
34872
34873
34874
34875
34876
34877
34878
34879
34880
34881
34882
34883
34884
34885
34886
34887
34888
34889
34890
34891
34892
34893
34894
34895
34896
34897
34898
34899
34900
34901
34902
34903
34904
34905
34906
34907
34908
34909
34910
34911
34912
34913
34914
34915
34916
34917
34918
34919
34920
34921
34922
34923
34924
34925
34926
34927
34928
34929
34930
34931
34932
34933
34934
34935
34936
34937
34938
34939
34940
34941
34942
34943
34944
34945
34946
34947
34948
34949
34950
34951
34952
34953
34954
34955
34956
34957
34958
34959
34960
34961
34962
34963
34964
34965
34966
34967
34968
34969
34970
34971
34972
34973
34974
34975
34976
34977
34978
34979
34980
34981
34982
34983
34984
34985
34986
34987
34988
34989
34990
34991
34992
34993
34994
34995
34996
34997
34998
34999
35000
35001
35002
35003
35004
35005
35006
35007
35008
35009
35010
35011
35012
35013
35014
35015
35016
35017
35018
35019
35020
35021
35022
35023
35024
35025
35026
35027
35028
35029
35030
35031
35032
35033
35034
35035
35036
35037
35038
35039
35040
35041
35042
35043
35044
35045
35046
35047
35048
35049
35050
35051
35052
35053
35054
35055
35056
35057
35058
35059
35060
35061
35062
35063
35064
35065
35066
35067
35068
35069
35070
35071
35072
35073
35074
35075
35076
35077
35078
35079
35080
35081
35082
35083
35084
35085
35086
35087
35088
35089
35090
35091
35092
35093
35094
35095
35096
35097
35098
35099
35100
35101
35102
35103
35104
35105
35106
35107
35108
35109
35110
35111
35112
35113
35114
35115
35116
35117
35118
35119
35120
35121
35122
35123
35124
35125
35126
35127
35128
35129
35130
35131
35132
35133
35134
35135
35136
35137
35138
35139
35140
35141
35142
35143
35144
35145
35146
35147
35148
35149
35150
35151
35152
35153
35154
35155
35156
35157
35158
35159
35160
35161
35162
35163
35164
35165
35166
35167
35168
35169
35170
35171
35172
35173
35174
35175
35176
35177
35178
35179
35180
35181
35182
35183
35184
35185
35186
35187
35188
35189
35190
35191
35192
35193
35194
35195
35196
35197
35198
35199
35200
35201
35202
35203
35204
35205
35206
35207
35208
35209
35210
35211
35212
35213
35214
35215
35216
35217
35218
35219
35220
35221
35222
35223
35224
35225
35226
35227
35228
35229
35230
35231
35232
35233
35234
35235
35236
35237
35238
35239
35240
35241
35242
35243
35244
35245
35246
35247
35248
35249
35250
35251
35252
35253
35254
35255
35256
35257
35258
35259
35260
35261
35262
35263
35264
35265
35266
35267
35268
35269
35270
35271
35272
35273
35274
35275
35276
35277
35278
35279
35280
35281
35282
35283
35284
35285
35286
35287
35288
35289
35290
35291
35292
35293
35294
35295
35296
35297
35298
35299
35300
35301
35302
35303
35304
35305
35306
35307
35308
35309
35310
35311
35312
35313
35314
35315
35316
35317
35318
35319
35320
35321
35322
35323
35324
35325
35326
35327
35328
35329
35330
35331
35332
35333
35334
35335
35336
35337
35338
35339
35340
35341
35342
35343
35344
35345
35346
35347
35348
35349
35350
35351
35352
35353
35354
35355
35356
35357
35358
35359
35360
35361
35362
From: Nico Grunbaum <na-g@nostrum.com>
Date: Fri, 30 Apr 2021 21:51:00 +0000
Subject: Bug 1654112 - Add grit dep for building webrtc on android; r=mjf

Differential Revision: https://phabricator.services.mozilla.com/D114027
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/3cce5e6938f0df87bd9ab12a5f556aceb93dfa1d
---
 tools/grit/.gitignore                         |    1 +
 tools/grit/BUILD.gn                           |   48 +
 tools/grit/MANIFEST.in                        |    3 +
 tools/grit/OWNERS                             |    8 +
 tools/grit/PRESUBMIT.py                       |   22 +
 tools/grit/README.md                          |   19 +
 tools/grit/grit.py                            |   31 +
 tools/grit/grit/__init__.py                   |   19 +
 tools/grit/grit/clique.py                     |  491 +++
 tools/grit/grit/clique_unittest.py            |  265 ++
 tools/grit/grit/constants.py                  |   23 +
 tools/grit/grit/exception.py                  |  139 +
 tools/grit/grit/extern/BogoFP.py              |   22 +
 tools/grit/grit/extern/FP.py                  |   72 +
 tools/grit/grit/extern/__init__.py            |    0
 tools/grit/grit/extern/tclib.py               |  503 +++
 tools/grit/grit/format/__init__.py            |    8 +
 tools/grit/grit/format/android_xml.py         |  212 ++
 .../grit/grit/format/android_xml_unittest.py  |  149 +
 tools/grit/grit/format/c_format.py            |   95 +
 tools/grit/grit/format/c_format_unittest.py   |   81 +
 .../grit/grit/format/chrome_messages_json.py  |   59 +
 .../format/chrome_messages_json_unittest.py   |  190 +
 tools/grit/grit/format/data_pack.py           |  321 ++
 tools/grit/grit/format/data_pack_unittest.py  |  102 +
 .../grit/grit/format/gen_predetermined_ids.py |  144 +
 .../format/gen_predetermined_ids_unittest.py  |   46 +
 tools/grit/grit/format/gzip_string.py         |   46 +
 .../grit/grit/format/gzip_string_unittest.py  |   65 +
 tools/grit/grit/format/html_inline.py         |  602 ++++
 .../grit/grit/format/html_inline_unittest.py  |  927 +++++
 tools/grit/grit/format/minifier.py            |   45 +
 .../grit/grit/format/policy_templates_json.py |   26 +
 .../format/policy_templates_json_unittest.py  |  207 ++
 tools/grit/grit/format/rc.py                  |  474 +++
 tools/grit/grit/format/rc_header.py           |   48 +
 tools/grit/grit/format/rc_header_unittest.py  |  138 +
 tools/grit/grit/format/rc_unittest.py         |  415 +++
 tools/grit/grit/format/resource_map.py        |  159 +
 .../grit/grit/format/resource_map_unittest.py |  345 ++
 tools/grit/grit/gather/__init__.py            |    8 +
 tools/grit/grit/gather/admin_template.py      |   62 +
 .../grit/gather/admin_template_unittest.py    |  115 +
 tools/grit/grit/gather/chrome_html.py         |  377 ++
 .../grit/grit/gather/chrome_html_unittest.py  |  610 ++++
 tools/grit/grit/gather/chrome_scaled_image.py |  157 +
 .../gather/chrome_scaled_image_unittest.py    |  209 ++
 tools/grit/grit/gather/interface.py           |  172 +
 tools/grit/grit/gather/json_loader.py         |   27 +
 tools/grit/grit/gather/policy_json.py         |  325 ++
 .../grit/grit/gather/policy_json_unittest.py  |  347 ++
 tools/grit/grit/gather/rc.py                  |  343 ++
 tools/grit/grit/gather/rc_unittest.py         |  372 ++
 tools/grit/grit/gather/regexp.py              |   82 +
 tools/grit/grit/gather/skeleton_gatherer.py   |  149 +
 tools/grit/grit/gather/tr_html.py             |  743 ++++
 tools/grit/grit/gather/tr_html_unittest.py    |  524 +++
 tools/grit/grit/gather/txt.py                 |   38 +
 tools/grit/grit/gather/txt_unittest.py        |   35 +
 tools/grit/grit/grd_reader.py                 |  238 ++
 tools/grit/grit/grd_reader_unittest.py        |  346 ++
 tools/grit/grit/grit-todo.xml                 |   62 +
 tools/grit/grit/grit_runner.py                |  334 ++
 tools/grit/grit/grit_runner_unittest.py       |   42 +
 tools/grit/grit/lazy_re.py                    |   46 +
 tools/grit/grit/lazy_re_unittest.py           |   40 +
 tools/grit/grit/node/__init__.py              |    8 +
 tools/grit/grit/node/base.py                  |  670 ++++
 tools/grit/grit/node/base_unittest.py         |  259 ++
 tools/grit/grit/node/brotli_util.py           |   29 +
 tools/grit/grit/node/custom/__init__.py       |    8 +
 tools/grit/grit/node/custom/filename.py       |   29 +
 .../grit/node/custom/filename_unittest.py     |   34 +
 tools/grit/grit/node/empty.py                 |   64 +
 tools/grit/grit/node/include.py               |  170 +
 tools/grit/grit/node/include_unittest.py      |  134 +
 tools/grit/grit/node/mapping.py               |   60 +
 tools/grit/grit/node/message.py               |  362 ++
 tools/grit/grit/node/message_unittest.py      |  380 ++
 tools/grit/grit/node/misc.py                  |  707 ++++
 tools/grit/grit/node/misc_unittest.py         |  590 ++++
 tools/grit/grit/node/mock_brotli.py           |   10 +
 tools/grit/grit/node/node_io.py               |  117 +
 tools/grit/grit/node/node_io_unittest.py      |  182 +
 tools/grit/grit/node/structure.py             |  375 ++
 tools/grit/grit/node/structure_unittest.py    |  178 +
 tools/grit/grit/node/variant.py               |   41 +
 tools/grit/grit/pseudo.py                     |  129 +
 tools/grit/grit/pseudo_rtl.py                 |  104 +
 tools/grit/grit/pseudo_unittest.py            |   55 +
 tools/grit/grit/shortcuts.py                  |   93 +
 tools/grit/grit/shortcuts_unittest.py         |   79 +
 tools/grit/grit/tclib.py                      |  246 ++
 tools/grit/grit/tclib_unittest.py             |  180 +
 tools/grit/grit/test_suite_all.py             |   34 +
 tools/grit/grit/testdata/GoogleDesktop.adm    |  945 +++++
 tools/grit/grit/testdata/README.txt           |   87 +
 tools/grit/grit/testdata/about.html           |   45 +
 tools/grit/grit/testdata/android.xml          |   24 +
 tools/grit/grit/testdata/bad_browser.html     |   16 +
 tools/grit/grit/testdata/browser.html         |   42 +
 tools/grit/grit/testdata/buildinfo.grd        |   46 +
 tools/grit/grit/testdata/cache_prefix.html    |   24 +
 .../grit/grit/testdata/cache_prefix_file.html |   25 +
 tools/grit/grit/testdata/chat_result.html     |   24 +
 .../chrome/app/generated_resources.grd        |  199 ++
 tools/grit/grit/testdata/chrome_html.html     |    6 +
 .../grit/testdata/default_100_percent/a.png   |  Bin 0 -> 159 bytes
 .../grit/testdata/default_100_percent/b.png   |    1 +
 tools/grit/grit/testdata/del_footer.html      |    8 +
 tools/grit/grit/testdata/del_header.html      |   60 +
 tools/grit/grit/testdata/deleted.html         |   21 +
 tools/grit/grit/testdata/depfile.grd          |   18 +
 tools/grit/grit/testdata/details.html         |   10 +
 .../grit/testdata/duplicate-name-input.xml    |   26 +
 tools/grit/grit/testdata/email_result.html    |   34 +
 tools/grit/grit/testdata/email_thread.html    |   10 +
 tools/grit/grit/testdata/error.html           |    8 +
 tools/grit/grit/testdata/explicit_web.html    |   11 +
 tools/grit/grit/testdata/footer.html          |   14 +
 .../grit/testdata/generated_resources_fr.xtb  | 3079 +++++++++++++++++
 .../grit/testdata/generated_resources_iw.xtb  |    4 +
 .../grit/testdata/generated_resources_no.xtb  |    4 +
 tools/grit/grit/testdata/grit_part.grdp       |    5 +
 tools/grit/grit/testdata/header.html          |   39 +
 tools/grit/grit/testdata/homepage.html        |   37 +
 tools/grit/grit/testdata/hover.html           |  177 +
 tools/grit/grit/testdata/include_test.html    |   31 +
 tools/grit/grit/testdata/included_sample.html |    1 +
 tools/grit/grit/testdata/indexing_speed.html  |   58 +
 tools/grit/grit/testdata/install_prefs.html   |   92 +
 tools/grit/grit/testdata/install_prefs2.html  |   52 +
 .../grit/testdata/klonk-alternate-skeleton.rc |  Bin 0 -> 1088 bytes
 tools/grit/grit/testdata/klonk.ico            |  Bin 0 -> 766 bytes
 tools/grit/grit/testdata/klonk.rc             |  Bin 0 -> 9824 bytes
 .../grit/grit/testdata/ko_oem_enable_bug.html |    1 +
 .../grit/testdata/ko_oem_non_admin_bug.html   |    1 +
 tools/grit/grit/testdata/mini.html            |   36 +
 tools/grit/grit/testdata/oem_enable.html      |  106 +
 tools/grit/grit/testdata/oem_non_admin.html   |   39 +
 tools/grit/grit/testdata/onebox.html          |   21 +
 tools/grit/grit/testdata/oneclick.html        |   34 +
 tools/grit/grit/testdata/password.html        |   37 +
 tools/grit/grit/testdata/preferences.html     |  234 ++
 tools/grit/grit/testdata/preprocess_test.html |    7 +
 tools/grit/grit/testdata/privacy.html         |   35 +
 tools/grit/grit/testdata/quit_apps.html       |   49 +
 tools/grit/grit/testdata/recrawl.html         |   30 +
 tools/grit/grit/testdata/resource_ids         |   13 +
 tools/grit/grit/testdata/script.html          |   38 +
 tools/grit/grit/testdata/searchbox.html       |   22 +
 tools/grit/grit/testdata/sidebar_h.html       |   82 +
 tools/grit/grit/testdata/sidebar_v.html       |  267 ++
 tools/grit/grit/testdata/simple-input.xml     |   52 +
 tools/grit/grit/testdata/simple.html          |    3 +
 tools/grit/grit/testdata/source.rc            |   57 +
 .../grit/testdata/special_100_percent/a.png   |  Bin 0 -> 159 bytes
 tools/grit/grit/testdata/status.html          |   44 +
 .../grit/testdata/structure_variables.html    |    4 +
 tools/grit/grit/testdata/substitute.grd       |   31 +
 tools/grit/grit/testdata/substitute.xmb       |   10 +
 .../grit/grit/testdata/substitute_no_ids.grd  |   31 +
 tools/grit/grit/testdata/substitute_tmpl.grd  |   31 +
 tools/grit/grit/testdata/test_css.css         |    1 +
 tools/grit/grit/testdata/test_html.html       |    1 +
 tools/grit/grit/testdata/test_js.js           |    1 +
 tools/grit/grit/testdata/test_svg.svg         |    1 +
 tools/grit/grit/testdata/test_text.txt        |    1 +
 tools/grit/grit/testdata/time_related.html    |   11 +
 tools/grit/grit/testdata/toolbar_about.html   |  138 +
 .../grit/testdata/tools/grit/resource_ids     |  176 +
 tools/grit/grit/testdata/transl.rc            |   56 +
 tools/grit/grit/testdata/versions.html        |    7 +
 tools/grit/grit/testdata/whitelist.txt        |    4 +
 .../grit/testdata/whitelist_resources.grd     |   54 +
 .../grit/grit/testdata/whitelist_strings.grd  |   23 +
 tools/grit/grit/tool/__init__.py              |    8 +
 tools/grit/grit/tool/android2grd.py           |  484 +++
 tools/grit/grit/tool/android2grd_unittest.py  |  181 +
 tools/grit/grit/tool/build.py                 |  556 +++
 tools/grit/grit/tool/build_unittest.py        |  341 ++
 tools/grit/grit/tool/buildinfo.py             |   78 +
 tools/grit/grit/tool/buildinfo_unittest.py    |   90 +
 tools/grit/grit/tool/count.py                 |   52 +
 tools/grit/grit/tool/diff_structures.py       |  119 +
 .../grit/tool/diff_structures_unittest.py     |   46 +
 tools/grit/grit/tool/interface.py             |   62 +
 tools/grit/grit/tool/menu_from_parts.py       |   79 +
 tools/grit/grit/tool/newgrd.py                |   85 +
 tools/grit/grit/tool/newgrd_unittest.py       |   51 +
 tools/grit/grit/tool/postprocess_interface.py |   29 +
 tools/grit/grit/tool/postprocess_unittest.py  |   64 +
 tools/grit/grit/tool/preprocess_interface.py  |   25 +
 tools/grit/grit/tool/preprocess_unittest.py   |   50 +
 tools/grit/grit/tool/rc2grd.py                |  418 +++
 tools/grit/grit/tool/rc2grd_unittest.py       |  163 +
 tools/grit/grit/tool/resize.py                |  295 ++
 tools/grit/grit/tool/test.py                  |   24 +
 tools/grit/grit/tool/transl2tc.py             |  251 ++
 tools/grit/grit/tool/transl2tc_unittest.py    |  133 +
 tools/grit/grit/tool/unit.py                  |   43 +
 .../grit/tool/update_resource_ids/__init__.py |  305 ++
 .../grit/tool/update_resource_ids/assigner.py |  286 ++
 .../update_resource_ids/assigner_unittest.py  |  154 +
 .../grit/tool/update_resource_ids/common.py   |  101 +
 .../grit/tool/update_resource_ids/parser.py   |  231 ++
 .../grit/tool/update_resource_ids/reader.py   |   83 +
 tools/grit/grit/tool/xmb.py                   |  295 ++
 tools/grit/grit/tool/xmb_unittest.py          |  132 +
 tools/grit/grit/util.py                       |  691 ++++
 tools/grit/grit/util_unittest.py              |  118 +
 tools/grit/grit/xtb_reader.py                 |  140 +
 tools/grit/grit/xtb_reader_unittest.py        |  110 +
 tools/grit/grit_info.py                       |  173 +
 tools/grit/grit_rule.gni                      |  485 +++
 tools/grit/minify_with_uglify.py              |   44 +
 tools/grit/minimize_css.py                    |  105 +
 tools/grit/minimize_css_unittest.py           |   58 +
 tools/grit/pak_util.py                        |  223 ++
 tools/grit/repack.gni                         |  189 +
 tools/grit/setup.py                           |   46 +
 tools/grit/stamp_grit_sources.py              |   57 +
 tools/grit/third_party/six/LICENSE            |   18 +
 tools/grit/third_party/six/README             |   16 +
 tools/grit/third_party/six/README.chromium    |   13 +
 tools/grit/third_party/six/__init__.py        |  868 +++++
 226 files changed, 33440 insertions(+)
 create mode 100644 tools/grit/.gitignore
 create mode 100644 tools/grit/BUILD.gn
 create mode 100644 tools/grit/MANIFEST.in
 create mode 100644 tools/grit/OWNERS
 create mode 100644 tools/grit/PRESUBMIT.py
 create mode 100644 tools/grit/README.md
 create mode 100644 tools/grit/grit.py
 create mode 100644 tools/grit/grit/__init__.py
 create mode 100644 tools/grit/grit/clique.py
 create mode 100644 tools/grit/grit/clique_unittest.py
 create mode 100644 tools/grit/grit/constants.py
 create mode 100644 tools/grit/grit/exception.py
 create mode 100644 tools/grit/grit/extern/BogoFP.py
 create mode 100644 tools/grit/grit/extern/FP.py
 create mode 100644 tools/grit/grit/extern/__init__.py
 create mode 100644 tools/grit/grit/extern/tclib.py
 create mode 100644 tools/grit/grit/format/__init__.py
 create mode 100644 tools/grit/grit/format/android_xml.py
 create mode 100644 tools/grit/grit/format/android_xml_unittest.py
 create mode 100644 tools/grit/grit/format/c_format.py
 create mode 100644 tools/grit/grit/format/c_format_unittest.py
 create mode 100644 tools/grit/grit/format/chrome_messages_json.py
 create mode 100644 tools/grit/grit/format/chrome_messages_json_unittest.py
 create mode 100644 tools/grit/grit/format/data_pack.py
 create mode 100644 tools/grit/grit/format/data_pack_unittest.py
 create mode 100644 tools/grit/grit/format/gen_predetermined_ids.py
 create mode 100644 tools/grit/grit/format/gen_predetermined_ids_unittest.py
 create mode 100644 tools/grit/grit/format/gzip_string.py
 create mode 100644 tools/grit/grit/format/gzip_string_unittest.py
 create mode 100644 tools/grit/grit/format/html_inline.py
 create mode 100644 tools/grit/grit/format/html_inline_unittest.py
 create mode 100644 tools/grit/grit/format/minifier.py
 create mode 100644 tools/grit/grit/format/policy_templates_json.py
 create mode 100644 tools/grit/grit/format/policy_templates_json_unittest.py
 create mode 100644 tools/grit/grit/format/rc.py
 create mode 100644 tools/grit/grit/format/rc_header.py
 create mode 100644 tools/grit/grit/format/rc_header_unittest.py
 create mode 100644 tools/grit/grit/format/rc_unittest.py
 create mode 100644 tools/grit/grit/format/resource_map.py
 create mode 100644 tools/grit/grit/format/resource_map_unittest.py
 create mode 100644 tools/grit/grit/gather/__init__.py
 create mode 100644 tools/grit/grit/gather/admin_template.py
 create mode 100644 tools/grit/grit/gather/admin_template_unittest.py
 create mode 100644 tools/grit/grit/gather/chrome_html.py
 create mode 100644 tools/grit/grit/gather/chrome_html_unittest.py
 create mode 100644 tools/grit/grit/gather/chrome_scaled_image.py
 create mode 100644 tools/grit/grit/gather/chrome_scaled_image_unittest.py
 create mode 100644 tools/grit/grit/gather/interface.py
 create mode 100644 tools/grit/grit/gather/json_loader.py
 create mode 100644 tools/grit/grit/gather/policy_json.py
 create mode 100644 tools/grit/grit/gather/policy_json_unittest.py
 create mode 100644 tools/grit/grit/gather/rc.py
 create mode 100644 tools/grit/grit/gather/rc_unittest.py
 create mode 100644 tools/grit/grit/gather/regexp.py
 create mode 100644 tools/grit/grit/gather/skeleton_gatherer.py
 create mode 100644 tools/grit/grit/gather/tr_html.py
 create mode 100644 tools/grit/grit/gather/tr_html_unittest.py
 create mode 100644 tools/grit/grit/gather/txt.py
 create mode 100644 tools/grit/grit/gather/txt_unittest.py
 create mode 100644 tools/grit/grit/grd_reader.py
 create mode 100644 tools/grit/grit/grd_reader_unittest.py
 create mode 100644 tools/grit/grit/grit-todo.xml
 create mode 100644 tools/grit/grit/grit_runner.py
 create mode 100644 tools/grit/grit/grit_runner_unittest.py
 create mode 100644 tools/grit/grit/lazy_re.py
 create mode 100644 tools/grit/grit/lazy_re_unittest.py
 create mode 100644 tools/grit/grit/node/__init__.py
 create mode 100644 tools/grit/grit/node/base.py
 create mode 100644 tools/grit/grit/node/base_unittest.py
 create mode 100644 tools/grit/grit/node/brotli_util.py
 create mode 100644 tools/grit/grit/node/custom/__init__.py
 create mode 100644 tools/grit/grit/node/custom/filename.py
 create mode 100644 tools/grit/grit/node/custom/filename_unittest.py
 create mode 100644 tools/grit/grit/node/empty.py
 create mode 100644 tools/grit/grit/node/include.py
 create mode 100644 tools/grit/grit/node/include_unittest.py
 create mode 100644 tools/grit/grit/node/mapping.py
 create mode 100644 tools/grit/grit/node/message.py
 create mode 100644 tools/grit/grit/node/message_unittest.py
 create mode 100644 tools/grit/grit/node/misc.py
 create mode 100644 tools/grit/grit/node/misc_unittest.py
 create mode 100644 tools/grit/grit/node/mock_brotli.py
 create mode 100644 tools/grit/grit/node/node_io.py
 create mode 100644 tools/grit/grit/node/node_io_unittest.py
 create mode 100644 tools/grit/grit/node/structure.py
 create mode 100644 tools/grit/grit/node/structure_unittest.py
 create mode 100644 tools/grit/grit/node/variant.py
 create mode 100644 tools/grit/grit/pseudo.py
 create mode 100644 tools/grit/grit/pseudo_rtl.py
 create mode 100644 tools/grit/grit/pseudo_unittest.py
 create mode 100644 tools/grit/grit/shortcuts.py
 create mode 100644 tools/grit/grit/shortcuts_unittest.py
 create mode 100644 tools/grit/grit/tclib.py
 create mode 100644 tools/grit/grit/tclib_unittest.py
 create mode 100644 tools/grit/grit/test_suite_all.py
 create mode 100644 tools/grit/grit/testdata/GoogleDesktop.adm
 create mode 100644 tools/grit/grit/testdata/README.txt
 create mode 100644 tools/grit/grit/testdata/about.html
 create mode 100644 tools/grit/grit/testdata/android.xml
 create mode 100644 tools/grit/grit/testdata/bad_browser.html
 create mode 100644 tools/grit/grit/testdata/browser.html
 create mode 100644 tools/grit/grit/testdata/buildinfo.grd
 create mode 100644 tools/grit/grit/testdata/cache_prefix.html
 create mode 100644 tools/grit/grit/testdata/cache_prefix_file.html
 create mode 100644 tools/grit/grit/testdata/chat_result.html
 create mode 100644 tools/grit/grit/testdata/chrome/app/generated_resources.grd
 create mode 100644 tools/grit/grit/testdata/chrome_html.html
 create mode 100644 tools/grit/grit/testdata/default_100_percent/a.png
 create mode 100644 tools/grit/grit/testdata/default_100_percent/b.png
 create mode 100644 tools/grit/grit/testdata/del_footer.html
 create mode 100644 tools/grit/grit/testdata/del_header.html
 create mode 100644 tools/grit/grit/testdata/deleted.html
 create mode 100644 tools/grit/grit/testdata/depfile.grd
 create mode 100644 tools/grit/grit/testdata/details.html
 create mode 100644 tools/grit/grit/testdata/duplicate-name-input.xml
 create mode 100644 tools/grit/grit/testdata/email_result.html
 create mode 100644 tools/grit/grit/testdata/email_thread.html
 create mode 100644 tools/grit/grit/testdata/error.html
 create mode 100644 tools/grit/grit/testdata/explicit_web.html
 create mode 100644 tools/grit/grit/testdata/footer.html
 create mode 100644 tools/grit/grit/testdata/generated_resources_fr.xtb
 create mode 100644 tools/grit/grit/testdata/generated_resources_iw.xtb
 create mode 100644 tools/grit/grit/testdata/generated_resources_no.xtb
 create mode 100644 tools/grit/grit/testdata/grit_part.grdp
 create mode 100644 tools/grit/grit/testdata/header.html
 create mode 100644 tools/grit/grit/testdata/homepage.html
 create mode 100644 tools/grit/grit/testdata/hover.html
 create mode 100644 tools/grit/grit/testdata/include_test.html
 create mode 100644 tools/grit/grit/testdata/included_sample.html
 create mode 100644 tools/grit/grit/testdata/indexing_speed.html
 create mode 100644 tools/grit/grit/testdata/install_prefs.html
 create mode 100644 tools/grit/grit/testdata/install_prefs2.html
 create mode 100644 tools/grit/grit/testdata/klonk-alternate-skeleton.rc
 create mode 100644 tools/grit/grit/testdata/klonk.ico
 create mode 100644 tools/grit/grit/testdata/klonk.rc
 create mode 100644 tools/grit/grit/testdata/ko_oem_enable_bug.html
 create mode 100644 tools/grit/grit/testdata/ko_oem_non_admin_bug.html
 create mode 100644 tools/grit/grit/testdata/mini.html
 create mode 100644 tools/grit/grit/testdata/oem_enable.html
 create mode 100644 tools/grit/grit/testdata/oem_non_admin.html
 create mode 100644 tools/grit/grit/testdata/onebox.html
 create mode 100644 tools/grit/grit/testdata/oneclick.html
 create mode 100644 tools/grit/grit/testdata/password.html
 create mode 100644 tools/grit/grit/testdata/preferences.html
 create mode 100644 tools/grit/grit/testdata/preprocess_test.html
 create mode 100644 tools/grit/grit/testdata/privacy.html
 create mode 100644 tools/grit/grit/testdata/quit_apps.html
 create mode 100644 tools/grit/grit/testdata/recrawl.html
 create mode 100644 tools/grit/grit/testdata/resource_ids
 create mode 100644 tools/grit/grit/testdata/script.html
 create mode 100644 tools/grit/grit/testdata/searchbox.html
 create mode 100644 tools/grit/grit/testdata/sidebar_h.html
 create mode 100644 tools/grit/grit/testdata/sidebar_v.html
 create mode 100644 tools/grit/grit/testdata/simple-input.xml
 create mode 100644 tools/grit/grit/testdata/simple.html
 create mode 100644 tools/grit/grit/testdata/source.rc
 create mode 100644 tools/grit/grit/testdata/special_100_percent/a.png
 create mode 100644 tools/grit/grit/testdata/status.html
 create mode 100644 tools/grit/grit/testdata/structure_variables.html
 create mode 100644 tools/grit/grit/testdata/substitute.grd
 create mode 100644 tools/grit/grit/testdata/substitute.xmb
 create mode 100644 tools/grit/grit/testdata/substitute_no_ids.grd
 create mode 100644 tools/grit/grit/testdata/substitute_tmpl.grd
 create mode 100644 tools/grit/grit/testdata/test_css.css
 create mode 100644 tools/grit/grit/testdata/test_html.html
 create mode 100644 tools/grit/grit/testdata/test_js.js
 create mode 100644 tools/grit/grit/testdata/test_svg.svg
 create mode 100644 tools/grit/grit/testdata/test_text.txt
 create mode 100644 tools/grit/grit/testdata/time_related.html
 create mode 100644 tools/grit/grit/testdata/toolbar_about.html
 create mode 100644 tools/grit/grit/testdata/tools/grit/resource_ids
 create mode 100644 tools/grit/grit/testdata/transl.rc
 create mode 100644 tools/grit/grit/testdata/versions.html
 create mode 100644 tools/grit/grit/testdata/whitelist.txt
 create mode 100644 tools/grit/grit/testdata/whitelist_resources.grd
 create mode 100644 tools/grit/grit/testdata/whitelist_strings.grd
 create mode 100644 tools/grit/grit/tool/__init__.py
 create mode 100644 tools/grit/grit/tool/android2grd.py
 create mode 100644 tools/grit/grit/tool/android2grd_unittest.py
 create mode 100644 tools/grit/grit/tool/build.py
 create mode 100644 tools/grit/grit/tool/build_unittest.py
 create mode 100644 tools/grit/grit/tool/buildinfo.py
 create mode 100644 tools/grit/grit/tool/buildinfo_unittest.py
 create mode 100644 tools/grit/grit/tool/count.py
 create mode 100644 tools/grit/grit/tool/diff_structures.py
 create mode 100644 tools/grit/grit/tool/diff_structures_unittest.py
 create mode 100644 tools/grit/grit/tool/interface.py
 create mode 100644 tools/grit/grit/tool/menu_from_parts.py
 create mode 100644 tools/grit/grit/tool/newgrd.py
 create mode 100644 tools/grit/grit/tool/newgrd_unittest.py
 create mode 100644 tools/grit/grit/tool/postprocess_interface.py
 create mode 100644 tools/grit/grit/tool/postprocess_unittest.py
 create mode 100644 tools/grit/grit/tool/preprocess_interface.py
 create mode 100644 tools/grit/grit/tool/preprocess_unittest.py
 create mode 100644 tools/grit/grit/tool/rc2grd.py
 create mode 100644 tools/grit/grit/tool/rc2grd_unittest.py
 create mode 100644 tools/grit/grit/tool/resize.py
 create mode 100644 tools/grit/grit/tool/test.py
 create mode 100644 tools/grit/grit/tool/transl2tc.py
 create mode 100644 tools/grit/grit/tool/transl2tc_unittest.py
 create mode 100644 tools/grit/grit/tool/unit.py
 create mode 100644 tools/grit/grit/tool/update_resource_ids/__init__.py
 create mode 100644 tools/grit/grit/tool/update_resource_ids/assigner.py
 create mode 100644 tools/grit/grit/tool/update_resource_ids/assigner_unittest.py
 create mode 100644 tools/grit/grit/tool/update_resource_ids/common.py
 create mode 100644 tools/grit/grit/tool/update_resource_ids/parser.py
 create mode 100644 tools/grit/grit/tool/update_resource_ids/reader.py
 create mode 100644 tools/grit/grit/tool/xmb.py
 create mode 100644 tools/grit/grit/tool/xmb_unittest.py
 create mode 100644 tools/grit/grit/util.py
 create mode 100644 tools/grit/grit/util_unittest.py
 create mode 100644 tools/grit/grit/xtb_reader.py
 create mode 100644 tools/grit/grit/xtb_reader_unittest.py
 create mode 100644 tools/grit/grit_info.py
 create mode 100644 tools/grit/grit_rule.gni
 create mode 100644 tools/grit/minify_with_uglify.py
 create mode 100644 tools/grit/minimize_css.py
 create mode 100644 tools/grit/minimize_css_unittest.py
 create mode 100644 tools/grit/pak_util.py
 create mode 100644 tools/grit/repack.gni
 create mode 100644 tools/grit/setup.py
 create mode 100644 tools/grit/stamp_grit_sources.py
 create mode 100644 tools/grit/third_party/six/LICENSE
 create mode 100644 tools/grit/third_party/six/README
 create mode 100644 tools/grit/third_party/six/README.chromium
 create mode 100644 tools/grit/third_party/six/__init__.py

diff --git a/tools/grit/.gitignore b/tools/grit/.gitignore
new file mode 100644
index 0000000000..0d20b6487c
--- /dev/null
+++ b/tools/grit/.gitignore
@@ -0,0 +1 @@
+*.pyc
diff --git a/tools/grit/BUILD.gn b/tools/grit/BUILD.gn
new file mode 100644
index 0000000000..1cd3c75b55
--- /dev/null
+++ b/tools/grit/BUILD.gn
@@ -0,0 +1,48 @@
+# 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.
+
+# This target creates a stamp file that depends on all the sources in the grit
+# directory. By depending on this, a target can force itself to be rebuilt if
+# grit itself changes.
+
+import("//build/config/sanitizers/sanitizers.gni")
+
+action("grit_sources") {
+  depfile = "$target_out_dir/grit_sources.d"
+  script = "stamp_grit_sources.py"
+
+  inputs = [ "grit.py" ]
+
+  # Note that we can't call this "grit_sources.stamp" because that file is
+  # implicitly created by GN for script actions.
+  outputs = [ "$target_out_dir/grit_sources.script.stamp" ]
+
+  args = [
+    rebase_path("//tools/grit", root_build_dir),
+    rebase_path(outputs[0], root_build_dir),
+    rebase_path(depfile, root_build_dir),
+  ]
+}
+
+group("grit_python_unittests") {
+  testonly = true
+
+  data = [
+    "//testing/scripts/common.py",
+    "//testing/scripts/run_isolated_script_test.py",
+    "//testing/xvfb.py",
+    "//tools/grit/",
+    "//third_party/catapult/third_party/typ/",
+  ]
+}
+
+# See https://crbug.com/983200
+if (is_mac && is_asan) {
+  create_bundle("brotli_mac_asan_workaround") {
+    bundle_root_dir = "$target_out_dir/$target_name"
+    bundle_executable_dir = bundle_root_dir
+
+    public_deps = [ "//third_party/brotli:brotli($host_toolchain)" ]
+  }
+}
diff --git a/tools/grit/MANIFEST.in b/tools/grit/MANIFEST.in
new file mode 100644
index 0000000000..1cbff42400
--- /dev/null
+++ b/tools/grit/MANIFEST.in
@@ -0,0 +1,3 @@
+exclude grit/test_suite_all.py
+exclude grit/tool/test.py
+global-exclude *_unittest.py
diff --git a/tools/grit/OWNERS b/tools/grit/OWNERS
new file mode 100644
index 0000000000..6a8f447b82
--- /dev/null
+++ b/tools/grit/OWNERS
@@ -0,0 +1,8 @@
+agrieve@chromium.org
+flackr@chromium.org
+thakis@chromium.org
+thestig@chromium.org
+
+# Admin policy related grit tools.
+per-file *policy*=file://components/policy/tools/OWNERS
+per-file *admin_template*=file://components/policy/tools/OWNERS
diff --git a/tools/grit/PRESUBMIT.py b/tools/grit/PRESUBMIT.py
new file mode 100644
index 0000000000..03b7188551
--- /dev/null
+++ b/tools/grit/PRESUBMIT.py
@@ -0,0 +1,22 @@
+# Copyright (c) 2012 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.
+
+"""grit unittests presubmit script.
+
+See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts for
+details on the presubmit API built into gcl.
+"""
+
+
+def RunUnittests(input_api, output_api):
+  return input_api.canned_checks.RunUnitTests(input_api, output_api,
+      [input_api.os_path.join('grit', 'test_suite_all.py')])
+
+
+def CheckChangeOnUpload(input_api, output_api):
+  return RunUnittests(input_api, output_api)
+
+
+def CheckChangeOnCommit(input_api, output_api):
+  return RunUnittests(input_api, output_api)
diff --git a/tools/grit/README.md b/tools/grit/README.md
new file mode 100644
index 0000000000..b5c3f4b51b
--- /dev/null
+++ b/tools/grit/README.md
@@ -0,0 +1,19 @@
+# GRIT (Google Resource and Internationalization Tool)
+
+This is a tool for projects to manage resources and simplify the localization
+workflow.
+
+See the user guide for more details on using this project:
+https://dev.chromium.org/developers/tools-we-use-in-chromium/grit/grit-users-guide
+
+## History
+
+This code previously used to live at
+https://code.google.com/p/grit-i18n/source/checkout which still contains the
+project's history.  https://chromium.googlesource.com/external/grit-i18n/ is
+a git mirror of the SVN repository that's identical except for the last two
+commits.  The project is now developed in the Chromium project directly.
+
+There is a read-only mirror of just this directory at
+https://chromium.googlesource.com/chromium/src/tools/grit/ if you don't want to
+check out all of Chromium.
diff --git a/tools/grit/grit.py b/tools/grit/grit.py
new file mode 100644
index 0000000000..abd1ab6449
--- /dev/null
+++ b/tools/grit/grit.py
@@ -0,0 +1,31 @@
+#!/usr/bin/env python
+# Copyright (c) 2012 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.
+
+'''Bootstrapping for GRIT.
+'''
+
+from __future__ import print_function
+
+import os
+import sys
+
+import grit.grit_runner
+
+sys.path.append(
+    os.path.join(
+        os.path.dirname(os.path.dirname(os.path.abspath(__file__))),
+        'diagnosis'))
+try:
+  import crbug_1001171
+except ImportError:
+  crbug_1001171 = None
+
+
+if __name__ == '__main__':
+  if crbug_1001171:
+    with crbug_1001171.DumpStateOnLookupError():
+      sys.exit(grit.grit_runner.Main(sys.argv[1:]))
+  else:
+    sys.exit(grit.grit_runner.Main(sys.argv[1:]))
diff --git a/tools/grit/grit/__init__.py b/tools/grit/grit/__init__.py
new file mode 100644
index 0000000000..91ac9ee896
--- /dev/null
+++ b/tools/grit/grit/__init__.py
@@ -0,0 +1,19 @@
+# Copyright (c) 2012 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.
+
+'''Package 'grit'
+'''
+
+from __future__ import print_function
+
+import os
+import sys
+
+
+_CUR_DIR = os.path.abspath(os.path.dirname(__file__))
+_GRIT_DIR = os.path.dirname(_CUR_DIR)
+_THIRD_PARTY_DIR = os.path.join(_GRIT_DIR, 'third_party')
+
+if _THIRD_PARTY_DIR not in sys.path:
+  sys.path.insert(0, _THIRD_PARTY_DIR)
diff --git a/tools/grit/grit/clique.py b/tools/grit/grit/clique.py
new file mode 100644
index 0000000000..e7be3ec164
--- /dev/null
+++ b/tools/grit/grit/clique.py
@@ -0,0 +1,491 @@
+# Copyright (c) 2012 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.
+
+'''Collections of messages and their translations, called cliques.  Also
+collections of cliques (uber-cliques).
+'''
+
+from __future__ import print_function
+
+import re
+
+import six
+
+from grit import constants
+from grit import exception
+from grit import lazy_re
+from grit import pseudo
+from grit import pseudo_rtl
+from grit import tclib
+
+
+class UberClique(object):
+  '''A factory (NOT a singleton factory) for making cliques.  It has several
+  methods for working with the cliques created using the factory.
+  '''
+
+  def __init__(self):
+    # A map from message ID to list of cliques whose source messages have
+    # that ID.  This will contain all cliques created using this factory.
+    # Different messages can have the same ID because they have the
+    # same translateable portion and placeholder names, but occur in different
+    # places in the resource tree.
+    #
+    # Each list of cliques is kept sorted by description, to achieve
+    # stable results from the BestClique method, see below.
+    self.cliques_ = {}
+
+    # A map of clique IDs to list of languages to indicate translations where we
+    # fell back to English.
+    self.fallback_translations_ = {}
+
+    # A map of clique IDs to list of languages to indicate missing translations.
+    self.missing_translations_ = {}
+
+  def _AddMissingTranslation(self, lang, clique, is_error):
+    tl = self.fallback_translations_
+    if is_error:
+      tl = self.missing_translations_
+    id = clique.GetId()
+    if id not in tl:
+      tl[id] = {}
+    if lang not in tl[id]:
+      tl[id][lang] = 1
+
+  def HasMissingTranslations(self):
+    return len(self.missing_translations_) > 0
+
+  def MissingTranslationsReport(self):
+    '''Returns a string suitable for printing to report missing
+    and fallback translations to the user.
+    '''
+    def ReportTranslation(clique, langs):
+      text = clique.GetMessage().GetPresentableContent()
+      # The text 'error' (usually 'Error:' but we are conservative)
+      # can trigger some build environments (Visual Studio, we're
+      # looking at you) to consider invocation of grit to have failed,
+      # so we make sure never to output that word.
+      extract = re.sub(r'(?i)error', 'REDACTED', text[0:40])[0:40]
+      ellipsis = ''
+      if len(text) > 40:
+        ellipsis = '...'
+      langs_extract = langs[0:6]
+      describe_langs = ','.join(langs_extract)
+      if len(langs) > 6:
+        describe_langs += " and %d more" % (len(langs) - 6)
+      return "  %s \"%s%s\" %s" % (clique.GetId(), extract, ellipsis,
+                                   describe_langs)
+    lines = []
+    if len(self.fallback_translations_):
+      lines.append(
+        "WARNING: Fell back to English for the following translations:")
+      for (id, langs) in self.fallback_translations_.items():
+        lines.append(
+            ReportTranslation(self.cliques_[id][0], list(langs.keys())))
+    if len(self.missing_translations_):
+      lines.append("ERROR: The following translations are MISSING:")
+      for (id, langs) in self.missing_translations_.items():
+        lines.append(
+            ReportTranslation(self.cliques_[id][0], list(langs.keys())))
+    return '\n'.join(lines)
+
+  def MakeClique(self, message, translateable=True):
+    '''Create a new clique initialized  with a message.
+
+    Args:
+      message: tclib.Message()
+      translateable: True | False
+    '''
+    clique = MessageClique(self, message, translateable)
+
+    # Enable others to find this clique by its message ID
+    if message.GetId() in self.cliques_:
+      presentable_text = clique.GetMessage().GetPresentableContent()
+      if not message.HasAssignedId():
+        for c in self.cliques_[message.GetId()]:
+          assert c.GetMessage().GetPresentableContent() == presentable_text
+      self.cliques_[message.GetId()].append(clique)
+      # We need to keep each list of cliques sorted by description, to
+      # achieve stable results from the BestClique method, see below.
+      self.cliques_[message.GetId()].sort(
+          key=lambda c:c.GetMessage().GetDescription())
+    else:
+      self.cliques_[message.GetId()] = [clique]
+
+    return clique
+
+  def FindCliqueAndAddTranslation(self, translation, language):
+    '''Adds the specified translation to the clique with the source message
+    it is a translation of.
+
+    Args:
+      translation: tclib.Translation()
+      language: 'en' | 'fr' ...
+
+    Return:
+      True if the source message was found, otherwise false.
+    '''
+    if translation.GetId() in self.cliques_:
+      for clique in self.cliques_[translation.GetId()]:
+        clique.AddTranslation(translation, language)
+      return True
+    else:
+      return False
+
+  def BestClique(self, id):
+    '''Returns the "best" clique from a list of cliques.  All the cliques
+    must have the same ID.  The "best" clique is chosen in the following
+    order of preference:
+    - The first clique that has a non-ID-based description.
+    - If no such clique found, the first clique with an ID-based description.
+    - Otherwise the first clique.
+
+    This method is stable in terms of always returning a clique with
+    an identical description (on different runs of GRIT on the same
+    data) because self.cliques_ is sorted by description.
+    '''
+    clique_list = self.cliques_[id]
+    clique_with_id = None
+    clique_default = None
+    for clique in clique_list:
+      if not clique_default:
+        clique_default = clique
+
+      description = clique.GetMessage().GetDescription()
+      if description and len(description) > 0:
+        if not description.startswith('ID:'):
+          # this is the preferred case so we exit right away
+          return clique
+        elif not clique_with_id:
+          clique_with_id = clique
+    if clique_with_id:
+      return clique_with_id
+    else:
+      return clique_default
+
+  def BestCliquePerId(self):
+    '''Iterates over the list of all cliques and returns the best clique for
+    each ID.  This will be the first clique with a source message that has a
+    non-empty description, or an arbitrary clique if none of them has a
+    description.
+    '''
+    for id in self.cliques_:
+      yield self.BestClique(id)
+
+  def BestCliqueByOriginalText(self, text, meaning):
+    '''Finds the "best" (as in BestClique()) clique that has original text
+    'text' and meaning 'meaning'.  Returns None if there is no such clique.
+    '''
+    # If needed, this can be optimized by maintaining a map of
+    # fingerprints of original text+meaning to cliques.
+    for c in self.BestCliquePerId():
+      msg = c.GetMessage()
+      if msg.GetRealContent() == text and msg.GetMeaning() == meaning:
+        return msg
+    return None
+
+  def AllMessageIds(self):
+    '''Returns a list of all defined message IDs.
+    '''
+    return list(self.cliques_.keys())
+
+  def AllCliques(self):
+    '''Iterates over all cliques.  Note that this can return multiple cliques
+    with the same ID.
+    '''
+    for cliques in self.cliques_.values():
+      for c in cliques:
+        yield c
+
+  def GenerateXtbParserCallback(self, lang, debug=False):
+    '''Creates a callback function as required by grit.xtb_reader.Parse().
+    This callback will create Translation objects for each message from
+    the XTB that exists in this uberclique, and add them as translations for
+    the relevant cliques.  The callback will add translations to the language
+    specified by 'lang'
+
+    Args:
+      lang: 'fr'
+      debug: True | False
+    '''
+    def Callback(id, structure):
+      if id not in self.cliques_:
+        if debug:
+          print("Ignoring translation #%s" % id)
+        return
+
+      if debug:
+        print("Adding translation #%s" % id)
+
+      # We fetch placeholder information from the original message (the XTB file
+      # only contains placeholder names).
+      original_msg = self.BestClique(id).GetMessage()
+
+      translation = tclib.Translation(id=id)
+      for is_ph,text in structure:
+        if not is_ph:
+          translation.AppendText(text)
+        else:
+          found_placeholder = False
+          for ph in original_msg.GetPlaceholders():
+            if ph.GetPresentation() == text:
+              translation.AppendPlaceholder(tclib.Placeholder(
+                ph.GetPresentation(), ph.GetOriginal(), ph.GetExample()))
+              found_placeholder = True
+              break
+          if not found_placeholder:
+            raise exception.MismatchingPlaceholders(
+              'Translation for message ID %s had <ph name="%s"/>, no match\n'
+              'in original message' % (id, text))
+      self.FindCliqueAndAddTranslation(translation, lang)
+    return Callback
+
+
+class CustomType(object):
+  '''A base class you should implement if you wish to specify a custom type
+  for a message clique (i.e. custom validation and optional modification of
+  translations).'''
+
+  def Validate(self, message):
+    '''Returns true if the message (a tclib.Message object) is valid,
+    otherwise false.
+    '''
+    raise NotImplementedError()
+
+  def ValidateAndModify(self, lang, translation):
+    '''Returns true if the translation (a tclib.Translation object) is valid,
+    otherwise false.  The language is also passed in.  This method may modify
+    the translation that is passed in, if it so wishes.
+    '''
+    raise NotImplementedError()
+
+  def ModifyTextPart(self, lang, text):
+    '''If you call ModifyEachTextPart, it will turn around and call this method
+    for each text part of the translation.  You should return the modified
+    version of the text, or just the original text to not change anything.
+    '''
+    raise NotImplementedError()
+
+  def ModifyEachTextPart(self, lang, translation):
+    '''Call this to easily modify one or more of the textual parts of a
+    translation.  It will call ModifyTextPart for each part of the
+    translation.
+    '''
+    contents = translation.GetContent()
+    for ix in range(len(contents)):
+      if (isinstance(contents[ix], six.string_types)):
+        contents[ix] = self.ModifyTextPart(lang, contents[ix])
+
+
+class OneOffCustomType(CustomType):
+  '''A very simple custom type that performs the validation expressed by
+  the input expression on all languages including the source language.
+  The expression can access the variables 'lang', 'msg' and 'text()' where
+  'lang' is the language of 'msg', 'msg' is the message or translation being
+  validated and 'text()' returns the real contents of 'msg' (for shorthand).
+  '''
+  def __init__(self, expression):
+    self.expr = expression
+  def Validate(self, message):
+    return self.ValidateAndModify(MessageClique.source_language, message)
+  def ValidateAndModify(self, lang, msg):
+    def text():
+      return msg.GetRealContent()
+    return eval(self.expr, {},
+            {'lang' : lang,
+             'text' : text,
+             'msg' : msg,
+             })
+
+
+class MessageClique(object):
+  '''A message along with all of its translations.  Also code to bring
+  translations together with their original message.'''
+
+  # change this to the language code of Messages you add to cliques_.
+  # TODO(joi) Actually change this based on the <grit> node's source language
+  source_language = 'en'
+
+  # A constant translation we use when asked for a translation into the
+  # special language constants.CONSTANT_LANGUAGE.
+  CONSTANT_TRANSLATION = tclib.Translation(text='TTTTTT')
+
+  # A pattern to match messages that are empty or whitespace only.
+  WHITESPACE_MESSAGE = lazy_re.compile(r'^\s*$')
+
+  def __init__(self, uber_clique, message, translateable=True,
+               custom_type=None):
+    '''Create a new clique initialized with just a message.
+
+    Note that messages with a body comprised only of whitespace will implicitly
+    be marked non-translatable.
+
+    Args:
+      uber_clique: Our uber-clique (collection of cliques)
+      message: tclib.Message()
+      translateable: True | False
+      custom_type: instance of clique.CustomType interface
+    '''
+    # Our parent
+    self.uber_clique = uber_clique
+    # If not translateable, we only store the original message.
+    self.translateable = translateable
+
+    # We implicitly mark messages that have a whitespace-only body as
+    # non-translateable.
+    if MessageClique.WHITESPACE_MESSAGE.match(message.GetRealContent()):
+      self.translateable = False
+
+    # A mapping of language identifiers to tclib.BaseMessage and its
+    # subclasses (i.e. tclib.Message and tclib.Translation).
+    self.clique = { MessageClique.source_language : message }
+    # A list of the "shortcut groups" this clique is
+    # part of.  Within any given shortcut group, no shortcut key (e.g. &J)
+    # must appear more than once in each language for all cliques that
+    # belong to the group.
+    self.shortcut_groups = []
+    # An instance of the CustomType interface, or None.  If this is set, it will
+    # be used to validate the original message and translations thereof, and
+    # will also get a chance to modify translations of the message.
+    self.SetCustomType(custom_type)
+
+  def GetMessage(self):
+    '''Retrieves the tclib.Message that is the source for this clique.'''
+    return self.clique[MessageClique.source_language]
+
+  def GetId(self):
+    '''Retrieves the message ID of the messages in this clique.'''
+    return self.GetMessage().GetId()
+
+  def IsTranslateable(self):
+    return self.translateable
+
+  def AddToShortcutGroup(self, group):
+    self.shortcut_groups.append(group)
+
+  def SetCustomType(self, custom_type):
+    '''Makes this clique use custom_type for validating messages and
+    translations, and optionally modifying translations.
+    '''
+    self.custom_type = custom_type
+    if custom_type and not custom_type.Validate(self.GetMessage()):
+      raise exception.InvalidMessage(self.GetMessage().GetRealContent())
+
+  def MessageForLanguage(self, lang, pseudo_if_no_match=True,
+                         fallback_to_english=False):
+    '''Returns the message/translation for the specified language, providing
+    a pseudotranslation if there is no available translation and a pseudo-
+    translation is requested.
+
+    The translation of any message whatsoever in the special language
+    'x_constant' is the message "TTTTTT".
+
+    Args:
+      lang: 'en'
+      pseudo_if_no_match: True
+      fallback_to_english: False
+
+    Return:
+      tclib.BaseMessage
+    '''
+    if not self.translateable:
+      return self.GetMessage()
+
+    if lang == constants.CONSTANT_LANGUAGE:
+      return self.CONSTANT_TRANSLATION
+
+    for msglang in self.clique:
+      if lang == msglang:
+        return self.clique[msglang]
+
+    if lang == constants.FAKE_BIDI:
+      return pseudo_rtl.PseudoRTLMessage(self.GetMessage())
+
+    if fallback_to_english:
+      self.uber_clique._AddMissingTranslation(lang, self, is_error=False)
+      return self.GetMessage()
+
+    # If we're not supposed to generate pseudotranslations, we add an error
+    # report to a list of errors, then fail at a higher level, so that we
+    # get a list of all messages that are missing translations.
+    if not pseudo_if_no_match:
+      self.uber_clique._AddMissingTranslation(lang, self, is_error=True)
+
+    return pseudo.PseudoMessage(self.GetMessage())
+
+  def AllMessagesThatMatch(self, lang_re, include_pseudo = True):
+    '''Returns a map of all messages that match 'lang', including the pseudo
+    translation if requested.
+
+    Args:
+      lang_re: re.compile(r'fr|en')
+      include_pseudo: True
+
+    Return:
+      { 'en' : tclib.Message,
+        'fr' : tclib.Translation,
+        pseudo.PSEUDO_LANG : tclib.Translation }
+    '''
+    if not self.translateable:
+      return [self.GetMessage()]
+
+    matches = {}
+    for msglang in self.clique:
+      if lang_re.match(msglang):
+        matches[msglang] = self.clique[msglang]
+
+    if include_pseudo:
+      matches[pseudo.PSEUDO_LANG] = pseudo.PseudoMessage(self.GetMessage())
+
+    return matches
+
+  def AddTranslation(self, translation, language):
+    '''Add a translation to this clique.  The translation must have the same
+    ID as the message that is the source for this clique.
+
+    If this clique is not translateable, the function just returns.
+
+    Args:
+      translation: tclib.Translation()
+      language: 'en'
+
+    Throws:
+      grit.exception.InvalidTranslation if the translation you're trying to add
+      doesn't have the same message ID as the source message of this clique.
+    '''
+    if not self.translateable:
+      return
+    if translation.GetId() != self.GetId():
+      raise exception.InvalidTranslation(
+        'Msg ID %s, transl ID %s' % (self.GetId(), translation.GetId()))
+
+    assert not language in self.clique
+
+    # Because two messages can differ in the original content of their
+    # placeholders yet share the same ID (because they are otherwise the
+    # same), the translation we are getting may have different original
+    # content for placeholders than our message, yet it is still the right
+    # translation for our message (because it is for the same ID).  We must
+    # therefore fetch the original content of placeholders from our original
+    # English message.
+    #
+    # See grit.clique_unittest.MessageCliqueUnittest.testSemiIdenticalCliques
+    # for a concrete explanation of why this is necessary.
+
+    original = self.MessageForLanguage(self.source_language, False)
+    if len(original.GetPlaceholders()) != len(translation.GetPlaceholders()):
+      print("ERROR: '%s' translation of message id %s does not match" %
+            (language, translation.GetId()))
+      assert False
+
+    transl_msg = tclib.Translation(id=self.GetId(),
+                                   text=translation.GetPresentableContent(),
+                                   placeholders=original.GetPlaceholders())
+
+    if (self.custom_type and
+        not self.custom_type.ValidateAndModify(language, transl_msg)):
+      print("WARNING: %s translation failed validation: %s" %
+            (language, transl_msg.GetId()))
+
+    self.clique[language] = transl_msg
diff --git a/tools/grit/grit/clique_unittest.py b/tools/grit/grit/clique_unittest.py
new file mode 100644
index 0000000000..7d2d7318ba
--- /dev/null
+++ b/tools/grit/grit/clique_unittest.py
@@ -0,0 +1,265 @@
+#!/usr/bin/env python
+# Copyright (c) 2012 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.
+
+'''Unit tests for grit.clique'''
+
+from __future__ import print_function
+
+import os
+import sys
+if __name__ == '__main__':
+  sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
+
+import re
+import unittest
+
+from six import StringIO
+
+from grit import clique
+from grit import exception
+from grit import pseudo
+from grit import tclib
+from grit import grd_reader
+from grit import util
+
+class MessageCliqueUnittest(unittest.TestCase):
+  def testClique(self):
+    factory = clique.UberClique()
+    msg = tclib.Message(text='Hello USERNAME, how are you?',
+                        placeholders=[
+                          tclib.Placeholder('USERNAME', '%s', 'Joi')])
+    c = factory.MakeClique(msg)
+
+    self.failUnless(c.GetMessage() == msg)
+    self.failUnless(c.GetId() == msg.GetId())
+
+    msg_fr = tclib.Translation(text='Bonjour USERNAME, comment ca va?',
+                               id=msg.GetId(), placeholders=[
+                                tclib.Placeholder('USERNAME', '%s', 'Joi')])
+    msg_de = tclib.Translation(text='Guten tag USERNAME, wie geht es dir?',
+                               id=msg.GetId(), placeholders=[
+                                tclib.Placeholder('USERNAME', '%s', 'Joi')])
+
+    c.AddTranslation(msg_fr, 'fr')
+    factory.FindCliqueAndAddTranslation(msg_de, 'de')
+
+    # sort() sorts lists in-place and does not return them
+    for lang in ('en', 'fr', 'de'):
+      self.failUnless(lang in c.clique)
+
+    self.failUnless(c.MessageForLanguage('fr').GetRealContent() ==
+                    msg_fr.GetRealContent())
+
+    try:
+      c.MessageForLanguage('zh-CN', False)
+      self.fail('Should have gotten exception')
+    except:
+      pass
+
+    self.failUnless(c.MessageForLanguage('zh-CN', True) != None)
+
+    rex = re.compile('fr|de|bingo')
+    self.failUnless(len(c.AllMessagesThatMatch(rex, False)) == 2)
+    self.failUnless(
+        c.AllMessagesThatMatch(rex, True)[pseudo.PSEUDO_LANG] is not None)
+
+  def testBestClique(self):
+    factory = clique.UberClique()
+    factory.MakeClique(tclib.Message(text='Alfur', description='alfaholl'))
+    factory.MakeClique(tclib.Message(text='Alfur', description=''))
+    factory.MakeClique(tclib.Message(text='Vaettur', description=''))
+    factory.MakeClique(tclib.Message(text='Vaettur', description=''))
+    factory.MakeClique(tclib.Message(text='Troll', description=''))
+    factory.MakeClique(tclib.Message(text='Gryla', description='ID: IDS_GRYLA'))
+    factory.MakeClique(tclib.Message(text='Gryla', description='vondakerling'))
+    factory.MakeClique(tclib.Message(text='Leppaludi', description='ID: IDS_LL'))
+    factory.MakeClique(tclib.Message(text='Leppaludi', description=''))
+
+    count_best_cliques = 0
+    for c in factory.BestCliquePerId():
+      count_best_cliques += 1
+      msg = c.GetMessage()
+      text = msg.GetRealContent()
+      description = msg.GetDescription()
+      if text == 'Alfur':
+        self.failUnless(description == 'alfaholl')
+      elif text == 'Gryla':
+        self.failUnless(description == 'vondakerling')
+      elif text == 'Leppaludi':
+        self.failUnless(description == 'ID: IDS_LL')
+    self.failUnless(count_best_cliques == 5)
+
+  def testAllInUberClique(self):
+    resources = grd_reader.Parse(
+        StringIO(u'''<?xml version="1.0" encoding="UTF-8"?>
+<grit latest_public_release="2" source_lang_id="en-US" current_release="3" base_dir=".">
+  <release seq="3">
+    <messages>
+      <message name="IDS_GREETING" desc="Printed to greet the currently logged in user">
+        Hello <ph name="USERNAME">%s<ex>Joi</ex></ph>, how are you doing today?
+      </message>
+    </messages>
+    <structures>
+      <structure type="dialog" name="IDD_ABOUTBOX" encoding="utf-16" file="grit/testdata/klonk.rc" />
+      <structure type="tr_html" name="ID_HTML" file="grit/testdata/simple.html" />
+    </structures>
+  </release>
+</grit>'''), util.PathFromRoot('.'))
+    resources.SetOutputLanguage('en')
+    resources.RunGatherers()
+    content_list = []
+    for clique_list in resources.UberClique().cliques_.values():
+      for clique in clique_list:
+        content_list.append(clique.GetMessage().GetRealContent())
+    self.failUnless('Hello %s, how are you doing today?' in content_list)
+    self.failUnless('Jack "Black" Daniels' in content_list)
+    self.failUnless('Hello!' in content_list)
+
+  def testCorrectExceptionIfWrongEncodingOnResourceFile(self):
+    '''This doesn't really belong in this unittest file, but what the heck.'''
+    resources = grd_reader.Parse(
+        StringIO(u'''<?xml version="1.0" encoding="UTF-8"?>
+<grit latest_public_release="2" source_lang_id="en-US" current_release="3" base_dir=".">
+  <release seq="3">
+    <structures>
+      <structure type="dialog" name="IDD_ABOUTBOX" file="grit/testdata/klonk.rc" />
+    </structures>
+  </release>
+</grit>'''), util.PathFromRoot('.'))
+    self.assertRaises(exception.SectionNotFound, resources.RunGatherers)
+
+  def testSemiIdenticalCliques(self):
+    messages = [
+      tclib.Message(text='Hello USERNAME',
+                    placeholders=[tclib.Placeholder('USERNAME', '$1', 'Joi')]),
+      tclib.Message(text='Hello USERNAME',
+                    placeholders=[tclib.Placeholder('USERNAME', '%s', 'Joi')]),
+    ]
+    self.failUnless(messages[0].GetId() == messages[1].GetId())
+
+    # Both of the above would share a translation.
+    translation = tclib.Translation(id=messages[0].GetId(),
+                                    text='Bonjour USERNAME',
+                                    placeholders=[tclib.Placeholder(
+                                      'USERNAME', '$1', 'Joi')])
+
+    factory = clique.UberClique()
+    cliques = [factory.MakeClique(msg) for msg in messages]
+
+    for clq in cliques:
+      clq.AddTranslation(translation, 'fr')
+
+    self.failUnless(cliques[0].MessageForLanguage('fr').GetRealContent() ==
+                    'Bonjour $1')
+    self.failUnless(cliques[1].MessageForLanguage('fr').GetRealContent() ==
+                    'Bonjour %s')
+
+  def testMissingTranslations(self):
+    messages = [ tclib.Message(text='Hello'), tclib.Message(text='Goodbye') ]
+    factory = clique.UberClique()
+    cliques = [factory.MakeClique(msg) for msg in messages]
+
+    cliques[1].MessageForLanguage('fr', False, True)
+
+    self.failUnless(not factory.HasMissingTranslations())
+
+    cliques[0].MessageForLanguage('de', False, False)
+
+    self.failUnless(factory.HasMissingTranslations())
+
+    report = factory.MissingTranslationsReport()
+    self.failUnless(report.count('WARNING') == 1)
+    self.failUnless(report.count('8053599568341804890 "Goodbye" fr') == 1)
+    self.failUnless(report.count('ERROR') == 1)
+    self.failUnless(report.count('800120468867715734 "Hello" de') == 1)
+
+  def testCustomTypes(self):
+    factory = clique.UberClique()
+    message = tclib.Message(text='Bingo bongo')
+    c = factory.MakeClique(message)
+    try:
+      c.SetCustomType(DummyCustomType())
+      self.fail()
+    except:
+      pass  # expected case - 'Bingo bongo' does not start with 'jjj'
+
+    message = tclib.Message(text='jjjBingo bongo')
+    c = factory.MakeClique(message)
+    c.SetCustomType(util.NewClassInstance(
+      'grit.clique_unittest.DummyCustomType', clique.CustomType))
+    translation = tclib.Translation(id=message.GetId(), text='Bilingo bolongo')
+    c.AddTranslation(translation, 'fr')
+    self.failUnless(c.MessageForLanguage('fr').GetRealContent().startswith('jjj'))
+
+  def testWhitespaceMessagesAreNontranslateable(self):
+    factory = clique.UberClique()
+
+    message = tclib.Message(text=' \t')
+    c = factory.MakeClique(message, translateable=True)
+    self.failIf(c.IsTranslateable())
+
+    message = tclib.Message(text='\n \n ')
+    c = factory.MakeClique(message, translateable=True)
+    self.failIf(c.IsTranslateable())
+
+    message = tclib.Message(text='\n hello')
+    c = factory.MakeClique(message, translateable=True)
+    self.failUnless(c.IsTranslateable())
+
+  def testEachCliqueKeptSorted(self):
+    factory = clique.UberClique()
+    msg_a = tclib.Message(text='hello', description='a')
+    msg_b = tclib.Message(text='hello', description='b')
+    msg_c = tclib.Message(text='hello', description='c')
+    # Insert out of order
+    clique_b = factory.MakeClique(msg_b, translateable=True)
+    clique_a = factory.MakeClique(msg_a, translateable=True)
+    clique_c = factory.MakeClique(msg_c, translateable=True)
+    clique_list = factory.cliques_[clique_a.GetId()]
+    self.failUnless(len(clique_list) == 3)
+    self.failUnless(clique_list[0] == clique_a)
+    self.failUnless(clique_list[1] == clique_b)
+    self.failUnless(clique_list[2] == clique_c)
+
+  def testBestCliqueSortIsStable(self):
+    factory = clique.UberClique()
+    text = 'hello'
+    msg_no_description = tclib.Message(text=text)
+    msg_id_description_a = tclib.Message(text=text, description='ID: a')
+    msg_id_description_b = tclib.Message(text=text, description='ID: b')
+    msg_description_x = tclib.Message(text=text, description='x')
+    msg_description_y = tclib.Message(text=text, description='y')
+    clique_id = msg_no_description.GetId()
+
+    # Insert in an order that tests all outcomes.
+    clique_no_description = factory.MakeClique(msg_no_description,
+                                               translateable=True)
+    self.failUnless(factory.BestClique(clique_id) == clique_no_description)
+    clique_id_description_b = factory.MakeClique(msg_id_description_b,
+                                                 translateable=True)
+    self.failUnless(factory.BestClique(clique_id) == clique_id_description_b)
+    clique_id_description_a = factory.MakeClique(msg_id_description_a,
+                                                 translateable=True)
+    self.failUnless(factory.BestClique(clique_id) == clique_id_description_a)
+    clique_description_y = factory.MakeClique(msg_description_y,
+                                              translateable=True)
+    self.failUnless(factory.BestClique(clique_id) == clique_description_y)
+    clique_description_x = factory.MakeClique(msg_description_x,
+                                              translateable=True)
+    self.failUnless(factory.BestClique(clique_id) == clique_description_x)
+
+
+class DummyCustomType(clique.CustomType):
+  def Validate(self, message):
+    return message.GetRealContent().startswith('jjj')
+  def ValidateAndModify(self, lang, translation):
+    is_ok = self.Validate(translation)
+    self.ModifyEachTextPart(lang, translation)
+  def ModifyTextPart(self, lang, text):
+    return 'jjj%s' % text
+
+
+if __name__ == '__main__':
+  unittest.main()
diff --git a/tools/grit/grit/constants.py b/tools/grit/grit/constants.py
new file mode 100644
index 0000000000..8229c94b09
--- /dev/null
+++ b/tools/grit/grit/constants.py
@@ -0,0 +1,23 @@
+# Copyright (c) 2012 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.
+
+'''Constant definitions for GRIT.
+'''
+
+from __future__ import print_function
+
+# This is the Icelandic noun meaning "grit" and is used to check that our
+# input files are in the correct encoding.  The middle character gets encoded
+# as two bytes in UTF-8, so this is sufficient to detect incorrect encoding.
+ENCODING_CHECK = u'm\u00f6l'
+
+# A special language, translations into which are always "TTTTTT".
+CONSTANT_LANGUAGE = 'x_constant'
+
+FAKE_BIDI = 'fake-bidi'
+
+# Magic number added to the header of resources brotli compressed by grit. Used
+# to easily identify resources as being brotli compressed. See
+# ui/base/resource/resource_bundle.h for decompression usage.
+BROTLI_CONST = b'\x1e\x9b'
diff --git a/tools/grit/grit/exception.py b/tools/grit/grit/exception.py
new file mode 100644
index 0000000000..2a363fb077
--- /dev/null
+++ b/tools/grit/grit/exception.py
@@ -0,0 +1,139 @@
+# Copyright (c) 2012 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.
+
+'''Exception types for GRIT.
+'''
+
+from __future__ import print_function
+
+class Base(Exception):
+  '''A base exception that uses the class's docstring in addition to any
+  user-provided message as the body of the Base.
+  '''
+  def __init__(self, msg=''):
+    if len(msg):
+      if self.__doc__:
+        msg = self.__doc__ + ': ' + msg
+    else:
+      msg = self.__doc__
+    super(Base, self).__init__(msg)
+
+
+class Parsing(Base):
+  '''An error occurred parsing a GRD or XTB file.'''
+  pass
+
+
+class UnknownElement(Parsing):
+  '''An unknown node type was encountered.'''
+  pass
+
+
+class MissingElement(Parsing):
+  '''An expected element was missing.'''
+  pass
+
+
+class UnexpectedChild(Parsing):
+  '''An unexpected child element was encountered (on a leaf node).'''
+  pass
+
+
+class UnexpectedAttribute(Parsing):
+  '''The attribute was not expected'''
+  pass
+
+
+class UnexpectedContent(Parsing):
+  '''This element should not have content'''
+  pass
+
+class MissingMandatoryAttribute(Parsing):
+  '''This element is missing a mandatory attribute'''
+  pass
+
+
+class MutuallyExclusiveMandatoryAttribute(Parsing):
+  '''This element has 2 mutually exclusive mandatory attributes'''
+  pass
+
+
+class DuplicateKey(Parsing):
+  '''A duplicate key attribute was found.'''
+  pass
+
+
+class TooManyExamples(Parsing):
+  '''Only one <ex> element is allowed for each <ph> element.'''
+  pass
+
+
+class FileNotFound(Parsing):
+  '''The resource file was not found.'''
+  pass
+
+
+class InvalidMessage(Base):
+  '''The specified message failed validation.'''
+  pass
+
+
+class InvalidTranslation(Base):
+  '''Attempt to add an invalid translation to a clique.'''
+  pass
+
+
+class NoSuchTranslation(Base):
+  '''Requested translation not available'''
+  pass
+
+
+class NotReady(Base):
+  '''Attempt to use an object before it is ready, or attempt to translate \
+an empty document.'''
+  pass
+
+
+class MismatchingPlaceholders(Base):
+  '''Placeholders do not match.'''
+  pass
+
+
+class InvalidPlaceholderName(Base):
+  '''Placeholder name can only contain A-Z, a-z, 0-9 and underscore.'''
+  pass
+
+
+class BlockTagInTranslateableChunk(Base):
+  '''A block tag was encountered where it wasn't expected.'''
+  pass
+
+
+class SectionNotFound(Base):
+  '''The section you requested was not found in the RC file. Make \
+sure the section ID is correct (matches the section's ID in the RC file). \
+Also note that you may need to specify the RC file's encoding (using the \
+encoding="" attribute) if it is not in the default Windows-1252 encoding. \
+'''
+  pass
+
+
+class IdRangeOverlap(Base):
+  '''ID range overlap.'''
+  pass
+
+
+class ReservedHeaderCollision(Base):
+  '''Resource included with first 3 bytes matching reserved header.'''
+  pass
+
+
+class PlaceholderNotInsidePhNode(Base):
+  '''Placeholder formatters should be inside <ph> element.'''
+  pass
+
+
+class InvalidCharactersInsidePhNode(Base):
+  '''Invalid characters found inside <ph> element.'''
+  pass
diff --git a/tools/grit/grit/extern/BogoFP.py b/tools/grit/grit/extern/BogoFP.py
new file mode 100644
index 0000000000..fc90145833
--- /dev/null
+++ b/tools/grit/grit/extern/BogoFP.py
@@ -0,0 +1,22 @@
+# Copyright (c) 2012 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.
+
+"""Bogus fingerprint implementation, do not use for production,
+provided only as an example.
+
+Usage:
+    grit.py -h grit.extern.BogoFP xmb /tmp/foo
+"""
+
+from __future__ import print_function
+
+import grit.extern.FP
+
+
+def UnsignedFingerPrint(str, encoding='utf-8'):
+  """Generate a fingerprint not intended for production from str (it
+  reduces the precision of the production fingerprint by one bit).
+  """
+  return (0xFFFFF7FFFFFFFFFF &
+          grit.extern.FP._UnsignedFingerPrintImpl(str, encoding))
diff --git a/tools/grit/grit/extern/FP.py b/tools/grit/grit/extern/FP.py
new file mode 100644
index 0000000000..f4ec4d943f
--- /dev/null
+++ b/tools/grit/grit/extern/FP.py
@@ -0,0 +1,72 @@
+# Copyright (c) 2012 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.
+
+from __future__ import print_function
+
+try:
+  import hashlib
+  _new_md5 = hashlib.md5
+except ImportError:
+  import md5
+  _new_md5 = md5.new
+
+
+"""64-bit fingerprint support for strings.
+
+Usage:
+    from extern import FP
+    print('Fingerprint is %ld' % FP.FingerPrint('Hello world!'))
+"""
+
+
+def _UnsignedFingerPrintImpl(str, encoding='utf-8'):
+  """Generate a 64-bit fingerprint by taking the first half of the md5
+  of the string.
+  """
+  hex128 = _new_md5(str.encode(encoding)).hexdigest()
+  int64 = int(hex128[:16], 16)
+  return int64
+
+
+def UnsignedFingerPrint(str, encoding='utf-8'):
+  """Generate a 64-bit fingerprint.
+
+  The default implementation uses _UnsignedFingerPrintImpl, which
+  takes the first half of the md5 of the string, but the
+  implementation may be switched using SetUnsignedFingerPrintImpl.
+  """
+  return _UnsignedFingerPrintImpl(str, encoding)
+
+
+def FingerPrint(str, encoding='utf-8'):
+  fp = UnsignedFingerPrint(str, encoding=encoding)
+  # interpret fingerprint as signed longs
+  if fp & 0x8000000000000000:
+    fp = -((~fp & 0xFFFFFFFFFFFFFFFF) + 1)
+  return fp
+
+
+def UseUnsignedFingerPrintFromModule(module_name):
+  """Imports module_name and replaces UnsignedFingerPrint in the
+  current module with the function of the same name from the imported
+  module.
+
+  Returns the function object previously known as
+  grit.extern.FP.UnsignedFingerPrint.
+  """
+  hash_module = __import__(module_name, fromlist=[module_name])
+  return SetUnsignedFingerPrint(hash_module.UnsignedFingerPrint)
+
+
+def SetUnsignedFingerPrint(function_object):
+  """Sets grit.extern.FP.UnsignedFingerPrint to point to
+  function_object.
+
+  Returns the function object previously known as
+  grit.extern.FP.UnsignedFingerPrint.
+  """
+  global UnsignedFingerPrint
+  original_function_object = UnsignedFingerPrint
+  UnsignedFingerPrint = function_object
+  return original_function_object
diff --git a/tools/grit/grit/extern/__init__.py b/tools/grit/grit/extern/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/tools/grit/grit/extern/tclib.py b/tools/grit/grit/extern/tclib.py
new file mode 100644
index 0000000000..9952a87c11
--- /dev/null
+++ b/tools/grit/grit/extern/tclib.py
@@ -0,0 +1,503 @@
+# Copyright (c) 2012 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.
+
+# The tclib module contains tools for aggregating, verifying, and storing
+# messages destined for the Translation Console, as well as for reading
+# translations back and outputting them in some desired format.
+#
+# This has been stripped down to include only the functionality needed by grit
+# for creating Windows .rc and .h files.  These are the only parts needed by
+# the Chrome build process.
+
+from __future__ import print_function
+
+from grit.extern import FP
+
+# This module assumes that within a bundle no two messages can have the
+# same id unless they're identical.
+
+# The basic classes defined here for external use are Message and Translation,
+# where the former is used for English messages and the latter for
+# translations. These classes have a lot of common functionality, as expressed
+# by the common parent class BaseMessage. Perhaps the most important
+# distinction is that translated text is stored in UTF-8, whereas original text
+# is stored in whatever encoding the client uses (presumably Latin-1).
+
+# --------------------
+# The public interface
+# --------------------
+
+# Generate message id from message text and meaning string (optional),
+# both in utf-8 encoding
+#
+def GenerateMessageId(message, meaning=''):
+  fp = FP.FingerPrint(message)
+  if meaning:
+    # combine the fingerprints of message and meaning
+    fp2 = FP.FingerPrint(meaning)
+    if fp < 0:
+      fp = fp2 + (fp << 1) + 1
+    else:
+      fp = fp2 + (fp << 1)
+  # To avoid negative ids we strip the high-order bit
+  return str(fp & 0x7fffffffffffffff)
+
+# -------------------------------------------------------------------------
+# The MessageTranslationError class is used to signal tclib-specific errors.
+
+
+class MessageTranslationError(Exception):
+
+  def __init__(self, args = ''):
+    self.args = args
+
+
+# -----------------------------------------------------------
+# The Placeholder class represents a placeholder in a message.
+
+class Placeholder(object):
+  # String representation
+  def __str__(self):
+    return '%s, "%s", "%s"' % \
+           (self.__presentation, self.__original, self.__example)
+
+  # Getters
+  def GetOriginal(self):
+    return self.__original
+
+  def GetPresentation(self):
+    return self.__presentation
+
+  def GetExample(self):
+    return self.__example
+
+  def __eq__(self, other):
+    return self.EqualTo(other, strict=1, ignore_trailing_spaces=0)
+
+  # Equality test
+  #
+  # ignore_trailing_spaces: TC is using varchar to store the
+  # phrwr fields, as a result of that, the trailing spaces
+  # are removed by MySQL when the strings are stored into TC:-(
+  # ignore_trailing_spaces parameter is used to ignore
+  # trailing spaces during equivalence comparison.
+  #
+  def EqualTo(self, other, strict = 1, ignore_trailing_spaces = 1):
+    if type(other) is not Placeholder:
+      return 0
+    if StringEquals(self.__presentation, other.__presentation,
+                    ignore_trailing_spaces):
+      if not strict or (StringEquals(self.__original, other.__original,
+                                     ignore_trailing_spaces)  and
+                        StringEquals(self.__example, other.__example,
+                                     ignore_trailing_spaces)):
+        return 1
+    return 0
+
+
+# -----------------------------------------------------------------
+# BaseMessage is the common parent class of Message and Translation.
+# It is not meant for direct use.
+
+class BaseMessage(object):
+  # Three types of message construction is supported. If the message text is a
+  # simple string with no dynamic content, you can pass it to the constructor
+  # as the "text" parameter. Otherwise, you can omit "text" and assemble the
+  # message step by step using AppendText() and AppendPlaceholder(). Or, as an
+  # alternative, you can give the constructor the "presentable" version of the
+  # message and a list of placeholders; it will then parse the presentation and
+  # build the message accordingly. For example:
+  # Message(text = "There are NUM_BUGS bugs in your code",
+  #         placeholders = [Placeholder("NUM_BUGS", "%d", "33")],
+  #         description = "Bla bla bla")
+  def __eq__(self, other):
+    # "source encoding" is nonsense, so ignore it
+    return _ObjectEquals(self, other, ['_BaseMessage__source_encoding'])
+
+  def GetName(self):
+    return self.__name
+
+  def GetSourceEncoding(self):
+    return self.__source_encoding
+
+  # Append a placeholder to the message
+  def AppendPlaceholder(self, placeholder):
+    if not isinstance(placeholder, Placeholder):
+      raise MessageTranslationError("Invalid message placeholder %s in "
+                                    "message %s" % (placeholder, self.GetId()))
+    # Are there other placeholders with the same presentation?
+    # If so, they need to be the same.
+    for other in self.GetPlaceholders():
+      if placeholder.GetPresentation() == other.GetPresentation():
+        if not placeholder.EqualTo(other):
+          raise MessageTranslationError(
+              "Conflicting declarations of %s within message" %
+              placeholder.GetPresentation())
+    # update placeholder list
+    dup = 0
+    for item in self.__content:
+      if isinstance(item, Placeholder) and placeholder.EqualTo(item):
+        dup = 1
+        break
+    if not dup:
+      self.__placeholders.append(placeholder)
+
+    # update content
+    self.__content.append(placeholder)
+
+  # Strips leading and trailing whitespace, and returns a tuple
+  # containing the leading and trailing space that was removed.
+  def Strip(self):
+    leading = trailing = ''
+    if len(self.__content) > 0:
+      s0 = self.__content[0]
+      if not isinstance(s0, Placeholder):
+        s = s0.lstrip()
+        leading = s0[:-len(s)]
+        self.__content[0] = s
+
+      s0 = self.__content[-1]
+      if not isinstance(s0, Placeholder):
+        s = s0.rstrip()
+        trailing = s0[len(s):]
+        self.__content[-1] = s
+    return leading, trailing
+
+  # Return the id of this message
+  def GetId(self):
+    if self.__id is None:
+      return self.GenerateId()
+    return self.__id
+
+  # Set the id of this message
+  def SetId(self, id):
+    if id is None:
+      self.__id = None
+    else:
+      self.__id = str(id)  # Treat numerical ids as strings
+
+  # Return content of this message as a list (internal use only)
+  def GetContent(self):
+    return self.__content
+
+  # Return a human-readable version of this message
+  def GetPresentableContent(self):
+    presentable_content = ""
+    for item in self.__content:
+      if isinstance(item, Placeholder):
+        presentable_content += item.GetPresentation()
+      else:
+        presentable_content += item
+
+    return presentable_content
+
+  # Return a fragment of a message in escaped format
+  def EscapeFragment(self, fragment):
+    return fragment.replace('%', '%%')
+
+  # Return the "original" version of this message, doing %-escaping
+  # properly.  If source_msg is specified, the placeholder original
+  # information inside source_msg will be used instead.
+  def GetOriginalContent(self, source_msg = None):
+    original_content = ""
+    for item in self.__content:
+      if isinstance(item, Placeholder):
+        if source_msg:
+          ph = source_msg.GetPlaceholder(item.GetPresentation())
+          if not ph:
+            raise MessageTranslationError(
+                "Placeholder %s doesn't exist in message: %s" %
+                (item.GetPresentation(), source_msg))
+          original_content += ph.GetOriginal()
+        else:
+          original_content += item.GetOriginal()
+      else:
+        original_content += self.EscapeFragment(item)
+    return original_content
+
+  # Return the example of this message
+  def GetExampleContent(self):
+    example_content = ""
+    for item in self.__content:
+      if isinstance(item, Placeholder):
+        example_content += item.GetExample()
+      else:
+        example_content += item
+    return example_content
+
+  # Return a list of all unique placeholders in this message
+  def GetPlaceholders(self):
+    return self.__placeholders
+
+  # Return a placeholder in this message
+  def GetPlaceholder(self, presentation):
+    for item in self.__content:
+      if (isinstance(item, Placeholder) and
+          item.GetPresentation() == presentation):
+        return item
+    return None
+
+  # Return this message's description
+  def GetDescription(self):
+    return self.__description
+
+  # Add a message source
+  def AddSource(self, source):
+    self.__sources.append(source)
+
+  # Return this message's sources as a list
+  def GetSources(self):
+    return self.__sources
+
+  # Return this message's sources as a string
+  def GetSourcesAsText(self, delimiter = "; "):
+    return delimiter.join(self.__sources)
+
+  # Set the obsolete flag for a message (internal use only)
+  def SetObsolete(self):
+    self.__obsolete = 1
+
+  # Get the obsolete flag for a message (internal use only)
+  def IsObsolete(self):
+    return self.__obsolete
+
+  # Get the sequence number (0 by default)
+  def GetSequenceNumber(self):
+    return self.__sequence_number
+
+  # Set the sequence number
+  def SetSequenceNumber(self, number):
+    self.__sequence_number = number
+
+  # Increment instance counter
+  def AddInstance(self):
+    self.__num_instances += 1
+
+  # Return instance count
+  def GetNumInstances(self):
+    return self.__num_instances
+
+  def GetErrors(self, from_tc=0):
+    """
+    Returns a description of the problem if the message is not
+    syntactically valid, or None if everything is fine.
+
+    Args:
+      from_tc: indicates whether this message came from the TC. We let
+      the TC get away with some things we normally wouldn't allow for
+      historical reasons.
+    """
+    # check that placeholders are unambiguous
+    pos = 0
+    phs = {}
+    for item in self.__content:
+      if isinstance(item, Placeholder):
+        phs[pos] = item
+        pos += len(item.GetPresentation())
+      else:
+        pos += len(item)
+    presentation = self.GetPresentableContent()
+    for ph in self.GetPlaceholders():
+      for pos in FindOverlapping(presentation, ph.GetPresentation()):
+        # message contains the same text as a placeholder presentation
+        other_ph = phs.get(pos)
+        if ((not other_ph
+             and not IsSubstringInPlaceholder(pos, len(ph.GetPresentation()), phs))
+            or
+            (other_ph and len(other_ph.GetPresentation()) < len(ph.GetPresentation()))):
+          return  "message contains placeholder name '%s':\n%s" % (
+            ph.GetPresentation(), presentation)
+    return None
+
+
+  def __CopyTo(self, other):
+    """
+    Returns a copy of this BaseMessage.
+    """
+    assert isinstance(other,  self.__class__) or isinstance(self, other.__class__)
+    other.__source_encoding = self.__source_encoding
+    other.__content         = self.__content[:]
+    other.__description     = self.__description
+    other.__id              = self.__id
+    other.__num_instances   = self.__num_instances
+    other.__obsolete        = self.__obsolete
+    other.__name            = self.__name
+    other.__placeholders    = self.__placeholders[:]
+    other.__sequence_number = self.__sequence_number
+    other.__sources         = self.__sources[:]
+
+    return other
+
+  def HasText(self):
+    """Returns true iff this message has anything other than placeholders."""
+    for item in self.__content:
+      if not isinstance(item, Placeholder):
+        return True
+    return False
+
+# --------------------------------------------------------
+# The Message class represents original (English) messages
+
+class Message(BaseMessage):
+  # See BaseMessage constructor
+  def __init__(self, source_encoding, text=None, id=None,
+               description=None, meaning="", placeholders=None,
+               source=None, sequence_number=0, clone_from=None,
+               time_created=0, name=None, is_hidden = 0):
+
+    if clone_from is not None:
+      BaseMessage.__init__(self, None, clone_from=clone_from)
+      self.__meaning = clone_from.__meaning
+      self.__time_created = clone_from.__time_created
+      self.__is_hidden = clone_from.__is_hidden
+      return
+
+    BaseMessage.__init__(self, source_encoding, text, id, description,
+                         placeholders, source, sequence_number,
+                         name=name)
+    self.__meaning = meaning
+    self.__time_created = time_created
+    self.SetIsHidden(is_hidden)
+
+  # String representation
+  def __str__(self):
+    s = 'source: %s, id: %s, content: "%s", meaning: "%s", ' \
+        'description: "%s"' % \
+        (self.GetSourcesAsText(), self.GetId(), self.GetPresentableContent(),
+         self.__meaning, self.GetDescription())
+    if self.GetName() is not None:
+      s += ', name: "%s"' % self.GetName()
+    placeholders = self.GetPlaceholders()
+    for i in range(len(placeholders)):
+      s += ", placeholder[%d]: %s" % (i, placeholders[i])
+    return s
+
+  # Strips leading and trailing whitespace, and returns a tuple
+  # containing the leading and trailing space that was removed.
+  def Strip(self):
+    leading = trailing = ''
+    content = self.GetContent()
+    if len(content) > 0:
+      s0 = content[0]
+      if not isinstance(s0, Placeholder):
+        s = s0.lstrip()
+        leading = s0[:-len(s)]
+        content[0] = s
+
+      s0 = content[-1]
+      if not isinstance(s0, Placeholder):
+        s = s0.rstrip()
+        trailing = s0[len(s):]
+        content[-1] = s
+    return leading, trailing
+
+  # Generate an id by hashing message content
+  def GenerateId(self):
+    self.SetId(GenerateMessageId(self.GetPresentableContent(),
+                                 self.__meaning))
+    return self.GetId()
+
+  def GetMeaning(self):
+    return self.__meaning
+
+  def GetTimeCreated(self):
+    return self.__time_created
+
+  # Equality operator
+  def EqualTo(self, other, strict = 1):
+    # Check id, meaning, content
+    if self.GetId() != other.GetId():
+      return 0
+    if self.__meaning != other.__meaning:
+      return 0
+    if self.GetPresentableContent() != other.GetPresentableContent():
+      return 0
+    # Check descriptions if comparison is strict
+    if (strict and
+        self.GetDescription() is not None and
+        other.GetDescription() is not None and
+        self.GetDescription() != other.GetDescription()):
+      return 0
+    # Check placeholders
+    ph1 = self.GetPlaceholders()
+    ph2 = other.GetPlaceholders()
+    if len(ph1) != len(ph2):
+      return 0
+    for i in range(len(ph1)):
+      if not ph1[i].EqualTo(ph2[i], strict):
+        return 0
+
+    return 1
+
+  def Copy(self):
+    """
+    Returns a copy of this Message.
+    """
+    assert isinstance(self, Message)
+    return Message(None, clone_from=self)
+
+  def SetIsHidden(self, is_hidden):
+    """Sets whether this message should be hidden.
+
+    Args:
+      is_hidden : 0 or 1 - if the message should be hidden, 0 otherwise
+    """
+    if is_hidden not in [0, 1]:
+      raise MessageTranslationError("is_hidden must be 0 or 1, got %s")
+    self.__is_hidden = is_hidden
+
+  def IsHidden(self):
+    """Returns 1 if this message is hidden, and 0 otherwise."""
+    return self.__is_hidden
+
+# ----------------------------------------------------
+# The Translation class represents translated messages
+
+class Translation(BaseMessage):
+  # See BaseMessage constructor
+  def __init__(self, source_encoding, text=None, id=None,
+               description=None, placeholders=None, source=None,
+               sequence_number=0, clone_from=None, ignore_ph_errors=0,
+               name=None):
+    if clone_from is not None:
+      BaseMessage.__init__(self, None, clone_from=clone_from)
+      return
+
+    BaseMessage.__init__(self, source_encoding, text, id, description,
+                         placeholders, source, sequence_number,
+                         ignore_ph_errors=ignore_ph_errors, name=name)
+
+  # String representation
+  def __str__(self):
+    s = 'source: %s, id: %s, content: "%s", description: "%s"' % \
+        (self.GetSourcesAsText(), self.GetId(), self.GetPresentableContent(),
+         self.GetDescription());
+    placeholders = self.GetPlaceholders()
+    for i in range(len(placeholders)):
+      s += ", placeholder[%d]: %s" % (i, placeholders[i])
+    return s
+
+  # Equality operator
+  def EqualTo(self, other, strict=1):
+    # Check id and content
+    if self.GetId() != other.GetId():
+      return 0
+    if self.GetPresentableContent() != other.GetPresentableContent():
+      return 0
+    # Check placeholders
+    ph1 = self.GetPlaceholders()
+    ph2 = other.GetPlaceholders()
+    if len(ph1) != len(ph2):
+      return 0
+    for i in range(len(ph1)):
+      if not ph1[i].EqualTo(ph2[i], strict):
+        return 0
+
+    return 1
+
+  def Copy(self):
+    """
+    Returns a copy of this Translation.
+    """
+    return Translation(None, clone_from=self)
diff --git a/tools/grit/grit/format/__init__.py b/tools/grit/grit/format/__init__.py
new file mode 100644
index 0000000000..55d56b8cfd
--- /dev/null
+++ b/tools/grit/grit/format/__init__.py
@@ -0,0 +1,8 @@
+# Copyright (c) 2012 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.
+
+'''Module grit.format
+'''
+
+pass
diff --git a/tools/grit/grit/format/android_xml.py b/tools/grit/grit/format/android_xml.py
new file mode 100644
index 0000000000..7eb288891f
--- /dev/null
+++ b/tools/grit/grit/format/android_xml.py
@@ -0,0 +1,212 @@
+# Copyright (c) 2012 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.
+
+"""Produces localized strings.xml files for Android.
+
+In cases where an "android" type output file is requested in a grd, the classes
+in android_xml will process the messages and translations to produce a valid
+strings.xml that is properly localized with the specified language.
+
+For example if the following output tag were to be included in a grd file
+  <outputs>
+    ...
+    <output filename="values-es/strings.xml" type="android" lang="es" />
+    ...
+  </outputs>
+
+for a grd file with the following messages:
+
+  <message name="IDS_HELLO" desc="Simple greeting">Hello</message>
+  <message name="IDS_WORLD" desc="The world">world</message>
+
+and there existed an appropriate xtb file containing the Spanish translations,
+then the output would be:
+
+  <?xml version="1.0" encoding="utf-8"?>
+  <resources xmlns:android="http://schemas.android.com/apk/res/android">
+    <string name="hello">"Hola"</string>
+    <string name="world">"mundo"</string>
+  </resources>
+
+which would be written to values-es/strings.xml and usable by the Android
+resource framework.
+
+Advanced usage
+--------------
+
+To process only certain messages in a grd file, tag each desired message by
+adding "android_java" to formatter_data. Then set the environmental variable
+ANDROID_JAVA_TAGGED_ONLY to "true" when building the grd file. For example:
+
+  <message name="IDS_HELLO" formatter_data="android_java">Hello</message>
+
+To generate Android plurals (aka "quantity strings"), use the ICU plural syntax
+in the grd file. This will automatically be transformed into a <purals> element
+in the output xml file. For example:
+
+  <message name="IDS_CATS">
+    {NUM_CATS, plural,
+    =1 {1 cat}
+    other {# cats}}
+  </message>
+
+  will produce
+
+  <plurals name="cats">
+    <item quantity="one">1 Katze</item>
+    <item quantity="other">%d Katzen</item>
+  </plurals>
+"""
+
+from __future__ import print_function
+
+import os
+import re
+import xml.sax.saxutils
+
+from grit import lazy_re
+from grit.node import message
+
+
+# When this environmental variable has value "true", only tagged messages will
+# be outputted.
+_TAGGED_ONLY_ENV_VAR = 'ANDROID_JAVA_TAGGED_ONLY'
+_TAGGED_ONLY_DEFAULT = False
+
+# In tagged-only mode, only messages with this tag will be ouputted.
+_EMIT_TAG = 'android_java'
+
+_NAME_PATTERN = lazy_re.compile(r'IDS_(?P<name>[A-Z0-9_]+)\Z')
+
+# Most strings are output as a <string> element. Note the double quotes
+# around the value to preserve whitespace.
+_STRING_TEMPLATE = u'<string name="%s">"%s"</string>\n'
+
+# Some strings are output as a <plurals> element.
+_PLURALS_TEMPLATE = '<plurals name="%s">\n%s</plurals>\n'
+_PLURALS_ITEM_TEMPLATE = '  <item quantity="%s">%s</item>\n'
+
+# Matches e.g. "{HELLO, plural, HOW ARE YOU DOING}", while capturing
+# "HOW ARE YOU DOING" in <items>.
+_PLURALS_PATTERN = lazy_re.compile(r'\{[A-Z_]+,\s*plural,(?P<items>.*)\}$',
+                                   flags=re.S)
+
+# Repeatedly matched against the <items> capture in _PLURALS_PATTERN,
+# to match "<quantity>{<value>}".
+_PLURALS_ITEM_PATTERN = lazy_re.compile(r'(?P<quantity>\S+?)\s*'
+                                        r'\{(?P<value>.*?)\}')
+_PLURALS_QUANTITY_MAP = {
+  '=0': 'zero',
+  'zero': 'zero',
+  '=1': 'one',
+  'one': 'one',
+  '=2': 'two',
+  'two': 'two',
+  'few': 'few',
+  'many': 'many',
+  'other': 'other',
+}
+
+
+def Format(root, lang='en', output_dir='.'):
+  yield ('<?xml version="1.0" encoding="utf-8"?>\n'
+          '<resources '
+          'xmlns:android="http://schemas.android.com/apk/res/android">\n')
+
+  tagged_only = _TAGGED_ONLY_DEFAULT
+  if _TAGGED_ONLY_ENV_VAR in os.environ:
+    tagged_only = os.environ[_TAGGED_ONLY_ENV_VAR].lower()
+    if tagged_only == 'true':
+      tagged_only = True
+    elif tagged_only == 'false':
+      tagged_only = False
+    else:
+      raise Exception('env variable ANDROID_JAVA_TAGGED_ONLY must have value '
+                      'true or false. Invalid value: %s' % tagged_only)
+
+  for item in root.ActiveDescendants():
+    with item:
+      if ShouldOutputNode(item, tagged_only):
+        yield _FormatMessage(item, lang)
+
+  yield '</resources>\n'
+
+
+def ShouldOutputNode(node, tagged_only):
+  """Returns true if node should be outputted.
+
+  Args:
+      node: a Node from the grd dom
+      tagged_only: true, if only tagged messages should be outputted
+  """
+  return (isinstance(node, message.MessageNode) and
+          (not tagged_only or _EMIT_TAG in node.formatter_data))
+
+
+def _FormatPluralMessage(message):
+  """Compiles ICU plural syntax to the body of an Android <plurals> element.
+
+  1. In a .grd file, we can write a plural string like this:
+
+    <message name="IDS_THINGS">
+      {NUM_THINGS, plural,
+      =1 {1 thing}
+      other {# things}}
+    </message>
+
+  2. The Android equivalent looks like this:
+
+    <plurals name="things">
+      <item quantity="one">1 thing</item>
+      <item quantity="other">%d things</item>
+    </plurals>
+
+  This method takes the body of (1) and converts it to the body of (2).
+
+  If the message is *not* a plural string, this function returns `None`.
+  If the message includes quantities without an equivalent format in Android,
+  it raises an exception.
+  """
+  ret = {}
+  plural_match = _PLURALS_PATTERN.match(message)
+  if not plural_match:
+    return None
+  body_in = plural_match.group('items').strip()
+  lines = []
+  quantities_so_far = set()
+  for item_match in _PLURALS_ITEM_PATTERN.finditer(body_in):
+    quantity_in = item_match.group('quantity')
+    quantity_out = _PLURALS_QUANTITY_MAP.get(quantity_in)
+    value_in = item_match.group('value')
+    value_out = '"' + value_in.replace('#', '%d') + '"'
+    if quantity_out:
+      # only one line per quantity out (https://crbug.com/787488)
+      if quantity_out not in quantities_so_far:
+        quantities_so_far.add(quantity_out)
+        lines.append(_PLURALS_ITEM_TEMPLATE % (quantity_out, value_out))
+    else:
+      raise Exception('Unsupported plural quantity for android '
+                      'strings.xml: %s' % quantity_in)
+  return ''.join(lines)
+
+
+def _FormatMessage(item, lang):
+  """Writes out a single string as a <resource/> element."""
+
+  mangled_name = item.GetTextualIds()[0]
+  match = _NAME_PATTERN.match(mangled_name)
+  if not match:
+    raise Exception('Unexpected resource name: %s' % mangled_name)
+  name = match.group('name').lower()
+
+  value = item.ws_at_start + item.Translate(lang) + item.ws_at_end
+  # Replace < > & with &lt; &gt; &amp; to ensure we generate valid XML and
+  # replace ' " with \' \" to conform to Android's string formatting rules.
+  value = xml.sax.saxutils.escape(value, {"'": "\\'", '"': '\\"'})
+
+  plurals = _FormatPluralMessage(value)
+  if plurals:
+    return _PLURALS_TEMPLATE % (name, plurals)
+  else:
+    return _STRING_TEMPLATE % (name, value)
diff --git a/tools/grit/grit/format/android_xml_unittest.py b/tools/grit/grit/format/android_xml_unittest.py
new file mode 100644
index 0000000000..d9f476fddf
--- /dev/null
+++ b/tools/grit/grit/format/android_xml_unittest.py
@@ -0,0 +1,149 @@
+#!/usr/bin/env python
+# Copyright (c) 2012 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.
+
+"""Unittest for android_xml.py."""
+
+from __future__ import print_function
+
+import os
+import sys
+import unittest
+
+if __name__ == '__main__':
+  sys.path.append(os.path.join(os.path.dirname(__file__), '../..'))
+
+from six import StringIO
+
+from grit import util
+from grit.format import android_xml
+from grit.node import message
+from grit.tool import build
+
+
+class AndroidXmlUnittest(unittest.TestCase):
+
+  def testMessages(self):
+    root = util.ParseGrdForUnittest(r"""
+        <messages>
+          <message name="IDS_SIMPLE" desc="A vanilla string">
+            Martha
+          </message>
+          <message name="IDS_ONE_LINE" desc="On one line">sat and wondered</message>
+          <message name="IDS_QUOTES" desc="A string with quotation marks">
+            out loud, "Why don't I build a flying car?"
+          </message>
+          <message name="IDS_MULTILINE" desc="A string split over several lines">
+            She gathered
+wood, charcoal, and
+a sledge hammer.
+          </message>
+          <message name="IDS_WHITESPACE" desc="A string with extra whitespace.">
+            '''   How old fashioned  --  she thought. '''
+          </message>
+          <message name="IDS_PLACEHOLDERS" desc="A string with placeholders">
+            I'll buy a <ph name="WAVELENGTH">%d<ex>200</ex></ph> nm laser at <ph name="STORE_NAME">%s<ex>the grocery store</ex></ph>.
+          </message>
+          <message name="IDS_PLURALS" desc="A string using the ICU plural format">
+            {NUM_THINGS, plural,
+            =1 {Maybe I'll get one laser.}
+            other {Maybe I'll get # lasers.}}
+          </message>
+          <message name="IDS_PLURALS_NO_SPACE" desc="A string using the ICU plural format with no space">
+            {NUM_MISSISSIPPIS, plural,
+            =1{OneMississippi}other{ManyMississippis}}
+          </message>
+        </messages>
+        """)
+
+    buf = StringIO()
+    build.RcBuilder.ProcessNode(root, DummyOutput('android', 'en'), buf)
+    output = buf.getvalue()
+    expected = r"""
+<?xml version="1.0" encoding="utf-8"?>
+<resources xmlns:android="http://schemas.android.com/apk/res/android">
+<string name="simple">"Martha"</string>
+<string name="one_line">"sat and wondered"</string>
+<string name="quotes">"out loud, \"Why don\'t I build a flying car?\""</string>
+<string name="multiline">"She gathered
+wood, charcoal, and
+a sledge hammer."</string>
+<string name="whitespace">"   How old fashioned  --  she thought. "</string>
+<string name="placeholders">"I\'ll buy a %d nm laser at %s."</string>
+<plurals name="plurals">
+  <item quantity="one">"Maybe I\'ll get one laser."</item>
+  <item quantity="other">"Maybe I\'ll get %d lasers."</item>
+</plurals>
+<plurals name="plurals_no_space">
+  <item quantity="one">"OneMississippi"</item>
+  <item quantity="other">"ManyMississippis"</item>
+</plurals>
+</resources>
+"""
+    self.assertEqual(output.strip(), expected.strip())
+
+
+  def testConflictingPlurals(self):
+    root = util.ParseGrdForUnittest(r"""
+        <messages>
+          <message name="IDS_PLURALS" desc="A string using the ICU plural format">
+            {NUM_THINGS, plural,
+            =1 {Maybe I'll get one laser.}
+            one {Maybe I'll get one laser.}
+            other {Maybe I'll get # lasers.}}
+          </message>
+        </messages>
+        """)
+
+    buf = StringIO()
+    build.RcBuilder.ProcessNode(root, DummyOutput('android', 'en'), buf)
+    output = buf.getvalue()
+    expected = r"""
+<?xml version="1.0" encoding="utf-8"?>
+<resources xmlns:android="http://schemas.android.com/apk/res/android">
+<plurals name="plurals">
+  <item quantity="one">"Maybe I\'ll get one laser."</item>
+  <item quantity="other">"Maybe I\'ll get %d lasers."</item>
+</plurals>
+</resources>
+"""
+    self.assertEqual(output.strip(), expected.strip())
+
+
+  def testTaggedOnly(self):
+    root = util.ParseGrdForUnittest(r"""
+        <messages>
+          <message name="IDS_HELLO" desc="" formatter_data="android_java">
+            Hello
+          </message>
+          <message name="IDS_WORLD" desc="">
+            world
+          </message>
+        </messages>
+        """)
+
+    msg_hello, msg_world = root.GetChildrenOfType(message.MessageNode)
+    self.assertTrue(android_xml.ShouldOutputNode(msg_hello, tagged_only=True))
+    self.assertFalse(android_xml.ShouldOutputNode(msg_world, tagged_only=True))
+    self.assertTrue(android_xml.ShouldOutputNode(msg_hello, tagged_only=False))
+    self.assertTrue(android_xml.ShouldOutputNode(msg_world, tagged_only=False))
+
+
+class DummyOutput(object):
+
+  def __init__(self, type, language):
+    self.type = type
+    self.language = language
+
+  def GetType(self):
+    return self.type
+
+  def GetLanguage(self):
+    return self.language
+
+  def GetOutputFilename(self):
+    return 'hello.gif'
+
+if __name__ == '__main__':
+  unittest.main()
diff --git a/tools/grit/grit/format/c_format.py b/tools/grit/grit/format/c_format.py
new file mode 100644
index 0000000000..16809a9f70
--- /dev/null
+++ b/tools/grit/grit/format/c_format.py
@@ -0,0 +1,95 @@
+# Copyright (c) 2012 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.
+
+"""Formats as a .C file for compilation.
+"""
+
+from __future__ import print_function
+
+import codecs
+import os
+import re
+
+import six
+
+from grit import util
+
+
+def _FormatHeader(root, output_dir):
+  """Returns the required preamble for C files."""
+  # Find the location of the resource header file, so that we can include
+  # it.
+  resource_header = 'resource.h'  # fall back to this
+  for output in root.GetOutputFiles():
+    if output.attrs['type'] == 'rc_header':
+      resource_header = os.path.abspath(output.GetOutputFilename())
+      resource_header = util.MakeRelativePath(output_dir, resource_header)
+  return """// This file is automatically generated by GRIT.  Do not edit.
+
+#include "%s"
+
+// All strings are UTF-8
+""" % (resource_header)
+# end _FormatHeader() function
+
+
+def Format(root, lang='en', output_dir='.'):
+  """Outputs a C switch statement representing the string table."""
+  from grit.node import message
+  assert isinstance(lang, six.string_types)
+
+  yield _FormatHeader(root, output_dir)
+
+  yield 'const char* GetString(int id) {\n  switch (id) {'
+
+  for item in root.ActiveDescendants():
+    with item:
+      if isinstance(item, message.MessageNode):
+        yield _FormatMessage(item, lang)
+
+  yield '\n    default:\n      return 0;\n  }\n}\n'
+
+
+def _HexToOct(match):
+  "Return the octal form of the hex numbers"
+  hex = match.group("hex")
+  result = ""
+  while len(hex):
+    next_num = int(hex[2:4], 16)
+    result += "\\" + '%03o' % next_num
+    hex = hex[4:]
+  return match.group("escaped_backslashes") + result
+
+
+def _FormatMessage(item, lang):
+  """Format a single <message> element."""
+
+  message = item.ws_at_start + item.Translate(lang) + item.ws_at_end
+  # Output message with non-ascii chars escaped as octal numbers C's grammar
+  # allows escaped hexadecimal numbers to be infinite, but octal is always of
+  # the form \OOO.  Python 3 doesn't support string-escape, so we have to jump
+  # through some hoops here via codecs.escape_encode.
+  # This basically does:
+  #   - message - the starting string
+  #   - message.encode(...) - convert to bytes
+  #   - codecs.escape_encode(...) - convert non-ASCII bytes to \x## escapes
+  #   - (...).decode() - convert bytes back to a string
+  message = codecs.escape_encode(message.encode('utf-8'))[0].decode('utf-8')
+  # an escaped char is (\xHH)+ but only if the initial
+  # backslash is not escaped.
+  not_a_backslash = r"(^|[^\\])"  # beginning of line or a non-backslash char
+  escaped_backslashes = not_a_backslash + r"(\\\\)*"
+  hex_digits = r"((\\x)[0-9a-f]{2})+"
+  two_digit_hex_num = re.compile(
+    r"(?P<escaped_backslashes>%s)(?P<hex>%s)"
+    % (escaped_backslashes, hex_digits))
+  message = two_digit_hex_num.sub(_HexToOct, message)
+  # unescape \ (convert \\ back to \)
+  message = message.replace('\\\\', '\\')
+  message = message.replace('"', '\\"')
+  message = util.LINEBREAKS.sub(r'\\n', message)
+
+  name_attr = item.GetTextualIds()[0]
+
+  return '\n    case %s:\n      return "%s";' % (name_attr, message)
diff --git a/tools/grit/grit/format/c_format_unittest.py b/tools/grit/grit/format/c_format_unittest.py
new file mode 100644
index 0000000000..380120c42f
--- /dev/null
+++ b/tools/grit/grit/format/c_format_unittest.py
@@ -0,0 +1,81 @@
+#!/usr/bin/env python
+# Copyright (c) 2012 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.
+
+"""Unittest for c_format.py.
+"""
+
+from __future__ import print_function
+
+import os
+import sys
+if __name__ == '__main__':
+  sys.path.append(os.path.join(os.path.dirname(__file__), '../..'))
+
+import unittest
+
+from six import StringIO
+
+from grit import util
+from grit.tool import build
+
+
+class CFormatUnittest(unittest.TestCase):
+
+  def testMessages(self):
+    root = util.ParseGrdForUnittest(u"""
+    <messages>
+      <message name="IDS_QUESTIONS">Do you want to play questions?</message>
+      <message name="IDS_QUOTES">
+      "What's in a name, <ph name="NAME">%s<ex>Brandon</ex></ph>?"
+      </message>
+      <message name="IDS_LINE_BREAKS">
+          Was that rhetoric?
+No.
+Statement.  Two all.  Game point.
+</message>
+      <message name="IDS_NON_ASCII">
+         \u00f5\\xc2\\xa4\\\u00a4\\\\xc3\\xb5\u4924
+      </message>
+    </messages>
+      """)
+
+    buf = StringIO()
+    build.RcBuilder.ProcessNode(root, DummyOutput('c_format', 'en'), buf)
+    output = util.StripBlankLinesAndComments(buf.getvalue())
+    self.assertEqual(u"""\
+#include "resource.h"
+const char* GetString(int id) {
+  switch (id) {
+    case IDS_QUESTIONS:
+      return "Do you want to play questions?";
+    case IDS_QUOTES:
+      return "\\"What\\'s in a name, %s?\\"";
+    case IDS_LINE_BREAKS:
+      return "Was that rhetoric?\\nNo.\\nStatement.  Two all.  Game point.";
+    case IDS_NON_ASCII:
+      return "\\303\\265\\xc2\\xa4\\\\302\\244\\\\xc3\\xb5\\344\\244\\244";
+    default:
+      return 0;
+  }
+}""", output)
+
+
+class DummyOutput(object):
+
+  def __init__(self, type, language):
+    self.type = type
+    self.language = language
+
+  def GetType(self):
+    return self.type
+
+  def GetLanguage(self):
+    return self.language
+
+  def GetOutputFilename(self):
+    return 'hello.gif'
+
+if __name__ == '__main__':
+  unittest.main()
diff --git a/tools/grit/grit/format/chrome_messages_json.py b/tools/grit/grit/format/chrome_messages_json.py
new file mode 100644
index 0000000000..88ec1d914b
--- /dev/null
+++ b/tools/grit/grit/format/chrome_messages_json.py
@@ -0,0 +1,59 @@
+# Copyright (c) 2012 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.
+
+"""Formats as a .json file that can be used to localize Google Chrome
+extensions."""
+
+from __future__ import print_function
+
+from json import JSONEncoder
+
+from grit import constants
+from grit.node import message
+
+def Format(root, lang='en', output_dir='.'):
+  """Format the messages as JSON."""
+  yield '{'
+
+  encoder = JSONEncoder(ensure_ascii=False)
+  format = '"%s":{"message":%s%s}'
+  placeholder_format = '"%i":{"content":"$%i"}'
+  first = True
+  for child in root.ActiveDescendants():
+    if isinstance(child, message.MessageNode):
+      id = child.attrs['name']
+      if id.startswith('IDR_') or id.startswith('IDS_'):
+        id = id[4:]
+
+      translation_missing = child.GetCliques()[0].clique.get(lang) is None;
+      if (child.ShouldFallbackToEnglish() and translation_missing and
+          lang != constants.FAKE_BIDI):
+          # Skip the string if it's not translated. Chrome will fallback
+          # to English automatically.
+          continue
+
+      loc_message = encoder.encode(child.ws_at_start + child.Translate(lang) +
+                                   child.ws_at_end)
+
+      # Replace $n place-holders with $n$ and add an appropriate "placeholders"
+      # entry. Note that chrome.i18n.getMessage only supports 9 placeholders:
+      # https://developer.chrome.com/extensions/i18n#method-getMessage
+      placeholders = ''
+      for i in range(1, 10):
+        if loc_message.find('$%d' % i) == -1:
+          break
+        loc_message = loc_message.replace('$%d' % i, '$%d$' % i)
+        if placeholders:
+          placeholders += ','
+        placeholders += placeholder_format % (i, i)
+
+      if not first:
+        yield ','
+      first = False
+
+      if placeholders:
+        placeholders = ',"placeholders":{%s}' % placeholders
+      yield format % (id, loc_message, placeholders)
+
+  yield '}'
diff --git a/tools/grit/grit/format/chrome_messages_json_unittest.py b/tools/grit/grit/format/chrome_messages_json_unittest.py
new file mode 100644
index 0000000000..a54e6bdc1c
--- /dev/null
+++ b/tools/grit/grit/format/chrome_messages_json_unittest.py
@@ -0,0 +1,190 @@
+#!/usr/bin/env python
+# Copyright (c) 2012 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.
+
+"""Unittest for chrome_messages_json.py.
+"""
+
+from __future__ import print_function
+
+import json
+import os
+import sys
+if __name__ == '__main__':
+  sys.path.append(os.path.join(os.path.dirname(__file__), '../..'))
+
+import unittest
+
+from six import StringIO
+
+from grit import grd_reader
+from grit import util
+from grit.tool import build
+
+class ChromeMessagesJsonFormatUnittest(unittest.TestCase):
+
+  # The default unittest diff limit is too low for our unittests.
+  # Allow the framework to show the full diff output all the time.
+  maxDiff = None
+
+  def testMessages(self):
+    root = util.ParseGrdForUnittest(u"""
+    <messages>
+      <message name="IDS_SIMPLE_MESSAGE">
+              Simple message.
+      </message>
+      <message name="IDS_QUOTES">
+              element\u2019s \u201c<ph name="NAME">%s<ex>name</ex></ph>\u201d attribute
+      </message>
+      <message name="IDS_PLACEHOLDERS">
+              <ph name="ERROR_COUNT">%1$d<ex>1</ex></ph> error, <ph name="WARNING_COUNT">%2$d<ex>1</ex></ph> warning
+      </message>
+      <message name="IDS_PLACEHOLDERS_SUBSTITUTED_BY_GETMESSAGE">
+              <ph name="BEGIN">$1<ex>a</ex></ph>test<ph name="END">$2<ex>b</ex></ph>
+      </message>
+      <message name="IDS_STARTS_WITH_SPACE">
+              ''' (<ph name="COUNT">%d<ex>2</ex></ph>)
+      </message>
+      <message name="IDS_ENDS_WITH_SPACE">
+              (<ph name="COUNT">%d<ex>2</ex></ph>) '''
+      </message>
+      <message name="IDS_SPACE_AT_BOTH_ENDS">
+              ''' (<ph name="COUNT">%d<ex>2</ex></ph>) '''
+      </message>
+      <message name="IDS_DOUBLE_QUOTES">
+              A "double quoted" message.
+      </message>
+      <message name="IDS_BACKSLASH">
+              \\
+      </message>
+    </messages>
+    """)
+
+    buf = StringIO()
+    build.RcBuilder.ProcessNode(root, DummyOutput('chrome_messages_json', 'en'),
+                                buf)
+    output = buf.getvalue()
+    test = u"""
+{
+  "SIMPLE_MESSAGE": {
+    "message": "Simple message."
+  },
+  "QUOTES": {
+    "message": "element\u2019s \u201c%s\u201d attribute"
+  },
+  "PLACEHOLDERS": {
+    "message": "%1$d error, %2$d warning"
+  },
+  "PLACEHOLDERS_SUBSTITUTED_BY_GETMESSAGE": {
+    "message": "$1$test$2$",
+    "placeholders": {
+      "1": {
+        "content": "$1"
+      },
+      "2": {
+        "content": "$2"
+      }
+    }
+  },
+  "STARTS_WITH_SPACE": {
+    "message": " (%d)"
+  },
+  "ENDS_WITH_SPACE": {
+    "message": "(%d) "
+  },
+  "SPACE_AT_BOTH_ENDS": {
+    "message": " (%d) "
+  },
+  "DOUBLE_QUOTES": {
+    "message": "A \\"double quoted\\" message."
+  },
+  "BACKSLASH": {
+    "message": "\\\\"
+  }
+}
+"""
+    self.assertEqual(json.loads(test), json.loads(output))
+
+  def testTranslations(self):
+    root = util.ParseGrdForUnittest("""
+    <messages>
+        <message name="ID_HELLO">Hello!</message>
+        <message name="ID_HELLO_USER">Hello <ph name="USERNAME">%s<ex>
+          Joi</ex></ph></message>
+      </messages>
+    """)
+
+    buf = StringIO()
+    build.RcBuilder.ProcessNode(root, DummyOutput('chrome_messages_json', 'fr'),
+                                buf)
+    output = buf.getvalue()
+    test = u"""
+{
+  "ID_HELLO": {
+    "message": "H\u00e9P\u00e9ll\u00f4P\u00f4!"
+  },
+  "ID_HELLO_USER": {
+    "message": "H\u00e9P\u00e9ll\u00f4P\u00f4 %s"
+  }
+}
+"""
+    self.assertEqual(json.loads(test), json.loads(output))
+
+  def testSkipMissingTranslations(self):
+    grd = """<?xml version="1.0" encoding="UTF-8"?>
+<grit latest_public_release="2" current_release="3" source_lang_id="en"
+    base_dir="%s">
+  <outputs>
+  </outputs>
+  <release seq="3" allow_pseudo="False">
+    <messages fallback_to_english="true">
+      <message name="ID_HELLO_NO_TRANSLATION">Hello not translated</message>
+    </messages>
+  </release>
+</grit>"""
+    root = grd_reader.Parse(StringIO(grd), dir=".")
+
+    buf = StringIO()
+    build.RcBuilder.ProcessNode(root, DummyOutput('chrome_messages_json', 'fr'),
+                                buf)
+    output = buf.getvalue()
+    test = u'{}'
+    self.assertEqual(test, output)
+
+  def testVerifyMinification(self):
+    root = util.ParseGrdForUnittest(u"""
+    <messages>
+      <message name="IDS">
+        <ph name="BEGIN">$1<ex>a</ex></ph>test<ph name="END">$2<ex>b</ex></ph>
+      </message>
+    </messages>
+    """)
+
+    buf = StringIO()
+    build.RcBuilder.ProcessNode(root, DummyOutput('chrome_messages_json', 'en'),
+                                buf)
+    output = buf.getvalue()
+    test = (u'{"IDS":{"message":"$1$test$2$","placeholders":'
+            u'{"1":{"content":"$1"},"2":{"content":"$2"}}}}')
+    self.assertEqual(test, output)
+
+
+class DummyOutput(object):
+
+  def __init__(self, type, language):
+    self.type = type
+    self.language = language
+
+  def GetType(self):
+    return self.type
+
+  def GetLanguage(self):
+    return self.language
+
+  def GetOutputFilename(self):
+    return 'hello.gif'
+
+
+if __name__ == '__main__':
+  unittest.main()
diff --git a/tools/grit/grit/format/data_pack.py b/tools/grit/grit/format/data_pack.py
new file mode 100644
index 0000000000..f7128a4725
--- /dev/null
+++ b/tools/grit/grit/format/data_pack.py
@@ -0,0 +1,321 @@
+#!/usr/bin/env python
+# Copyright (c) 2012 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.
+
+"""Support for formatting a data pack file used for platform agnostic resource
+files.
+"""
+
+from __future__ import print_function
+
+import collections
+import os
+import struct
+import sys
+if __name__ == '__main__':
+  sys.path.append(os.path.join(os.path.dirname(__file__), '../..'))
+
+import six
+
+from grit import util
+from grit.node import include
+from grit.node import message
+from grit.node import structure
+
+
+PACK_FILE_VERSION = 5
+BINARY, UTF8, UTF16 = range(3)
+
+
+GrdInfoItem = collections.namedtuple('GrdInfoItem',
+                                     ['textual_id', 'id', 'path'])
+
+
+class WrongFileVersion(Exception):
+  pass
+
+
+class CorruptDataPack(Exception):
+  pass
+
+
+class DataPackSizes(object):
+  def __init__(self, header, id_table, alias_table, data):
+    self.header = header
+    self.id_table = id_table
+    self.alias_table = alias_table
+    self.data = data
+
+  @property
+  def total(self):
+    return sum(v for v in self.__dict__.values())
+
+  def __iter__(self):
+    yield ('header', self.header)
+    yield ('id_table', self.id_table)
+    yield ('alias_table', self.alias_table)
+    yield ('data', self.data)
+
+  def __eq__(self, other):
+    return self.__dict__ == other.__dict__
+
+  def __repr__(self):
+    return self.__class__.__name__ + repr(self.__dict__)
+
+
+class DataPackContents(object):
+  def __init__(self, resources, encoding, version, aliases, sizes):
+    # Map of resource_id -> str.
+    self.resources = resources
+    # Encoding (int).
+    self.encoding = encoding
+    # Version (int).
+    self.version = version
+    # Map of resource_id->canonical_resource_id
+    self.aliases = aliases
+    # DataPackSizes instance.
+    self.sizes = sizes
+
+
+def Format(root, lang='en', output_dir='.'):
+  """Writes out the data pack file format (platform agnostic resource file)."""
+  id_map = root.GetIdMap()
+  data = {}
+  root.info = []
+  for node in root.ActiveDescendants():
+    with node:
+      if isinstance(node, (include.IncludeNode, message.MessageNode,
+                           structure.StructureNode)):
+        value = node.GetDataPackValue(lang, util.BINARY)
+        if value is not None:
+          resource_id = id_map[node.GetTextualIds()[0]]
+          data[resource_id] = value
+          root.info.append('{},{},{}'.format(
+              node.attrs.get('name'), resource_id, node.source))
+  return WriteDataPackToString(data, UTF8)
+
+
+def ReadDataPack(input_file):
+  return ReadDataPackFromString(util.ReadFile(input_file, util.BINARY))
+
+
+def ReadDataPackFromString(data):
+  """Reads a data pack file and returns a dictionary."""
+  # Read the header.
+  version = struct.unpack('<I', data[:4])[0]
+  if version == 4:
+    resource_count, encoding = struct.unpack('<IB', data[4:9])
+    alias_count = 0
+    header_size = 9
+  elif version == 5:
+    encoding, resource_count, alias_count = struct.unpack('<BxxxHH', data[4:12])
+    header_size = 12
+  else:
+    raise WrongFileVersion('Found version: ' + str(version))
+
+  resources = {}
+  kIndexEntrySize = 2 + 4  # Each entry is a uint16 and a uint32.
+  def entry_at_index(idx):
+    offset = header_size + idx * kIndexEntrySize
+    return struct.unpack('<HI', data[offset:offset + kIndexEntrySize])
+
+  prev_resource_id, prev_offset = entry_at_index(0)
+  for i in range(1, resource_count + 1):
+    resource_id, offset = entry_at_index(i)
+    resources[prev_resource_id] = data[prev_offset:offset]
+    prev_resource_id, prev_offset = resource_id, offset
+
+  id_table_size = (resource_count + 1) * kIndexEntrySize
+  # Read the alias table.
+  kAliasEntrySize = 2 + 2  # uint16, uint16
+  def alias_at_index(idx):
+    offset = header_size + id_table_size + idx * kAliasEntrySize
+    return struct.unpack('<HH', data[offset:offset + kAliasEntrySize])
+
+  aliases = {}
+  for i in range(alias_count):
+    resource_id, index = alias_at_index(i)
+    aliased_id = entry_at_index(index)[0]
+    aliases[resource_id] = aliased_id
+    resources[resource_id] = resources[aliased_id]
+
+  alias_table_size = kAliasEntrySize * alias_count
+  sizes = DataPackSizes(
+      header_size, id_table_size, alias_table_size,
+      len(data) - header_size - id_table_size - alias_table_size)
+  assert sizes.total == len(data), 'original={} computed={}'.format(
+      len(data), sizes.total)
+  return DataPackContents(resources, encoding, version, aliases, sizes)
+
+
+def WriteDataPackToString(resources, encoding):
+  """Returns bytes with a map of id=>data in the data pack format."""
+  ret = []
+
+  # Compute alias map.
+  resource_ids = sorted(resources)
+  # Use reversed() so that for duplicates lower IDs clobber higher ones.
+  id_by_data = {resources[k]: k for k in reversed(resource_ids)}
+  # Map of resource_id -> resource_id, where value < key.
+  alias_map = {k: id_by_data[v] for k, v in resources.items()
+               if id_by_data[v] != k}
+
+  # Write file header.
+  resource_count = len(resources) - len(alias_map)
+  # Padding bytes added for alignment.
+  ret.append(struct.pack('<IBxxxHH', PACK_FILE_VERSION, encoding,
+                         resource_count, len(alias_map)))
+  HEADER_LENGTH = 4 + 4 + 2 + 2
+
+  # Each main table entry is: uint16 + uint32 (and an extra entry at the end).
+  # Each alias table entry is: uint16 + uint16.
+  data_offset = HEADER_LENGTH + (resource_count + 1) * 6 + len(alias_map) * 4
+
+  # Write main table.
+  index_by_id = {}
+  deduped_data = []
+  index = 0
+  for resource_id in resource_ids:
+    if resource_id in alias_map:
+      continue
+    data = resources[resource_id]
+    if isinstance(data, six.text_type):
+      data = data.encode('utf-8')
+    index_by_id[resource_id] = index
+    ret.append(struct.pack('<HI', resource_id, data_offset))
+    data_offset += len(data)
+    deduped_data.append(data)
+    index += 1
+
+  assert index == resource_count
+  # Add an extra entry at the end.
+  ret.append(struct.pack('<HI', 0, data_offset))
+
+  # Write alias table.
+  for resource_id in sorted(alias_map):
+    index = index_by_id[alias_map[resource_id]]
+    ret.append(struct.pack('<HH', resource_id, index))
+
+  # Write data.
+  ret.extend(deduped_data)
+  return b''.join(ret)
+
+
+def WriteDataPack(resources, output_file, encoding):
+  """Writes a map of id=>data into output_file as a data pack."""
+  content = WriteDataPackToString(resources, encoding)
+  with open(output_file, 'wb') as file:
+    file.write(content)
+
+
+def ReadGrdInfo(grd_file):
+  info_dict = {}
+  with open(grd_file + '.info', 'rt') as f:
+    for line in f:
+      item = GrdInfoItem._make(line.strip().split(','))
+      info_dict[int(item.id)] = item
+  return info_dict
+
+
+def RePack(output_file, input_files, whitelist_file=None,
+           suppress_removed_key_output=False,
+           output_info_filepath=None):
+  """Write a new data pack file by combining input pack files.
+
+  Args:
+      output_file: path to the new data pack file.
+      input_files: a list of paths to the data pack files to combine.
+      whitelist_file: path to the file that contains the list of resource IDs
+                      that should be kept in the output file or None to include
+                      all resources.
+      suppress_removed_key_output: allows the caller to suppress the output from
+                                   RePackFromDataPackStrings.
+      output_info_file: If not None, specify the output .info filepath.
+
+  Raises:
+      KeyError: if there are duplicate keys or resource encoding is
+      inconsistent.
+  """
+  input_data_packs = [ReadDataPack(filename) for filename in input_files]
+  input_info_files = [filename + '.info' for filename in input_files]
+  whitelist = None
+  if whitelist_file:
+    lines = util.ReadFile(whitelist_file, 'utf-8').strip().splitlines()
+    if not lines:
+      raise Exception('Whitelist file should not be empty')
+    whitelist = set(int(x) for x in lines)
+  inputs = [(p.resources, p.encoding) for p in input_data_packs]
+  resources, encoding = RePackFromDataPackStrings(
+      inputs, whitelist, suppress_removed_key_output)
+  WriteDataPack(resources, output_file, encoding)
+  if output_info_filepath is None:
+    output_info_filepath = output_file + '.info'
+  with open(output_info_filepath, 'w') as output_info_file:
+    for filename in input_info_files:
+      with open(filename, 'r') as info_file:
+        output_info_file.writelines(info_file.readlines())
+
+
+def RePackFromDataPackStrings(inputs, whitelist,
+                              suppress_removed_key_output=False):
+  """Combines all inputs into one.
+
+  Args:
+      inputs: a list of (resources_by_id, encoding) tuples to be combined.
+      whitelist: a list of resource IDs that should be kept in the output string
+                 or None to include all resources.
+      suppress_removed_key_output: Do not print removed keys.
+
+  Returns:
+      Returns (resources_by_id, encoding).
+
+  Raises:
+      KeyError: if there are duplicate keys or resource encoding is
+      inconsistent.
+  """
+  resources = {}
+  encoding = None
+  for input_resources, input_encoding in inputs:
+    # Make sure we have no dups.
+    duplicate_keys = set(input_resources.keys()) & set(resources.keys())
+    if duplicate_keys:
+      raise KeyError('Duplicate keys: ' + str(list(duplicate_keys)))
+
+    # Make sure encoding is consistent.
+    if encoding in (None, BINARY):
+      encoding = input_encoding
+    elif input_encoding not in (BINARY, encoding):
+      raise KeyError('Inconsistent encodings: ' + str(encoding) +
+                     ' vs ' + str(input_encoding))
+
+    if whitelist:
+      whitelisted_resources = dict([(key, input_resources[key])
+                                    for key in input_resources.keys()
+                                    if key in whitelist])
+      resources.update(whitelisted_resources)
+      removed_keys = [key for key in input_resources.keys()
+                      if key not in whitelist]
+      if not suppress_removed_key_output:
+        for key in removed_keys:
+          print('RePackFromDataPackStrings Removed Key:', key)
+    else:
+      resources.update(input_resources)
+
+  # Encoding is 0 for BINARY, 1 for UTF8 and 2 for UTF16
+  if encoding is None:
+    encoding = BINARY
+  return resources, encoding
+
+
+def main():
+  # Write a simple file.
+  data = {1: '', 4: 'this is id 4', 6: 'this is id 6', 10: ''}
+  WriteDataPack(data, 'datapack1.pak', UTF8)
+  data2 = {1000: 'test', 5: 'five'}
+  WriteDataPack(data2, 'datapack2.pak', UTF8)
+  print('wrote datapack1 and datapack2 to current directory.')
+
+
+if __name__ == '__main__':
+  main()
diff --git a/tools/grit/grit/format/data_pack_unittest.py b/tools/grit/grit/format/data_pack_unittest.py
new file mode 100644
index 0000000000..fcd7035473
--- /dev/null
+++ b/tools/grit/grit/format/data_pack_unittest.py
@@ -0,0 +1,102 @@
+#!/usr/bin/env python
+# Copyright (c) 2012 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.
+
+'''Unit tests for grit.format.data_pack'''
+
+from __future__ import print_function
+
+import os
+import sys
+if __name__ == '__main__':
+  sys.path.append(os.path.join(os.path.dirname(__file__), '../..'))
+
+import unittest
+
+from grit.format import data_pack
+
+
+class FormatDataPackUnittest(unittest.TestCase):
+  def testReadDataPackV4(self):
+    expected_data = (
+        b'\x04\x00\x00\x00'                  # header(version
+        b'\x04\x00\x00\x00'                  #        no. entries,
+        b'\x01'                              #        encoding)
+        b'\x01\x00\x27\x00\x00\x00'          # index entry 1
+        b'\x04\x00\x27\x00\x00\x00'          # index entry 4
+        b'\x06\x00\x33\x00\x00\x00'          # index entry 6
+        b'\x0a\x00\x3f\x00\x00\x00'          # index entry 10
+        b'\x00\x00\x3f\x00\x00\x00'          # extra entry for the size of last
+        b'this is id 4this is id 6')         # data
+    expected_data_pack = data_pack.DataPackContents(
+        {
+            1: b'',
+            4: b'this is id 4',
+            6: b'this is id 6',
+            10: b'',
+        }, data_pack.UTF8, 4, {}, data_pack.DataPackSizes(9, 30, 0, 24))
+    loaded = data_pack.ReadDataPackFromString(expected_data)
+    self.assertDictEqual(expected_data_pack.__dict__, loaded.__dict__)
+
+  def testReadWriteDataPackV5(self):
+    expected_data = (
+        b'\x05\x00\x00\x00'                  # version
+        b'\x01\x00\x00\x00'                  # encoding & padding
+        b'\x03\x00'                          # resource_count
+        b'\x01\x00'                          # alias_count
+        b'\x01\x00\x28\x00\x00\x00'          # index entry 1
+        b'\x04\x00\x28\x00\x00\x00'          # index entry 4
+        b'\x06\x00\x34\x00\x00\x00'          # index entry 6
+        b'\x00\x00\x40\x00\x00\x00'          # extra entry for the size of last
+        b'\x0a\x00\x01\x00'                  # alias table
+        b'this is id 4this is id 6')         # data
+    input_resources = {
+        1: b'',
+        4: b'this is id 4',
+        6: b'this is id 6',
+        10: b'this is id 4',
+    }
+    data = data_pack.WriteDataPackToString(input_resources, data_pack.UTF8)
+    self.assertEquals(data, expected_data)
+
+    expected_data_pack = data_pack.DataPackContents({
+        1: b'',
+        4: input_resources[4],
+        6: input_resources[6],
+        10: input_resources[4],
+    }, data_pack.UTF8, 5, {10: 4}, data_pack.DataPackSizes(12, 24, 4, 24))
+    loaded = data_pack.ReadDataPackFromString(expected_data)
+    self.assertDictEqual(expected_data_pack.__dict__, loaded.__dict__)
+
+  def testRePackUnittest(self):
+    expected_with_whitelist = {
+        1: 'Never gonna', 10: 'give you up', 20: 'Never gonna let',
+        30: 'you down', 40: 'Never', 50: 'gonna run around and',
+        60: 'desert you'}
+    expected_without_whitelist = {
+        1: 'Never gonna', 10: 'give you up', 20: 'Never gonna let', 65: 'Close',
+        30: 'you down', 40: 'Never', 50: 'gonna run around and', 4: 'click',
+        60: 'desert you', 6: 'chirr', 32: 'oops, try again', 70: 'Awww, snap!'}
+    inputs = [{1: 'Never gonna', 4: 'click', 6: 'chirr', 10: 'give you up'},
+              {20: 'Never gonna let', 30: 'you down', 32: 'oops, try again'},
+              {40: 'Never', 50: 'gonna run around and', 60: 'desert you'},
+              {65: 'Close', 70: 'Awww, snap!'}]
+    whitelist = [1, 10, 20, 30, 40, 50, 60]
+    inputs = [(i, data_pack.UTF8) for i in inputs]
+
+    # RePack using whitelist
+    output, _ = data_pack.RePackFromDataPackStrings(
+        inputs, whitelist, suppress_removed_key_output=True)
+    self.assertDictEqual(expected_with_whitelist, output,
+                         'Incorrect resource output')
+
+    # RePack a None whitelist
+    output, _ = data_pack.RePackFromDataPackStrings(
+        inputs, None, suppress_removed_key_output=True)
+    self.assertDictEqual(expected_without_whitelist, output,
+                         'Incorrect resource output')
+
+
+if __name__ == '__main__':
+  unittest.main()
diff --git a/tools/grit/grit/format/gen_predetermined_ids.py b/tools/grit/grit/format/gen_predetermined_ids.py
new file mode 100644
index 0000000000..9b2aa7b1a5
--- /dev/null
+++ b/tools/grit/grit/format/gen_predetermined_ids.py
@@ -0,0 +1,144 @@
+#!/usr/bin/env python
+# Copyright 2017 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.
+
+"""
+A tool to generate a predetermined resource ids file that can be used as an
+input to grit via the -p option. This is meant to be run manually every once in
+a while and its output checked in. See tools/gritsettings/README.md for details.
+"""
+
+from __future__ import print_function
+
+import os
+import re
+import sys
+
+# Regular expression for parsing the #define macro format. Matches both the
+# version of the macro with whitelist support and the one without. For example,
+# Without generate whitelist flag:
+#   #define IDS_FOO_MESSAGE 1234
+# With generate whitelist flag:
+#   #define IDS_FOO_MESSAGE (::ui::WhitelistedResource<1234>(), 1234)
+RESOURCE_EXTRACT_REGEX = re.compile(r'^#define (\S*).* (\d+)\)?$', re.MULTILINE)
+
+ORDERED_RESOURCE_IDS_REGEX = re.compile(r'^Resource=(\d*)$', re.MULTILINE)
+
+
+def _GetResourceNameIdPairsIter(string_to_scan):
+  """Gets an iterator of the resource name and id pairs of the given string.
+
+  Scans the input string for lines of the form "#define NAME ID" and returns
+  an iterator over all matching (NAME, ID) pairs.
+
+  Args:
+    string_to_scan: The input string to scan.
+
+  Yields:
+    A tuple of name and id.
+  """
+  for match in RESOURCE_EXTRACT_REGEX.finditer(string_to_scan):
+    yield match.group(1, 2)
+
+
+def _ReadOrderedResourceIds(path):
+  """Reads ordered resource ids from the given file.
+
+  The resources are expected to be of the format produced by running Chrome
+  with --print-resource-ids command line.
+
+  Args:
+    path: File path to read resource ids from.
+
+  Returns:
+    An array of ordered resource ids.
+  """
+  ordered_resource_ids = []
+  with open(path, "r") as f:
+    for match in ORDERED_RESOURCE_IDS_REGEX.finditer(f.read()):
+      ordered_resource_ids.append(int(match.group(1)))
+  return ordered_resource_ids
+
+
+def GenerateResourceMapping(original_resources, ordered_resource_ids):
+  """Generates a resource mapping from the ordered ids and the original mapping.
+
+  The returned dict will assign new ids to ordered_resource_ids numerically
+  increasing from 101.
+
+  Args:
+    original_resources: A dict of original resource ids to resource names.
+    ordered_resource_ids: An array of ordered resource ids.
+
+  Returns:
+    A dict of resource ids to resource names.
+  """
+  output_resource_map = {}
+  # 101 is used as the starting value since other parts of GRIT require it to be
+  # the minimum (e.g. rc_header.py) based on Windows resource numbering.
+  next_id = 101
+  for original_id in ordered_resource_ids:
+    resource_name = original_resources[original_id]
+    output_resource_map[next_id] = resource_name
+    next_id += 1
+  return output_resource_map
+
+
+def ReadResourceIdsFromFile(file, original_resources):
+  """Reads resource ids from a GRIT-produced header file.
+
+  Args:
+    file: File to a GRIT-produced header file to read from.
+    original_resources: Dict of resource ids to resource names to add to.
+  """
+  for resource_name, resource_id in _GetResourceNameIdPairsIter(file.read()):
+    original_resources[int(resource_id)] = resource_name
+
+
+def _ReadOriginalResourceIds(out_dir):
+  """Reads resource ids from GRIT header files in the specified directory.
+
+  Args:
+    out_dir: A Chrome build output directory (e.g. out/gn) to scan.
+
+  Returns:
+    A dict of resource ids to resource names.
+  """
+  original_resources = {}
+  for root, dirnames, filenames in os.walk(out_dir + '/gen'):
+    for filename in filenames:
+      if filename.endswith(('_resources.h', '_settings.h', '_strings.h')):
+        with open(os.path.join(root, filename), "r") as f:
+          ReadResourceIdsFromFile(f, original_resources)
+  return original_resources
+
+
+def _GeneratePredeterminedIdsFile(ordered_resources_file, out_dir):
+  """Generates a predetermined ids file.
+
+  Args:
+    ordered_resources_file: File path to read ordered resource ids from.
+    out_dir: A Chrome build output directory (e.g. out/gn) to scan.
+
+  Returns:
+    A dict of resource ids to resource names.
+  """
+  original_resources = _ReadOriginalResourceIds(out_dir)
+  ordered_resource_ids = _ReadOrderedResourceIds(ordered_resources_file)
+  output_resource_map = GenerateResourceMapping(original_resources,
+                                                ordered_resource_ids)
+  for res_id in sorted(output_resource_map.keys()):
+    print(output_resource_map[res_id], res_id)
+
+
+def main(argv):
+  if len(argv) != 2:
+    print("usage: gen_predetermined_ids.py <ordered_resources_file> <out_dir>")
+    sys.exit(1)
+  ordered_resources_file, out_dir = argv[0], argv[1]
+  _GeneratePredeterminedIdsFile(ordered_resources_file, out_dir)
+
+
+if '__main__' == __name__:
+  main(sys.argv[1:])
diff --git a/tools/grit/grit/format/gen_predetermined_ids_unittest.py b/tools/grit/grit/format/gen_predetermined_ids_unittest.py
new file mode 100644
index 0000000000..bd0331adb4
--- /dev/null
+++ b/tools/grit/grit/format/gen_predetermined_ids_unittest.py
@@ -0,0 +1,46 @@
+#!/usr/bin/env python
+# Copyright 2017 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.
+
+'''Unit tests for the gen_predetermined_ids module.'''
+
+from __future__ import print_function
+
+import os
+import sys
+if __name__ == '__main__':
+  sys.path.append(os.path.join(os.path.dirname(__file__), '../..'))
+
+import unittest
+
+from six import StringIO
+
+from grit.format import gen_predetermined_ids
+
+class GenPredeterminedIdsUnittest(unittest.TestCase):
+  def testGenerateResourceMapping(self):
+    original_resources = {200: 'A', 201: 'B', 300: 'C', 350: 'D', 370: 'E'}
+    ordered_resource_ids = [300, 201, 370]
+    mapping = gen_predetermined_ids.GenerateResourceMapping(
+        original_resources, ordered_resource_ids)
+    self.assertEqual({101: 'C', 102: 'B', 103: 'E'}, mapping)
+
+  def testReadResourceIdsFromFile(self):
+    f = StringIO('''
+// This file is automatically generated by GRIT. Do not edit.
+
+#pragma once
+
+#define IDS_BOOKMARKS_NO_ITEMS 12500
+#define IDS_BOOKMARK_BAR_IMPORT_LINK (::ui::WhitelistedResource<12501>(), 12501)
+#define IDS_BOOKMARK_X (::ui::WhitelistedResource<12502>(), 12502)
+''')
+    resources = {}
+    gen_predetermined_ids.ReadResourceIdsFromFile(f, resources)
+    self.assertEqual({12500: 'IDS_BOOKMARKS_OPEN_ALL',
+                      12501: 'IDS_BOOKMARKS_OPEN_ALL_INCOGNITO',
+                      12502: 'IDS_BOOKMARK_X'}, resources)
+
+if __name__ == '__main__':
+  unittest.main()
diff --git a/tools/grit/grit/format/gzip_string.py b/tools/grit/grit/format/gzip_string.py
new file mode 100644
index 0000000000..3cd17185c9
--- /dev/null
+++ b/tools/grit/grit/format/gzip_string.py
@@ -0,0 +1,46 @@
+# Copyright (c) 2016 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.
+"""Provides gzip utilities for strings.
+"""
+
+from __future__ import print_function
+
+import gzip
+import io
+import subprocess
+
+
+def GzipStringRsyncable(data):
+  # Make call to host system's gzip to get access to --rsyncable option. This
+  # option makes updates much smaller - if one line is changed in the resource,
+  # it won't have to push the entire compressed resource with the update.
+  # Instead, --rsyncable breaks the file into small chunks, so that one doesn't
+  # affect the other in compression, and then only that chunk will have to be
+  # updated.
+  gzip_proc = subprocess.Popen(['gzip', '--stdout', '--rsyncable',
+                                '--best', '--no-name'],
+                               stdin=subprocess.PIPE,
+                               stdout=subprocess.PIPE,
+                               stderr=subprocess.PIPE)
+  data, stderr = gzip_proc.communicate(data)
+  if gzip_proc.returncode != 0:
+    raise subprocess.CalledProcessError(gzip_proc.returncode, 'gzip',
+                                        stderr)
+  return data
+
+
+def GzipString(data):
+  # Gzipping using Python's built in gzip: Windows doesn't ship with gzip, and
+  # OSX's gzip does not have an --rsyncable option built in. Although this is
+  # not preferable to --rsyncable, it is an option for the systems that do
+  # not have --rsyncable. If used over GzipStringRsyncable, the primary
+  # difference of this function's compression will be larger updates every time
+  # a compressed resource is changed.
+  gzip_output = io.BytesIO()
+  with gzip.GzipFile(mode='wb', compresslevel=9, fileobj=gzip_output,
+                     mtime=0) as gzip_file:
+    gzip_file.write(data)
+  data = gzip_output.getvalue()
+  gzip_output.close()
+  return data
diff --git a/tools/grit/grit/format/gzip_string_unittest.py b/tools/grit/grit/format/gzip_string_unittest.py
new file mode 100644
index 0000000000..c0cfbe1837
--- /dev/null
+++ b/tools/grit/grit/format/gzip_string_unittest.py
@@ -0,0 +1,65 @@
+#!/usr/bin/env python
+# Copyright (c) 2016 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.
+
+'''Unit tests for grit.format.gzip_string'''
+
+from __future__ import print_function
+
+import gzip
+import io
+import os
+import sys
+if __name__ == '__main__':
+  sys.path.append(os.path.join(os.path.dirname(__file__), '../..'))
+
+import unittest
+
+from grit.format import gzip_string
+
+
+class FormatGzipStringUnittest(unittest.TestCase):
+
+  def testGzipStringRsyncable(self):
+    # Can only test the rsyncable version on platforms which support rsyncable,
+    # which at the moment is Linux.
+    if sys.platform == 'linux2':
+      header_begin = (b'\x1f\x8b')  # gzip first two bytes
+      input = (b'TEST STRING STARTING NOW'
+               b'continuing'
+               b'<even more>'
+               b'<finished NOW>')
+
+      compressed = gzip_string.GzipStringRsyncable(input)
+      self.failUnless(header_begin == compressed[:2])
+
+      compressed_file = io.BytesIO()
+      compressed_file.write(compressed)
+      compressed_file.seek(0)
+
+      with gzip.GzipFile(mode='rb', fileobj=compressed_file) as f:
+        output = f.read()
+      self.failUnless(output == input)
+
+  def testGzipString(self):
+    header_begin = b'\x1f\x8b'  # gzip first two bytes
+    input = (b'TEST STRING STARTING NOW'
+             b'continuing'
+             b'<even more>'
+             b'<finished NOW>')
+
+    compressed = gzip_string.GzipString(input)
+    self.failUnless(header_begin == compressed[:2])
+
+    compressed_file = io.BytesIO()
+    compressed_file.write(compressed)
+    compressed_file.seek(0)
+
+    with gzip.GzipFile(mode='rb', fileobj=compressed_file) as f:
+      output = f.read()
+    self.failUnless(output == input)
+
+
+if __name__ == '__main__':
+  unittest.main()
diff --git a/tools/grit/grit/format/html_inline.py b/tools/grit/grit/format/html_inline.py
new file mode 100644
index 0000000000..da55216ea4
--- /dev/null
+++ b/tools/grit/grit/format/html_inline.py
@@ -0,0 +1,602 @@
+#!/usr/bin/env python
+# Copyright (c) 2012 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.
+
+"""Flattens a HTML file by inlining its external resources.
+
+This is a small script that takes a HTML file, looks for src attributes
+and inlines the specified file, producing one HTML file with no external
+dependencies. It recursively inlines the included files.
+"""
+
+from __future__ import print_function
+
+import os
+import re
+import sys
+import base64
+import mimetypes
+
+from grit import lazy_re
+from grit import util
+from grit.format import minifier
+
+# There is a python bug that makes mimetypes crash if the Windows
+# registry contains non-Latin keys ( http://bugs.python.org/issue9291
+# ). Initing manually and blocking external mime-type databases will
+# prevent that bug and if we add svg manually, it will still give us
+# the data we need.
+mimetypes.init([])
+mimetypes.add_type('image/svg+xml', '.svg')
+
+# webm video type is not always available if mimetype package is outdated.
+mimetypes.add_type('video/webm', '.webm')
+
+DIST_DEFAULT = 'chromium'
+DIST_ENV_VAR = 'CHROMIUM_BUILD'
+DIST_SUBSTR = '%DISTRIBUTION%'
+
+# Matches beginning of an "if" block.
+_BEGIN_IF_BLOCK = lazy_re.compile(
+    r'<if [^>]*?expr=("(?P<expr1>[^">]*)"|\'(?P<expr2>[^\'>]*)\')[^>]*?>')
+
+# Matches ending of an "if" block.
+_END_IF_BLOCK = lazy_re.compile(r'</if>')
+
+# Used by DoInline to replace various links with inline content.
+_STYLESHEET_RE = lazy_re.compile(
+    r'<link rel="stylesheet"[^>]+?href="(?P<filename>[^"]*)".*?>(\s*</link>)?',
+    re.DOTALL)
+_INCLUDE_RE = lazy_re.compile(
+    r'(?P<comment>\/\/ )?<include[^>]+?'
+    r'src=("(?P<file1>[^">]*)"|\'(?P<file2>[^\'>]*)\').*?>(\s*</include>)?',
+    re.DOTALL)
+_SRC_RE = lazy_re.compile(
+    r'<(?!script)(?:[^>]+?\s)src="(?!\[\[|{{)(?P<filename>[^"\']*)"',
+    re.MULTILINE)
+# This re matches '<img srcset="..."' or '<source srcset="..."'
+_SRCSET_RE = lazy_re.compile(
+    r'<(img|source)\b(?:[^>]*?\s)srcset="(?!\[\[|{{|\$i18n{)'
+    r'(?P<srcset>[^"\']*)"',
+    re.MULTILINE)
+# This re is for splitting srcset value string into "image candidate strings".
+# Notes:
+# - HTML 5.2 states that URL cannot start or end with comma.
+# - the "descriptor" is either "width descriptor" or "pixel density descriptor".
+#   The first one consists of "valid non-negative integer + letter 'x'",
+#   the second one is formed of "positive valid floating-point number +
+#   letter 'w'". As a reasonable compromise, we match a list of characters
+#   that form both of them.
+# Matches for example "img2.png 2x" or "img9.png 11E-2w".
+_SRCSET_ENTRY_RE = lazy_re.compile(
+    r'\s*(?P<url>[^,\s]\S+[^,\s])'
+    r'(?:\s+(?P<descriptor>[\deE.-]+[wx]))?\s*'
+    r'(?P<separator>,|$)',
+    re.MULTILINE)
+_ICON_RE = lazy_re.compile(
+    r'<link rel="icon"\s(?:[^>]+?\s)?'
+    r'href=(?P<quote>")(?P<filename>[^"\']*)\1',
+    re.MULTILINE)
+
+
+def GetDistribution():
+  """Helper function that gets the distribution we are building.
+
+  Returns:
+    string
+  """
+  distribution = DIST_DEFAULT
+  if DIST_ENV_VAR in os.environ:
+    distribution = os.environ[DIST_ENV_VAR]
+    if len(distribution) > 1 and distribution[0] == '_':
+      distribution = distribution[1:].lower()
+  return distribution
+
+def ConvertFileToDataURL(filename, base_path, distribution, inlined_files,
+    names_only):
+  """Convert filename to inlined data URI.
+
+  Takes a filename from ether "src" or "srcset", and attempts to read the file
+  at 'filename'. Returns data URI as string with given file inlined.
+  If it finds DIST_SUBSTR string in file name, replaces it with distribution.
+  If filename contains ':', it is considered URL and not translated.
+
+  Args:
+    filename: filename string from ether src or srcset attributes.
+    base_path: path that to look for files in
+    distribution: string that should replace DIST_SUBSTR
+    inlined_files: The name of the opened file is appended to this list.
+    names_only: If true, the function will not read the file but just return "".
+                It will still add the filename to |inlined_files|.
+
+  Returns:
+    string
+  """
+  if filename.find(':') != -1:
+    # filename is probably a URL, which we don't want to bother inlining
+    return filename
+
+  filename = filename.replace(DIST_SUBSTR , distribution)
+  filepath = os.path.normpath(os.path.join(base_path, filename))
+  inlined_files.add(filepath)
+
+  if names_only:
+    return ""
+
+  mimetype = mimetypes.guess_type(filename)[0]
+  if mimetype is None:
+    raise Exception('%s is of an an unknown type and '
+                    'cannot be stored in a data url.' % filename)
+  inline_data = base64.standard_b64encode(util.ReadFile(filepath, util.BINARY))
+  return 'data:%s;base64,%s' % (mimetype, inline_data.decode('utf-8'))
+
+
+def SrcInlineAsDataURL(
+    src_match, base_path, distribution, inlined_files, names_only=False,
+    filename_expansion_function=None):
+  """regex replace function.
+
+  Takes a regex match for src="filename", attempts to read the file
+  at 'filename' and returns the src attribute with the file inlined
+  as a data URI. If it finds DIST_SUBSTR string in file name, replaces
+  it with distribution.
+
+  Args:
+    src_match: regex match object with 'filename' named capturing group
+    base_path: path that to look for files in
+    distribution: string that should replace DIST_SUBSTR
+    inlined_files: The name of the opened file is appended to this list.
+    names_only: If true, the function will not read the file but just return "".
+                It will still add the filename to |inlined_files|.
+
+  Returns:
+    string
+  """
+  filename = src_match.group('filename')
+  if filename_expansion_function:
+    filename = filename_expansion_function(filename)
+
+  data_url = ConvertFileToDataURL(filename, base_path, distribution,
+                                  inlined_files, names_only)
+
+  if not data_url:
+    return data_url
+
+  prefix = src_match.string[src_match.start():src_match.start('filename')]
+  suffix = src_match.string[src_match.end('filename'):src_match.end()]
+  return prefix + data_url + suffix
+
+def SrcsetInlineAsDataURL(
+    srcset_match, base_path, distribution, inlined_files, names_only=False,
+    filename_expansion_function=None):
+  """regex replace function to inline files in srcset="..." attributes
+
+  Takes a regex match for srcset="filename 1x, filename 2x, ...", attempts to
+  read the files referenced by filenames and returns the srcset attribute with
+  the files inlined as a data URI. If it finds DIST_SUBSTR string in file name,
+  replaces it with distribution.
+
+  Args:
+    srcset_match: regex match object with 'srcset' named capturing group
+    base_path: path that to look for files in
+    distribution: string that should replace DIST_SUBSTR
+    inlined_files: The name of the opened file is appended to this list.
+    names_only: If true, the function will not read the file but just return "".
+                It will still add the filename to |inlined_files|.
+
+  Returns:
+    string
+  """
+  srcset = srcset_match.group('srcset')
+
+  if not srcset:
+    return srcset_match.group(0)
+
+  # HTML 5.2 defines srcset as a list of "image candidate strings".
+  # Each of them consists of URL and descriptor.
+  # _SRCSET_ENTRY_RE splits srcset into a list of URLs, descriptors and
+  # commas.
+  # The descriptor part will be None if that optional regex didn't match
+  parts = _SRCSET_ENTRY_RE.split(srcset)
+
+  if not parts:
+    return srcset_match.group(0)
+
+  # List of image candidate strings that will form new srcset="..."
+  new_candidates = []
+
+  # When iterating over split srcset we fill this parts of a single image
+  # candidate string: [url, descriptor]
+  candidate = [];
+
+  # Each entry should consist of some text before the entry, the url,
+  # the descriptor or None if the entry has no descriptor, a comma separator or
+  # the end of the line, and finally some text after the entry (which is the
+  # same as the text before the next entry).
+  for i in range(0, len(parts) - 1, 4):
+    before, url, descriptor, separator, after = parts[i:i+5]
+
+    # There must be a comma-separated next entry or this must be the last entry.
+    assert separator == "," or (separator == "" and i == len(parts) - 5), (
+           "Bad srcset format in {}".format(srcset_match.group(0)))
+    # Both before and after the entry must be empty
+    assert before == after == "", (
+           "Bad srcset format in {}".format(srcset_match.group(0)))
+
+    if filename_expansion_function:
+      filename = filename_expansion_function(url)
+    else:
+      filename = url
+
+    data_url = ConvertFileToDataURL(filename, base_path, distribution,
+                                    inlined_files, names_only)
+
+    # This is not "names_only" mode
+    if data_url:
+      candidate = [data_url]
+      if descriptor:
+        candidate.append(descriptor)
+
+      new_candidates.append(" ".join(candidate))
+
+  prefix = srcset_match.string[srcset_match.start():
+      srcset_match.start('srcset')]
+  suffix = srcset_match.string[srcset_match.end('srcset'):srcset_match.end()]
+  return prefix + ','.join(new_candidates) + suffix
+
+class InlinedData:
+  """Helper class holding the results from DoInline().
+
+  Holds the inlined data and the set of filenames of all the inlined
+  files.
+  """
+  def __init__(self, inlined_data, inlined_files):
+    self.inlined_data = inlined_data
+    self.inlined_files = inlined_files
+
+def DoInline(
+    input_filename, grd_node, allow_external_script=False,
+    preprocess_only=False, names_only=False, strip_whitespace=False,
+    rewrite_function=None, filename_expansion_function=None):
+  """Helper function that inlines the resources in a specified file.
+
+  Reads input_filename, finds all the src attributes and attempts to
+  inline the files they are referring to, then returns the result and
+  the set of inlined files.
+
+  Args:
+    input_filename: name of file to read in
+    grd_node: html node from the grd file for this include tag
+    preprocess_only: Skip all HTML processing, only handle <if> and <include>.
+    names_only: |nil| will be returned for the inlined contents (faster).
+    strip_whitespace: remove whitespace and comments in the input files.
+    rewrite_function: function(filepath, text, distribution) which will be
+        called to rewrite html content before inlining images.
+    filename_expansion_function: function(filename) which will be called to
+        rewrite filenames before attempting to read them.
+  Returns:
+    a tuple of the inlined data as a string and the set of filenames
+    of all the inlined files
+  """
+  if filename_expansion_function:
+    input_filename = filename_expansion_function(input_filename)
+  input_filepath = os.path.dirname(input_filename)
+  distribution = GetDistribution()
+
+  # Keep track of all the files we inline.
+  inlined_files = set()
+
+  def SrcReplace(src_match, filepath=input_filepath,
+                 inlined_files=inlined_files):
+    """Helper function to provide SrcInlineAsDataURL with the base file path"""
+    return SrcInlineAsDataURL(
+        src_match, filepath, distribution, inlined_files, names_only=names_only,
+        filename_expansion_function=filename_expansion_function)
+
+  def SrcsetReplace(srcset_match, filepath=input_filepath,
+                 inlined_files=inlined_files):
+    """Helper function to provide SrcsetInlineAsDataURL with the base file
+    path.
+    """
+    return SrcsetInlineAsDataURL(
+        srcset_match, filepath, distribution, inlined_files,
+        names_only=names_only,
+        filename_expansion_function=filename_expansion_function)
+
+  def GetFilepath(src_match, base_path = input_filepath):
+    filename = [v for k, v in src_match.groupdict().items()
+                if k.startswith('file') and v][0]
+
+    if filename.find(':') != -1:
+      # filename is probably a URL, which we don't want to bother inlining
+      return None
+
+    filename = filename.replace('%DISTRIBUTION%', distribution)
+    if filename_expansion_function:
+      filename = filename_expansion_function(filename)
+    return os.path.normpath(os.path.join(base_path, filename))
+
+  def IsConditionSatisfied(src_match):
+    expr1 = src_match.group('expr1') or ''
+    expr2 = src_match.group('expr2') or ''
+    return grd_node is None or grd_node.EvaluateCondition(expr1 + expr2)
+
+  def CheckConditionalElements(str):
+    """Helper function to conditionally inline inner elements"""
+    while True:
+      begin_if = _BEGIN_IF_BLOCK.search(str)
+      if begin_if is None:
+        if _END_IF_BLOCK.search(str) is not None:
+          raise Exception('Unmatched </if>')
+        return str
+
+      condition_satisfied = IsConditionSatisfied(begin_if)
+      leading = str[0:begin_if.start()]
+      content_start = begin_if.end()
+
+      # Find matching "if" block end.
+      count = 1
+      pos = begin_if.end()
+      while True:
+        end_if = _END_IF_BLOCK.search(str, pos)
+        if end_if is None:
+          raise Exception('Unmatched <if>')
+
+        next_if = _BEGIN_IF_BLOCK.search(str, pos)
+        if next_if is None or next_if.start() >= end_if.end():
+          count = count - 1
+          if count == 0:
+            break
+          pos = end_if.end()
+        else:
+          count = count + 1
+          pos = next_if.end()
+
+      content = str[content_start:end_if.start()]
+      trailing = str[end_if.end():]
+
+      if condition_satisfied:
+        str = leading + CheckConditionalElements(content) + trailing
+      else:
+        str = leading + trailing
+
+  def InlineFileContents(src_match,
+                         pattern,
+                         inlined_files=inlined_files,
+                         strip_whitespace=False):
+    """Helper function to inline external files of various types"""
+    filepath = GetFilepath(src_match)
+    if filepath is None:
+      return src_match.group(0)
+    inlined_files.add(filepath)
+
+    if names_only:
+      inlined_files.update(GetResourceFilenames(
+          filepath,
+          grd_node,
+          allow_external_script,
+          rewrite_function,
+          filename_expansion_function=filename_expansion_function))
+      return ""
+    # To recursively save inlined files, we need InlinedData instance returned
+    # by DoInline.
+    inlined_data_inst=DoInline(filepath, grd_node,
+        allow_external_script=allow_external_script,
+        preprocess_only=preprocess_only,
+        strip_whitespace=strip_whitespace,
+        filename_expansion_function=filename_expansion_function)
+
+    inlined_files.update(inlined_data_inst.inlined_files)
+
+    return pattern % inlined_data_inst.inlined_data;
+
+
+  def InlineIncludeFiles(src_match):
+    """Helper function to directly inline generic external files (without
+       wrapping them with any kind of tags).
+    """
+    return InlineFileContents(src_match, '%s')
+
+  def InlineScript(match):
+    """Helper function to inline external script files"""
+    attrs = (match.group('attrs1') + match.group('attrs2')).strip()
+    if attrs:
+      attrs = ' ' + attrs
+    return InlineFileContents(match, '<script' + attrs + '>%s</script>',
+                              strip_whitespace=True)
+
+  def InlineCSSText(text, css_filepath):
+    """Helper function that inlines external resources in CSS text"""
+    filepath = os.path.dirname(css_filepath)
+    # Allow custom modifications before inlining images.
+    if rewrite_function:
+      text = rewrite_function(filepath, text, distribution)
+    text = InlineCSSImages(text, filepath)
+    return InlineCSSImports(text, filepath)
+
+  def InlineCSSFile(src_match, pattern, base_path=input_filepath):
+    """Helper function to inline external CSS files.
+
+    Args:
+      src_match: A regular expression match with a named group named "filename".
+      pattern: The pattern to replace with the contents of the CSS file.
+      base_path: The base path to use for resolving the CSS file.
+
+    Returns:
+      The text that should replace the reference to the CSS file.
+    """
+    filepath = GetFilepath(src_match, base_path)
+    if filepath is None:
+      return src_match.group(0)
+
+    # Even if names_only is set, the CSS file needs to be opened, because it
+    # can link to images that need to be added to the file set.
+    inlined_files.add(filepath)
+
+    # Inline stylesheets included in this css file.
+    text = _INCLUDE_RE.sub(InlineIncludeFiles, util.ReadFile(filepath, 'utf-8'))
+    # When resolving CSS files we need to pass in the path so that relative URLs
+    # can be resolved.
+
+    return pattern % InlineCSSText(text, filepath)
+
+  def GetUrlRegexString(postfix=''):
+    """Helper function that returns a string for a regex that matches url('')
+       but not url([[ ]]) or url({{ }}). Appends |postfix| to group names.
+    """
+    url_re = (r'url\((?!\[\[|{{)(?P<q%s>"|\'|)(?P<filename%s>[^"\'()]*)'
+              r'(?P=q%s)\)')
+    return url_re % (postfix, postfix, postfix)
+
+  def InlineCSSImages(text, filepath=input_filepath):
+    """Helper function that inlines external images in CSS backgrounds."""
+    # Replace contents of url() for css attributes: content, background,
+    # or *-image.
+    property_re = r'(content|background|[\w-]*-image):[^;]*'
+    # Replace group names to prevent duplicates when forming value_re.
+    image_set_value_re = (r'image-set\(([ ]*' + GetUrlRegexString('2') +
+        r'[ ]*[0-9.]*x[ ]*(,[ ]*)?)+\)')
+    value_re = '(%s|%s)' % (GetUrlRegexString(), image_set_value_re)
+    css_re = property_re + value_re
+    return re.sub(css_re, lambda m: InlineCSSUrls(m, filepath), text)
+
+  def InlineCSSUrls(src_match, filepath=input_filepath):
+    """Helper function that inlines each url on a CSS image rule match."""
+    # Replace contents of url() references in matches.
+    return re.sub(GetUrlRegexString(),
+                  lambda m: SrcReplace(m, filepath),
+                  src_match.group(0))
+
+  def InlineCSSImports(text, filepath=input_filepath):
+    """Helper function that inlines CSS files included via the @import
+       directive.
+    """
+    return re.sub(r'@import\s+' + GetUrlRegexString() + r';',
+                  lambda m: InlineCSSFile(m, '%s', filepath),
+                  text)
+
+
+  flat_text = util.ReadFile(input_filename, 'utf-8')
+
+  # Check conditional elements, remove unsatisfied ones from the file. We do
+  # this twice. The first pass is so that we don't even bother calling
+  # InlineScript, InlineCSSFile and InlineIncludeFiles on text we're eventually
+  # going to throw out anyway.
+  flat_text = CheckConditionalElements(flat_text)
+
+  flat_text = _INCLUDE_RE.sub(InlineIncludeFiles, flat_text)
+
+  if not preprocess_only:
+    if strip_whitespace:
+      flat_text = minifier.Minify(flat_text.encode('utf-8'),
+                                  input_filename).decode('utf-8')
+
+    if not allow_external_script:
+      # We need to inline css and js before we inline images so that image
+      # references gets inlined in the css and js
+      flat_text = re.sub(r'<script (?P<attrs1>.*?)src="(?P<filename>[^"\']*)"'
+                         r'(?P<attrs2>.*?)></script>',
+                         InlineScript,
+                         flat_text)
+
+    flat_text = _STYLESHEET_RE.sub(
+        lambda m: InlineCSSFile(m, '<style>%s</style>'),
+        flat_text)
+
+  # Check conditional elements, second pass. This catches conditionals in any
+  # of the text we just inlined.
+  flat_text = CheckConditionalElements(flat_text)
+
+  # Allow custom modifications before inlining images.
+  if rewrite_function:
+    flat_text = rewrite_function(input_filepath, flat_text, distribution)
+
+  if not preprocess_only:
+    flat_text = _SRC_RE.sub(SrcReplace, flat_text)
+    flat_text = _SRCSET_RE.sub(SrcsetReplace, flat_text)
+
+    # TODO(arv): Only do this inside <style> tags.
+    flat_text = InlineCSSImages(flat_text)
+
+    flat_text = _ICON_RE.sub(SrcReplace, flat_text)
+
+  if names_only:
+    flat_text = None  # Will contains garbage if the flag is set anyway.
+  return InlinedData(flat_text, inlined_files)
+
+
+def InlineToString(input_filename, grd_node, preprocess_only = False,
+                   allow_external_script=False, strip_whitespace=False,
+                   rewrite_function=None, filename_expansion_function=None):
+  """Inlines the resources in a specified file and returns it as a string.
+
+  Args:
+    input_filename: name of file to read in
+    grd_node: html node from the grd file for this include tag
+  Returns:
+    the inlined data as a string
+  """
+  try:
+    return DoInline(
+        input_filename,
+        grd_node,
+        preprocess_only=preprocess_only,
+        allow_external_script=allow_external_script,
+        strip_whitespace=strip_whitespace,
+        rewrite_function=rewrite_function,
+        filename_expansion_function=filename_expansion_function).inlined_data
+  except IOError as e:
+    raise Exception("Failed to open %s while trying to flatten %s. (%s)" %
+                    (e.filename, input_filename, e.strerror))
+
+
+def InlineToFile(input_filename, output_filename, grd_node):
+  """Inlines the resources in a specified file and writes it.
+
+  Reads input_filename, finds all the src attributes and attempts to
+  inline the files they are referring to, then writes the result
+  to output_filename.
+
+  Args:
+    input_filename: name of file to read in
+    output_filename: name of file to be written to
+    grd_node: html node from the grd file for this include tag
+  Returns:
+    a set of filenames of all the inlined files
+  """
+  inlined_data = InlineToString(input_filename, grd_node)
+  with open(output_filename, 'wb') as out_file:
+    out_file.write(inlined_data)
+
+
+def GetResourceFilenames(filename,
+                         grd_node,
+                         allow_external_script=False,
+                         rewrite_function=None,
+                         filename_expansion_function=None):
+  """For a grd file, returns a set of all the files that would be inline."""
+  try:
+    return DoInline(
+        filename,
+        grd_node,
+        names_only=True,
+        preprocess_only=False,
+        allow_external_script=allow_external_script,
+        strip_whitespace=False,
+        rewrite_function=rewrite_function,
+        filename_expansion_function=filename_expansion_function).inlined_files
+  except IOError as e:
+    raise Exception("Failed to open %s while trying to flatten %s. (%s)" %
+                    (e.filename, filename, e.strerror))
+
+
+def main():
+  if len(sys.argv) <= 2:
+    print("Flattens a HTML file by inlining its external resources.\n")
+    print("html_inline.py inputfile outputfile")
+  else:
+    InlineToFile(sys.argv[1], sys.argv[2], None)
+
+if __name__ == '__main__':
+  main()
diff --git a/tools/grit/grit/format/html_inline_unittest.py b/tools/grit/grit/format/html_inline_unittest.py
new file mode 100644
index 0000000000..1b11e9e476
--- /dev/null
+++ b/tools/grit/grit/format/html_inline_unittest.py
@@ -0,0 +1,927 @@
+#!/usr/bin/env python
+# Copyright (c) 2012 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.
+
+'''Unit tests for grit.format.html_inline'''
+
+from __future__ import print_function
+
+import os
+import re
+import sys
+if __name__ == '__main__':
+  sys.path.append(os.path.join(os.path.dirname(__file__), '../..'))
+
+import unittest
+
+from grit import util
+from grit.format import html_inline
+
+
+class HtmlInlineUnittest(unittest.TestCase):
+  '''Unit tests for HtmlInline.'''
+
+  def testGetResourceFilenames(self):
+    '''Tests that all included files are returned by GetResourceFilenames.'''
+
+    files = {
+      'index.html': '''
+      <!DOCTYPE HTML>
+      <html>
+        <head>
+          <link rel="stylesheet" href="test.css">
+          <link rel="stylesheet"
+              href="really-long-long-long-long-long-test.css">
+        </head>
+        <body>
+          <include src='test.html'>
+          <include
+              src="really-long-long-long-long-long-test-file-omg-so-long.html">
+        </body>
+      </html>
+      ''',
+
+      'test.html': '''
+      <include src="test2.html">
+      ''',
+
+      'really-long-long-long-long-long-test-file-omg-so-long.html': '''
+      <!-- This really long named resource should be included. -->
+      ''',
+
+      'test2.html': '''
+      <!-- This second level resource should also be included. -->
+      ''',
+
+      'test.css': '''
+      .image {
+        background: url('test.png');
+      }
+      ''',
+
+      'really-long-long-long-long-long-test.css': '''
+      a:hover {
+        font-weight: bold;  /* Awesome effect is awesome! */
+      }
+      ''',
+
+      'test.png': 'PNG DATA',
+    }
+
+    source_resources = set()
+    tmp_dir = util.TempDir(files)
+    for filename in files:
+      source_resources.add(tmp_dir.GetPath(filename))
+
+    resources = html_inline.GetResourceFilenames(tmp_dir.GetPath('index.html'),
+                                                 None)
+    resources.add(tmp_dir.GetPath('index.html'))
+    self.failUnlessEqual(resources, source_resources)
+    tmp_dir.CleanUp()
+
+  def testUnmatchedEndIfBlock(self):
+    '''Tests that an unmatched </if> raises an exception.'''
+
+    files = {
+      'index.html': '''
+      <!DOCTYPE HTML>
+      <html>
+        <if expr="lang == 'fr'">
+          bonjour
+        </if>
+        <if expr='lang == "de"'>
+          hallo
+        </if>
+        </if>
+      </html>
+      ''',
+    }
+
+    tmp_dir = util.TempDir(files)
+
+    with self.assertRaises(Exception) as cm:
+      html_inline.GetResourceFilenames(tmp_dir.GetPath('index.html'), None)
+    self.failUnlessEqual(str(cm.exception), 'Unmatched </if>')
+    tmp_dir.CleanUp()
+
+  def testCompressedJavaScript(self):
+    '''Tests that ".src=" doesn't treat as a tag.'''
+
+    files = {
+      'index.js': '''
+      if(i<j)a.src="hoge.png";
+      ''',
+    }
+
+    source_resources = set()
+    tmp_dir = util.TempDir(files)
+    for filename in files:
+      source_resources.add(tmp_dir.GetPath(filename))
+
+    resources = html_inline.GetResourceFilenames(tmp_dir.GetPath('index.js'),
+                                                 None)
+    resources.add(tmp_dir.GetPath('index.js'))
+    self.failUnlessEqual(resources, source_resources)
+    tmp_dir.CleanUp()
+
+  def testInlineCSSImports(self):
+    '''Tests that @import directives in inlined CSS files are inlined too.
+    '''
+
+    files = {
+      'index.html': '''
+      <html>
+      <head>
+      <link rel="stylesheet" href="css/test.css">
+      </head>
+      </html>
+      ''',
+
+      'css/test.css': '''
+      @import url('test2.css');
+      blink {
+        display: none;
+      }
+      ''',
+
+      'css/test2.css': '''
+      .image {
+        background: url('../images/test.png');
+      }
+      '''.strip(),
+
+      'images/test.png': 'PNG DATA'
+    }
+
+    expected_inlined = '''
+      <html>
+      <head>
+      <style>
+      .image {
+        background: url('data:image/png;base64,UE5HIERBVEE=');
+      }
+      blink {
+        display: none;
+      }
+      </style>
+      </head>
+      </html>
+      '''
+
+    source_resources = set()
+    tmp_dir = util.TempDir(files)
+    for filename in files:
+      source_resources.add(tmp_dir.GetPath(util.normpath(filename)))
+
+    result = html_inline.DoInline(tmp_dir.GetPath('index.html'), None)
+    resources = result.inlined_files
+    resources.add(tmp_dir.GetPath('index.html'))
+    self.failUnlessEqual(resources, source_resources)
+    self.failUnlessEqual(expected_inlined,
+                         util.FixLineEnd(result.inlined_data, '\n'))
+
+    tmp_dir.CleanUp()
+
+  def testInlineIgnoresPolymerBindings(self):
+    '''Tests that polymer bindings are ignored when inlining.
+    '''
+
+    files = {
+      'index.html': '''
+      <html>
+      <head>
+      <link rel="stylesheet" href="test.css">
+      </head>
+      <body>
+        <iron-icon src="[[icon]]"></iron-icon><!-- Should be ignored. -->
+        <iron-icon src="{{src}}"></iron-icon><!-- Also ignored. -->
+        <!-- [[image]] should be ignored. -->
+        <div style="background: url([[image]]),
+                                url('test.png');">
+        </div>
+        <div style="background: url('test.png'),
+                                url([[image]]);">
+        </div>
+      </body>
+      </html>
+      ''',
+
+      'test.css': '''
+      .image {
+        background: url('test.png');
+        background-image: url([[ignoreMe]]);
+        background-image: image-set(url({{alsoMe}}), 1x);
+        background-image: image-set(
+            url({{ignore}}) 1x,
+            url('test.png') 2x);
+      }
+      ''',
+
+      'test.png': 'PNG DATA'
+    }
+
+    expected_inlined = '''
+      <html>
+      <head>
+      <style>
+      .image {
+        background: url('data:image/png;base64,UE5HIERBVEE=');
+        background-image: url([[ignoreMe]]);
+        background-image: image-set(url({{alsoMe}}), 1x);
+        background-image: image-set(
+            url({{ignore}}) 1x,
+            url('data:image/png;base64,UE5HIERBVEE=') 2x);
+      }
+      </style>
+      </head>
+      <body>
+        <iron-icon src="[[icon]]"></iron-icon><!-- Should be ignored. -->
+        <iron-icon src="{{src}}"></iron-icon><!-- Also ignored. -->
+        <!-- [[image]] should be ignored. -->
+        <div style="background: url([[image]]),
+                                url('data:image/png;base64,UE5HIERBVEE=');">
+        </div>
+        <div style="background: url('data:image/png;base64,UE5HIERBVEE='),
+                                url([[image]]);">
+        </div>
+      </body>
+      </html>
+      '''
+
+    source_resources = set()
+    tmp_dir = util.TempDir(files)
+    for filename in files:
+      source_resources.add(tmp_dir.GetPath(util.normpath(filename)))
+
+    result = html_inline.DoInline(tmp_dir.GetPath('index.html'), None)
+    resources = result.inlined_files
+    resources.add(tmp_dir.GetPath('index.html'))
+    self.failUnlessEqual(resources, source_resources)
+    self.failUnlessEqual(expected_inlined,
+                         util.FixLineEnd(result.inlined_data, '\n'))
+
+    tmp_dir.CleanUp()
+
+  def testInlineCSSWithIncludeDirective(self):
+    '''Tests that include directive in external css files also inlined'''
+
+    files = {
+      'index.html': '''
+      <html>
+      <head>
+      <link rel="stylesheet" href="foo.css">
+      </head>
+      </html>
+      ''',
+
+      'foo.css': '''<include src="style.css">''',
+
+      'style.css': '''
+      <include src="style2.css">
+      blink {
+        display: none;
+      }
+      ''',
+      'style2.css': '''h1 {}''',
+    }
+
+    expected_inlined = '''
+      <html>
+      <head>
+      <style>
+      h1 {}
+      blink {
+        display: none;
+      }
+      </style>
+      </head>
+      </html>
+      '''
+
+    source_resources = set()
+    tmp_dir = util.TempDir(files)
+    for filename in files:
+      source_resources.add(tmp_dir.GetPath(filename))
+
+    result = html_inline.DoInline(tmp_dir.GetPath('index.html'), None)
+    resources = result.inlined_files
+    resources.add(tmp_dir.GetPath('index.html'))
+    self.failUnlessEqual(resources, source_resources)
+    self.failUnlessEqual(expected_inlined,
+                         util.FixLineEnd(result.inlined_data, '\n'))
+    tmp_dir.CleanUp()
+
+  def testCssIncludedFileNames(self):
+    '''Tests that all included files from css are returned'''
+
+    files = {
+      'index.html': '''
+      <!DOCTYPE HTML>
+      <html>
+        <head>
+          <link rel="stylesheet" href="test.css">
+        </head>
+        <body>
+        </body>
+      </html>
+      ''',
+
+      'test.css': '''
+      <include src="test2.css">
+      ''',
+
+      'test2.css': '''
+      <include src="test3.css">
+      .image {
+        background: url('test.png');
+      }
+      ''',
+
+      'test3.css': '''h1 {}''',
+
+      'test.png': 'PNG DATA'
+    }
+
+    source_resources = set()
+    tmp_dir = util.TempDir(files)
+    for filename in files:
+      source_resources.add(tmp_dir.GetPath(filename))
+
+    resources = html_inline.GetResourceFilenames(tmp_dir.GetPath('index.html'),
+                                                 None)
+    resources.add(tmp_dir.GetPath('index.html'))
+    self.failUnlessEqual(resources, source_resources)
+    tmp_dir.CleanUp()
+
+  def testInlineCSSLinks(self):
+    '''Tests that only CSS files referenced via relative URLs are inlined.'''
+
+    files = {
+      'index.html': '''
+      <html>
+      <head>
+      <link rel="stylesheet" href="foo.css">
+      <link rel="stylesheet" href="chrome://resources/bar.css">
+      </head>
+      </html>
+      ''',
+
+      'foo.css': '''
+      @import url(chrome://resources/blurp.css);
+      blink {
+        display: none;
+      }
+      ''',
+    }
+
+    expected_inlined = '''
+      <html>
+      <head>
+      <style>
+      @import url(chrome://resources/blurp.css);
+      blink {
+        display: none;
+      }
+      </style>
+      <link rel="stylesheet" href="chrome://resources/bar.css">
+      </head>
+      </html>
+      '''
+
+    source_resources = set()
+    tmp_dir = util.TempDir(files)
+    for filename in files:
+      source_resources.add(tmp_dir.GetPath(filename))
+
+    result = html_inline.DoInline(tmp_dir.GetPath('index.html'), None)
+    resources = result.inlined_files
+    resources.add(tmp_dir.GetPath('index.html'))
+    self.failUnlessEqual(resources, source_resources)
+    self.failUnlessEqual(expected_inlined,
+                         util.FixLineEnd(result.inlined_data, '\n'))
+    tmp_dir.CleanUp()
+
+  def testFilenameVariableExpansion(self):
+    '''Tests that variables are expanded in filenames before inlining.'''
+
+    files = {
+      'index.html': '''
+      <html>
+      <head>
+      <link rel="stylesheet" href="style[WHICH].css">
+      <script src="script[WHICH].js"></script>
+      </head>
+      <include src="tmpl[WHICH].html">
+      <img src="img[WHICH].png">
+      </html>
+      ''',
+      'style1.css': '''h1 {}''',
+      'tmpl1.html': '''<h1></h1>''',
+      'script1.js': '''console.log('hello');''',
+      'img1.png': '''abc''',
+    }
+
+    expected_inlined = '''
+      <html>
+      <head>
+      <style>h1 {}</style>
+      <script>console.log('hello');</script>
+      </head>
+      <h1></h1>
+      <img src="data:image/png;base64,YWJj">
+      </html>
+      '''
+
+    source_resources = set()
+    tmp_dir = util.TempDir(files)
+    for filename in files:
+      source_resources.add(tmp_dir.GetPath(filename))
+
+    def replacer(var, repl):
+      return lambda filename: filename.replace('[%s]' % var, repl)
+
+    # Test normal inlining.
+    result = html_inline.DoInline(
+        tmp_dir.GetPath('index.html'),
+        None,
+        filename_expansion_function=replacer('WHICH', '1'))
+    resources = result.inlined_files
+    resources.add(tmp_dir.GetPath('index.html'))
+    self.failUnlessEqual(resources, source_resources)
+    self.failUnlessEqual(expected_inlined,
+                         util.FixLineEnd(result.inlined_data, '\n'))
+
+    # Test names-only inlining.
+    result = html_inline.DoInline(
+        tmp_dir.GetPath('index.html'),
+        None,
+        names_only=True,
+        filename_expansion_function=replacer('WHICH', '1'))
+    resources = result.inlined_files
+    resources.add(tmp_dir.GetPath('index.html'))
+    self.failUnlessEqual(resources, source_resources)
+    tmp_dir.CleanUp()
+
+  def testWithCloseTags(self):
+    '''Tests that close tags are removed.'''
+
+    files = {
+      'index.html': '''
+      <html>
+      <head>
+      <link rel="stylesheet" href="style1.css"></link>
+      <link rel="stylesheet" href="style2.css">
+      </link>
+      <link rel="stylesheet" href="style2.css"
+      >
+      </link>
+      <script src="script1.js"></script>
+      </head>
+      <include src="tmpl1.html"></include>
+      <include src="tmpl2.html">
+      </include>
+      <include src="tmpl2.html"
+      >
+      </include>
+      <img src="img1.png">
+      <include src='single-double-quotes.html"></include>
+      <include src="double-single-quotes.html'></include>
+      </html>
+      ''',
+      'style1.css': '''h1 {}''',
+      'style2.css': '''h2 {}''',
+      'tmpl1.html': '''<h1></h1>''',
+      'tmpl2.html': '''<h2></h2>''',
+      'script1.js': '''console.log('hello');''',
+      'img1.png': '''abc''',
+    }
+
+    expected_inlined = '''
+      <html>
+      <head>
+      <style>h1 {}</style>
+      <style>h2 {}</style>
+      <style>h2 {}</style>
+      <script>console.log('hello');</script>
+      </head>
+      <h1></h1>
+      <h2></h2>
+      <h2></h2>
+      <img src="data:image/png;base64,YWJj">
+      <include src='single-double-quotes.html"></include>
+      <include src="double-single-quotes.html'></include>
+      </html>
+      '''
+
+    source_resources = set()
+    tmp_dir = util.TempDir(files)
+    for filename in files:
+      source_resources.add(tmp_dir.GetPath(filename))
+
+    # Test normal inlining.
+    result = html_inline.DoInline(
+        tmp_dir.GetPath('index.html'),
+        None)
+    resources = result.inlined_files
+    resources.add(tmp_dir.GetPath('index.html'))
+    self.failUnlessEqual(resources, source_resources)
+    self.failUnlessEqual(expected_inlined,
+                         util.FixLineEnd(result.inlined_data, '\n'))
+    tmp_dir.CleanUp()
+
+  def testCommentedJsInclude(self):
+    '''Tests that <include> works inside a comment.'''
+
+    files = {
+      'include.js': '// <include src="other.js">',
+      'other.js': '// Copyright somebody\nalert(1);',
+    }
+
+    expected_inlined = '// Copyright somebody\nalert(1);'
+
+    source_resources = set()
+    tmp_dir = util.TempDir(files)
+    for filename in files:
+      source_resources.add(tmp_dir.GetPath(filename))
+
+    result = html_inline.DoInline(tmp_dir.GetPath('include.js'), None)
+    resources = result.inlined_files
+    resources.add(tmp_dir.GetPath('include.js'))
+    self.failUnlessEqual(resources, source_resources)
+    self.failUnlessEqual(expected_inlined,
+                         util.FixLineEnd(result.inlined_data, '\n'))
+    tmp_dir.CleanUp()
+
+  def testCommentedJsIf(self):
+    '''Tests that <if> works inside a comment.'''
+
+    files = {
+      'if.js': '''
+      // <if expr="True">
+      yep();
+      // </if>
+
+      // <if expr="False">
+      nope();
+      // </if>
+      ''',
+    }
+
+    expected_inlined = '''
+      // 
+      yep();
+      // 
+
+      // 
+      '''
+
+    source_resources = set()
+    tmp_dir = util.TempDir(files)
+    for filename in files:
+      source_resources.add(tmp_dir.GetPath(filename))
+
+    class FakeGrdNode(object):
+      def EvaluateCondition(self, cond):
+        return eval(cond)
+
+    result = html_inline.DoInline(tmp_dir.GetPath('if.js'), FakeGrdNode())
+    resources = result.inlined_files
+
+    resources.add(tmp_dir.GetPath('if.js'))
+    self.failUnlessEqual(resources, source_resources)
+    self.failUnlessEqual(expected_inlined,
+                         util.FixLineEnd(result.inlined_data, '\n'))
+    tmp_dir.CleanUp()
+
+  def testImgSrcset(self):
+    '''Tests that img srcset="" attributes are converted.'''
+
+    # Note that there is no space before "img10.png" and that
+    # "img11.png" has no descriptor.
+    files = {
+      'index.html': '''
+      <html>
+      <img src="img1.png" srcset="img2.png 1x, img3.png 2x">
+      <img src="img4.png" srcset=" img5.png   1x , img6.png 2x ">
+      <img src="chrome://theme/img11.png" srcset="img7.png 1x, '''\
+          '''chrome://theme/img13.png 2x">
+      <img srcset="img8.png 300w, img9.png 11E-2w,img10.png -1e2w">
+      <img srcset="img11.png">
+      <img srcset="img11.png, img2.png 1x">
+      <img srcset="img2.png 1x, img11.png">
+      </html>
+      ''',
+      'img1.png': '''a1''',
+      'img2.png': '''a2''',
+      'img3.png': '''a3''',
+      'img4.png': '''a4''',
+      'img5.png': '''a5''',
+      'img6.png': '''a6''',
+      'img7.png': '''a7''',
+      'img8.png': '''a8''',
+      'img9.png': '''a9''',
+      'img10.png': '''a10''',
+      'img11.png': '''a11''',
+    }
+
+    expected_inlined = '''
+      <html>
+      <img src="data:image/png;base64,YTE=" srcset="data:image/png;base64,'''\
+          '''YTI= 1x,data:image/png;base64,YTM= 2x">
+      <img src="data:image/png;base64,YTQ=" srcset="data:image/png;base64,'''\
+          '''YTU= 1x,data:image/png;base64,YTY= 2x">
+      <img src="chrome://theme/img11.png" srcset="data:image/png;base64,'''\
+          '''YTc= 1x,chrome://theme/img13.png 2x">
+      <img srcset="data:image/png;base64,YTg= 300w,data:image/png;base64,'''\
+          '''YTk= 11E-2w,data:image/png;base64,YTEw -1e2w">
+      <img srcset="data:image/png;base64,YTEx">
+      <img srcset="data:image/png;base64,YTEx,data:image/png;base64,YTI= 1x">
+      <img srcset="data:image/png;base64,YTI= 1x,data:image/png;base64,YTEx">
+      </html>
+      '''
+
+    source_resources = set()
+    tmp_dir = util.TempDir(files)
+    for filename in files:
+      source_resources.add(tmp_dir.GetPath(filename))
+
+    # Test normal inlining.
+    result = html_inline.DoInline(
+        tmp_dir.GetPath('index.html'),
+        None)
+    resources = result.inlined_files
+    resources.add(tmp_dir.GetPath('index.html'))
+    self.failUnlessEqual(resources, source_resources)
+    self.failUnlessEqual(expected_inlined,
+                         util.FixLineEnd(result.inlined_data, '\n'))
+    tmp_dir.CleanUp()
+
+  def testImgSrcsetIgnoresI18n(self):
+    '''Tests that $i18n{...} strings are ignored when inlining.
+    '''
+
+    src_html = '''
+      <html>
+      <head></head>
+      <body>
+        <img srcset="$i18n{foo}">
+      </body>
+      </html>
+      '''
+
+    files = {
+      'index.html': src_html,
+    }
+
+    expected_inlined = src_html
+
+    source_resources = set()
+    tmp_dir = util.TempDir(files)
+    for filename in files:
+      source_resources.add(tmp_dir.GetPath(util.normpath(filename)))
+
+    result = html_inline.DoInline(tmp_dir.GetPath('index.html'), None)
+    resources = result.inlined_files
+    resources.add(tmp_dir.GetPath('index.html'))
+    self.failUnlessEqual(resources, source_resources)
+    self.failUnlessEqual(expected_inlined,
+                         util.FixLineEnd(result.inlined_data, '\n'))
+    tmp_dir.CleanUp()
+
+  def testSourceSrcset(self):
+    '''Tests that source srcset="" attributes are converted.'''
+
+    # Note that there is no space before "img10.png" and that
+    # "img11.png" has no descriptor.
+    files = {
+      'index.html': '''
+      <html>
+      <source src="img1.png" srcset="img2.png 1x, img3.png 2x">
+      <source src="img4.png" srcset=" img5.png   1x , img6.png 2x ">
+      <source src="chrome://theme/img11.png" srcset="img7.png 1x, '''\
+          '''chrome://theme/img13.png 2x">
+      <source srcset="img8.png 300w, img9.png 11E-2w,img10.png -1e2w">
+      <source srcset="img11.png">
+      </html>
+      ''',
+      'img1.png': '''a1''',
+      'img2.png': '''a2''',
+      'img3.png': '''a3''',
+      'img4.png': '''a4''',
+      'img5.png': '''a5''',
+      'img6.png': '''a6''',
+      'img7.png': '''a7''',
+      'img8.png': '''a8''',
+      'img9.png': '''a9''',
+      'img10.png': '''a10''',
+      'img11.png': '''a11''',
+    }
+
+    expected_inlined = '''
+      <html>
+      <source src="data:image/png;base64,YTE=" srcset="data:image/png;'''\
+          '''base64,YTI= 1x,data:image/png;base64,YTM= 2x">
+      <source src="data:image/png;base64,YTQ=" srcset="data:image/png;'''\
+          '''base64,YTU= 1x,data:image/png;base64,YTY= 2x">
+      <source src="chrome://theme/img11.png" srcset="data:image/png;'''\
+          '''base64,YTc= 1x,chrome://theme/img13.png 2x">
+      <source srcset="data:image/png;base64,YTg= 300w,data:image/png;'''\
+          '''base64,YTk= 11E-2w,data:image/png;base64,YTEw -1e2w">
+      <source srcset="data:image/png;base64,YTEx">
+      </html>
+      '''
+
+    source_resources = set()
+    tmp_dir = util.TempDir(files)
+    for filename in files:
+      source_resources.add(tmp_dir.GetPath(filename))
+
+    # Test normal inlining.
+    result = html_inline.DoInline(tmp_dir.GetPath('index.html'), None)
+    resources = result.inlined_files
+    resources.add(tmp_dir.GetPath('index.html'))
+    self.failUnlessEqual(resources, source_resources)
+    self.failUnlessEqual(expected_inlined,
+                         util.FixLineEnd(result.inlined_data, '\n'))
+    tmp_dir.CleanUp()
+
+  def testConditionalInclude(self):
+    '''Tests that output and dependency generation includes only files not'''\
+        ''' blocked by  <if> macros.'''
+
+    files = {
+      'index.html': '''
+      <html>
+      <if expr="True">
+        <img src="img1.png" srcset="img2.png 1x, img3.png 2x">
+      </if>
+      <if expr="False">
+        <img src="img4.png" srcset=" img5.png 1x, img6.png 2x ">
+      </if>
+      <if expr="True">
+        <img src="chrome://theme/img11.png" srcset="img7.png 1x, '''\
+            '''chrome://theme/img13.png 2x">
+      </if>
+      <img srcset="img8.png 300w, img9.png 11E-2w,img10.png -1e2w">
+      </html>
+      ''',
+      'img1.png': '''a1''',
+      'img2.png': '''a2''',
+      'img3.png': '''a3''',
+      'img4.png': '''a4''',
+      'img5.png': '''a5''',
+      'img6.png': '''a6''',
+      'img7.png': '''a7''',
+      'img8.png': '''a8''',
+      'img9.png': '''a9''',
+      'img10.png': '''a10''',
+    }
+
+    expected_inlined = '''
+      <html>
+      <img src="data:image/png;base64,YTE=" srcset="data:image/png;base64,'''\
+          '''YTI= 1x,data:image/png;base64,YTM= 2x">
+      <img src="chrome://theme/img11.png" srcset="data:image/png;base64,'''\
+          '''YTc= 1x,chrome://theme/img13.png 2x">
+      <img srcset="data:image/png;base64,YTg= 300w,data:image/png;base64,'''\
+          '''YTk= 11E-2w,data:image/png;base64,YTEw -1e2w">
+      </html>
+      '''
+
+    expected_files = [
+      'index.html',
+      'img1.png',
+      'img2.png',
+      'img3.png',
+      'img7.png',
+      'img8.png',
+      'img9.png',
+      'img10.png'
+    ]
+
+    source_resources = set()
+    tmp_dir = util.TempDir(files)
+    for filename in expected_files:
+      source_resources.add(tmp_dir.GetPath(filename))
+
+    class FakeGrdNode(object):
+      def EvaluateCondition(self, cond):
+        return eval(cond)
+
+    # Test normal inlining.
+    result = html_inline.DoInline(
+        tmp_dir.GetPath('index.html'),
+        FakeGrdNode())
+    resources = result.inlined_files
+    resources.add(tmp_dir.GetPath('index.html'))
+    self.failUnlessEqual(resources, source_resources)
+
+    # ignore whitespace
+    expected_inlined = re.sub(r'\s+', ' ', expected_inlined)
+    actually_inlined = re.sub(r'\s+', ' ',
+                              util.FixLineEnd(result.inlined_data, '\n'))
+    self.failUnlessEqual(expected_inlined, actually_inlined);
+    tmp_dir.CleanUp()
+
+  def testPreprocessOnlyEvaluatesIncludeAndIf(self):
+    '''Tests that preprocess_only=true evaluates <include> and <if> only.  '''
+
+    files = {
+      'index.html': '''
+      <html>
+        <head>
+          <link rel="stylesheet" href="not_inlined.css">
+          <script src="also_not_inlined.js">
+        </head>
+        <body>
+          <include src="inline_this.html">
+          <if expr="True">
+            <p>'if' should be evaluated.</p>
+          </if>
+        </body>
+      </html>
+      ''',
+      'not_inlined.css': ''' /* <link> should not be inlined. */ ''',
+      'also_not_inlined.js': ''' // <script> should not be inlined. ''',
+      'inline_this.html': ''' <p>'include' should be inlined.</p> '''
+    }
+
+    expected_inlined = '''
+      <html>
+        <head>
+          <link rel="stylesheet" href="not_inlined.css">
+          <script src="also_not_inlined.js">
+        </head>
+        <body>
+          <p>'include' should be inlined.</p>
+          <p>'if' should be evaluated.</p>
+        </body>
+      </html>
+      '''
+
+    source_resources = set()
+    tmp_dir = util.TempDir(files)
+    source_resources.add(tmp_dir.GetPath('index.html'))
+    source_resources.add(tmp_dir.GetPath('inline_this.html'))
+
+    result = html_inline.DoInline(tmp_dir.GetPath('index.html'), None,
+                                  preprocess_only=True)
+    resources = result.inlined_files
+    resources.add(tmp_dir.GetPath('index.html'))
+    self.failUnlessEqual(resources, source_resources)
+
+    # Ignore whitespace
+    expected_inlined = re.sub(r'\s+', ' ', expected_inlined)
+    actually_inlined = re.sub(r'\s+', ' ',
+                              util.FixLineEnd(result.inlined_data, '\n'))
+    self.failUnlessEqual(expected_inlined, actually_inlined)
+
+    tmp_dir.CleanUp()
+
+  def testPreprocessOnlyAppliesRecursively(self):
+    '''Tests that preprocess_only=true propagates to included files. '''
+
+    files = {
+      'index.html': '''
+      <html>
+        <include src="outer_include.html">
+      </html>
+      ''',
+      'outer_include.html': '''
+      <include src="inner_include.html">
+      <link rel="stylesheet" href="not_inlined.css">
+      ''',
+      'inner_include.html': ''' <p>This should be inlined in index.html</p> ''',
+      'not_inlined.css': ''' /* This should not be inlined. */ '''
+    }
+
+    expected_inlined = '''
+      <html>
+        <p>This should be inlined in index.html</p>
+        <link rel="stylesheet" href="not_inlined.css">
+      </html>
+      '''
+
+    source_resources = set()
+    tmp_dir = util.TempDir(files)
+    source_resources.add(tmp_dir.GetPath('index.html'))
+    source_resources.add(tmp_dir.GetPath('outer_include.html'))
+    source_resources.add(tmp_dir.GetPath('inner_include.html'))
+
+    result = html_inline.DoInline(tmp_dir.GetPath('index.html'), None,
+                                  preprocess_only=True)
+    resources = result.inlined_files
+    resources.add(tmp_dir.GetPath('index.html'))
+    self.failUnlessEqual(resources, source_resources)
+
+    # Ignore whitespace
+    expected_inlined = re.sub(r'\s+', ' ', expected_inlined)
+    actually_inlined = re.sub(r'\s+', ' ',
+                              util.FixLineEnd(result.inlined_data, '\n'))
+    self.failUnlessEqual(expected_inlined, actually_inlined)
+
+    tmp_dir.CleanUp()
+
+if __name__ == '__main__':
+  unittest.main()
diff --git a/tools/grit/grit/format/minifier.py b/tools/grit/grit/format/minifier.py
new file mode 100644
index 0000000000..1a0ea34e49
--- /dev/null
+++ b/tools/grit/grit/format/minifier.py
@@ -0,0 +1,45 @@
+# Copyright 2016 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.
+"""Framework for stripping whitespace and comments from resource files"""
+
+from __future__ import print_function
+
+from os import path
+import subprocess
+import sys
+
+import six
+
+__js_minifier = None
+__css_minifier = None
+
+def SetJsMinifier(minifier):
+  global __js_minifier
+  __js_minifier = minifier.split()
+
+def SetCssMinifier(minifier):
+  global __css_minifier
+  __css_minifier = minifier.split()
+
+def Minify(source, filename):
+  """Minify |source| (bytes) from |filename| and return bytes."""
+  file_type = path.splitext(filename)[1]
+  minifier = None
+  if file_type == '.js':
+    minifier = __js_minifier
+  elif file_type == '.css':
+    minifier = __css_minifier
+  if not minifier:
+    return source
+  p = subprocess.Popen(
+      minifier,
+      stdin=subprocess.PIPE,
+      stdout=subprocess.PIPE,
+      stderr=subprocess.PIPE)
+  (stdout, stderr) = p.communicate(source)
+  if p.returncode != 0:
+    print('Minification failed for %s' % filename)
+    print(stderr)
+    sys.exit(p.returncode)
+  return stdout
diff --git a/tools/grit/grit/format/policy_templates_json.py b/tools/grit/grit/format/policy_templates_json.py
new file mode 100644
index 0000000000..2f9330bb9a
--- /dev/null
+++ b/tools/grit/grit/format/policy_templates_json.py
@@ -0,0 +1,26 @@
+# Copyright 2017 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.
+
+"""Translates policy_templates.json files.
+"""
+
+from __future__ import print_function
+
+from grit.node import structure
+
+
+def Format(root, lang='en', output_dir='.'):
+  policy_json = None
+  for item in root.ActiveDescendants():
+    with item:
+      if (isinstance(item, structure.StructureNode) and
+          item.attrs['type'] == 'policy_template_metafile'):
+        json_text = item.gatherer.Translate(
+            lang,
+            pseudo_if_not_available=item.PseudoIsAllowed(),
+            fallback_to_english=item.ShouldFallbackToEnglish())
+        # We're only expecting one node of this kind.
+        assert not policy_json
+        policy_json = json_text
+  return policy_json
diff --git a/tools/grit/grit/format/policy_templates_json_unittest.py b/tools/grit/grit/format/policy_templates_json_unittest.py
new file mode 100644
index 0000000000..e252c94e2c
--- /dev/null
+++ b/tools/grit/grit/format/policy_templates_json_unittest.py
@@ -0,0 +1,207 @@
+#!/usr/bin/env python
+# coding: utf-8
+# Copyright 2017 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.
+
+"""Unittest for policy_templates_json.py.
+"""
+
+from __future__ import print_function
+
+import os
+import sys
+if __name__ == '__main__':
+  sys.path.append(os.path.join(os.path.dirname(__file__), '../..'))
+
+import grit.extern.tclib
+import tempfile
+import unittest
+
+from six import StringIO
+
+from grit import grd_reader
+from grit.tool import build
+
+
+class PolicyTemplatesJsonUnittest(unittest.TestCase):
+
+  def testPolicyTranslation(self):
+    # Create test policy_templates.json data.
+    caption = "The main policy"
+    caption_translation = "Die Hauptrichtlinie"
+
+    message = \
+      "Red cabbage stays red cabbage and wedding dress stays wedding dress"
+    message_translation = \
+      "Blaukraut bleibt Blaukraut und Brautkleid bleibt Brautkleid"
+
+    schema_key_description = "Number of users"
+    schema_key_description_translation = "Anzahl der Nutzer"
+
+    policy_json = """
+        {
+          "policy_definitions": [
+            {
+              'name': 'MainPolicy',
+              'type': 'main',
+              'owners': ['foo@bar.com'],
+              'schema': {
+                'properties': {
+                  'default_launch_container': {
+                    'enum': [
+                      'tab',
+                      'window',
+                    ],
+                    'type': 'string',
+                  },
+                  'users_number': {
+                    'description': '''%s''',
+                    'type': 'integer',
+                  },
+                },
+                'type': 'object',
+              },
+              'supported_on': ['chrome_os:29-'],
+              'features': {
+                'can_be_recommended': True,
+                'dynamic_refresh': True,
+              },
+              'example_value': True,
+              'caption': '''%s''',
+              'tags': [],
+              'desc': '''This policy does stuff.'''
+            },
+          ],
+          "policy_atomic_group_definitions": [],
+          "placeholders": [],
+          "messages": {
+            'message_string_id': {
+              'desc': '''The description is removed from the grit output''',
+              'text': '''%s'''
+            }
+          }
+        }""" % (schema_key_description, caption, message)
+
+    # Create translations. The translation IDs are hashed from the English text.
+    caption_id = grit.extern.tclib.GenerateMessageId(caption);
+    message_id = grit.extern.tclib.GenerateMessageId(message);
+    schema_key_description_id = grit.extern.tclib.GenerateMessageId(
+        schema_key_description)
+    policy_xtb = """
+<?xml version="1.0" ?>
+<!DOCTYPE translationbundle>
+<translationbundle lang="de">
+<translation id="%s">%s</translation>
+<translation id="%s">%s</translation>
+<translation id="%s">%s</translation>
+</translationbundle>""" % (caption_id, caption_translation,
+                           message_id, message_translation,
+                           schema_key_description_id,
+                           schema_key_description_translation)
+
+    # Write both to a temp file.
+    tmp_dir_name = tempfile.gettempdir()
+
+    json_file_path = os.path.join(tmp_dir_name, 'test.json')
+    with open(json_file_path, 'w') as f:
+      f.write(policy_json.strip())
+
+    xtb_file_path = os.path.join(tmp_dir_name, 'test.xtb')
+    with open(xtb_file_path, 'w') as f:
+      f.write(policy_xtb.strip())
+
+    # Assemble a test grit tree, similar to policy_templates.grd.
+    grd_text = '''
+    <grit base_dir="." latest_public_release="0" current_release="1" source_lang_id="en">
+      <translations>
+        <file path="%s" lang="de" />
+      </translations>
+      <release seq="1">
+        <structures>
+          <structure name="IDD_POLICY_SOURCE_FILE" file="%s" type="policy_template_metafile" />
+        </structures>
+      </release>
+    </grit>''' % (xtb_file_path, json_file_path)
+    grd_string_io = StringIO(grd_text)
+
+    # Parse the grit tree and load the policies' JSON with a gatherer.
+    grd = grd_reader.Parse(grd_string_io, dir=tmp_dir_name, defines={'_google_chrome': True})
+    grd.SetOutputLanguage('en')
+    grd.RunGatherers()
+
+    # Remove the temp files.
+    os.unlink(xtb_file_path)
+    os.unlink(json_file_path)
+
+    # Run grit with en->de translation.
+    env_lang = 'en'
+    out_lang = 'de'
+    env_defs = {'_google_chrome': '1'}
+
+    grd.SetOutputLanguage(env_lang)
+    grd.SetDefines(env_defs)
+    buf = StringIO()
+    build.RcBuilder.ProcessNode(grd, DummyOutput('policy_templates', out_lang), buf)
+    output = buf.getvalue()
+
+    # Caption and message texts get taken from xtb.
+    # desc is 'translated' to some pseudo-English
+    #   'ThïPïs pôPôlïPïcýPý dôéPôés stüPüff'.
+    expected = u"""{
+  "policy_definitions": [
+    {
+      "caption": "%s",
+      "desc": "Th\xefP\xefs p\xf4P\xf4l\xefP\xefc\xfdP\xfd d\xf4\xe9P\xf4\xe9s st\xfcP\xfcff.",
+      "example_value": true,
+      "features": {"can_be_recommended": true, "dynamic_refresh": true},
+      "name": "MainPolicy",
+      "owners": ["foo@bar.com"],
+      "schema": {
+        "properties": {
+          "default_launch_container": {
+            "enum": [
+              "tab",
+              "window"
+            ],
+            "type": "string"
+          },
+          "users_number": {
+            "description": "%s",
+            "type": "integer"
+          }
+        },
+        "type": "object"
+      },
+      "supported_on": ["chrome_os:29-"],
+      "tags": [],
+      "type": "main"
+    }
+  ],
+  "policy_atomic_group_definitions": [
+  ],
+  "messages": {
+    "message_string_id": {
+      "text": "%s"
+    }
+  }
+
+}""" % (caption_translation, schema_key_description_translation,
+        message_translation)
+    self.assertEqual(expected, output)
+
+
+class DummyOutput(object):
+
+  def __init__(self, type, language):
+    self.type = type
+    self.language = language
+
+  def GetType(self):
+    return self.type
+
+  def GetLanguage(self):
+    return self.language
+
+  def GetOutputFilename(self):
+    return 'hello.gif'
diff --git a/tools/grit/grit/format/rc.py b/tools/grit/grit/format/rc.py
new file mode 100644
index 0000000000..ed32bb809e
--- /dev/null
+++ b/tools/grit/grit/format/rc.py
@@ -0,0 +1,474 @@
+# Copyright (c) 2012 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.
+
+'''Support for formatting an RC file for compilation.
+'''
+
+from __future__ import print_function
+
+import os
+import re
+from functools import partial
+
+import six
+
+from grit import util
+from grit.node import misc
+
+
+def Format(root, lang='en', output_dir='.'):
+  from grit.node import empty, include, message, structure
+
+  yield _FormatHeader(root, lang, output_dir)
+
+  for item in root.ActiveDescendants():
+    if isinstance(item, empty.MessagesNode):
+      # Write one STRINGTABLE per <messages> container.
+      # This is hacky: it iterates over the children twice.
+      yield 'STRINGTABLE\nBEGIN\n'
+      for subitem in item.ActiveDescendants():
+        if isinstance(subitem, message.MessageNode):
+          with subitem:
+            yield FormatMessage(subitem, lang)
+      yield 'END\n\n'
+    elif isinstance(item, include.IncludeNode):
+      with item:
+        yield FormatInclude(item, lang, output_dir)
+    elif isinstance(item, structure.StructureNode):
+      with item:
+        yield FormatStructure(item, lang, output_dir)
+
+
+'''
+This dictionary defines the language charset pair lookup table, which is used
+for replacing the GRIT expand variables for language info in Product Version
+resource. The key is the language ISO country code, and the value
+is the language and character-set pair, which is a hexadecimal string
+consisting of the concatenation of the language and character-set identifiers.
+The first 4 digit of the value is the hex value of LCID, the remaining
+4 digits is the hex value of character-set id(code page)of the language.
+
+LCID resource: http://msdn.microsoft.com/en-us/library/ms776294.aspx
+Codepage resource: http://www.science.co.il/language/locale-codes.asp
+
+We have defined three GRIT expand_variables to be used in the version resource
+file to set the language info. Here is an example how they should be used in
+the VS_VERSION_INFO section of the resource file to allow GRIT to localize
+the language info correctly according to product locale.
+
+VS_VERSION_INFO VERSIONINFO
+...
+BEGIN
+    BLOCK "StringFileInfo"
+    BEGIN
+      BLOCK "[GRITVERLANGCHARSETHEX]"
+        BEGIN
+        ...
+        END
+    END
+    BLOCK "VarFileInfo"
+    BEGIN
+        VALUE "Translation", [GRITVERLANGID], [GRITVERCHARSETID]
+    END
+END
+
+'''
+
+_LANGUAGE_CHARSET_PAIR = {
+  # Language neutral LCID, unicode(1200) code page.
+  'neutral'     : '000004b0',
+  # LANG_USER_DEFAULT LCID, unicode(1200) code page.
+  'userdefault' : '040004b0',
+  'ar'          : '040104e8',
+  'fi'          : '040b04e4',
+  'ko'          : '041203b5',
+  'es'          : '0c0a04e4',
+  'bg'          : '040204e3',
+  # No codepage for filipino, use unicode(1200).
+  'fil'         : '046404e4',
+  'fr'          : '040c04e4',
+  'lv'          : '042604e9',
+  'sv'          : '041d04e4',
+  'ca'          : '040304e4',
+  'de'          : '040704e4',
+  'lt'          : '042704e9',
+  # Do not use! This is only around for backwards
+  # compatibility and will be removed - use fil instead
+  'tl'          : '0c0004b0',
+  'zh-CN'       : '080403a8',
+  'zh-TW'       : '040403b6',
+  'zh-HK'       : '0c0403b6',
+  'el'          : '040804e5',
+  'no'          : '001404e4',
+  'nb'          : '041404e4',
+  'nn'          : '081404e4',
+  'th'          : '041e036a',
+  'he'          : '040d04e7',
+  'iw'          : '040d04e7',
+  'pl'          : '041504e2',
+  'tr'          : '041f04e6',
+  'hr'          : '041a04e4',
+  # No codepage for Hindi, use unicode(1200).
+  'hi'          : '043904b0',
+  'pt-PT'       : '081604e4',
+  'pt-BR'       : '041604e4',
+  'uk'          : '042204e3',
+  'cs'          : '040504e2',
+  'hu'          : '040e04e2',
+  'ro'          : '041804e2',
+  # No codepage for Urdu, use unicode(1200).
+  'ur'          : '042004b0',
+  'da'          : '040604e4',
+  'is'          : '040f04e4',
+  'ru'          : '041904e3',
+  'vi'          : '042a04ea',
+  'nl'          : '041304e4',
+  'id'          : '042104e4',
+  'sr'          : '081a04e2',
+  'en-GB'       : '0809040e',
+  'it'          : '041004e4',
+  'sk'          : '041b04e2',
+  'et'          : '042504e9',
+  'ja'          : '041103a4',
+  'sl'          : '042404e2',
+  'en'          : '040904b0',
+  # LCID for Mexico; Windows does not support L.A. LCID.
+  'es-419'      : '080a04e4',
+  # No codepage for Bengali, use unicode(1200).
+  'bn'          : '044504b0',
+  'fa'          : '042904e8',
+  # No codepage for Gujarati, use unicode(1200).
+  'gu'          : '044704b0',
+  # No codepage for Kannada, use unicode(1200).
+  'kn'          : '044b04b0',
+  # Malay (Malaysia) [ms-MY]
+  'ms'          : '043e04e4',
+  # No codepage for Malayalam, use unicode(1200).
+  'ml'          : '044c04b0',
+  # No codepage for Marathi, use unicode(1200).
+  'mr'          : '044e04b0',
+  # No codepage for Oriya , use unicode(1200).
+  'or'          : '044804b0',
+  # No codepage for Tamil, use unicode(1200).
+  'ta'          : '044904b0',
+  # No codepage for Telugu, use unicode(1200).
+  'te'          : '044a04b0',
+  # No codepage for Amharic, use unicode(1200). >= Vista.
+  'am'          : '045e04b0',
+  'sw'          : '044104e4',
+  'af'          : '043604e4',
+  'eu'          : '042d04e4',
+  'fr-CA'       : '0c0c04e4',
+  'gl'          : '045604e4',
+  # No codepage for Zulu, use unicode(1200).
+  'zu'          : '043504b0',
+  'fake-bidi'   : '040d04e7',
+}
+
+# Language ID resource: http://msdn.microsoft.com/en-us/library/ms776294.aspx
+#
+# There is no appropriate sublang for Spanish (Latin America) [es-419], so we
+# use Mexico. SUBLANG_DEFAULT would incorrectly map to Spain. Unlike other
+# Latin American countries, Mexican Spanish is supported by VERSIONINFO:
+# http://msdn.microsoft.com/en-us/library/aa381058.aspx
+
+_LANGUAGE_DIRECTIVE_PAIR = {
+  'neutral'     : 'LANG_NEUTRAL, SUBLANG_NEUTRAL',
+  'userdefault' : 'LANG_NEUTRAL, SUBLANG_DEFAULT',
+  'ar'          : 'LANG_ARABIC, SUBLANG_DEFAULT',
+  'fi'          : 'LANG_FINNISH, SUBLANG_DEFAULT',
+  'ko'          : 'LANG_KOREAN, SUBLANG_KOREAN',
+  'es'          : 'LANG_SPANISH, SUBLANG_SPANISH_MODERN',
+  'bg'          : 'LANG_BULGARIAN, SUBLANG_DEFAULT',
+  # LANG_FILIPINO (100) not in VC 7 winnt.h.
+  'fil'         : '100, SUBLANG_DEFAULT',
+  'fr'          : 'LANG_FRENCH, SUBLANG_FRENCH',
+  'lv'          : 'LANG_LATVIAN, SUBLANG_DEFAULT',
+  'sv'          : 'LANG_SWEDISH, SUBLANG_SWEDISH',
+  'ca'          : 'LANG_CATALAN, SUBLANG_DEFAULT',
+  'de'          : 'LANG_GERMAN, SUBLANG_GERMAN',
+  'lt'          : 'LANG_LITHUANIAN, SUBLANG_LITHUANIAN',
+  # Do not use! See above.
+  'tl'          : 'LANG_NEUTRAL, SUBLANG_DEFAULT',
+  'zh-CN'       : 'LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED',
+  'zh-TW'       : 'LANG_CHINESE, SUBLANG_CHINESE_TRADITIONAL',
+  'zh-HK'       : 'LANG_CHINESE, SUBLANG_CHINESE_HONGKONG',
+  'el'          : 'LANG_GREEK, SUBLANG_DEFAULT',
+  'no'          : 'LANG_NORWEGIAN, SUBLANG_DEFAULT',
+  'nb'          : 'LANG_NORWEGIAN, SUBLANG_NORWEGIAN_BOKMAL',
+  'nn'          : 'LANG_NORWEGIAN, SUBLANG_NORWEGIAN_NYNORSK',
+  'th'          : 'LANG_THAI, SUBLANG_DEFAULT',
+  'he'          : 'LANG_HEBREW, SUBLANG_DEFAULT',
+  'iw'          : 'LANG_HEBREW, SUBLANG_DEFAULT',
+  'pl'          : 'LANG_POLISH, SUBLANG_DEFAULT',
+  'tr'          : 'LANG_TURKISH, SUBLANG_DEFAULT',
+  'hr'          : 'LANG_CROATIAN, SUBLANG_DEFAULT',
+  'hi'          : 'LANG_HINDI, SUBLANG_DEFAULT',
+  'pt-PT'       : 'LANG_PORTUGUESE, SUBLANG_PORTUGUESE',
+  'pt-BR'       : 'LANG_PORTUGUESE, SUBLANG_DEFAULT',
+  'uk'          : 'LANG_UKRAINIAN, SUBLANG_DEFAULT',
+  'cs'          : 'LANG_CZECH, SUBLANG_DEFAULT',
+  'hu'          : 'LANG_HUNGARIAN, SUBLANG_DEFAULT',
+  'ro'          : 'LANG_ROMANIAN, SUBLANG_DEFAULT',
+  'ur'          : 'LANG_URDU, SUBLANG_DEFAULT',
+  'da'          : 'LANG_DANISH, SUBLANG_DEFAULT',
+  'is'          : 'LANG_ICELANDIC, SUBLANG_DEFAULT',
+  'ru'          : 'LANG_RUSSIAN, SUBLANG_DEFAULT',
+  'vi'          : 'LANG_VIETNAMESE, SUBLANG_DEFAULT',
+  'nl'          : 'LANG_DUTCH, SUBLANG_DEFAULT',
+  'id'          : 'LANG_INDONESIAN, SUBLANG_DEFAULT',
+  'sr'          : 'LANG_SERBIAN, SUBLANG_SERBIAN_LATIN',
+  'en-GB'       : 'LANG_ENGLISH, SUBLANG_ENGLISH_UK',
+  'it'          : 'LANG_ITALIAN, SUBLANG_DEFAULT',
+  'sk'          : 'LANG_SLOVAK, SUBLANG_DEFAULT',
+  'et'          : 'LANG_ESTONIAN, SUBLANG_DEFAULT',
+  'ja'          : 'LANG_JAPANESE, SUBLANG_DEFAULT',
+  'sl'          : 'LANG_SLOVENIAN, SUBLANG_DEFAULT',
+  'en'          : 'LANG_ENGLISH, SUBLANG_ENGLISH_US',
+  # No L.A. sublang exists.
+  'es-419'      : 'LANG_SPANISH, SUBLANG_SPANISH_MEXICAN',
+  'bn'          : 'LANG_BENGALI, SUBLANG_DEFAULT',
+  'fa'          : 'LANG_PERSIAN, SUBLANG_DEFAULT',
+  'gu'          : 'LANG_GUJARATI, SUBLANG_DEFAULT',
+  'kn'          : 'LANG_KANNADA, SUBLANG_DEFAULT',
+  'ms'          : 'LANG_MALAY, SUBLANG_DEFAULT',
+  'ml'          : 'LANG_MALAYALAM, SUBLANG_DEFAULT',
+  'mr'          : 'LANG_MARATHI, SUBLANG_DEFAULT',
+  'or'          : 'LANG_ORIYA, SUBLANG_DEFAULT',
+  'ta'          : 'LANG_TAMIL, SUBLANG_DEFAULT',
+  'te'          : 'LANG_TELUGU, SUBLANG_DEFAULT',
+  'am'          : 'LANG_AMHARIC, SUBLANG_DEFAULT',
+  'sw'          : 'LANG_SWAHILI, SUBLANG_DEFAULT',
+  'af'          : 'LANG_AFRIKAANS, SUBLANG_DEFAULT',
+  'eu'          : 'LANG_BASQUE, SUBLANG_DEFAULT',
+  'fr-CA'       : 'LANG_FRENCH, SUBLANG_FRENCH_CANADIAN',
+  'gl'          : 'LANG_GALICIAN, SUBLANG_DEFAULT',
+  'zu'          : 'LANG_ZULU, SUBLANG_DEFAULT',
+  'pa'          : 'LANG_PUNJABI, SUBLANG_PUNJABI_INDIA',
+  'sa'          : 'LANG_SANSKRIT, SUBLANG_SANSKRIT_INDIA',
+  'si'          : 'LANG_SINHALESE, SUBLANG_SINHALESE_SRI_LANKA',
+  'ne'          : 'LANG_NEPALI, SUBLANG_NEPALI_NEPAL',
+  'ti'          : 'LANG_TIGRIGNA, SUBLANG_TIGRIGNA_ERITREA',
+  'fake-bidi'   : 'LANG_HEBREW, SUBLANG_DEFAULT',
+}
+
+# A note on 'no-specific-language' in the following few functions:
+# Some build systems may wish to call GRIT to scan for dependencies in
+# a language-agnostic way, and can then specify this fake language as
+# the output context.  It should never be used when output is actually
+# being generated.
+
+def GetLangCharsetPair(language):
+  if language in _LANGUAGE_CHARSET_PAIR:
+    return _LANGUAGE_CHARSET_PAIR[language]
+  if language != 'no-specific-language':
+    print('Warning:GetLangCharsetPair() found undefined language %s' % language)
+  return ''
+
+def GetLangDirectivePair(language):
+  if language in _LANGUAGE_DIRECTIVE_PAIR:
+    return _LANGUAGE_DIRECTIVE_PAIR[language]
+
+  # We don't check for 'no-specific-language' here because this
+  # function should only get called when output is being formatted,
+  # and at that point we would not want to get
+  # 'no-specific-language' passed as the language.
+  print('Warning:GetLangDirectivePair() found undefined language %s' % language)
+  return 'unknown language: see tools/grit/format/rc.py'
+
+def GetLangIdHex(language):
+  if language in _LANGUAGE_CHARSET_PAIR:
+    langcharset = _LANGUAGE_CHARSET_PAIR[language]
+    lang_id = '0x' + langcharset[0:4]
+    return lang_id
+  if language != 'no-specific-language':
+    print('Warning:GetLangIdHex() found undefined language %s' % language)
+  return ''
+
+
+def GetCharsetIdDecimal(language):
+  if language in _LANGUAGE_CHARSET_PAIR:
+    langcharset = _LANGUAGE_CHARSET_PAIR[language]
+    charset_decimal = int(langcharset[4:], 16)
+    return str(charset_decimal)
+  if language != 'no-specific-language':
+    print('Warning:GetCharsetIdDecimal() found undefined language %s' % language)
+  return ''
+
+
+def GetUnifiedLangCode(language) :
+  r = re.compile('([a-z]{1,2})_([a-z]{1,2})')
+  if r.match(language) :
+    underscore = language.find('_')
+    return language[0:underscore] + '-' + language[underscore + 1:].upper()
+  return language
+
+
+def RcSubstitutions(substituter, lang):
+  '''Add language-based substitutions for Rc files to the substitutor.'''
+  unified_lang_code = GetUnifiedLangCode(lang)
+  substituter.AddSubstitutions({
+      'GRITVERLANGCHARSETHEX': GetLangCharsetPair(unified_lang_code),
+      'GRITVERLANGID': GetLangIdHex(unified_lang_code),
+      'GRITVERCHARSETID': GetCharsetIdDecimal(unified_lang_code)})
+
+
+def _FormatHeader(root, lang, output_dir):
+  '''Returns the required preamble for RC files.'''
+  assert isinstance(lang, six.string_types)
+  assert isinstance(root, misc.GritNode)
+  # Find the location of the resource header file, so that we can include
+  # it.
+  resource_header = 'resource.h'  # fall back to this
+  language_directive = ''
+  for output in root.GetOutputFiles():
+    if output.attrs['type'] == 'rc_header':
+      resource_header = os.path.abspath(output.GetOutputFilename())
+      resource_header = util.MakeRelativePath(output_dir, resource_header)
+    if output.attrs['lang'] != lang:
+      continue
+    if output.attrs['language_section'] == '':
+      # If no language_section is requested, no directive is added
+      # (Used when the generated rc will be included from another rc
+      # file that will have the appropriate language directive)
+      language_directive = ''
+    elif output.attrs['language_section'] == 'neutral':
+      # If a neutral language section is requested (default), add a
+      # neutral language directive
+      language_directive = 'LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL'
+    elif output.attrs['language_section'] == 'lang':
+      language_directive = 'LANGUAGE %s' % GetLangDirectivePair(lang)
+  resource_header = resource_header.replace('\\', '\\\\')
+  return '''// This file is automatically generated by GRIT.  Do not edit.
+
+#include "%s"
+#include <winresrc.h>
+#ifdef IDC_STATIC
+#undef IDC_STATIC
+#endif
+#define IDC_STATIC (-1)
+
+%s
+
+
+''' % (resource_header, language_directive)
+# end _FormatHeader() function
+
+
+def FormatMessage(item, lang):
+  '''Returns a single message of a string table.'''
+  message = item.ws_at_start + item.Translate(lang) + item.ws_at_end
+  # Escape quotation marks (RC format uses doubling-up
+  message = message.replace('"', '""')
+  # Replace linebreaks with a \n escape
+  message = util.LINEBREAKS.sub(r'\\n', message)
+  if hasattr(item.GetRoot(), 'GetSubstituter'):
+    substituter = item.GetRoot().GetSubstituter()
+    message = substituter.Substitute(message)
+
+  name_attr = item.GetTextualIds()[0]
+
+  return '  %-15s "%s"\n' % (name_attr, message)
+
+
+def _FormatSection(item, lang, output_dir):
+  '''Writes out an .rc file section.'''
+  assert isinstance(lang, six.string_types)
+  from grit.node import structure
+  assert isinstance(item, structure.StructureNode)
+
+  if item.IsExcludedFromRc():
+    return ''
+
+  text = item.gatherer.Translate(
+      lang, skeleton_gatherer=item.GetSkeletonGatherer(),
+      pseudo_if_not_available=item.PseudoIsAllowed(),
+      fallback_to_english=item.ShouldFallbackToEnglish()) + '\n\n'
+
+  # Replace the language expand_variables in version rc info.
+  if item.ExpandVariables() and hasattr(item.GetRoot(), 'GetSubstituter'):
+    substituter = item.GetRoot().GetSubstituter()
+    text = substituter.Substitute(text)
+  return text
+
+
+def FormatInclude(item, lang, output_dir, type=None, process_html=False):
+  '''Formats an item that is included in an .rc file (e.g. an ICON).
+
+  Args:
+    item: an IncludeNode or StructureNode
+    lang, output_dir: standard formatter parameters
+    type: .rc file resource type, e.g. 'ICON' (ignored unless item is a
+          StructureNode)
+    process_html: False/True (ignored unless item is a StructureNode)
+  '''
+  assert isinstance(lang, six.string_types)
+  from grit.node import structure
+  from grit.node import include
+  assert isinstance(item, (structure.StructureNode, include.IncludeNode))
+
+  if isinstance(item, include.IncludeNode):
+    type = item.attrs['type'].upper()
+    process_html = item.attrs['flattenhtml'] == 'true'
+    filename_only = item.attrs['filenameonly'] == 'true'
+    relative_path = item.attrs['relativepath'] == 'true'
+  else:
+    assert (isinstance(item, structure.StructureNode) and item.attrs['type'] in
+        ['admin_template', 'chrome_html', 'chrome_scaled_image',
+         'tr_html', 'txt'])
+    filename_only = False
+    relative_path = False
+
+  # By default, we use relative pathnames to included resources so that
+  # sharing the resulting .rc files is possible.
+  #
+  # The FileForLanguage() Function has the side effect of generating the file
+  # if needed (e.g. if it is an HTML file include).
+  file_for_lang = item.FileForLanguage(lang, output_dir)
+  if file_for_lang is None:
+    return ''
+
+  filename = os.path.abspath(file_for_lang)
+  if process_html:
+    filename = item.Process(output_dir)
+  elif filename_only:
+    filename = os.path.basename(filename)
+  elif relative_path:
+    filename = util.MakeRelativePath(output_dir, filename)
+
+  filename = filename.replace('\\', '\\\\')  # escape for the RC format
+
+  if isinstance(item, structure.StructureNode) and item.IsExcludedFromRc():
+    return ''
+
+  name = item.attrs['name']
+  item_id = item.GetRoot().GetIdMap()[name]
+  return '// ID: %d\n%-18s %-18s "%s"\n' % (item_id, name, type, filename)
+
+
+def _DoNotFormat(item, lang, output_dir):
+  return ''
+
+
+# Formatter instance to use for each type attribute
+# when formatting Structure nodes.
+_STRUCTURE_FORMATTERS = {
+  'accelerators'        : _FormatSection,
+  'dialog'              : _FormatSection,
+  'menu'                : _FormatSection,
+  'rcdata'              : _FormatSection,
+  'version'             : _FormatSection,
+  'admin_template'      : partial(FormatInclude, type='ADM'),
+  'chrome_html'         : partial(FormatInclude, type='BINDATA',
+                                                 process_html=True),
+  'chrome_scaled_image' : partial(FormatInclude, type='BINDATA'),
+  'tr_html'             : partial(FormatInclude, type='HTML'),
+  'txt'                 : partial(FormatInclude, type='TXT'),
+  'policy_template_metafile': _DoNotFormat,
+}
+
+
+def FormatStructure(item, lang, output_dir):
+  formatter = _STRUCTURE_FORMATTERS[item.attrs['type']]
+  return formatter(item, lang, output_dir)
diff --git a/tools/grit/grit/format/rc_header.py b/tools/grit/grit/format/rc_header.py
new file mode 100644
index 0000000000..ea2c217f53
--- /dev/null
+++ b/tools/grit/grit/format/rc_header.py
@@ -0,0 +1,48 @@
+# Copyright (c) 2012 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.
+
+'''Item formatters for RC headers.
+'''
+
+from __future__ import print_function
+
+
+def Format(root, lang='en', output_dir='.'):
+  yield '''\
+// This file is automatically generated by GRIT. Do not edit.
+
+#pragma once
+'''
+  # Check for emit nodes under the rc_header. If any emit node
+  # is present, we assume it means the GRD file wants to override
+  # the default header, with no includes.
+  default_includes = ['#include <atlres.h>', '']
+  emit_lines = []
+  for output_node in root.GetOutputFiles():
+    if output_node.GetType() == 'rc_header':
+      for child in output_node.children:
+        if child.name == 'emit' and child.attrs['emit_type'] == 'prepend':
+          emit_lines.append(child.GetCdata())
+  for line in emit_lines or default_includes:
+    yield line + '\n'
+  if root.IsWhitelistSupportEnabled():
+    yield '#include "ui/base/resource/whitelist.h"\n'
+  for line in FormatDefines(root):
+    yield line
+
+
+def FormatDefines(root):
+  '''Yields #define SYMBOL 1234 lines.
+
+  Args:
+    root: A GritNode.
+  '''
+  tids = root.GetIdMap()
+  rc_header_format = '#define {0} {1}\n'
+  if root.IsWhitelistSupportEnabled():
+    rc_header_format = '#define {0} (::ui::WhitelistedResource<{1}>(), {1})\n'
+  for item in root.ActiveDescendants():
+    with item:
+      for tid in item.GetTextualIds():
+        yield rc_header_format.format(tid, tids[tid])
diff --git a/tools/grit/grit/format/rc_header_unittest.py b/tools/grit/grit/format/rc_header_unittest.py
new file mode 100644
index 0000000000..eed4d70a99
--- /dev/null
+++ b/tools/grit/grit/format/rc_header_unittest.py
@@ -0,0 +1,138 @@
+#!/usr/bin/env python
+# Copyright (c) 2012 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.
+
+'''Unit tests for the rc_header formatter'''
+
+# GRD samples exceed the 80 character limit.
+# pylint: disable-msg=C6310
+
+from __future__ import print_function
+
+import os
+import sys
+import unittest
+
+if __name__ == '__main__':
+  sys.path.append(os.path.join(os.path.dirname(__file__), '../..'))
+
+from grit import util
+from grit.format import rc_header
+
+
+class RcHeaderFormatterUnittest(unittest.TestCase):
+  def FormatAll(self, grd):
+    output = rc_header.FormatDefines(grd)
+    return ''.join(output).replace(' ', '')
+
+  def testFormatter(self):
+    grd = util.ParseGrdForUnittest('''
+        <includes first_id="300" comment="bingo">
+          <include type="gif" name="ID_LOGO" file="images/logo.gif" />
+        </includes>
+        <messages first_id="10000">
+          <message name="IDS_GREETING" desc="Printed to greet the currently logged in user">
+            Hello <ph name="USERNAME">%s<ex>Joi</ex></ph>, how are you doing today?
+          </message>
+          <message name="IDS_BONGO">
+            Bongo!
+          </message>
+        </messages>
+        <structures>
+          <structure type="dialog" name="IDD_NARROW_DIALOG" file="rc_files/dialogs.rc" />
+          <structure type="version" name="VS_VERSION_INFO" file="rc_files/version.rc" />
+        </structures>''')
+    output = self.FormatAll(grd)
+    self.failUnless(output.count('IDS_GREETING10000'))
+    self.failUnless(output.count('ID_LOGO300'))
+
+  def testOnlyDefineResourcesThatSatisfyOutputCondition(self):
+    grd = util.ParseGrdForUnittest('''
+        <includes first_id="300" comment="bingo">
+          <include type="gif" name="ID_LOGO" file="images/logo.gif" />
+        </includes>
+        <messages first_id="10000">
+          <message name="IDS_FIRSTPRESENTSTRING" desc="Present in .rc file.">
+            I will appear in the .rc file.
+          </message>
+          <if expr="False"> <!--Do not include in the .rc files until used.-->
+            <message name="IDS_MISSINGSTRING" desc="Not present in .rc file.">
+              I will not appear in the .rc file.
+            </message>
+          </if>
+          <if expr="lang != 'es'">
+            <message name="IDS_LANGUAGESPECIFICSTRING" desc="Present in .rc file.">
+              Hello.
+            </message>
+          </if>
+          <if expr="lang == 'es'">
+            <message name="IDS_LANGUAGESPECIFICSTRING" desc="Present in .rc file.">
+              Hola.
+            </message>
+          </if>
+          <message name="IDS_THIRDPRESENTSTRING" desc="Present in .rc file.">
+            I will also appear in the .rc file.
+          </message>
+       </messages>''')
+    output = self.FormatAll(grd)
+    self.failUnless(output.count('IDS_FIRSTPRESENTSTRING10000'))
+    self.failIf(output.count('IDS_MISSINGSTRING'))
+    self.failUnless(output.count('IDS_LANGUAGESPECIFICSTRING10002'))
+    self.failUnless(output.count('IDS_THIRDPRESENTSTRING10003'))
+
+  def testEmit(self):
+    grd = util.ParseGrdForUnittest('''
+        <outputs>
+          <output type="rc_all" filename="dummy">
+            <emit emit_type="prepend">Wrong</emit>
+          </output>
+          <if expr="False">
+            <output type="rc_header" filename="dummy">
+              <emit emit_type="prepend">No</emit>
+            </output>
+          </if>
+          <output type="rc_header" filename="dummy">
+            <emit emit_type="append">Error</emit>
+          </output>
+          <output type="rc_header" filename="dummy">
+            <emit emit_type="prepend">Bingo</emit>
+          </output>
+        </outputs>''')
+    output = ''.join(rc_header.Format(grd, 'en', '.'))
+    output = util.StripBlankLinesAndComments(output)
+    self.assertEqual('#pragma once\nBingo', output)
+
+  def testRcHeaderFormat(self):
+    grd = util.ParseGrdForUnittest('''
+        <includes first_id="300" comment="bingo">
+          <include type="gif" name="IDR_LOGO" file="images/logo.gif" />
+        </includes>
+        <messages first_id="10000">
+          <message name="IDS_GREETING" desc="Printed to greet the currently logged in user">
+            Hello <ph name="USERNAME">%s<ex>Joi</ex></ph>, how are you doing today?
+          </message>
+          <message name="IDS_BONGO">
+            Bongo!
+          </message>
+        </messages>''')
+
+    # Using the default settings.
+    output = rc_header.FormatDefines(grd)
+    self.assertEqual(('#define IDR_LOGO 300\n'
+                      '#define IDS_GREETING 10000\n'
+                      '#define IDS_BONGO 10001\n'), ''.join(output))
+
+    # Using resource whitelist support.
+    grd.SetWhitelistSupportEnabled(True)
+    output = rc_header.FormatDefines(grd)
+    self.assertEqual(('#define IDR_LOGO '
+                      '(::ui::WhitelistedResource<300>(), 300)\n'
+                      '#define IDS_GREETING '
+                      '(::ui::WhitelistedResource<10000>(), 10000)\n'
+                      '#define IDS_BONGO '
+                      '(::ui::WhitelistedResource<10001>(), 10001)\n'),
+                     ''.join(output))
+
+if __name__ == '__main__':
+  unittest.main()
diff --git a/tools/grit/grit/format/rc_unittest.py b/tools/grit/grit/format/rc_unittest.py
new file mode 100644
index 0000000000..d23f063596
--- /dev/null
+++ b/tools/grit/grit/format/rc_unittest.py
@@ -0,0 +1,415 @@
+#!/usr/bin/env python
+# Copyright (c) 2011 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.
+
+'''Unit tests for grit.format.rc'''
+
+from __future__ import print_function
+
+import os
+import re
+import sys
+if __name__ == '__main__':
+  sys.path.append(os.path.join(os.path.dirname(__file__), '../..'))
+
+import tempfile
+import unittest
+
+from six import StringIO
+
+from grit import grd_reader
+from grit import util
+from grit.node import structure
+from grit.tool import build
+
+
+_PREAMBLE = '''\
+#include "resource.h"
+#include <winresrc.h>
+#ifdef IDC_STATIC
+#undef IDC_STATIC
+#endif
+#define IDC_STATIC (-1)
+'''
+
+
+class DummyOutput(object):
+  def __init__(self, type, language, file = 'hello.gif'):
+    self.type = type
+    self.language = language
+    self.file = file
+
+  def GetType(self):
+    return self.type
+
+  def GetLanguage(self):
+    return self.language
+
+  def GetOutputFilename(self):
+    return self.file
+
+
+class FormatRcUnittest(unittest.TestCase):
+  def testMessages(self):
+    root = util.ParseGrdForUnittest("""
+      <messages>
+          <message name="IDS_BTN_GO" desc="Button text" meaning="verb">Go!</message>
+          <message name="IDS_GREETING" desc="Printed to greet the currently logged in user">
+            Hello <ph name="USERNAME">%s<ex>Joi</ex></ph>, how are you doing today?
+          </message>
+          <message name="BONGO" desc="Flippo nippo">
+            Howdie "Mr. Elephant", how are you doing?   '''
+          </message>
+          <message name="IDS_WITH_LINEBREAKS">
+Good day sir,
+I am a bee
+Sting sting
+          </message>
+      </messages>
+      """)
+
+    buf = StringIO()
+    build.RcBuilder.ProcessNode(root, DummyOutput('rc_all', 'en'), buf)
+    output = util.StripBlankLinesAndComments(buf.getvalue())
+    self.assertEqual(_PREAMBLE + u'''\
+STRINGTABLE
+BEGIN
+  IDS_BTN_GO      "Go!"
+  IDS_GREETING    "Hello %s, how are you doing today?"
+  BONGO           "Howdie ""Mr. Elephant"", how are you doing?   "
+  IDS_WITH_LINEBREAKS "Good day sir,\\nI am a bee\\nSting sting"
+END''', output)
+
+  def testRcSection(self):
+    root = util.ParseGrdForUnittest(r'''
+      <structures>
+          <structure type="menu" name="IDC_KLONKMENU" file="grit\testdata\klonk.rc" encoding="utf-16" />
+          <structure type="dialog" name="IDD_ABOUTBOX" file="grit\testdata\klonk.rc" encoding="utf-16" />
+          <structure type="version" name="VS_VERSION_INFO" file="grit\testdata\klonk.rc" encoding="utf-16" />
+      </structures>''')
+    root.SetOutputLanguage('en')
+    root.RunGatherers()
+
+    buf = StringIO()
+    build.RcBuilder.ProcessNode(root, DummyOutput('rc_all', 'en'), buf)
+    output = util.StripBlankLinesAndComments(buf.getvalue())
+    expected = _PREAMBLE + u'''\
+IDC_KLONKMENU MENU
+BEGIN
+    POPUP "&File"
+    BEGIN
+        MENUITEM "E&xit",                       IDM_EXIT
+        MENUITEM "This be ""Klonk"" me like",   ID_FILE_THISBE
+        POPUP "gonk"
+        BEGIN
+            MENUITEM "Klonk && is [good]",           ID_GONK_KLONKIS
+        END
+    END
+    POPUP "&Help"
+    BEGIN
+        MENUITEM "&About ...",                  IDM_ABOUT
+    END
+END
+
+IDD_ABOUTBOX DIALOGEX 22, 17, 230, 75
+STYLE DS_SETFONT | DS_MODALFRAME | WS_CAPTION | WS_SYSMENU
+CAPTION "About"
+FONT 8, "System", 0, 0, 0x0
+BEGIN
+    ICON            IDI_KLONK,IDC_MYICON,14,9,20,20
+    LTEXT           "klonk Version ""yibbee"" 1.0",IDC_STATIC,49,10,119,8,
+                    SS_NOPREFIX
+    LTEXT           "Copyright (C) 2005",IDC_STATIC,49,20,119,8
+    DEFPUSHBUTTON   "OK",IDOK,195,6,30,11,WS_GROUP
+    CONTROL         "Jack ""Black"" Daniels",IDC_RADIO1,"Button",
+                    BS_AUTORADIOBUTTON,46,51,84,10
+END
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION 1,0,0,1
+ PRODUCTVERSION 1,0,0,1
+ FILEFLAGSMASK 0x17L
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x4L
+ FILETYPE 0x1L
+ FILESUBTYPE 0x0L
+BEGIN
+    BLOCK "StringFileInfo"
+    BEGIN
+        BLOCK "040904b0"
+        BEGIN
+            VALUE "FileDescription", "klonk Application"
+            VALUE "FileVersion", "1, 0, 0, 1"
+            VALUE "InternalName", "klonk"
+            VALUE "LegalCopyright", "Copyright (C) 2005"
+            VALUE "OriginalFilename", "klonk.exe"
+            VALUE "ProductName", " klonk Application"
+            VALUE "ProductVersion", "1, 0, 0, 1"
+        END
+    END
+    BLOCK "VarFileInfo"
+    BEGIN
+        VALUE "Translation", 0x409, 1200
+    END
+END'''.strip()
+    for expected_line, output_line in zip(expected.split(), output.split()):
+      self.assertEqual(expected_line, output_line)
+
+  def testRcIncludeStructure(self):
+    root = util.ParseGrdForUnittest('''
+      <structures>
+        <structure type="tr_html" name="IDR_HTML" file="bingo.html"/>
+        <structure type="tr_html" name="IDR_HTML2" file="bingo2.html"/>
+      </structures>''', base_dir = '/temp')
+    # We do not run gatherers as it is not needed and wouldn't find the file
+
+    buf = StringIO()
+    build.RcBuilder.ProcessNode(root, DummyOutput('rc_all', 'en'), buf)
+    output = util.StripBlankLinesAndComments(buf.getvalue())
+    expected = (_PREAMBLE +
+                u'IDR_HTML           HTML               "%s"\n'
+                u'IDR_HTML2          HTML               "%s"'
+                % (util.normpath('/temp/bingo.html').replace('\\', '\\\\'),
+                   util.normpath('/temp/bingo2.html').replace('\\', '\\\\')))
+    # hackety hack to work on win32&lin
+    output = re.sub(r'"[c-zC-Z]:', '"', output)
+    self.assertEqual(expected, output)
+
+  def testRcIncludeFile(self):
+    root = util.ParseGrdForUnittest('''
+      <includes>
+        <include type="TXT" name="TEXT_ONE" file="bingo.txt"/>
+        <include type="TXT" name="TEXT_TWO" file="bingo2.txt"  filenameonly="true" />
+      </includes>''', base_dir = '/temp')
+
+    buf = StringIO()
+    build.RcBuilder.ProcessNode(root, DummyOutput('rc_all', 'en'), buf)
+    output = util.StripBlankLinesAndComments(buf.getvalue())
+    expected = (_PREAMBLE +
+                u'TEXT_ONE           TXT                "%s"\n'
+                u'TEXT_TWO           TXT                "%s"'
+                % (util.normpath('/temp/bingo.txt').replace('\\', '\\\\'),
+                   'bingo2.txt'))
+    # hackety hack to work on win32&lin
+    output = re.sub(r'"[c-zC-Z]:', '"', output)
+    self.assertEqual(expected, output)
+
+  def testRcIncludeFlattenedHtmlFile(self):
+    input_file = util.PathFromRoot('grit/testdata/include_test.html')
+    output_file = '%s/HTML_FILE1_include_test.html' % tempfile.gettempdir()
+    root = util.ParseGrdForUnittest('''
+      <includes>
+        <include name="HTML_FILE1" flattenhtml="true" file="%s" type="BINDATA" />
+      </includes>''' % input_file)
+
+    buf = StringIO()
+    build.RcBuilder.ProcessNode(root, DummyOutput('rc_all', 'en', output_file),
+                                buf)
+    output = util.StripBlankLinesAndComments(buf.getvalue())
+
+    expected = (_PREAMBLE +
+        u'HTML_FILE1         BINDATA            "HTML_FILE1_include_test.html"')
+    # hackety hack to work on win32&lin
+    output = re.sub(r'"[c-zC-Z]:', '"', output)
+    self.assertEqual(expected, output)
+
+    file_contents = util.ReadFile(output_file, 'utf-8')
+
+    # Check for the content added by the <include> tag.
+    self.failUnless(file_contents.find('Hello Include!') != -1)
+    # Check for the content that was removed by if tag.
+    self.failUnless(file_contents.find('should be removed') == -1)
+    # Check for the content that was kept in place by if.
+    self.failUnless(file_contents.find('should be kept') != -1)
+    self.failUnless(file_contents.find('in the middle...') != -1)
+    self.failUnless(file_contents.find('at the end...') != -1)
+    # Check for nested content that was kept
+    self.failUnless(file_contents.find('nested true should be kept') != -1)
+    self.failUnless(file_contents.find('silbing true should be kept') != -1)
+    # Check for removed "<if>" and "</if>" tags.
+    self.failUnless(file_contents.find('<if expr=') == -1)
+    self.failUnless(file_contents.find('</if>') == -1)
+    os.remove(output_file)
+
+  def testStructureNodeOutputfile(self):
+    input_file = util.PathFromRoot('grit/testdata/simple.html')
+    root = util.ParseGrdForUnittest('''
+        <structures>
+          <structure type="tr_html" name="IDR_HTML" file="%s" />
+        </structures>''' % input_file)
+    struct, = root.GetChildrenOfType(structure.StructureNode)
+    # We must run the gatherer since we'll be wanting the translation of the
+    # file.  The file exists in the location pointed to.
+    root.SetOutputLanguage('en')
+    root.RunGatherers()
+
+    output_dir = tempfile.gettempdir()
+    en_file = struct.FileForLanguage('en', output_dir)
+    self.failUnless(en_file == input_file)
+    fr_file = struct.FileForLanguage('fr', output_dir)
+    self.failUnless(fr_file == os.path.join(output_dir, 'fr_simple.html'))
+
+    contents = util.ReadFile(fr_file, 'utf-8')
+
+    self.failUnless(contents.find('<p>') != -1)  # should contain the markup
+    self.failUnless(contents.find('Hello!') == -1)  # should be translated
+    os.remove(fr_file)
+
+  def testChromeHtmlNodeOutputfile(self):
+    input_file = util.PathFromRoot('grit/testdata/chrome_html.html')
+    output_file = '%s/HTML_FILE1_chrome_html.html' % tempfile.gettempdir()
+    root = util.ParseGrdForUnittest('''
+        <structures>
+          <structure type="chrome_html" name="HTML_FILE1" file="%s" flattenhtml="true" />
+        </structures>''' % input_file)
+    struct, = root.GetChildrenOfType(structure.StructureNode)
+    struct.gatherer.SetDefines({'scale_factors': '2x'})
+    # We must run the gatherers since we'll be wanting the chrome_html output.
+    # The file exists in the location pointed to.
+    root.SetOutputLanguage('en')
+    root.RunGatherers()
+
+    buf = StringIO()
+    build.RcBuilder.ProcessNode(root, DummyOutput('rc_all', 'en', output_file),
+                                buf)
+    output = util.StripBlankLinesAndComments(buf.getvalue())
+    expected = (_PREAMBLE +
+        u'HTML_FILE1         BINDATA            "HTML_FILE1_chrome_html.html"')
+    # hackety hack to work on win32&lin
+    output = re.sub(r'"[c-zC-Z]:', '"', output)
+    self.assertEqual(expected, output)
+
+    file_contents = util.ReadFile(output_file, 'utf-8')
+
+    # Check for the content added by the <include> tag.
+    self.failUnless(file_contents.find('Hello Include!') != -1)
+    # Check for inserted -webkit-image-set.
+    self.failUnless(file_contents.find('content: -webkit-image-set') != -1)
+    os.remove(output_file)
+
+  def testSubstitutionHtml(self):
+    input_file = util.PathFromRoot('grit/testdata/toolbar_about.html')
+    root = grd_reader.Parse(StringIO('''<?xml version="1.0" encoding="UTF-8"?>
+      <grit latest_public_release="2" source_lang_id="en-US" current_release="3" base_dir=".">
+        <release seq="1" allow_pseudo="False">
+          <structures fallback_to_english="True">
+            <structure type="tr_html" name="IDR_HTML" file="%s" expand_variables="true"/>
+          </structures>
+        </release>
+      </grit>
+      ''' % input_file), util.PathFromRoot('.'))
+    root.SetOutputLanguage('ar')
+    # We must run the gatherers since we'll be wanting the translation of the
+    # file.  The file exists in the location pointed to.
+    root.RunGatherers()
+
+    output_dir = tempfile.gettempdir()
+    struct, = root.GetChildrenOfType(structure.StructureNode)
+    ar_file = struct.FileForLanguage('ar', output_dir)
+    self.failUnless(ar_file == os.path.join(output_dir,
+                                            'ar_toolbar_about.html'))
+
+    contents = util.ReadFile(ar_file, 'utf-8')
+
+    self.failUnless(contents.find('dir="RTL"') != -1)
+    os.remove(ar_file)
+
+  def testFallbackToEnglish(self):
+    root = util.ParseGrdForUnittest(r'''
+        <structures fallback_to_english="True">
+          <structure type="dialog" name="IDD_ABOUTBOX" file="grit\testdata\klonk.rc" encoding="utf-16" />
+        </structures>''', base_dir=util.PathFromRoot('.'))
+    root.SetOutputLanguage('en')
+    root.RunGatherers()
+
+    buf = StringIO()
+    formatter = build.RcBuilder.ProcessNode(
+        root, DummyOutput('rc_all', 'bingobongo'), buf)
+    output = util.StripBlankLinesAndComments(buf.getvalue())
+    self.assertEqual(_PREAMBLE + '''\
+IDD_ABOUTBOX DIALOGEX 22, 17, 230, 75
+STYLE DS_SETFONT | DS_MODALFRAME | WS_CAPTION | WS_SYSMENU
+CAPTION "About"
+FONT 8, "System", 0, 0, 0x0
+BEGIN
+    ICON            IDI_KLONK,IDC_MYICON,14,9,20,20
+    LTEXT           "klonk Version ""yibbee"" 1.0",IDC_STATIC,49,10,119,8,
+                    SS_NOPREFIX
+    LTEXT           "Copyright (C) 2005",IDC_STATIC,49,20,119,8
+    DEFPUSHBUTTON   "OK",IDOK,195,6,30,11,WS_GROUP
+    CONTROL         "Jack ""Black"" Daniels",IDC_RADIO1,"Button",
+                    BS_AUTORADIOBUTTON,46,51,84,10
+END''', output)
+
+
+  def testSubstitutionRc(self):
+    root = grd_reader.Parse(StringIO(r'''<?xml version="1.0" encoding="UTF-8"?>
+    <grit latest_public_release="2" source_lang_id="en-US" current_release="3"
+          base_dir=".">
+      <outputs>
+        <output lang="en" type="rc_all" filename="grit\testdata\klonk_resources.rc"/>
+      </outputs>
+      <release seq="1" allow_pseudo="False">
+        <structures>
+          <structure type="menu" name="IDC_KLONKMENU"
+              file="grit\testdata\klonk.rc" encoding="utf-16"
+              expand_variables="true" />
+        </structures>
+        <messages>
+          <message name="good" sub_variable="true">
+            excellent
+          </message>
+        </messages>
+      </release>
+    </grit>
+    '''), util.PathFromRoot('.'))
+    root.SetOutputLanguage('en')
+    root.RunGatherers()
+
+    buf = StringIO()
+    build.RcBuilder.ProcessNode(root, DummyOutput('rc_all', 'en'), buf)
+    output = buf.getvalue()
+    self.assertEqual('''
+// This file is automatically generated by GRIT.  Do not edit.
+
+#include "resource.h"
+#include <winresrc.h>
+#ifdef IDC_STATIC
+#undef IDC_STATIC
+#endif
+#define IDC_STATIC (-1)
+
+LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
+
+
+IDC_KLONKMENU MENU
+BEGIN
+    POPUP "&File"
+    BEGIN
+        MENUITEM "E&xit",                       IDM_EXIT
+        MENUITEM "This be ""Klonk"" me like",   ID_FILE_THISBE
+        POPUP "gonk"
+        BEGIN
+            MENUITEM "Klonk && is excellent",           ID_GONK_KLONKIS
+        END
+    END
+    POPUP "&Help"
+    BEGIN
+        MENUITEM "&About ...",                  IDM_ABOUT
+    END
+END
+
+STRINGTABLE
+BEGIN
+  good            "excellent"
+END
+'''.strip(), output.strip())
+
+
+if __name__ == '__main__':
+  unittest.main()
diff --git a/tools/grit/grit/format/resource_map.py b/tools/grit/grit/format/resource_map.py
new file mode 100644
index 0000000000..95a8b83160
--- /dev/null
+++ b/tools/grit/grit/format/resource_map.py
@@ -0,0 +1,159 @@
+# Copyright (c) 2012 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.
+
+'''This file contains item formatters for resource_map_header and
+resource_map_source files.  A resource map is a mapping between resource names
+(string) and the internal resource ID.'''
+
+from __future__ import print_function
+
+import os
+from functools import partial
+
+from grit import util
+
+
+def GetFormatter(type):
+  if type == 'resource_map_header':
+    return _FormatHeader
+  if type == 'resource_file_map_source':
+    return partial(_FormatSource, _GetItemPath)
+  if type == 'resource_map_source':
+    return partial(_FormatSource, _GetItemName)
+
+
+def GetMapName(root):
+  '''Get the name of the resource map based on the header file name.  E.g.,
+  if our header filename is theme_resources.h, we name our resource map
+  kThemeResourcesMap.
+
+  |root| is the grd file root.'''
+  outputs = root.GetOutputFiles()
+  rc_header_file = None
+  for output in outputs:
+    if 'rc_header' == output.GetType():
+      rc_header_file = output.GetFilename()
+  if not rc_header_file:
+    raise Exception('unable to find resource header filename')
+  filename = os.path.splitext(os.path.split(rc_header_file)[1])[0]
+  filename = filename[0].upper() + filename[1:]
+  while True:
+    pos = filename.find('_')
+    if pos == -1 or pos >= len(filename):
+      break
+    filename = filename[:pos] + filename[pos + 1].upper() + filename[pos + 2:]
+  return 'k' + filename
+
+
+def _FormatHeader(root, lang='en', output_dir='.'):
+  '''Create the header file for the resource mapping.  This file just declares
+  an array of name/value pairs.'''
+  return '''\
+// This file is automatically generated by GRIT.  Do not edit.
+
+#include <stddef.h>
+
+#ifndef GRIT_RESOURCE_MAP_STRUCT_
+#define GRIT_RESOURCE_MAP_STRUCT_
+struct GritResourceMap {
+  const char* const name;
+  int value;
+};
+#endif // GRIT_RESOURCE_MAP_STRUCT_
+
+extern const GritResourceMap %(map_name)s[];
+extern const size_t %(map_name)sSize;
+''' % { 'map_name': GetMapName(root) }
+
+
+def _FormatSourceHeader(root, output_dir):
+  '''Create the header of the C++ source file for the resource mapping.'''
+  rc_header_file = None
+  map_header_file = None
+  for output in root.GetOutputFiles():
+    type = output.GetType()
+    if 'rc_header' == type:
+      rc_header_file = util.MakeRelativePath(output_dir,
+                                             output.GetOutputFilename())
+    elif 'resource_map_header' == type:
+      map_header_file = util.MakeRelativePath(output_dir,
+                                              output.GetOutputFilename())
+  if not rc_header_file or not map_header_file:
+    raise Exception('resource_map_source output type requires '
+        'a resource_map_header and rc_header outputs')
+  return '''\
+// This file is automatically generated by GRIT.  Do not edit.
+
+#include "%(map_header_file)s"
+
+#include <stddef.h>
+
+#include "base/stl_util.h"
+
+#include "%(rc_header_file)s"
+
+const GritResourceMap %(map_name)s[] = {
+''' % { 'map_header_file': map_header_file,
+        'rc_header_file': rc_header_file,
+        'map_name': GetMapName(root),
+      }
+
+
+def _FormatSourceFooter(root):
+  # Return the footer text.
+  return '''\
+};
+
+const size_t %(map_name)sSize = base::size(%(map_name)s);
+''' % { 'map_name': GetMapName(root) }
+
+
+def _FormatSource(get_key, root, lang, output_dir):
+  from grit.node import include, structure, message
+  id_map = root.GetIdMap()
+  yield _FormatSourceHeader(root, output_dir)
+  seen = set()
+  for item in root.ActiveDescendants():
+    if not item.IsResourceMapSource():
+      continue
+    key = get_key(item)
+    tid = item.attrs['name']
+    if tid not in id_map or key in seen:
+      continue
+    seen.add(key)
+    yield '  {"%s", %s},\n' % (key, tid)
+  yield _FormatSourceFooter(root)
+
+
+def _GetItemName(item):
+  return item.attrs['name']
+
+# Check if |path2| is a subpath of |path1|.
+def _IsSubpath(path1, path2):
+  path1_abs = os.path.abspath(path1)
+  path2_abs = os.path.abspath(path2)
+  common = os.path.commonprefix([path1_abs, path2_abs])
+  return path1_abs == common
+
+def _GetItemPath(item):
+  path = item.GetInputPath().replace("\\", "/")
+
+  # Handle the case where the file resides within the output folder,
+  # by expanding any variables as well as replacing the output folder name with
+  # a fixed string such that the key added to the map does not depend on a given
+  # developer's setup.
+  #
+  # For example this will convert the following path:
+  # ../../out/gchrome/${root_gen_dir}/ui/webui/resources/js/foo.js
+  # to:
+  # @out_folder@/gen/ui/webui/resources/js/foo.js
+
+  real_path = item.ToRealPath(item.GetInputPath())
+  if (item.attrs.get('use_base_dir', 'true') != 'true' and
+          _IsSubpath(os.path.curdir, real_path)):
+    path = os.path.join(
+        '@out_folder@', os.path.relpath(real_path)).replace("\\", "/")
+
+  assert '$' not in path, 'all variables should have been expanded'
+  return path
diff --git a/tools/grit/grit/format/resource_map_unittest.py b/tools/grit/grit/format/resource_map_unittest.py
new file mode 100644
index 0000000000..3499b321ef
--- /dev/null
+++ b/tools/grit/grit/format/resource_map_unittest.py
@@ -0,0 +1,345 @@
+#!/usr/bin/env python
+# Copyright (c) 2012 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.
+
+'''Unit tests for grit.format.resource_map'''
+
+from __future__ import print_function
+
+import os
+import sys
+if __name__ == '__main__':
+  sys.path.append(os.path.join(os.path.dirname(__file__), '../..'))
+
+import unittest
+
+from grit import util
+from grit.format import resource_map
+
+
+class FormatResourceMapUnittest(unittest.TestCase):
+  def testFormatResourceMap(self):
+    grd = util.ParseGrdForUnittest('''
+        <outputs>
+          <output type="rc_header" filename="the_rc_header.h" />
+          <output type="resource_map_header"
+                  filename="the_resource_map_header.h" />
+        </outputs>
+        <release seq="3">
+          <structures first_id="300">
+            <structure type="menu" name="IDC_KLONKMENU"
+                       file="grit\\testdata\\klonk.rc" encoding="utf-16" />
+          </structures>
+          <includes first_id="10000">
+            <include type="foo" file="abc" name="IDS_FIRSTPRESENT" />
+            <if expr="False">
+              <include type="foo" file="def" name="IDS_MISSING" />
+            </if>
+            <if expr="lang != 'es'">
+              <include type="foo" file="ghi" name="IDS_LANGUAGESPECIFIC" />
+            </if>
+            <if expr="lang == 'es'">
+              <include type="foo" file="jkl" name="IDS_LANGUAGESPECIFIC" />
+            </if>
+            <include type="foo" file="mno" name="IDS_THIRDPRESENT" />
+            <include type="foo" file="opq" name="IDS_FOURTHPRESENT"
+                                   skip_in_resource_map="true" />
+         </includes>
+       </release>''', run_gatherers=True)
+    output = util.StripBlankLinesAndComments(''.join(
+        resource_map.GetFormatter('resource_map_header')(grd, 'en', '.')))
+    self.assertEqual('''\
+#include <stddef.h>
+#ifndef GRIT_RESOURCE_MAP_STRUCT_
+#define GRIT_RESOURCE_MAP_STRUCT_
+struct GritResourceMap {
+  const char* const name;
+  int value;
+};
+#endif // GRIT_RESOURCE_MAP_STRUCT_
+extern const GritResourceMap kTheRcHeader[];
+extern const size_t kTheRcHeaderSize;''', output)
+    output = util.StripBlankLinesAndComments(''.join(
+        resource_map.GetFormatter('resource_map_source')(grd, 'en', '.')))
+    self.assertEqual('''\
+#include "the_resource_map_header.h"
+#include <stddef.h>
+#include "base/stl_util.h"
+#include "the_rc_header.h"
+const GritResourceMap kTheRcHeader[] = {
+  {"IDC_KLONKMENU", IDC_KLONKMENU},
+  {"IDS_FIRSTPRESENT", IDS_FIRSTPRESENT},
+  {"IDS_LANGUAGESPECIFIC", IDS_LANGUAGESPECIFIC},
+  {"IDS_THIRDPRESENT", IDS_THIRDPRESENT},
+};
+const size_t kTheRcHeaderSize = base::size(kTheRcHeader);''', output)
+    output = util.StripBlankLinesAndComments(''.join(
+        resource_map.GetFormatter('resource_file_map_source')(grd, 'en', '.')))
+    self.assertEqual('''\
+#include "the_resource_map_header.h"
+#include <stddef.h>
+#include "base/stl_util.h"
+#include "the_rc_header.h"
+const GritResourceMap kTheRcHeader[] = {
+  {"grit/testdata/klonk.rc", IDC_KLONKMENU},
+  {"abc", IDS_FIRSTPRESENT},
+  {"ghi", IDS_LANGUAGESPECIFIC},
+  {"mno", IDS_THIRDPRESENT},
+};
+const size_t kTheRcHeaderSize = base::size(kTheRcHeader);''', output)
+
+  def testFormatResourceMapWithGeneratedFile(self):
+    os.environ["root_gen_dir"] = "gen"
+
+    grd = util.ParseGrdForUnittest('''\
+        <outputs>
+          <output type="rc_header" filename="the_rc_header.h" />
+          <output type="resource_map_header"
+                  filename="resource_map_header.h" />
+        </outputs>
+        <release seq="3">
+          <includes first_id="10000">
+            <include type="BINDATA"
+                     file="${root_gen_dir}/foo/bar/baz.js"
+                     name="IDR_FOO_BAR_BAZ_JS"
+                     use_base_dir="false"
+                     compress="gzip" />
+         </includes>
+        </release>''', run_gatherers=True)
+
+    formatter = resource_map.GetFormatter('resource_file_map_source')
+    output = util.StripBlankLinesAndComments(''.join(formatter(grd, 'en', '.')))
+    expected = '''\
+#include "resource_map_header.h"
+#include <stddef.h>
+#include "base/stl_util.h"
+#include "the_rc_header.h"
+const GritResourceMap kTheRcHeader[] = {
+  {"@out_folder@/gen/foo/bar/baz.js", IDR_FOO_BAR_BAZ_JS},
+};
+const size_t kTheRcHeaderSize = base::size(kTheRcHeader);'''
+    self.assertEqual(expected, output)
+
+  def testFormatResourceMapWithOutputAllEqualsFalseForStructures(self):
+    grd = util.ParseGrdForUnittest('''
+        <outputs>
+          <output type="rc_header" filename="the_rc_header.h" />
+          <output type="resource_map_header"
+                  filename="the_resource_map_header.h" />
+          <output type="resource_map_source"
+                  filename="the_resource_map_header.cc" />
+        </outputs>
+        <release seq="3">
+          <structures first_id="300">
+            <structure type="chrome_scaled_image" name="IDR_KLONKMENU"
+                       file="foo.png" />
+            <if expr="False">
+              <structure type="chrome_scaled_image" name="IDR_MISSING"
+                         file="bar.png" />
+            </if>
+            <if expr="True">
+              <structure type="chrome_scaled_image" name="IDR_BLOB"
+                         file="blob.png" />
+            </if>
+            <if expr="True">
+              <then>
+                <structure type="chrome_scaled_image" name="IDR_METEOR"
+                           file="meteor.png" />
+              </then>
+              <else>
+                <structure type="chrome_scaled_image" name="IDR_METEOR"
+                           file="roetem.png" />
+              </else>
+            </if>
+            <if expr="False">
+              <structure type="chrome_scaled_image" name="IDR_LAST"
+                         file="zyx.png" />
+            </if>
+            <if expr="True">
+              <structure type="chrome_scaled_image" name="IDR_LAST"
+                         file="xyz.png" />
+            </if>
+         </structures>
+        </release>''', run_gatherers=True)
+    output = util.StripBlankLinesAndComments(''.join(
+        resource_map.GetFormatter('resource_map_header')(grd, 'en', '.')))
+    self.assertEqual('''\
+#include <stddef.h>
+#ifndef GRIT_RESOURCE_MAP_STRUCT_
+#define GRIT_RESOURCE_MAP_STRUCT_
+struct GritResourceMap {
+  const char* const name;
+  int value;
+};
+#endif // GRIT_RESOURCE_MAP_STRUCT_
+extern const GritResourceMap kTheRcHeader[];
+extern const size_t kTheRcHeaderSize;''', output)
+    output = util.StripBlankLinesAndComments(''.join(
+        resource_map.GetFormatter('resource_map_source')(grd, 'en', '.')))
+    self.assertEqual('''\
+#include "the_resource_map_header.h"
+#include <stddef.h>
+#include "base/stl_util.h"
+#include "the_rc_header.h"
+const GritResourceMap kTheRcHeader[] = {
+  {"IDR_KLONKMENU", IDR_KLONKMENU},
+  {"IDR_BLOB", IDR_BLOB},
+  {"IDR_METEOR", IDR_METEOR},
+  {"IDR_LAST", IDR_LAST},
+};
+const size_t kTheRcHeaderSize = base::size(kTheRcHeader);''', output)
+    output = util.StripBlankLinesAndComments(''.join(
+        resource_map.GetFormatter('resource_map_source')(grd, 'en', '.')))
+    self.assertEqual('''\
+#include "the_resource_map_header.h"
+#include <stddef.h>
+#include "base/stl_util.h"
+#include "the_rc_header.h"
+const GritResourceMap kTheRcHeader[] = {
+  {"IDR_KLONKMENU", IDR_KLONKMENU},
+  {"IDR_BLOB", IDR_BLOB},
+  {"IDR_METEOR", IDR_METEOR},
+  {"IDR_LAST", IDR_LAST},
+};
+const size_t kTheRcHeaderSize = base::size(kTheRcHeader);''', output)
+
+  def testFormatResourceMapWithOutputAllEqualsFalseForIncludes(self):
+    grd = util.ParseGrdForUnittest('''
+        <outputs>
+          <output type="rc_header" filename="the_rc_header.h" />
+          <output type="resource_map_header"
+                  filename="the_resource_map_header.h" />
+        </outputs>
+        <release seq="3">
+          <structures first_id="300">
+            <structure type="menu" name="IDC_KLONKMENU"
+                       file="grit\\testdata\\klonk.rc" encoding="utf-16" />
+          </structures>
+          <includes first_id="10000">
+            <include type="foo" file="abc" name="IDS_FIRSTPRESENT" />
+            <if expr="False">
+              <include type="foo" file="def" name="IDS_MISSING" />
+            </if>
+            <include type="foo" file="mno" name="IDS_THIRDPRESENT" />
+            <if expr="True">
+              <include type="foo" file="blob" name="IDS_BLOB" />
+            </if>
+            <if expr="True">
+              <then>
+                <include type="foo" file="meteor" name="IDS_METEOR" />
+              </then>
+              <else>
+                <include type="foo" file="roetem" name="IDS_METEOR" />
+              </else>
+            </if>
+            <if expr="False">
+              <include type="foo" file="zyx" name="IDS_LAST" />
+            </if>
+            <if expr="True">
+              <include type="foo" file="xyz" name="IDS_LAST" />
+            </if>
+         </includes>
+        </release>''', run_gatherers=True)
+    output = util.StripBlankLinesAndComments(''.join(
+        resource_map.GetFormatter('resource_map_header')(grd, 'en', '.')))
+    self.assertEqual('''\
+#include <stddef.h>
+#ifndef GRIT_RESOURCE_MAP_STRUCT_
+#define GRIT_RESOURCE_MAP_STRUCT_
+struct GritResourceMap {
+  const char* const name;
+  int value;
+};
+#endif // GRIT_RESOURCE_MAP_STRUCT_
+extern const GritResourceMap kTheRcHeader[];
+extern const size_t kTheRcHeaderSize;''', output)
+    output = util.StripBlankLinesAndComments(''.join(
+        resource_map.GetFormatter('resource_map_source')(grd, 'en', '.')))
+    self.assertEqual('''\
+#include "the_resource_map_header.h"
+#include <stddef.h>
+#include "base/stl_util.h"
+#include "the_rc_header.h"
+const GritResourceMap kTheRcHeader[] = {
+  {"IDC_KLONKMENU", IDC_KLONKMENU},
+  {"IDS_FIRSTPRESENT", IDS_FIRSTPRESENT},
+  {"IDS_THIRDPRESENT", IDS_THIRDPRESENT},
+  {"IDS_BLOB", IDS_BLOB},
+  {"IDS_METEOR", IDS_METEOR},
+  {"IDS_LAST", IDS_LAST},
+};
+const size_t kTheRcHeaderSize = base::size(kTheRcHeader);''', output)
+    output = util.StripBlankLinesAndComments(''.join(
+        resource_map.GetFormatter('resource_file_map_source')(grd, 'en', '.')))
+    self.assertEqual('''\
+#include "the_resource_map_header.h"
+#include <stddef.h>
+#include "base/stl_util.h"
+#include "the_rc_header.h"
+const GritResourceMap kTheRcHeader[] = {
+  {"grit/testdata/klonk.rc", IDC_KLONKMENU},
+  {"abc", IDS_FIRSTPRESENT},
+  {"mno", IDS_THIRDPRESENT},
+  {"blob", IDS_BLOB},
+  {"meteor", IDS_METEOR},
+  {"xyz", IDS_LAST},
+};
+const size_t kTheRcHeaderSize = base::size(kTheRcHeader);''', output)
+
+  def testFormatStringResourceMap(self):
+    grd = util.ParseGrdForUnittest('''
+        <outputs>
+          <output type="rc_header" filename="the_rc_header.h" />
+          <output type="resource_map_header" filename="the_rc_map_header.h" />
+          <output type="resource_map_source" filename="the_rc_map_source.cc" />
+        </outputs>
+        <release seq="1" allow_pseudo="false">
+          <messages fallback_to_english="true">
+            <message name="IDS_PRODUCT_NAME" desc="The application name">
+              Application
+            </message>
+            <if expr="True">
+              <message name="IDS_DEFAULT_TAB_TITLE_TITLE_CASE"
+                  desc="In Title Case: The default title in a tab.">
+                New Tab
+              </message>
+            </if>
+            <if expr="False">
+              <message name="IDS_DEFAULT_TAB_TITLE"
+                  desc="The default title in a tab.">
+                New tab
+              </message>
+            </if>
+          </messages>
+        </release>''', run_gatherers=True)
+    grd.InitializeIds()
+    output = util.StripBlankLinesAndComments(''.join(
+        resource_map.GetFormatter('resource_map_header')(grd, 'en', '.')))
+    self.assertEqual('''\
+#include <stddef.h>
+#ifndef GRIT_RESOURCE_MAP_STRUCT_
+#define GRIT_RESOURCE_MAP_STRUCT_
+struct GritResourceMap {
+  const char* const name;
+  int value;
+};
+#endif // GRIT_RESOURCE_MAP_STRUCT_
+extern const GritResourceMap kTheRcHeader[];
+extern const size_t kTheRcHeaderSize;''', output)
+    output = util.StripBlankLinesAndComments(''.join(
+        resource_map.GetFormatter('resource_map_source')(grd, 'en', '.')))
+    self.assertEqual('''\
+#include "the_rc_map_header.h"
+#include <stddef.h>
+#include "base/stl_util.h"
+#include "the_rc_header.h"
+const GritResourceMap kTheRcHeader[] = {
+  {"IDS_PRODUCT_NAME", IDS_PRODUCT_NAME},
+  {"IDS_DEFAULT_TAB_TITLE_TITLE_CASE", IDS_DEFAULT_TAB_TITLE_TITLE_CASE},
+};
+const size_t kTheRcHeaderSize = base::size(kTheRcHeader);''', output)
+
+
+if __name__ == '__main__':
+  unittest.main()
diff --git a/tools/grit/grit/gather/__init__.py b/tools/grit/grit/gather/__init__.py
new file mode 100644
index 0000000000..2d578f5643
--- /dev/null
+++ b/tools/grit/grit/gather/__init__.py
@@ -0,0 +1,8 @@
+# Copyright (c) 2012 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.
+
+'''Module grit.gather
+'''
+
+pass
diff --git a/tools/grit/grit/gather/admin_template.py b/tools/grit/grit/gather/admin_template.py
new file mode 100644
index 0000000000..c26b6a88d7
--- /dev/null
+++ b/tools/grit/grit/gather/admin_template.py
@@ -0,0 +1,62 @@
+# Copyright (c) 2012 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.
+
+'''Gatherer for administrative template files.
+'''
+
+from __future__ import print_function
+
+import re
+
+from grit.gather import regexp
+from grit import exception
+from grit import lazy_re
+
+
+class MalformedAdminTemplateException(exception.Base):
+  '''This file doesn't look like a .adm file to me.'''
+  pass
+
+
+class AdmGatherer(regexp.RegexpGatherer):
+  '''Gatherer for the translateable portions of an admin template.
+
+  This gatherer currently makes the following assumptions:
+  - there is only one [strings] section and it is always the last section
+    of the file
+  - translateable strings do not need to be escaped.
+  '''
+
+  # Finds the strings section as the group named 'strings'
+  _STRINGS_SECTION = lazy_re.compile(
+      r'(?P<first_part>.+^\[strings\])(?P<strings>.+)\Z',
+      re.MULTILINE | re.DOTALL)
+
+  # Finds the translateable sections from within the [strings] section.
+  _TRANSLATEABLES = lazy_re.compile(
+      r'^\s*[A-Za-z0-9_]+\s*=\s*"(?P<text>.+)"\s*$',
+      re.MULTILINE)
+
+  def Escape(self, text):
+    return text.replace('\n', '\\n')
+
+  def UnEscape(self, text):
+    return text.replace('\\n', '\n')
+
+  def Parse(self):
+    if self.have_parsed_:
+      return
+    self.have_parsed_ = True
+
+    self.text_ = self._LoadInputFile().strip()
+    m = self._STRINGS_SECTION.match(self.text_)
+    if not m:
+      raise MalformedAdminTemplateException()
+    # Add the first part, which is all nontranslateable, to the skeleton
+    self._AddNontranslateableChunk(m.group('first_part'))
+    # Then parse the rest using the _TRANSLATEABLES regexp.
+    self._RegExpParse(self._TRANSLATEABLES, m.group('strings'))
+
+  def GetTextualIds(self):
+    return [self.extkey]
diff --git a/tools/grit/grit/gather/admin_template_unittest.py b/tools/grit/grit/gather/admin_template_unittest.py
new file mode 100644
index 0000000000..c637af3a75
--- /dev/null
+++ b/tools/grit/grit/gather/admin_template_unittest.py
@@ -0,0 +1,115 @@
+#!/usr/bin/env python
+# Copyright (c) 2012 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.
+
+'''Unit tests for the admin template gatherer.'''
+
+from __future__ import print_function
+
+import os
+import sys
+if __name__ == '__main__':
+  sys.path.append(os.path.join(os.path.dirname(__file__), '../..'))
+
+import unittest
+
+from six import StringIO
+
+from grit.gather import admin_template
+from grit import util
+from grit import grd_reader
+from grit import grit_runner
+from grit.tool import build
+
+
+class AdmGathererUnittest(unittest.TestCase):
+  def testParsingAndTranslating(self):
+    pseudofile = StringIO(
+      'bingo bongo\n'
+      'ding dong\n'
+      '[strings] \n'
+      'whatcha="bingo bongo"\n'
+      'gotcha = "bingolabongola "the wise" fingulafongula" \n')
+    gatherer = admin_template.AdmGatherer(pseudofile)
+    gatherer.Parse()
+    self.failUnless(len(gatherer.GetCliques()) == 2)
+    self.failUnless(gatherer.GetCliques()[1].GetMessage().GetRealContent() ==
+                    'bingolabongola "the wise" fingulafongula')
+
+    translation = gatherer.Translate('en')
+    self.failUnless(translation == gatherer.GetText().strip())
+
+  def testErrorHandling(self):
+    pseudofile = StringIO(
+      'bingo bongo\n'
+      'ding dong\n'
+      'whatcha="bingo bongo"\n'
+      'gotcha = "bingolabongola "the wise" fingulafongula" \n')
+    gatherer = admin_template.AdmGatherer(pseudofile)
+    self.assertRaises(admin_template.MalformedAdminTemplateException,
+                      gatherer.Parse)
+
+  _TRANSLATABLES_FROM_FILE = (
+    'Google', 'Google Desktop', 'Preferences',
+    'Controls Google Desktop preferences',
+    'Indexing and Capture Control',
+    'Controls what files, web pages, and other content will be indexed by Google Desktop.',
+    'Prevent indexing of email',
+    # there are lots more but we don't check any further
+  )
+
+  def VerifyCliquesFromAdmFile(self, cliques):
+    self.failUnless(len(cliques) > 20)
+    for clique, expected in zip(cliques, self._TRANSLATABLES_FROM_FILE):
+      text = clique.GetMessage().GetRealContent()
+      self.failUnless(text == expected)
+
+  def testFromFile(self):
+    fname = util.PathFromRoot('grit/testdata/GoogleDesktop.adm')
+    gatherer = admin_template.AdmGatherer(fname)
+    gatherer.Parse()
+    cliques = gatherer.GetCliques()
+    self.VerifyCliquesFromAdmFile(cliques)
+
+  def MakeGrd(self):
+    grd = grd_reader.Parse(StringIO('''<?xml version="1.0" encoding="UTF-8"?>
+      <grit latest_public_release="2" source_lang_id="en-US" current_release="3">
+        <release seq="3">
+          <structures>
+            <structure type="admin_template" name="IDAT_GOOGLE_DESKTOP_SEARCH"
+              file="GoogleDesktop.adm" exclude_from_rc="true" />
+            <structure type="txt" name="BINGOBONGO"
+              file="README.txt" exclude_from_rc="true" />
+          </structures>
+        </release>
+        <outputs>
+          <output filename="de_res.rc" type="rc_all" lang="de" />
+        </outputs>
+      </grit>'''), util.PathFromRoot('grit/testdata'))
+    grd.SetOutputLanguage('en')
+    grd.RunGatherers()
+    return grd
+
+  def testInGrd(self):
+    grd = self.MakeGrd()
+    cliques = grd.children[0].children[0].children[0].GetCliques()
+    self.VerifyCliquesFromAdmFile(cliques)
+
+  def testFileIsOutput(self):
+    grd = self.MakeGrd()
+    dirname = util.TempDir({})
+    try:
+      tool = build.RcBuilder()
+      tool.o = grit_runner.Options()
+      tool.output_directory = dirname.GetPath()
+      tool.res = grd
+      tool.Process()
+
+      self.failUnless(os.path.isfile(dirname.GetPath('de_GoogleDesktop.adm')))
+      self.failUnless(os.path.isfile(dirname.GetPath('de_README.txt')))
+    finally:
+      dirname.CleanUp()
+
+if __name__ == '__main__':
+  unittest.main()
diff --git a/tools/grit/grit/gather/chrome_html.py b/tools/grit/grit/gather/chrome_html.py
new file mode 100644
index 0000000000..71c1332d66
--- /dev/null
+++ b/tools/grit/grit/gather/chrome_html.py
@@ -0,0 +1,377 @@
+# Copyright (c) 2012 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.
+
+"""Prepares a Chrome HTML file by inlining resources and adding references to
+high DPI resources and removing references to unsupported scale factors.
+
+This is a small gatherer that takes a HTML file, looks for src attributes
+and inlines the specified file, producing one HTML file with no external
+dependencies. It recursively inlines the included files. When inlining CSS
+image files this script also checks for the existence of high DPI versions
+of the inlined file including those on relevant platforms. Unsupported scale
+factors are also removed from existing image sets to support explicitly
+referencing all available images.
+"""
+
+from __future__ import print_function
+
+import os
+import re
+
+from grit import lazy_re
+from grit import util
+from grit.format import html_inline
+from grit.gather import interface
+
+
+# Distribution string to replace with distribution.
+DIST_SUBSTR = '%DISTRIBUTION%'
+
+
+# Matches a chrome theme source URL.
+_THEME_SOURCE = lazy_re.compile(
+    r'(?P<baseurl>chrome://theme/IDR_[A-Z0-9_]*)(?P<query>\?.*)?')
+# Pattern for matching CSS url() function.
+_CSS_URL_PATTERN = r'url\((?P<quote>"|\'|)(?P<filename>[^"\'()]*)(?P=quote)\)'
+# Matches CSS url() functions with the capture group 'filename'.
+_CSS_URL = lazy_re.compile(_CSS_URL_PATTERN)
+# Matches one or more CSS image urls used in given properties.
+_CSS_IMAGE_URLS = lazy_re.compile(
+    r'(?P<attribute>content|background|[\w-]*-image):\s*'
+        r'(?P<urls>(' + _CSS_URL_PATTERN + r'\s*,?\s*)+)')
+# Matches CSS image sets.
+_CSS_IMAGE_SETS = lazy_re.compile(
+    r'(?P<attribute>content|background|[\w-]*-image):[ ]*'
+        r'-webkit-image-set\((?P<images>'
+        r'(\s*,?\s*url\((?P<quote>"|\'|)[^"\'()]*(?P=quote)\)[ ]*[0-9.]*x)*)\)',
+    re.MULTILINE)
+# Matches a single image in a CSS image set with the capture group scale.
+_CSS_IMAGE_SET_IMAGE = lazy_re.compile(r'\s*,?\s*'
+    r'url\((?P<quote>"|\'|)[^"\'()]*(?P=quote)\)[ ]*(?P<scale>[0-9.]*x)',
+    re.MULTILINE)
+_HTML_IMAGE_SRC = lazy_re.compile(
+    r'<img[^>]+src=\"(?P<filename>[^">]*)\"[^>]*>')
+
+def GetImageList(
+    base_path, filename, scale_factors, distribution,
+    filename_expansion_function=None):
+  """Generate the list of images which match the provided scale factors.
+
+  Takes an image filename and checks for files of the same name in folders
+  corresponding to the supported scale factors. If the file is from a
+  chrome://theme/ source, inserts supported @Nx scale factors as high DPI
+  versions.
+
+  Args:
+    base_path: path to look for relative file paths in
+    filename: name of the base image file
+    scale_factors: a list of the supported scale factors (i.e. ['2x'])
+    distribution: string that should replace %DISTRIBUTION%
+
+  Returns:
+    array of tuples containing scale factor and image (i.e.
+        [('1x', 'image.png'), ('2x', '2x/image.png')]).
+  """
+  # Any matches for which a chrome URL handler will serve all scale factors
+  # can simply request all scale factors.
+  theme_match = _THEME_SOURCE.match(filename)
+  if theme_match:
+    images = [('1x', filename)]
+    for scale_factor in scale_factors:
+      scale_filename = "%s@%s" % (theme_match.group('baseurl'), scale_factor)
+      if theme_match.group('query'):
+        scale_filename += theme_match.group('query')
+      images.append((scale_factor, scale_filename))
+    return images
+
+  if filename.find(':') != -1:
+    # filename is probably a URL, only return filename itself.
+    return [('1x', filename)]
+
+  filename = filename.replace(DIST_SUBSTR, distribution)
+  if filename_expansion_function:
+    filename = filename_expansion_function(filename)
+  filepath = os.path.join(base_path, filename)
+  images = [('1x', filename)]
+
+  for scale_factor in scale_factors:
+    # Check for existence of file and add to image set.
+    scale_path = os.path.split(os.path.join(base_path, filename))
+    scale_image_path = os.path.join(scale_path[0], scale_factor, scale_path[1])
+    if os.path.isfile(scale_image_path):
+      # HTML/CSS always uses forward slashed paths.
+      parts = filename.rsplit('/', 1)
+      if len(parts) == 1:
+        path = ''
+      else:
+        path = parts[0] + '/'
+      scale_image_name = path + scale_factor + '/' + parts[-1]
+      images.append((scale_factor, scale_image_name))
+  return images
+
+
+def GenerateImageSet(images, quote):
+  """Generates a -webkit-image-set for the provided list of images.
+
+  Args:
+    images: an array of tuples giving scale factor and file path
+            (i.e. [('1x', 'image.png'), ('2x', '2x/image.png')]).
+    quote: a string giving the quotation character to use (i.e. "'")
+
+  Returns:
+    string giving a -webkit-image-set rule referencing the provided images.
+        (i.e. '-webkit-image-set(url('image.png') 1x, url('2x/image.png') 2x)')
+  """
+  imageset = []
+  for (scale_factor, filename) in images:
+    imageset.append("url(%s%s%s) %s" % (quote, filename, quote, scale_factor))
+  return "-webkit-image-set(%s)" % (', '.join(imageset))
+
+
+def UrlToImageSet(
+    src_match, base_path, scale_factors, distribution,
+    filename_expansion_function=None):
+  """Regex replace function which replaces url() with -webkit-image-set.
+
+  Takes a regex match for url('path'). If the file is local, checks for
+  files of the same name in folders corresponding to the supported scale
+  factors. If the file is from a chrome://theme/ source, inserts the
+  supported @Nx scale factor request. In either case inserts a
+  -webkit-image-set rule to fetch the appropriate image for the current
+  scale factor.
+
+  Args:
+    src_match: regex match object from _CSS_URLS
+    base_path: path to look for relative file paths in
+    scale_factors: a list of the supported scale factors (i.e. ['2x'])
+    distribution: string that should replace %DISTRIBUTION%.
+
+  Returns:
+    string
+  """
+  quote = src_match.group('quote')
+  filename = src_match.group('filename')
+  image_list = GetImageList(
+      base_path, filename, scale_factors, distribution,
+      filename_expansion_function=filename_expansion_function)
+
+  # Don't modify the source if there is only one image.
+  if len(image_list) == 1:
+    return src_match.group(0)
+
+  return GenerateImageSet(image_list, quote)
+
+
+def InsertImageSet(
+    src_match, base_path, scale_factors, distribution,
+    filename_expansion_function=None):
+  """Regex replace function which inserts -webkit-image-set rules.
+
+  Takes a regex match for `property: url('path')[, url('path')]+`.
+  Replaces one or more occurances of the match with image set rules.
+
+  Args:
+    src_match: regex match object from _CSS_IMAGE_URLS
+    base_path: path to look for relative file paths in
+    scale_factors: a list of the supported scale factors (i.e. ['2x'])
+    distribution: string that should replace %DISTRIBUTION%.
+
+  Returns:
+    string
+  """
+  attr = src_match.group('attribute')
+  urls = _CSS_URL.sub(
+      lambda m: UrlToImageSet(m, base_path, scale_factors, distribution,
+                              filename_expansion_function),
+      src_match.group('urls'))
+
+  return "%s: %s" % (attr, urls)
+
+
+def InsertImageStyle(
+    src_match, base_path, scale_factors, distribution,
+    filename_expansion_function=None):
+  """Regex replace function which adds a content style to an <img>.
+
+  Takes a regex match from _HTML_IMAGE_SRC and replaces the attribute with a CSS
+  style which defines the image set.
+  """
+  filename = src_match.group('filename')
+  image_list = GetImageList(
+      base_path, filename, scale_factors, distribution,
+      filename_expansion_function=filename_expansion_function)
+
+  # Don't modify the source if there is only one image or image already defines
+  # a style.
+  if src_match.group(0).find(" style=\"") != -1 or len(image_list) == 1:
+    return src_match.group(0)
+
+  return "%s style=\"content: %s;\">" % (src_match.group(0)[:-1],
+                                        GenerateImageSet(image_list, "'"))
+
+
+def InsertImageSets(
+    filepath, text, scale_factors, distribution,
+    filename_expansion_function=None):
+  """Helper function that adds references to external images available in any of
+  scale_factors in CSS backgrounds.
+  """
+  # Add high DPI urls for css attributes: content, background,
+  # or *-image or <img src="foo">.
+  return _CSS_IMAGE_URLS.sub(
+      lambda m: InsertImageSet(
+          m, filepath, scale_factors, distribution,
+          filename_expansion_function=filename_expansion_function),
+      _HTML_IMAGE_SRC.sub(
+          lambda m: InsertImageStyle(
+              m, filepath, scale_factors, distribution,
+              filename_expansion_function=filename_expansion_function),
+          text))
+
+
+def RemoveImagesNotIn(scale_factors, src_match):
+  """Regex replace function which removes images for scale factors not in
+  scale_factors.
+
+  Takes a regex match for _CSS_IMAGE_SETS. For each image in the group images,
+  checks if this scale factor is in scale_factors and if not, removes it.
+
+  Args:
+    scale_factors: a list of the supported scale factors (i.e. ['1x', '2x'])
+    src_match: regex match object from _CSS_IMAGE_SETS
+
+  Returns:
+    string
+  """
+  attr = src_match.group('attribute')
+  images = _CSS_IMAGE_SET_IMAGE.sub(
+      lambda m: m.group(0) if m.group('scale') in scale_factors else '',
+      src_match.group('images'))
+  return "%s: -webkit-image-set(%s)" % (attr, images)
+
+
+def RemoveImageSetImages(text, scale_factors):
+  """Helper function which removes images in image sets not in the list of
+  supported scale_factors.
+  """
+  return _CSS_IMAGE_SETS.sub(
+      lambda m: RemoveImagesNotIn(scale_factors, m), text)
+
+
+def ProcessImageSets(
+    filepath, text, scale_factors, distribution,
+    filename_expansion_function=None):
+  """Helper function that adds references to external images available in other
+  scale_factors and removes images from image-sets in unsupported scale_factors.
+  """
+  # Explicitly add 1x to supported scale factors so that it is not removed.
+  supported_scale_factors = ['1x']
+  supported_scale_factors.extend(scale_factors)
+  return InsertImageSets(
+      filepath,
+      RemoveImageSetImages(text, supported_scale_factors),
+      scale_factors,
+      distribution,
+      filename_expansion_function=filename_expansion_function)
+
+
+class ChromeHtml(interface.GathererBase):
+  """Represents an HTML document processed for Chrome WebUI.
+
+  HTML documents used in Chrome WebUI have local resources inlined and
+  automatically insert references to high DPI assets used in CSS properties
+  with the use of the -webkit-image-set value. References to unsupported scale
+  factors in image sets are also removed. This does not generate any
+  translateable messages and instead generates a single DataPack resource.
+  """
+
+  def __init__(self, *args, **kwargs):
+    super(ChromeHtml, self).__init__(*args, **kwargs)
+    self.allow_external_script_ = False
+    self.flatten_html_ = False
+    self.preprocess_only_ = False
+    # 1x resources are implicitly already in the source and do not need to be
+    # added.
+    self.scale_factors_ = []
+    self.filename_expansion_function = None
+
+  def SetAttributes(self, attrs):
+    self.allow_external_script_ = ('allowexternalscript' in attrs and
+                                   attrs['allowexternalscript'] == 'true')
+    self.preprocess_only_ = ('preprocess' in attrs and
+                             attrs['preprocess'] == 'true')
+    self.flatten_html_ = (self.preprocess_only_ or ('flattenhtml' in attrs and
+                           attrs['flattenhtml'] == 'true'))
+
+  def SetDefines(self, defines):
+    if 'scale_factors' in defines:
+      self.scale_factors_ = defines['scale_factors'].split(',')
+
+  def GetText(self):
+    """Returns inlined text of the HTML document."""
+    return self.inlined_text_
+
+  def GetTextualIds(self):
+    return [self.extkey]
+
+  def GetData(self, lang, encoding):
+    """Returns inlined text of the HTML document."""
+    ret = self.inlined_text_
+    if encoding == util.BINARY:
+      ret = ret.encode('utf-8')
+    return ret
+
+  def GetHtmlResourceFilenames(self):
+    """Returns a set of all filenames inlined by this file."""
+    if self.flatten_html_:
+      return html_inline.GetResourceFilenames(
+          self.grd_node.ToRealPath(self.GetInputPath()),
+          self.grd_node,
+          allow_external_script=self.allow_external_script_,
+          rewrite_function=lambda fp, t, d: ProcessImageSets(
+              fp, t, self.scale_factors_, d,
+              filename_expansion_function=self.filename_expansion_function),
+          filename_expansion_function=self.filename_expansion_function)
+    return []
+
+  def Translate(self, lang, pseudo_if_not_available=True,
+                skeleton_gatherer=None, fallback_to_english=False):
+    """Returns this document translated."""
+    return self.inlined_text_
+
+  def SetFilenameExpansionFunction(self, fn):
+    self.filename_expansion_function = fn
+
+  def Parse(self):
+    """Parses and inlines the represented file."""
+
+    filename = self.GetInputPath()
+    # If there is a grd_node, prefer its GetInputPath(), as that may do more
+    # processing to make the call to ToRealPath() below work correctly.
+    if self.grd_node:
+      filename = self.grd_node.GetInputPath()
+    if self.filename_expansion_function:
+      filename = self.filename_expansion_function(filename)
+    # Hack: some unit tests supply an absolute path and no root node.
+    if not os.path.isabs(filename):
+      filename = self.grd_node.ToRealPath(filename)
+    if self.flatten_html_:
+      self.inlined_text_ = html_inline.InlineToString(
+          filename,
+          self.grd_node,
+          allow_external_script = self.allow_external_script_,
+          strip_whitespace=True,
+          preprocess_only = self.preprocess_only_,
+          rewrite_function=lambda fp, t, d: ProcessImageSets(
+              fp, t, self.scale_factors_, d,
+              filename_expansion_function=self.filename_expansion_function),
+          filename_expansion_function=self.filename_expansion_function)
+    else:
+      distribution = html_inline.GetDistribution()
+      self.inlined_text_ = ProcessImageSets(
+          os.path.dirname(filename),
+          util.ReadFile(filename, 'utf-8'),
+          self.scale_factors_,
+          distribution,
+          filename_expansion_function=self.filename_expansion_function)
diff --git a/tools/grit/grit/gather/chrome_html_unittest.py b/tools/grit/grit/gather/chrome_html_unittest.py
new file mode 100644
index 0000000000..8c75ee5bf4
--- /dev/null
+++ b/tools/grit/grit/gather/chrome_html_unittest.py
@@ -0,0 +1,610 @@
+#!/usr/bin/env python
+# Copyright (c) 2012 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.
+
+'''Unit tests for grit.gather.chrome_html'''
+
+from __future__ import print_function
+
+import os
+import re
+import sys
+if __name__ == '__main__':
+  sys.path.append(os.path.join(os.path.dirname(__file__), '../..'))
+
+import unittest
+
+from grit import lazy_re
+from grit import util
+from grit.gather import chrome_html
+
+
+_NEW_LINE = lazy_re.compile('(\r\n|\r|\n)', re.MULTILINE)
+
+
+def StandardizeHtml(text):
+  '''Standardizes the newline format and png mime type in Html text.'''
+  return _NEW_LINE.sub('\n', text).replace('data:image/x-png;',
+                                           'data:image/png;')
+
+
+class ChromeHtmlUnittest(unittest.TestCase):
+  '''Unit tests for ChromeHtml.'''
+
+  def testFileResources(self):
+    '''Tests inlined image file resources with available high DPI assets.'''
+
+    tmp_dir = util.TempDir({
+      'index.html': '''
+      <!DOCTYPE HTML>
+      <html>
+        <head>
+          <link rel="stylesheet" href="test.css">
+        </head>
+        <body>
+          <!-- Don't need a body. -->
+        </body>
+      </html>
+      ''',
+
+      'test.css': '''
+      .image {
+        background: url('test.png');
+      }
+      ''',
+
+      'test.png': 'PNG DATA',
+
+      '1.4x/test.png': '1.4x PNG DATA',
+
+      '1.8x/test.png': '1.8x PNG DATA',
+    })
+
+    html = chrome_html.ChromeHtml(tmp_dir.GetPath('index.html'))
+    html.SetDefines({'scale_factors': '1.4x,1.8x'})
+    html.SetAttributes({'flattenhtml': 'true'})
+    html.Parse()
+    self.failUnlessEqual(StandardizeHtml(html.GetData('en', 'utf-8')),
+                         StandardizeHtml('''
+      <!DOCTYPE HTML>
+      <html>
+        <head>
+          <style>
+      .image {
+        background: -webkit-image-set(url('data:image/png;base64,UE5HIERBVEE=') 1x, url('data:image/png;base64,MS40eCBQTkcgREFUQQ==') 1.4x, url('data:image/png;base64,MS44eCBQTkcgREFUQQ==') 1.8x);
+      }
+      </style>
+        </head>
+        <body>
+          <!-- Don't need a body. -->
+        </body>
+      </html>
+      '''))
+    tmp_dir.CleanUp()
+
+  def testFileResourcesImageTag(self):
+    '''Tests inlined image file resources with available high DPI assets on
+    an image tag.'''
+
+    tmp_dir = util.TempDir({
+      'index.html': '''
+      <!DOCTYPE HTML>
+      <html>
+        <body>
+          <img id="foo" src="test.png">
+        </body>
+      </html>
+      ''',
+
+      'test.png': 'PNG DATA',
+
+      '2x/test.png': '2x PNG DATA',
+    })
+
+    html = chrome_html.ChromeHtml(tmp_dir.GetPath('index.html'))
+    html.SetDefines({'scale_factors': '2x'})
+    html.SetAttributes({'flattenhtml': 'true'})
+    html.Parse()
+    self.failUnlessEqual(StandardizeHtml(html.GetData('en', 'utf-8')),
+                         StandardizeHtml('''
+      <!DOCTYPE HTML>
+      <html>
+        <body>
+          <img id="foo" src="data:image/png;base64,UE5HIERBVEE=" style="content: -webkit-image-set(url('data:image/png;base64,UE5HIERBVEE=') 1x, url('data:image/png;base64,MnggUE5HIERBVEE=') 2x);">
+        </body>
+      </html>
+      '''))
+    tmp_dir.CleanUp()
+
+  def testFileResourcesNoFlatten(self):
+    '''Tests non-inlined image file resources with available high DPI assets.'''
+
+    tmp_dir = util.TempDir({
+      'test.css': '''
+      .image {
+        background: url('test.png');
+      }
+      ''',
+
+      'test.png': 'PNG DATA',
+
+      '1.4x/test.png': '1.4x PNG DATA',
+
+      '1.8x/test.png': '1.8x PNG DATA',
+    })
+
+    html = chrome_html.ChromeHtml(tmp_dir.GetPath('test.css'))
+    html.SetDefines({'scale_factors': '1.4x,1.8x'})
+    html.SetAttributes({'flattenhtml': 'false'})
+    html.Parse()
+    self.failUnlessEqual(StandardizeHtml(html.GetData('en', 'utf-8')),
+                         StandardizeHtml('''
+      .image {
+        background: -webkit-image-set(url('test.png') 1x, url('1.4x/test.png') 1.4x, url('1.8x/test.png') 1.8x);
+      }
+      '''))
+    tmp_dir.CleanUp()
+
+  def testFileResourcesNoFlattenSubdir(self):
+    '''Tests non-inlined image file resources w/high DPI assets in subdirs.'''
+
+    tmp_dir = util.TempDir({
+      'test.css': '''
+      .image {
+        background: url('sub/test.png');
+      }
+      ''',
+
+      'sub/test.png': 'PNG DATA',
+
+      'sub/1.4x/test.png': '1.4x PNG DATA',
+
+      'sub/1.8x/test.png': '1.8x PNG DATA',
+    })
+
+    html = chrome_html.ChromeHtml(tmp_dir.GetPath('test.css'))
+    html.SetDefines({'scale_factors': '1.4x,1.8x'})
+    html.SetAttributes({'flattenhtml': 'false'})
+    html.Parse()
+    self.failUnlessEqual(StandardizeHtml(html.GetData('en', 'utf-8')),
+                         StandardizeHtml('''
+      .image {
+        background: -webkit-image-set(url('sub/test.png') 1x, url('sub/1.4x/test.png') 1.4x, url('sub/1.8x/test.png') 1.8x);
+      }
+      '''))
+    tmp_dir.CleanUp()
+
+  def testFileResourcesPreprocess(self):
+    '''Tests preprocessed image file resources with available high DPI
+    assets.'''
+
+    tmp_dir = util.TempDir({
+      'test.css': '''
+      .image {
+        background: url('test.png');
+      }
+      ''',
+
+      'test.png': 'PNG DATA',
+
+      '1.4x/test.png': '1.4x PNG DATA',
+
+      '1.8x/test.png': '1.8x PNG DATA',
+    })
+
+    html = chrome_html.ChromeHtml(tmp_dir.GetPath('test.css'))
+    html.SetDefines({'scale_factors': '1.4x,1.8x'})
+    html.SetAttributes({'flattenhtml': 'false', 'preprocess': 'true'})
+    html.Parse()
+    self.failUnlessEqual(StandardizeHtml(html.GetData('en', 'utf-8')),
+                         StandardizeHtml('''
+      .image {
+        background: -webkit-image-set(url('test.png') 1x, url('1.4x/test.png') 1.4x, url('1.8x/test.png') 1.8x);
+      }
+      '''))
+    tmp_dir.CleanUp()
+
+  def testFileResourcesDoubleQuotes(self):
+    '''Tests inlined image file resources if url() filename is double quoted.'''
+
+    tmp_dir = util.TempDir({
+      'test.css': '''
+      .image {
+        background: url("test.png");
+      }
+      ''',
+
+      'test.png': 'PNG DATA',
+
+      '2x/test.png': '2x PNG DATA',
+    })
+
+    html = chrome_html.ChromeHtml(tmp_dir.GetPath('test.css'))
+    html.SetDefines({'scale_factors': '2x'})
+    html.SetAttributes({'flattenhtml': 'true'})
+    html.Parse()
+    self.failUnlessEqual(StandardizeHtml(html.GetData('en', 'utf-8')),
+                         StandardizeHtml('''
+      .image {
+        background: -webkit-image-set(url("data:image/png;base64,UE5HIERBVEE=") 1x, url("data:image/png;base64,MnggUE5HIERBVEE=") 2x);
+      }
+      '''))
+    tmp_dir.CleanUp()
+
+  def testFileResourcesNoQuotes(self):
+    '''Tests inlined image file resources when url() filename is unquoted.'''
+
+    tmp_dir = util.TempDir({
+      'test.css': '''
+      .image {
+        background: url(test.png);
+      }
+      ''',
+
+      'test.png': 'PNG DATA',
+
+      '2x/test.png': '2x PNG DATA',
+    })
+
+    html = chrome_html.ChromeHtml(tmp_dir.GetPath('test.css'))
+    html.SetDefines({'scale_factors': '2x'})
+    html.SetAttributes({'flattenhtml': 'true'})
+    html.Parse()
+    self.failUnlessEqual(StandardizeHtml(html.GetData('en', 'utf-8')),
+                         StandardizeHtml('''
+      .image {
+        background: -webkit-image-set(url(data:image/png;base64,UE5HIERBVEE=) 1x, url(data:image/png;base64,MnggUE5HIERBVEE=) 2x);
+      }
+      '''))
+    tmp_dir.CleanUp()
+
+  def testFileResourcesSubdirs(self):
+    '''Tests inlined image file resources if url() filename is in a subdir.'''
+
+    tmp_dir = util.TempDir({
+      'test.css': '''
+      .image {
+        background: url('some/sub/path/test.png');
+      }
+      ''',
+
+      'some/sub/path/test.png': 'PNG DATA',
+
+      'some/sub/path/2x/test.png': '2x PNG DATA',
+    })
+
+    html = chrome_html.ChromeHtml(tmp_dir.GetPath('test.css'))
+    html.SetDefines({'scale_factors': '2x'})
+    html.SetAttributes({'flattenhtml': 'true'})
+    html.Parse()
+    self.failUnlessEqual(StandardizeHtml(html.GetData('en', 'utf-8')),
+                         StandardizeHtml('''
+      .image {
+        background: -webkit-image-set(url('data:image/png;base64,UE5HIERBVEE=') 1x, url('data:image/png;base64,MnggUE5HIERBVEE=') 2x);
+      }
+      '''))
+    tmp_dir.CleanUp()
+
+  def testFileResourcesNoFile(self):
+    '''Tests inlined image file resources without available high DPI assets.'''
+
+    tmp_dir = util.TempDir({
+      'index.html': '''
+      <!DOCTYPE HTML>
+      <html>
+        <head>
+          <link rel="stylesheet" href="test.css">
+        </head>
+        <body>
+          <!-- Don't need a body. -->
+        </body>
+      </html>
+      ''',
+
+      'test.css': '''
+      .image {
+        background: url('test.png');
+      }
+      ''',
+
+      'test.png': 'PNG DATA',
+    })
+
+    html = chrome_html.ChromeHtml(tmp_dir.GetPath('index.html'))
+    html.SetDefines({'scale_factors': '2x'})
+    html.SetAttributes({'flattenhtml': 'true'})
+    html.Parse()
+    self.failUnlessEqual(StandardizeHtml(html.GetData('en', 'utf-8')),
+                         StandardizeHtml('''
+      <!DOCTYPE HTML>
+      <html>
+        <head>
+          <style>
+      .image {
+        background: url('data:image/png;base64,UE5HIERBVEE=');
+      }
+      </style>
+        </head>
+        <body>
+          <!-- Don't need a body. -->
+        </body>
+      </html>
+      '''))
+    tmp_dir.CleanUp()
+
+  def testFileResourcesMultipleBackgrounds(self):
+    '''Tests inlined image file resources with two url()s.'''
+
+    tmp_dir = util.TempDir({
+      'test.css': '''
+      .image {
+        background: url(test.png), url(test.png);
+      }
+      ''',
+
+      'test.png': 'PNG DATA',
+
+      '2x/test.png': '2x PNG DATA',
+    })
+
+    html = chrome_html.ChromeHtml(tmp_dir.GetPath('test.css'))
+    html.SetDefines({'scale_factors': '2x'})
+    html.SetAttributes({'flattenhtml': 'true'})
+    html.Parse()
+    self.failUnlessEqual(StandardizeHtml(html.GetData('en', 'utf-8')),
+                         StandardizeHtml('''
+      .image {
+        background: -webkit-image-set(url(data:image/png;base64,UE5HIERBVEE=) 1x, url(data:image/png;base64,MnggUE5HIERBVEE=) 2x), -webkit-image-set(url(data:image/png;base64,UE5HIERBVEE=) 1x, url(data:image/png;base64,MnggUE5HIERBVEE=) 2x);
+      }
+      '''))
+    tmp_dir.CleanUp()
+
+  def testFileResourcesMultipleBackgroundsWithNewline1(self):
+    '''Tests inlined image file resources with line break after first url().'''
+
+    tmp_dir = util.TempDir({
+      'test.css': '''
+      .image {
+        background: url(test.png),
+                    url(test.png);
+      }
+      ''',
+
+      'test.png': 'PNG DATA',
+
+      '2x/test.png': '2x PNG DATA',
+    })
+
+    html = chrome_html.ChromeHtml(tmp_dir.GetPath('test.css'))
+    html.SetDefines({'scale_factors': '2x'})
+    html.SetAttributes({'flattenhtml': 'true'})
+    html.Parse()
+    self.failUnlessEqual(StandardizeHtml(html.GetData('en', 'utf-8')),
+                         StandardizeHtml('''
+      .image {
+        background: -webkit-image-set(url(data:image/png;base64,UE5HIERBVEE=) 1x, url(data:image/png;base64,MnggUE5HIERBVEE=) 2x),
+                    -webkit-image-set(url(data:image/png;base64,UE5HIERBVEE=) 1x, url(data:image/png;base64,MnggUE5HIERBVEE=) 2x);
+      }
+      '''))
+    tmp_dir.CleanUp()
+
+  def testFileResourcesMultipleBackgroundsWithNewline2(self):
+    '''Tests inlined image file resources with line break before first url()
+    and before second url().'''
+
+    tmp_dir = util.TempDir({
+      'test.css': '''
+      .image {
+        background:
+          url(test.png),
+          url(test.png);
+      }
+      ''',
+
+      'test.png': 'PNG DATA',
+
+      '2x/test.png': '2x PNG DATA',
+    })
+
+    html = chrome_html.ChromeHtml(tmp_dir.GetPath('test.css'))
+    html.SetDefines({'scale_factors': '2x'})
+    html.SetAttributes({'flattenhtml': 'true'})
+    html.Parse()
+    self.failUnlessEqual(StandardizeHtml(html.GetData('en', 'utf-8')),
+                         StandardizeHtml('''
+      .image {
+        background: -webkit-image-set(url(data:image/png;base64,UE5HIERBVEE=) 1x, url(data:image/png;base64,MnggUE5HIERBVEE=) 2x),
+          -webkit-image-set(url(data:image/png;base64,UE5HIERBVEE=) 1x, url(data:image/png;base64,MnggUE5HIERBVEE=) 2x);
+      }
+      '''))
+    tmp_dir.CleanUp()
+
+  def testFileResourcesCRLF(self):
+    '''Tests inlined image file resource when url() is preceded by a Windows
+    style line break.'''
+
+    tmp_dir = util.TempDir({
+      'test.css': '''
+      .image {
+        background:\r\nurl(test.png);
+      }
+      ''',
+
+      'test.png': 'PNG DATA',
+
+      '2x/test.png': '2x PNG DATA',
+    })
+
+    html = chrome_html.ChromeHtml(tmp_dir.GetPath('test.css'))
+    html.SetDefines({'scale_factors': '2x'})
+    html.SetAttributes({'flattenhtml': 'true'})
+    html.Parse()
+    self.failUnlessEqual(StandardizeHtml(html.GetData('en', 'utf-8')),
+                         StandardizeHtml('''
+      .image {
+        background: -webkit-image-set(url(data:image/png;base64,UE5HIERBVEE=) 1x, url(data:image/png;base64,MnggUE5HIERBVEE=) 2x);
+      }
+      '''))
+    tmp_dir.CleanUp()
+
+  def testThemeResources(self):
+    '''Tests inserting high DPI chrome://theme references.'''
+
+    tmp_dir = util.TempDir({
+      'index.html': '''
+      <!DOCTYPE HTML>
+      <html>
+        <head>
+          <link rel="stylesheet" href="test.css">
+        </head>
+        <body>
+          <!-- Don't need a body. -->
+        </body>
+      </html>
+      ''',
+
+      'test.css': '''
+      .image {
+        background: url('chrome://theme/IDR_RESOURCE_NAME');
+        content: url('chrome://theme/IDR_RESOURCE_NAME_WITH_Q?$1');
+      }
+      ''',
+    })
+
+    html = chrome_html.ChromeHtml(tmp_dir.GetPath('index.html'))
+    html.SetDefines({'scale_factors': '2x'})
+    html.SetAttributes({'flattenhtml': 'true'})
+    html.Parse()
+    self.failUnlessEqual(StandardizeHtml(html.GetData('en', 'utf-8')),
+                         StandardizeHtml('''
+      <!DOCTYPE HTML>
+      <html>
+        <head>
+          <style>
+      .image {
+        background: -webkit-image-set(url('chrome://theme/IDR_RESOURCE_NAME') 1x, url('chrome://theme/IDR_RESOURCE_NAME@2x') 2x);
+        content: -webkit-image-set(url('chrome://theme/IDR_RESOURCE_NAME_WITH_Q?$1') 1x, url('chrome://theme/IDR_RESOURCE_NAME_WITH_Q@2x?$1') 2x);
+      }
+      </style>
+        </head>
+        <body>
+          <!-- Don't need a body. -->
+        </body>
+      </html>
+      '''))
+    tmp_dir.CleanUp()
+
+  def testRemoveUnsupportedScale(self):
+    '''Tests removing an unsupported scale factor from an explicit image-set.'''
+
+    tmp_dir = util.TempDir({
+      'index.html': '''
+      <!DOCTYPE HTML>
+      <html>
+        <head>
+          <link rel="stylesheet" href="test.css">
+        </head>
+        <body>
+          <!-- Don't need a body. -->
+        </body>
+      </html>
+      ''',
+
+      'test.css': '''
+      .image {
+        background: -webkit-image-set(url('test.png') 1x,
+                                      url('test1.4.png') 1.4x,
+                                      url('test1.8.png') 1.8x);
+      }
+      ''',
+
+      'test.png': 'PNG DATA',
+
+      'test1.4.png': '1.4x PNG DATA',
+
+      'test1.8.png': '1.8x PNG DATA',
+    })
+
+    html = chrome_html.ChromeHtml(tmp_dir.GetPath('index.html'))
+    html.SetDefines({'scale_factors': '1.8x'})
+    html.SetAttributes({'flattenhtml': 'true'})
+    html.Parse()
+    self.failUnlessEqual(StandardizeHtml(html.GetData('en', 'utf-8')),
+                         StandardizeHtml('''
+      <!DOCTYPE HTML>
+      <html>
+        <head>
+          <style>
+      .image {
+        background: -webkit-image-set(url('data:image/png;base64,UE5HIERBVEE=') 1x,
+                                      url('data:image/png;base64,MS44eCBQTkcgREFUQQ==') 1.8x);
+      }
+      </style>
+        </head>
+        <body>
+          <!-- Don't need a body. -->
+        </body>
+      </html>
+      '''))
+    tmp_dir.CleanUp()
+
+  def testExpandVariablesInFilename(self):
+    '''
+    Tests variable substitution in filenames while flattening images
+    with multiple scale factors.
+    '''
+
+    tmp_dir = util.TempDir({
+      'index.html': '''
+      <!DOCTYPE HTML>
+      <html>
+        <head>
+          <link rel="stylesheet" href="test.css">
+        </head>
+        <body>
+          <!-- Don't need a body. -->
+        </body>
+      </html>
+      ''',
+
+      'test.css': '''
+      .image {
+        background: url('test[WHICH].png');
+      }
+      ''',
+
+      'test1.png': 'PNG DATA',
+      '1.4x/test1.png': '1.4x PNG DATA',
+      '1.8x/test1.png': '1.8x PNG DATA',
+    })
+
+    def replacer(var, repl):
+      return lambda filename: filename.replace('[%s]' % var, repl)
+
+    html = chrome_html.ChromeHtml(tmp_dir.GetPath('index.html'))
+    html.SetDefines({'scale_factors': '1.4x,1.8x'})
+    html.SetAttributes({'flattenhtml': 'true'})
+    html.SetFilenameExpansionFunction(replacer('WHICH', '1'));
+    html.Parse()
+    self.failUnlessEqual(StandardizeHtml(html.GetData('en', 'utf-8')),
+                         StandardizeHtml('''
+      <!DOCTYPE HTML>
+      <html>
+        <head>
+          <style>
+      .image {
+        background: -webkit-image-set(url('data:image/png;base64,UE5HIERBVEE=') 1x, url('data:image/png;base64,MS40eCBQTkcgREFUQQ==') 1.4x, url('data:image/png;base64,MS44eCBQTkcgREFUQQ==') 1.8x);
+      }
+      </style>
+        </head>
+        <body>
+          <!-- Don't need a body. -->
+        </body>
+      </html>
+      '''))
+    tmp_dir.CleanUp()
+
+
+if __name__ == '__main__':
+  unittest.main()
diff --git a/tools/grit/grit/gather/chrome_scaled_image.py b/tools/grit/grit/gather/chrome_scaled_image.py
new file mode 100644
index 0000000000..44f98cbcf0
--- /dev/null
+++ b/tools/grit/grit/gather/chrome_scaled_image.py
@@ -0,0 +1,157 @@
+# Copyright (c) 2012 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.
+
+'''Gatherer for <structure type="chrome_scaled_image">.
+'''
+
+from __future__ import print_function
+
+import os
+import struct
+
+from grit import exception
+from grit import lazy_re
+from grit import util
+from grit.gather import interface
+
+
+_PNG_SCALE_CHUNK = b'\0\0\0\0csCl\xc1\x30\x60\x4d'
+
+
+def _RescaleImage(data, from_scale, to_scale):
+  if from_scale != to_scale:
+    assert from_scale == 100
+    # Rather than rescaling the image we add a custom chunk directing Chrome to
+    # rescale it on load. Just append it to the PNG data since
+    # _MoveSpecialChunksToFront will move it later anyway.
+    data += _PNG_SCALE_CHUNK
+  return data
+
+
+_PNG_MAGIC = b'\x89PNG\r\n\x1a\n'
+
+'''Mandatory first chunk in order for the png to be valid.'''
+_FIRST_CHUNK = b'IHDR'
+
+'''Special chunks to move immediately after the IHDR chunk. (so that the PNG
+remains valid.)
+'''
+_SPECIAL_CHUNKS = frozenset(b'csCl npTc'.split())
+
+'''Any ancillary chunk not in this list is deleted from the PNG.'''
+_ANCILLARY_CHUNKS_TO_LEAVE = frozenset(
+    b'bKGD cHRM gAMA iCCP pHYs sBIT sRGB tRNS acTL fcTL fdAT'.split())
+
+
+def _MoveSpecialChunksToFront(data):
+  '''Move special chunks immediately after the IHDR chunk (so that the PNG
+  remains valid). Also delete ancillary chunks that are not on our whitelist.
+  '''
+  first = [_PNG_MAGIC]
+  special_chunks = []
+  rest = []
+  for chunk in _ChunkifyPNG(data):
+    type = chunk[4:8]
+    critical = type < b'a'
+    if type == _FIRST_CHUNK:
+      first.append(chunk)
+    elif type in _SPECIAL_CHUNKS:
+      special_chunks.append(chunk)
+    elif critical or type in _ANCILLARY_CHUNKS_TO_LEAVE:
+      rest.append(chunk)
+  return b''.join(first + special_chunks + rest)
+
+
+def _ChunkifyPNG(data):
+  '''Given a PNG image, yield its chunks in order.'''
+  assert data.startswith(_PNG_MAGIC)
+  pos = 8
+  while pos != len(data):
+    length = 12 + struct.unpack_from('>I', data, pos)[0]
+    assert 12 <= length <= len(data) - pos
+    yield data[pos:pos+length]
+    pos += length
+
+
+def _MakeBraceGlob(strings):
+  '''Given ['foo', 'bar'], return '{foo,bar}', for error reporting.
+  '''
+  if len(strings) == 1:
+    return strings[0]
+  else:
+    return '{' + ','.join(strings) + '}'
+
+
+class ChromeScaledImage(interface.GathererBase):
+  '''Represents an image that exists in multiple layout variants
+  (e.g. "default", "touch") and multiple scale variants
+  (e.g. "100_percent", "200_percent").
+  '''
+
+  split_context_re_ = lazy_re.compile(r'(.+)_(\d+)_percent\Z')
+
+  def _FindInputFile(self):
+    output_context = self.grd_node.GetRoot().output_context
+    match = self.split_context_re_.match(output_context)
+    if not match:
+      raise exception.MissingMandatoryAttribute(
+          'All <output> nodes must have an appropriate context attribute'
+          ' (e.g. context="touch_200_percent")')
+    req_layout, req_scale = match.group(1), int(match.group(2))
+
+    layouts = [req_layout]
+    try_default_layout = self.grd_node.GetRoot().fallback_to_default_layout
+    if try_default_layout and 'default' not in layouts:
+      layouts.append('default')
+
+    scales = [req_scale]
+    try_low_res = self.grd_node.FindBooleanAttribute(
+        'fallback_to_low_resolution', default=False, skip_self=False)
+    if try_low_res and 100 not in scales:
+      scales.append(100)
+
+    for layout in layouts:
+      for scale in scales:
+        dir = '%s_%s_percent' % (layout, scale)
+        path = os.path.join(dir, self.rc_file)
+        if os.path.exists(self.grd_node.ToRealPath(path)):
+          return path, scale, req_scale
+
+    if not try_default_layout:
+      # The file was not found in the specified output context and it was
+      # explicitly indicated that the default context should not be searched
+      # as a fallback, so return an empty path.
+      return None, 100, req_scale
+
+    # The file was found in neither the specified context nor the default
+    # context, so raise an exception.
+    dir = "%s_%s_percent" % (_MakeBraceGlob(layouts),
+                             _MakeBraceGlob([str(x) for x in scales]))
+    raise exception.FileNotFound(
+        'Tried ' + self.grd_node.ToRealPath(os.path.join(dir, self.rc_file)))
+
+  def GetInputPath(self):
+    path, scale, req_scale = self._FindInputFile()
+    return path
+
+  def Parse(self):
+    pass
+
+  def GetTextualIds(self):
+    return [self.extkey]
+
+  def GetData(self, lang, encoding):
+    assert encoding == util.BINARY
+
+    path, scale, req_scale = self._FindInputFile()
+    if path is None:
+      return None
+
+    data = util.ReadFile(self.grd_node.ToRealPath(path), util.BINARY)
+    data = _RescaleImage(data, scale, req_scale)
+    data = _MoveSpecialChunksToFront(data)
+    return data
+
+  def Translate(self, *args, **kwargs):
+    return self.GetData()
diff --git a/tools/grit/grit/gather/chrome_scaled_image_unittest.py b/tools/grit/grit/gather/chrome_scaled_image_unittest.py
new file mode 100644
index 0000000000..1cebfc6de2
--- /dev/null
+++ b/tools/grit/grit/gather/chrome_scaled_image_unittest.py
@@ -0,0 +1,209 @@
+#!/usr/bin/env python
+# Copyright (c) 2012 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.
+
+'''Unit tests for ChromeScaledImage.'''
+
+from __future__ import print_function
+
+import os
+import sys
+if __name__ == '__main__':
+  sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__),
+                                               '../..')))
+
+import re
+import struct
+import unittest
+import zlib
+
+from grit import exception
+from grit import util
+from grit.format import data_pack
+from grit.tool import build
+
+
+_OUTFILETYPES = [
+  ('.h', 'rc_header'),
+  ('_map.cc', 'resource_map_source'),
+  ('_map.h', 'resource_map_header'),
+  ('.pak', 'data_package'),
+  ('.rc', 'rc_all'),
+]
+
+
+_PNG_HEADER = (
+    b'\x89\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52'
+    b'\x00\x00\x00\x01\x00\x00\x00\x01\x08\x02\x00\x00\x00\x90\x77\x53'
+    b'\xde')
+_PNG_FOOTER = (
+    b'\x00\x00\x00\x0c\x49\x44\x41\x54\x18\x57\x63\xf8\xff\xff\x3f\x00'
+    b'\x05\xfe\x02\xfe\xa7\x35\x81\x84\x00\x00\x00\x00\x49\x45\x4e\x44'
+    b'\xae\x42\x60\x82')
+
+
+def _MakePNG(chunks):
+  # Python 3 changed the return value of zlib.crc32 to an unsigned int.
+  format = 'i' if sys.version_info.major < 3 else 'I'
+  pack_int32 = struct.Struct('>' + format).pack
+  chunks = [pack_int32(len(payload)) + type + payload +
+            pack_int32(zlib.crc32(type + payload))
+            for type, payload in chunks]
+  return _PNG_HEADER + b''.join(chunks) + _PNG_FOOTER
+
+
+def _GetFilesInPak(pakname):
+  '''Get a set of the files that were actually included in the .pak output.
+  '''
+  return set(data_pack.ReadDataPack(pakname).resources.values())
+
+
+def _GetFilesInRc(rcname, tmp_dir, contents):
+  '''Get a set of the files that were actually included in the .rc output.
+  '''
+  data = util.ReadFile(rcname, util.BINARY).decode('utf-16')
+  contents = dict((tmp_dir.GetPath(k), v) for k, v in contents.items())
+  return set(contents[os.path.normpath(m.group(1))]
+             for m in re.finditer(r'(?m)^\w+\s+BINDATA\s+"([^"]+)"$', data))
+
+
+def _MakeFallbackAttr(fallback):
+  if fallback is None:
+    return ''
+  else:
+    return ' fallback_to_low_resolution="%s"' % ('false', 'true')[fallback]
+
+
+def _Structures(fallback, *body):
+  return '<structures%s>\n%s\n</structures>' % (
+      _MakeFallbackAttr(fallback), '\n'.join(body))
+
+
+def _Structure(name, file, fallback=None):
+  return '<structure name="%s" file="%s" type="chrome_scaled_image"%s />' % (
+      name, file, _MakeFallbackAttr(fallback))
+
+
+def _If(expr, *body):
+  return '<if expr="%s">\n%s\n</if>' % (expr, '\n'.join(body))
+
+
+def _RunBuildTest(self, structures, inputs, expected_outputs, skip_rc=False,
+                  layout_fallback=''):
+  outputs = '\n'.join('<output filename="out/%s%s" type="%s" context="%s"%s />'
+                              % (context, ext, type, context, layout_fallback)
+                      for ext, type in _OUTFILETYPES
+                      for context in expected_outputs)
+
+  infiles = {
+      'in/in.grd': ('''<?xml version="1.0" encoding="UTF-8"?>
+      <grit latest_public_release="0" current_release="1">
+        <outputs>
+          %s
+        </outputs>
+        <release seq="1">
+          %s
+        </release>
+      </grit>
+      ''' % (outputs, structures)).encode('utf-8'),
+  }
+  for pngpath, pngdata in inputs.items():
+    normpath = os.path.normpath('in/' + pngpath)
+    infiles[normpath] = pngdata
+  class Options(object):
+    pass
+
+  with util.TempDir(infiles, mode='wb') as tmp_dir:
+    with tmp_dir.AsCurrentDir():
+      options = Options()
+      options.input = tmp_dir.GetPath('in/in.grd')
+      options.verbose = False
+      options.extra_verbose = False
+      build.RcBuilder().Run(options, [])
+    for context, expected_data in expected_outputs.items():
+      self.assertEquals(expected_data,
+                        _GetFilesInPak(tmp_dir.GetPath('out/%s.pak' % context)))
+      if not skip_rc:
+        self.assertEquals(expected_data,
+                          _GetFilesInRc(tmp_dir.GetPath('out/%s.rc' % context),
+                                        tmp_dir, infiles))
+
+
+class ChromeScaledImageUnittest(unittest.TestCase):
+  def testNormalFallback(self):
+    d123a = _MakePNG([(b'AbCd', b'')])
+    t123a = _MakePNG([(b'EfGh', b'')])
+    d123b = _MakePNG([(b'IjKl', b'')])
+    _RunBuildTest(self,
+        _Structures(None,
+            _Structure('IDR_A', 'a.png'),
+            _Structure('IDR_B', 'b.png'),
+        ),
+        {'default_123_percent/a.png': d123a,
+         'tactile_123_percent/a.png': t123a,
+         'default_123_percent/b.png': d123b,
+        },
+        {'default_123_percent': set([d123a, d123b]),
+         'tactile_123_percent': set([t123a, d123b]),
+        })
+
+  def testNormalFallbackFailure(self):
+    self.assertRaises(
+        exception.FileNotFound, _RunBuildTest, self,
+        _Structures(
+            None,
+            _Structure('IDR_A', 'a.png'),
+        ), {
+            'default_100_percent/a.png': _MakePNG([(b'AbCd', b'')]),
+            'tactile_100_percent/a.png': _MakePNG([(b'EfGh', b'')]),
+        }, {'tactile_123_percent': 'should fail before using this'})
+
+  def testLowresFallback(self):
+    png = _MakePNG([(b'Abcd', b'')])
+    png_with_csCl = _MakePNG([(b'csCl', b''), (b'Abcd', b'')])
+    for outer in (None, False, True):
+      for inner in (None, False, True):
+        args = (
+            self,
+            _Structures(outer,
+                _Structure('IDR_A', 'a.png', inner),
+            ),
+            {'default_100_percent/a.png': png},
+            {'tactile_200_percent': set([png_with_csCl])})
+        if inner or (inner is None and outer):
+          # should fall back to 100%
+          _RunBuildTest(*args, skip_rc=True)
+        else:
+          # shouldn't fall back
+          self.assertRaises(exception.FileNotFound, _RunBuildTest, *args)
+
+    # Test fallback failure with fallback_to_low_resolution=True
+    self.assertRaises(exception.FileNotFound,
+        _RunBuildTest, self,
+            _Structures(True,
+                _Structure('IDR_A', 'a.png'),
+            ),
+            {},  # no files
+            {'tactile_123_percent': 'should fail before using this'})
+
+  def testNoFallbackToDefaultLayout(self):
+    d123a = _MakePNG([(b'AbCd', b'')])
+    t123a = _MakePNG([(b'EfGh', b'')])
+    d123b = _MakePNG([(b'IjKl', b'')])
+    _RunBuildTest(self,
+        _Structures(None,
+            _Structure('IDR_A', 'a.png'),
+            _Structure('IDR_B', 'b.png'),
+        ),
+        {'default_123_percent/a.png': d123a,
+         'tactile_123_percent/a.png': t123a,
+         'default_123_percent/b.png': d123b,
+        },
+        {'default_123_percent': set([d123a, d123b]),
+         'tactile_123_percent': set([t123a]),
+        },
+        layout_fallback=' fallback_to_default_layout="false"')
+
+if __name__ == '__main__':
+  unittest.main()
diff --git a/tools/grit/grit/gather/interface.py b/tools/grit/grit/gather/interface.py
new file mode 100644
index 0000000000..15d64f9326
--- /dev/null
+++ b/tools/grit/grit/gather/interface.py
@@ -0,0 +1,172 @@
+# Copyright (c) 2012 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.
+
+'''Interface for all gatherers.
+'''
+
+from __future__ import print_function
+
+import os.path
+
+import six
+
+from grit import clique
+from grit import util
+
+
+class GathererBase(object):
+  '''Interface for all gatherer implementations.  Subclasses must implement
+  all methods that raise NotImplemented.'''
+
+  def __init__(self, rc_file, extkey=None, encoding='cp1252', is_skeleton=False):
+    '''Initializes the gatherer object's attributes, but does not attempt to
+    read the input file.
+
+    Args:
+      rc_file: The 'file' attribute of the <structure> node (usually the
+               relative path to the source file).
+      extkey: e.g. 'ID_MY_DIALOG'
+      encoding: e.g. 'utf-8'
+      is_skeleton: Indicates whether this gatherer is a skeleton gatherer, in
+                   which case we should not do some types of processing on the
+                   translateable bits.
+    '''
+    self.rc_file = rc_file
+    self.extkey = extkey
+    self.encoding = encoding
+    # A default uberclique that is local to this object.  Users can override
+    # this with the uberclique they are using.
+    self.uberclique = clique.UberClique()
+    # Indicates whether this gatherer is a skeleton gatherer, in which case
+    # we should not do some types of processing on the translateable bits.
+    self.is_skeleton = is_skeleton
+    # Stores the grd node on which this gatherer is running. This allows
+    # evaluating expressions.
+    self.grd_node = None
+
+  def SetAttributes(self, attrs):
+    '''Sets node attributes used by the gatherer.
+
+    By default, this does nothing.  If special handling is desired, it should be
+    overridden by the child gatherer.
+
+    Args:
+      attrs: The mapping of node attributes.
+    '''
+    pass
+
+  def SetDefines(self, defines):
+    '''Sets global defines used by the gatherer.
+
+    By default, this does nothing.  If special handling is desired, it should be
+    overridden by the child gatherer.
+
+    Args:
+      defines: The mapping of define values.
+    '''
+    pass
+
+  def SetGrdNode(self, node):
+    '''Sets the grd node on which this gatherer is running.
+    '''
+    self.grd_node = node
+
+  def SetUberClique(self, uberclique):
+    '''Overrides the default uberclique so that cliques created by this object
+    become part of the uberclique supplied by the user.
+    '''
+    self.uberclique = uberclique
+
+  def Parse(self):
+    '''Reads and parses the contents of what is being gathered.'''
+    raise NotImplementedError()
+
+  def GetData(self, lang, encoding):
+    '''Returns the data to be added to the DataPack for this node or None if
+    this node does not add a DataPack entry.
+    '''
+    return None
+
+  def GetText(self):
+    '''Returns the text of what is being gathered.'''
+    raise NotImplementedError()
+
+  def GetTextualIds(self):
+    '''Returns the mnemonic IDs that need to be defined for the resource
+    being gathered to compile correctly.'''
+    return []
+
+  def GetCliques(self):
+    '''Returns the MessageClique objects for all translateable portions.'''
+    return []
+
+  def GetInputPath(self):
+    return self.rc_file
+
+  def GetHtmlResourceFilenames(self):
+    """Returns a set of all filenames inlined by this gatherer."""
+    return []
+
+  def Translate(self, lang, pseudo_if_not_available=True,
+                skeleton_gatherer=None, fallback_to_english=False):
+    '''Returns the resource being gathered, with translateable portions filled
+    with the translation for language 'lang'.
+
+    If pseudo_if_not_available is true, a pseudotranslation will be used for any
+    message that doesn't have a real translation available.
+
+    If no translation is available and pseudo_if_not_available is false,
+    fallback_to_english controls the behavior.  If it is false, throw an error.
+    If it is true, use the English version of the message as its own
+    "translation".
+
+    If skeleton_gatherer is specified, the translation will use the nontranslateable
+    parts from the gatherer 'skeleton_gatherer', which must be of the same type
+    as 'self'.
+
+    If fallback_to_english
+
+    Args:
+      lang: 'en'
+      pseudo_if_not_available: True | False
+      skeleton_gatherer: other_gatherer
+      fallback_to_english: True | False
+
+    Return:
+      e.g. 'ID_THIS_SECTION TYPE\n...BEGIN\n  "Translated message"\n......\nEND'
+
+    Raises:
+      grit.exception.NotReady() if used before Parse() has been successfully
+      called.
+      grit.exception.NoSuchTranslation() if 'pseudo_if_not_available' and
+      fallback_to_english are both false and there is no translation for the
+      requested language.
+    '''
+    raise NotImplementedError()
+
+  def SubstituteMessages(self, substituter):
+    '''Applies substitutions to all messages in the gatherer.
+
+    Args:
+      substituter: a grit.util.Substituter object.
+    '''
+    pass
+
+  def SetFilenameExpansionFunction(self, fn):
+    '''Sets a function for rewriting filenames before gathering.'''
+    pass
+
+  # TODO(benrg): Move this elsewhere, since it isn't part of the interface.
+  def _LoadInputFile(self):
+    '''A convenience function for subclasses that loads the contents of the
+    input file.
+    '''
+    if isinstance(self.rc_file, six.string_types):
+      path = self.GetInputPath()
+      # Hack: some unit tests supply an absolute path and no root node.
+      if not os.path.isabs(path):
+        path = self.grd_node.ToRealPath(path)
+      return util.ReadFile(path, self.encoding)
+    else:
+      return self.rc_file.read()
diff --git a/tools/grit/grit/gather/json_loader.py b/tools/grit/grit/gather/json_loader.py
new file mode 100644
index 0000000000..058e5f17ae
--- /dev/null
+++ b/tools/grit/grit/gather/json_loader.py
@@ -0,0 +1,27 @@
+# Copyright (c) 2012 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.
+
+from __future__ import print_function
+
+from grit.gather import interface
+
+
+class JsonLoader(interface.GathererBase):
+  '''A simple gatherer that loads and parses a JSON file.'''
+
+  def Parse(self):
+    '''Reads and parses the text of self._json_text into the data structure in
+    self._data.
+    '''
+    self._json_text = self._LoadInputFile()
+    self._data = None
+
+    globs = {}
+    exec('data = ' + self._json_text, globs)
+    self._data = globs['data']
+
+  def GetData(self, lang, encoding):
+    '''Returns the parsed JSON data.'''
+    assert encoding == 'utf-8'
+    return self._data
diff --git a/tools/grit/grit/gather/policy_json.py b/tools/grit/grit/gather/policy_json.py
new file mode 100644
index 0000000000..6621c5f3c4
--- /dev/null
+++ b/tools/grit/grit/gather/policy_json.py
@@ -0,0 +1,325 @@
+# Copyright (c) 2012 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.
+
+'''Support for "policy_templates.json" format used by the policy template
+generator as a source for generating ADM,ADMX,etc files.'''
+
+from __future__ import print_function
+
+import json
+import sys
+
+import six
+
+from grit.gather import skeleton_gatherer
+from grit import util
+from grit import tclib
+from xml.dom import minidom
+from xml.parsers.expat import ExpatError
+
+
+class PolicyJson(skeleton_gatherer.SkeletonGatherer):
+  '''Collects and translates the following strings from policy_templates.json:
+    - captions, descriptions, labels and Android app support details of policies
+    - captions of enumeration items
+    - misc strings from the 'messages' section
+     Translatable strings may have untranslateable placeholders with the same
+     format that is used in .grd files.
+  '''
+
+  def _AddEndline(self, add_comma):
+    '''Adds an endline to the skeleton tree. If add_comma is true, adds a
+       comma before the endline.
+
+    Args:
+      add_comma: A boolean to add a comma or not.
+    '''
+    self._AddNontranslateableChunk(',\n' if add_comma else '\n')
+
+  def _ParsePlaceholder(self, placeholder, msg):
+    '''Extracts a placeholder from a DOM node and adds it to a tclib Message.
+
+    Args:
+      placeholder: A DOM node of the form:
+        <ph name="PLACEHOLDER_NAME">Placeholder text<ex>Example value</ex></ph>
+      msg: The placeholder is added to this message.
+    '''
+    text = []
+    example_text = []
+    for node1 in placeholder.childNodes:
+      if (node1.nodeType == minidom.Node.TEXT_NODE):
+        text.append(node1.data)
+      elif (node1.nodeType == minidom.Node.ELEMENT_NODE and
+            node1.tagName == 'ex'):
+        for node2 in node1.childNodes:
+          example_text.append(node2.toxml())
+      else:
+        raise Exception('Unexpected element inside a placeholder: ' +
+                        node2.toxml())
+    if example_text == []:
+      # In such cases the original text is okay for an example.
+      example_text = text
+
+    replaced_text = self.Escape(''.join(text).strip())
+    replaced_text = replaced_text.replace('$1', self._config['app_name'])
+    replaced_text = replaced_text.replace('$2', self._config['os_name'])
+    replaced_text = replaced_text.replace('$3', self._config['frame_name'])
+
+    msg.AppendPlaceholder(tclib.Placeholder(
+        placeholder.attributes['name'].value,
+        replaced_text,
+        ''.join(example_text).strip()))
+
+  def _ParseMessage(self, string, desc):
+    '''Parses a given string and adds it to the output as a translatable chunk
+    with a given description.
+
+    Args:
+      string: The message string to parse.
+      desc: The description of the message (for the translators).
+    '''
+    msg = tclib.Message(description=desc)
+    xml = '<msg>' + string + '</msg>'
+    try:
+      node = minidom.parseString(xml).childNodes[0]
+    except ExpatError:
+      reason = '''Input isn't valid XML (has < & > been escaped?): ''' + string
+      six.reraise(Exception, reason, sys.exc_info()[2])
+
+    for child in node.childNodes:
+      if child.nodeType == minidom.Node.TEXT_NODE:
+        msg.AppendText(child.data)
+      elif child.nodeType == minidom.Node.ELEMENT_NODE:
+        if child.tagName == 'ph':
+          self._ParsePlaceholder(child, msg)
+        else:
+          raise Exception("Not implemented.")
+      else:
+        raise Exception("Not implemented.")
+    self.skeleton_.append(self.uberclique.MakeClique(msg))
+
+  def _ParseNode(self, node):
+    '''Traverses the subtree of a DOM node, and register a tclib message for
+    all the <message> nodes.
+    '''
+    att_text = []
+    if node.attributes:
+      for key, value in sorted(node.attributes.items()):
+        att_text.append(' %s=\"%s\"' % (key, value))
+    self._AddNontranslateableChunk("<%s%s>" %
+                                   (node.tagName, ''.join(att_text)))
+    if node.tagName == 'message':
+      msg = tclib.Message(description=node.attributes['desc'])
+      for child in node.childNodes:
+        if child.nodeType == minidom.Node.TEXT_NODE:
+          if msg == None:
+            self._AddNontranslateableChunk(child.data)
+          else:
+            msg.AppendText(child.data)
+        elif child.nodeType == minidom.Node.ELEMENT_NODE:
+          if child.tagName == 'ph':
+            self._ParsePlaceholder(child, msg)
+        else:
+          assert False
+      self.skeleton_.append(self.uberclique.MakeClique(msg))
+    else:
+      for child in node.childNodes:
+        if child.nodeType == minidom.Node.TEXT_NODE:
+          self._AddNontranslateableChunk(child.data)
+        elif node.nodeType == minidom.Node.ELEMENT_NODE:
+          self._ParseNode(child)
+
+    self._AddNontranslateableChunk("</%s>" % node.tagName)
+
+  def _AddIndentedNontranslateableChunk(self, depth, string):
+    '''Adds a nontranslateable chunk of text to the internally stored output.
+
+    Args:
+      depth: The number of double spaces to prepend to the next argument string.
+      string: The chunk of text to add.
+    '''
+    result = []
+    while depth > 0:
+      result.append('  ')
+      depth = depth - 1
+    result.append(string)
+    self._AddNontranslateableChunk(''.join(result))
+
+  def _GetDescription(self, item, item_type, parent_item, key):
+    '''Creates a description for a translatable message. The description gives
+    some context for the person who will translate this message.
+
+    Args:
+      item: A policy or an enumeration item.
+      item_type: 'enum_item' | 'policy'
+      parent_item: The owner of item. (A policy of type group or enum.)
+      key: The name of the key to parse.
+      depth: The level of indentation.
+    '''
+    key_map = {
+      'desc': 'Description',
+      'caption': 'Caption',
+      'label': 'Label',
+      'arc_support': 'Information about the effect on Android apps'
+    }
+    if item_type == 'policy':
+      return ('%s of the policy named %s [owner(s): %s]' %
+              (key_map[key], item['name'],
+               ','.join(item['owners'] if 'owners' in item else 'unknown')))
+    if item_type == 'enum_item':
+      return ('%s of the option named %s in policy %s [owner(s): %s]' %
+              (key_map[key], item['name'], parent_item['name'],
+               ','.join(parent_item['owners'] if 'owners' in parent_item else 'unknown')))
+    raise Exception('Unexpected type %s' % item_type)
+
+  def _AddSchemaKeys(self, obj, depth):
+    obj_type = type(obj)
+    if obj_type == dict:
+      self._AddNontranslateableChunk('{\n')
+      keys = sorted(obj.keys())
+      for count, (key) in enumerate(keys, 1):
+        json_key = "%s: " % json.dumps(key)
+        self._AddIndentedNontranslateableChunk(depth + 1, json_key)
+        if key == 'description' and type(obj[key]) == str:
+          self._AddNontranslateableChunk("\"")
+          self._ParseMessage(obj[key], 'Description of schema property')
+          self._AddNontranslateableChunk("\"")
+        elif type(obj[key]) in (bool, int, str):
+          self._AddSchemaKeys(obj[key], 0)
+        else:
+          self._AddSchemaKeys(obj[key], depth + 1)
+        self._AddEndline(count < len(keys))
+      self._AddIndentedNontranslateableChunk(depth, '}')
+    elif obj_type == list:
+      self._AddNontranslateableChunk('[\n')
+      for count, (item) in enumerate(obj, 1):
+        self._AddSchemaKeys(item, depth + 1)
+        self._AddEndline(count < len(obj))
+      self._AddIndentedNontranslateableChunk(depth, ']')
+    elif obj_type in (bool, int, str):
+      self._AddIndentedNontranslateableChunk(depth, json.dumps(obj))
+    else:
+      raise Exception('Invalid schema object: %s' % obj)
+
+  def _AddPolicyKey(self, item, item_type, parent_item, key, depth):
+    '''Given a policy/enumeration item and a key, adds that key and its value
+    into the output.
+    E.g.:
+       'example_value': 123
+    If key indicates that the value is a translatable string, then it is parsed
+    as a translatable string.
+
+    Args:
+      item: A policy or an enumeration item.
+      item_type: 'enum_item' | 'policy'
+      parent_item: The owner of item. (A policy of type group or enum.)
+      key: The name of the key to parse.
+      depth: The level of indentation.
+    '''
+    self._AddIndentedNontranslateableChunk(depth, "%s: " % json.dumps(key))
+    if key in ('desc', 'caption', 'label', 'arc_support'):
+      self._AddNontranslateableChunk("\"")
+      self._ParseMessage(
+          item[key],
+          self._GetDescription(item, item_type, parent_item, key))
+      self._AddNontranslateableChunk("\"")
+    elif key in ('schema', 'validation_schema', 'description_schema'):
+      self._AddSchemaKeys(item[key], depth)
+    else:
+      self._AddNontranslateableChunk(json.dumps(item[key], ensure_ascii=False))
+
+  def _AddItems(self, items, item_type, parent_item, depth):
+    '''Parses and adds a list of items from the JSON file. Items can be policies
+    or parts of an enum policy.
+
+    Args:
+      items: Either a list of policies or a list of dictionaries.
+      item_type: 'enum_item' | 'policy'
+      parent_item: If items contains a list of policies, then this is the policy
+        group that owns them. If items contains a list of enumeration items,
+        then this is the enum policy that holds them.
+      depth: Indicates the depth of our position in the JSON hierarchy. Used to
+        add nice line-indent to the output.
+    '''
+    for item_count, (item1) in enumerate(items, 1):
+      self._AddIndentedNontranslateableChunk(depth, "{\n")
+      keys = sorted(item1.keys())
+      for keys_count, (key) in enumerate(keys, 1):
+        if key == 'items':
+          self._AddIndentedNontranslateableChunk(depth + 1, "\"items\": [\n")
+          self._AddItems(item1['items'], 'enum_item', item1, depth + 2)
+          self._AddIndentedNontranslateableChunk(depth + 1, "]")
+        elif key == 'policies' and all(not isinstance(x, str)
+                                       for x in item1['policies']):
+          self._AddIndentedNontranslateableChunk(depth + 1, "\"policies\": [\n")
+          self._AddItems(item1['policies'], 'policy', item1, depth + 2)
+          self._AddIndentedNontranslateableChunk(depth + 1, "]")
+        else:
+          self._AddPolicyKey(item1, item_type, parent_item, key, depth + 1)
+        self._AddEndline(keys_count < len(keys))
+      self._AddIndentedNontranslateableChunk(depth, "}")
+      self._AddEndline(item_count < len(items))
+
+  def _AddMessages(self):
+    '''Processed and adds the 'messages' section to the output.'''
+    self._AddNontranslateableChunk("  \"messages\": {\n")
+    messages = self.data['messages'].items()
+    for count, (name, message) in enumerate(messages, 1):
+      self._AddNontranslateableChunk("    %s: {\n" % json.dumps(name))
+      self._AddNontranslateableChunk("      \"text\": \"")
+      self._ParseMessage(message['text'], message['desc'])
+      self._AddNontranslateableChunk("\"\n")
+      self._AddNontranslateableChunk("    }")
+      self._AddEndline(count < len(self.data['messages']))
+    self._AddNontranslateableChunk("  }\n")
+
+  # Although we use the RegexpGatherer base class, we do not use the
+  # _RegExpParse method of that class to implement Parse().  Instead, we
+  # parse using a DOM parser.
+  def Parse(self):
+    if self.have_parsed_:
+      return
+    self.have_parsed_ = True
+
+    self.text_ = self._LoadInputFile()
+    if util.IsExtraVerbose():
+      print(self.text_)
+
+    self.data = eval(self.text_)
+
+    self._AddNontranslateableChunk('{\n')
+    self._AddNontranslateableChunk("  \"policy_definitions\": [\n")
+    self._AddItems(self.data['policy_definitions'], 'policy', None, 2)
+    self._AddNontranslateableChunk("  ],\n")
+    self._AddNontranslateableChunk("  \"policy_atomic_group_definitions\": [\n")
+    if 'policy_atomic_group_definitions' in self.data:
+      self._AddItems(self.data['policy_atomic_group_definitions'],
+                    'policy', None, 2)
+    self._AddNontranslateableChunk("  ],\n")
+    self._AddMessages()
+    self._AddNontranslateableChunk('\n}')
+
+  def Escape(self, text):
+    return json.dumps(text, ensure_ascii=False)[1:-1]
+
+  def SetDefines(self, defines):
+    if not defines:
+      raise Exception('Must pass valid defines')
+
+    if '_chromium' in defines:
+      self._config = {
+        'build': 'chromium',
+        'app_name': 'Chromium',
+        'frame_name': 'Chromium Frame',
+        'os_name': 'Chromium OS',
+      }
+    elif '_google_chrome' in defines:
+      self._config = {
+        'build': 'chrome',
+        'app_name': 'Google Chrome',
+        'frame_name': 'Google Chrome Frame',
+        'os_name': 'Google Chrome OS',
+      }
+    else:
+      raise Exception('Unknown build')
diff --git a/tools/grit/grit/gather/policy_json_unittest.py b/tools/grit/grit/gather/policy_json_unittest.py
new file mode 100644
index 0000000000..214cd276aa
--- /dev/null
+++ b/tools/grit/grit/gather/policy_json_unittest.py
@@ -0,0 +1,347 @@
+#!/usr/bin/env python
+# Copyright (c) 2011 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.
+
+'''Unit tests for grit.gather.policy_json'''
+
+from __future__ import print_function
+
+import json
+import os
+import re
+import sys
+if __name__ == '__main__':
+  sys.path.append(os.path.join(os.path.dirname(__file__), '../..'))
+
+import unittest
+
+from six import StringIO
+
+from grit.gather import policy_json
+
+class PolicyJsonUnittest(unittest.TestCase):
+
+  def GetExpectedOutput(self, original):
+    expected = eval(original)
+    for key, message in expected['messages'].items():
+      del message['desc']
+    return expected
+
+  def testEmpty(self):
+    original = """{
+      'policy_definitions': [],
+      'policy_atomic_group_definitions': [],
+      'messages': {}
+      }"""
+    gatherer = policy_json.PolicyJson(StringIO(original))
+    gatherer.Parse()
+    self.failUnless(len(gatherer.GetCliques()) == 0)
+    self.failUnless(eval(original) == json.loads(gatherer.Translate('en')))
+
+  def testGeneralPolicy(self):
+    original = (
+        "{"
+        "  'policy_definitions': ["
+        "    {"
+        "      'name': 'HomepageLocation',"
+        "      'type': 'string',"
+        "      'owners': ['foo@bar.com'],"
+        "      'supported_on': ['chrome.*:8-'],"
+        "      'features': {'dynamic_refresh': 1},"
+        "      'example_value': 'http://chromium.org',"
+        "      'caption': 'nothing special 1',"
+        "      'desc': 'nothing special 2',"
+        "      'label': 'nothing special 3',"
+        "    },"
+        "  ],"
+        "  'policy_atomic_group_definitions': [],"
+        "  'messages': {"
+        "    'msg_identifier': {"
+        "      'text': 'nothing special 3',"
+        "      'desc': 'nothing special descr 3',"
+        "    }"
+        "  }"
+        "}")
+    gatherer = policy_json.PolicyJson(StringIO(original))
+    gatherer.Parse()
+    self.failUnless(len(gatherer.GetCliques()) == 4)
+    expected = self.GetExpectedOutput(original)
+    self.failUnless(expected == json.loads(gatherer.Translate('en')))
+
+  def testEnum(self):
+    original = (
+        "{"
+        "  'policy_definitions': ["
+        "    {"
+        "      'name': 'Policy1',"
+        "      'owners': ['a@b'],"
+        "      'items': ["
+        "        {"
+        "          'name': 'Item1',"
+        "          'caption': 'nothing special',"
+        "        }"
+        "      ]"
+        "    },"
+        "  ],"
+        "  'policy_atomic_group_definitions': [],"
+        "  'messages': {}"
+        "}")
+    gatherer = policy_json.PolicyJson(StringIO(original))
+    gatherer.Parse()
+    self.failUnless(len(gatherer.GetCliques()) == 1)
+    expected = self.GetExpectedOutput(original)
+    self.failUnless(expected == json.loads(gatherer.Translate('en')))
+
+  def testSchema(self):
+    original = ("{"
+                "  'policy_definitions': ["
+                "    {"
+                "      'name': 'Policy1',"
+                "      'schema': {"
+                "        'type': 'object',"
+                "        'properties': {"
+                "          'outer': {"
+                "            'description': 'outer description',"
+                "            'type': 'object',"
+                "            'inner': {"
+                "              'description': 'inner description',"
+                "              'type': 'integer', 'minimum': 0, 'maximum': 100"
+                "            },"
+                "            'inner2': {"
+                "              'description': 'inner2 description',"
+                "              'type': 'integer',"
+                "              'enum': [ 1, 2, 3 ],"
+                "              'sensitiveValue': True"
+                "            },"
+                "          },"
+                "        },"
+                "      },"
+                "      'caption': 'nothing special',"
+                "      'owners': ['a@b']"
+                "    },"
+                "  ],"
+                "  'policy_atomic_group_definitions': [],"
+                "  'messages': {}"
+                "}")
+    gatherer = policy_json.PolicyJson(StringIO(original))
+    gatherer.Parse()
+    self.failUnless(len(gatherer.GetCliques()) == 4)
+    expected = self.GetExpectedOutput(original)
+    self.failUnless(expected == json.loads(gatherer.Translate('en')))
+
+  def testValidationSchema(self):
+    original = ("{"
+                "  'policy_definitions': ["
+                "    {"
+                "      'name': 'Policy1',"
+                "      'owners': ['a@b'],"
+                "      'validation_schema': {"
+                "        'type': 'object',"
+                "        'properties': {"
+                "          'description': 'properties description',"
+                "          'type': 'object',"
+                "        },"
+                "      },"
+                "    },"
+                "  ],"
+                "  'policy_atomic_group_definitions': [],"
+                "  'messages': {}"
+                "}")
+    gatherer = policy_json.PolicyJson(StringIO(original))
+    gatherer.Parse()
+    self.failUnless(len(gatherer.GetCliques()) == 1)
+    expected = self.GetExpectedOutput(original)
+    self.failUnless(expected == json.loads(gatherer.Translate('en')))
+
+  def testDescriptionSchema(self):
+    original = ("{"
+                "  'policy_definitions': ["
+                "    {"
+                "      'name': 'Policy1',"
+                "      'owners': ['a@b'],"
+                "      'description_schema': {"
+                "        'type': 'object',"
+                "        'properties': {"
+                "          'description': 'properties description',"
+                "          'type': 'object',"
+                "        },"
+                "      },"
+                "    },"
+                "  ],"
+                "  'policy_atomic_group_definitions': [],"
+                "  'messages': {}"
+                "}")
+    gatherer = policy_json.PolicyJson(StringIO(original))
+    gatherer.Parse()
+    self.failUnless(len(gatherer.GetCliques()) == 1)
+    expected = self.GetExpectedOutput(original)
+    self.failUnless(expected == json.loads(gatherer.Translate('en')))
+
+  # Keeping for backwards compatibility.
+  def testSubPolicyOldFormat(self):
+    original = (
+        "{"
+        "  'policy_definitions': ["
+        "    {"
+        "      'type': 'group',"
+        "      'policies': ["
+        "        {"
+        "          'name': 'Policy1',"
+        "          'caption': 'nothing special',"
+        "          'owners': ['a@b']"
+        "        }"
+        "      ]"
+        "    }"
+        "  ],"
+        "  'policy_atomic_group_definitions': [],"
+        "  'messages': {}"
+        "}")
+    gatherer = policy_json.PolicyJson(StringIO(original))
+    gatherer.Parse()
+    self.failUnless(len(gatherer.GetCliques()) == 1)
+    expected = self.GetExpectedOutput(original)
+    self.failUnless(expected == json.loads(gatherer.Translate('en')))
+
+  def testSubPolicyNewFormat(self):
+    original = (
+        "{"
+        "  'policy_definitions': ["
+        "    {"
+        "      'type': 'group',"
+        "      'policies': ['Policy1']"
+        "    },"
+        "    {"
+        "      'name': 'Policy1',"
+        "      'caption': 'nothing special',"
+        "      'owners': ['a@b']"
+        "    }"
+        "  ],"
+        "  'policy_atomic_group_definitions': [],"
+        "  'messages': {}"
+        "}")
+    gatherer = policy_json.PolicyJson(StringIO(original))
+    gatherer.Parse()
+    self.failUnless(len(gatherer.GetCliques()) == 1)
+    expected = self.GetExpectedOutput(original)
+    self.failUnless(expected == json.loads(gatherer.Translate('en')))
+
+  def testEscapingAndLineBreaks(self):
+    original = """{
+        'policy_definitions': [],
+        'policy_atomic_group_definitions': [],
+        'messages': {
+          'msg1': {
+            # The following line will contain two backslash characters when it
+            # ends up in eval().
+            'text': '''backslashes, Sir? \\\\''',
+            'desc': ''
+          },
+          'msg2': {
+            'text': '''quotes, Madam? "''',
+            'desc': ''
+          },
+          'msg3': {
+            # The following line will contain two backslash characters when it
+            # ends up in eval().
+            'text': 'backslashes, Sir? \\\\',
+            'desc': ''
+          },
+          'msg4': {
+            'text': "quotes, Madam? '",
+            'desc': ''
+          },
+          'msg5': {
+            'text': '''what happens
+with a newline?''',
+            'desc': ''
+          },
+          'msg6': {
+            # The following line will contain a backslash+n when it ends up in
+            # eval().
+            'text': 'what happens\\nwith a newline? (Episode 1)',
+            'desc': ''
+          }
+        }
+}"""
+    gatherer = policy_json.PolicyJson(StringIO(original))
+    gatherer.Parse()
+    self.failUnless(len(gatherer.GetCliques()) == 6)
+    expected = self.GetExpectedOutput(original)
+    self.failUnless(expected == json.loads(gatherer.Translate('en')))
+
+  def testPlaceholdersChromium(self):
+    original = """{
+        "policy_definitions": [
+          {
+            "name": "Policy1",
+            "caption": "Please install\\n<ph name=\\"PRODUCT_NAME\\">$1<ex>Google Chrome</ex></ph>.",
+            "owners": "a@b"
+          }
+        ],
+        "policy_atomic_group_definitions": [],
+        "messages": {}
+}"""
+    gatherer = policy_json.PolicyJson(StringIO(original))
+    gatherer.SetDefines({'_chromium': True})
+    gatherer.Parse()
+    self.failUnless(len(gatherer.GetCliques()) == 1)
+    expected = json.loads(re.sub('<ph.*ph>', 'Chromium', original))
+    self.failUnless(expected == json.loads(gatherer.Translate('en')))
+    self.failUnless(gatherer.GetCliques()[0].translateable)
+    msg = gatherer.GetCliques()[0].GetMessage()
+    self.failUnless(len(msg.GetPlaceholders()) == 1)
+    ph = msg.GetPlaceholders()[0]
+    self.failUnless(ph.GetOriginal() == 'Chromium')
+    self.failUnless(ph.GetPresentation() == 'PRODUCT_NAME')
+    self.failUnless(ph.GetExample() == 'Google Chrome')
+
+  def testPlaceholdersChrome(self):
+    original = """{
+        "policy_definitions": [
+          {
+            "name": "Policy1",
+            "caption": "Please install\\n<ph name=\\"PRODUCT_NAME\\">$1<ex>Google Chrome</ex></ph>.",
+            "owners": "a@b"
+          }
+        ],
+        "policy_atomic_group_definitions": [],
+        "messages": {}
+}"""
+    gatherer = policy_json.PolicyJson(StringIO(original))
+    gatherer.SetDefines({'_google_chrome': True})
+    gatherer.Parse()
+    self.failUnless(len(gatherer.GetCliques()) == 1)
+    expected = json.loads(re.sub('<ph.*ph>', 'Google Chrome', original))
+    self.failUnless(expected == json.loads(gatherer.Translate('en')))
+    self.failUnless(gatherer.GetCliques()[0].translateable)
+    msg = gatherer.GetCliques()[0].GetMessage()
+    self.failUnless(len(msg.GetPlaceholders()) == 1)
+    ph = msg.GetPlaceholders()[0]
+    self.failUnless(ph.GetOriginal() == 'Google Chrome')
+    self.failUnless(ph.GetPresentation() == 'PRODUCT_NAME')
+    self.failUnless(ph.GetExample() == 'Google Chrome')
+
+  def testGetDescription(self):
+    gatherer = policy_json.PolicyJson({})
+    gatherer.SetDefines({'_google_chrome': True})
+    self.assertEquals(
+        gatherer._GetDescription({'name': 'Policy1', 'owners': ['a@b']},
+                                 'policy', None, 'desc'),
+        'Description of the policy named Policy1 [owner(s): a@b]')
+    self.assertEquals(
+        gatherer._GetDescription({'name': 'Plcy2', 'owners': ['a@b', 'c@d']},
+                                 'policy', None, 'caption'),
+        'Caption of the policy named Plcy2 [owner(s): a@b,c@d]')
+    self.assertEquals(
+        gatherer._GetDescription({'name': 'Plcy3', 'owners': ['a@b']},
+                                 'policy', None, 'label'),
+        'Label of the policy named Plcy3 [owner(s): a@b]')
+    self.assertEquals(
+        gatherer._GetDescription({'name': 'Item'}, 'enum_item',
+                                 {'name': 'Plcy', 'owners': ['a@b']}, 'caption'),
+        'Caption of the option named Item in policy Plcy [owner(s): a@b]')
+
+
+if __name__ == '__main__':
+  unittest.main()
diff --git a/tools/grit/grit/gather/rc.py b/tools/grit/grit/gather/rc.py
new file mode 100644
index 0000000000..dd091d1e18
--- /dev/null
+++ b/tools/grit/grit/gather/rc.py
@@ -0,0 +1,343 @@
+# Copyright (c) 2012 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.
+
+'''Support for gathering resources from RC files.
+'''
+
+from __future__ import print_function
+
+import re
+
+from grit import exception
+from grit import lazy_re
+from grit import tclib
+
+from grit.gather import regexp
+
+
+# Find portions that need unescaping in resource strings.  We need to be
+# careful that a \\n is matched _first_ as a \\ rather than matching as
+# a \ followed by a \n.
+# TODO(joi) Handle ampersands if we decide to change them into <ph>
+# TODO(joi) May need to handle other control characters than \n
+_NEED_UNESCAPE = lazy_re.compile(r'""|\\\\|\\n|\\t')
+
+# Find portions that need escaping to encode string as a resource string.
+_NEED_ESCAPE = lazy_re.compile(r'"|\n|\t|\\|\&nbsp\;')
+
+# How to escape certain characters
+_ESCAPE_CHARS = {
+  '"' : '""',
+  '\n' : '\\n',
+  '\t' : '\\t',
+  '\\' : '\\\\',
+  '&nbsp;' : ' '
+}
+
+# How to unescape certain strings
+_UNESCAPE_CHARS = dict([[value, key] for key, value in _ESCAPE_CHARS.items()])
+
+
+
+class Section(regexp.RegexpGatherer):
+  '''A section from a resource file.'''
+
+  @staticmethod
+  def Escape(text):
+    '''Returns a version of 'text' with characters escaped that need to be
+    for inclusion in a resource section.'''
+    def Replace(match):
+      return _ESCAPE_CHARS[match.group()]
+    return _NEED_ESCAPE.sub(Replace, text)
+
+  @staticmethod
+  def UnEscape(text):
+    '''Returns a version of 'text' with escaped characters unescaped.'''
+    def Replace(match):
+      return _UNESCAPE_CHARS[match.group()]
+    return _NEED_UNESCAPE.sub(Replace, text)
+
+  def _RegExpParse(self, rexp, text_to_parse):
+    '''Overrides _RegExpParse to add shortcut group handling.  Otherwise
+    the same.
+    '''
+    super(Section, self)._RegExpParse(rexp, text_to_parse)
+
+    if not self.is_skeleton and len(self.GetTextualIds()) > 0:
+      group_name = self.GetTextualIds()[0]
+      for c in self.GetCliques():
+        c.AddToShortcutGroup(group_name)
+
+  def ReadSection(self):
+    rc_text = self._LoadInputFile()
+
+    out = ''
+    begin_count = 0
+    assert self.extkey
+    first_line_re = re.compile(r'\s*' + self.extkey + r'\b')
+    for line in rc_text.splitlines(True):
+      if out or first_line_re.match(line):
+        out += line
+
+      # we stop once we reach the END for the outermost block.
+      begin_count_was = begin_count
+      if len(out) > 0 and line.strip() == 'BEGIN':
+        begin_count += 1
+      elif len(out) > 0 and line.strip() == 'END':
+        begin_count -= 1
+      if begin_count_was == 1 and begin_count == 0:
+        break
+
+    if len(out) == 0:
+      raise exception.SectionNotFound('%s in file %s' % (self.extkey, self.rc_file))
+
+    self.text_ = out.strip()
+
+
+class Dialog(Section):
+  '''A resource section that contains a dialog resource.'''
+
+  # A typical dialog resource section looks like this:
+  #
+  # IDD_ABOUTBOX DIALOGEX 22, 17, 230, 75
+  # STYLE DS_SETFONT | DS_MODALFRAME | WS_CAPTION | WS_SYSMENU
+  # CAPTION "About"
+  # FONT 8, "System", 0, 0, 0x0
+  # BEGIN
+  #     ICON            IDI_KLONK,IDC_MYICON,14,9,20,20
+  #     LTEXT           "klonk Version ""yibbee"" 1.0",IDC_STATIC,49,10,119,8,
+  #                     SS_NOPREFIX
+  #     LTEXT           "Copyright (C) 2005",IDC_STATIC,49,20,119,8
+  #     DEFPUSHBUTTON   "OK",IDOK,195,6,30,11,WS_GROUP
+  #     CONTROL         "Jack ""Black"" Daniels",IDC_RADIO1,"Button",
+  #                     BS_AUTORADIOBUTTON,46,51,84,10
+  # END
+
+  # We are using a sorted set of keys, and we assume that the
+  # group name used for descriptions (type) will come after the "text"
+  # group in alphabetical order. We also assume that there cannot be
+  # more than one description per regular expression match.
+  # If that's not the case some descriptions will be clobbered.
+  dialog_re_ = lazy_re.compile(r'''
+    # The dialog's ID in the first line
+    (?P<id1>[A-Z0-9_]+)\s+DIALOG(EX)?
+    |
+    # The caption of the dialog
+    (?P<type1>CAPTION)\s+"(?P<text1>.*?([^"]|""))"\s
+    |
+    # Lines for controls that have text and an ID
+    \s+(?P<type2>[A-Z]+)\s+"(?P<text2>.*?([^"]|"")?)"\s*,\s*(?P<id2>[A-Z0-9_]+)\s*,
+    |
+    # Lines for controls that have text only
+    \s+(?P<type3>[A-Z]+)\s+"(?P<text3>.*?([^"]|"")?)"\s*,
+    |
+    # Lines for controls that reference other resources
+    \s+[A-Z]+\s+[A-Z0-9_]+\s*,\s*(?P<id3>[A-Z0-9_]*[A-Z][A-Z0-9_]*)
+    |
+    # This matches "NOT SOME_STYLE" so that it gets consumed and doesn't get
+    # matched by the next option (controls that have only an ID and then just
+    # numbers)
+    \s+NOT\s+[A-Z][A-Z0-9_]+
+    |
+    # Lines for controls that have only an ID and then just numbers
+    \s+[A-Z]+\s+(?P<id4>[A-Z0-9_]*[A-Z][A-Z0-9_]*)\s*,
+    ''', re.MULTILINE | re.VERBOSE)
+
+  def Parse(self):
+    '''Knows how to parse dialog resource sections.'''
+    self.ReadSection()
+    self._RegExpParse(self.dialog_re_, self.text_)
+
+
+class Menu(Section):
+  '''A resource section that contains a menu resource.'''
+
+  # A typical menu resource section looks something like this:
+  #
+  # IDC_KLONK MENU
+  # BEGIN
+  #     POPUP "&File"
+  #     BEGIN
+  #         MENUITEM "E&xit",                       IDM_EXIT
+  #         MENUITEM "This be ""Klonk"" me like",   ID_FILE_THISBE
+  #         POPUP "gonk"
+  #         BEGIN
+  #             MENUITEM "Klonk && is ""good""",           ID_GONK_KLONKIS
+  #         END
+  #     END
+  #     POPUP "&Help"
+  #     BEGIN
+  #         MENUITEM "&About ...",                  IDM_ABOUT
+  #     END
+  # END
+
+  # Description used for the messages generated for menus, to explain to
+  # the translators how to handle them.
+  MENU_MESSAGE_DESCRIPTION = (
+    'This message represents a menu. Each of the items appears in sequence '
+    '(some possibly within sub-menus) in the menu. The XX01XX placeholders '
+    'serve to separate items. Each item contains an & (ampersand) character '
+    'in front of the keystroke that should be used as a shortcut for that item '
+    'in the menu. Please make sure that no two items in the same menu share '
+    'the same shortcut.'
+  )
+
+  # A dandy regexp to suck all the IDs and translateables out of a menu
+  # resource
+  menu_re_ = lazy_re.compile(r'''
+    # Match the MENU ID on the first line
+    ^(?P<id1>[A-Z0-9_]+)\s+MENU
+    |
+    # Match the translateable caption for a popup menu
+    POPUP\s+"(?P<text1>.*?([^"]|""))"\s
+    |
+    # Match the caption & ID of a MENUITEM
+    MENUITEM\s+"(?P<text2>.*?([^"]|""))"\s*,\s*(?P<id2>[A-Z0-9_]+)
+    ''', re.MULTILINE | re.VERBOSE)
+
+  def Parse(self):
+    '''Knows how to parse menu resource sections.  Because it is important that
+    menu shortcuts are unique within the menu, we return each menu as a single
+    message with placeholders to break up the different menu items, rather than
+    return a single message per menu item.  we also add an automatic description
+    with instructions for the translators.'''
+    self.ReadSection()
+    self.single_message_ = tclib.Message(description=self.MENU_MESSAGE_DESCRIPTION)
+    self._RegExpParse(self.menu_re_, self.text_)
+
+
+class Version(Section):
+  '''A resource section that contains a VERSIONINFO resource.'''
+
+  # A typical version info resource can look like this:
+  #
+  # VS_VERSION_INFO VERSIONINFO
+  #  FILEVERSION 1,0,0,1
+  #  PRODUCTVERSION 1,0,0,1
+  #  FILEFLAGSMASK 0x3fL
+  # #ifdef _DEBUG
+  #  FILEFLAGS 0x1L
+  # #else
+  #  FILEFLAGS 0x0L
+  # #endif
+  #  FILEOS 0x4L
+  #  FILETYPE 0x2L
+  #  FILESUBTYPE 0x0L
+  # BEGIN
+  #     BLOCK "StringFileInfo"
+  #     BEGIN
+  #         BLOCK "040904e4"
+  #         BEGIN
+  #             VALUE "CompanyName", "TODO: <Company name>"
+  #             VALUE "FileDescription", "TODO: <File description>"
+  #             VALUE "FileVersion", "1.0.0.1"
+  #             VALUE "LegalCopyright", "TODO: (c) <Company name>.  All rights reserved."
+  #             VALUE "InternalName", "res_format_test.dll"
+  #             VALUE "OriginalFilename", "res_format_test.dll"
+  #             VALUE "ProductName", "TODO: <Product name>"
+  #             VALUE "ProductVersion", "1.0.0.1"
+  #         END
+  #     END
+  #     BLOCK "VarFileInfo"
+  #     BEGIN
+  #         VALUE "Translation", 0x409, 1252
+  #     END
+  # END
+  #
+  #
+  # In addition to the above fields, VALUE fields named "Comments" and
+  # "LegalTrademarks" may also be translateable.
+
+  version_re_ = lazy_re.compile(r'''
+    # Match the ID on the first line
+    ^(?P<id1>[A-Z0-9_]+)\s+VERSIONINFO
+    |
+    # Match all potentially translateable VALUE sections
+    \s+VALUE\s+"
+    (
+      CompanyName|FileDescription|LegalCopyright|
+      ProductName|Comments|LegalTrademarks
+    )",\s+"(?P<text1>.*?([^"]|""))"\s
+    ''', re.MULTILINE | re.VERBOSE)
+
+  def Parse(self):
+    '''Knows how to parse VERSIONINFO resource sections.'''
+    self.ReadSection()
+    self._RegExpParse(self.version_re_, self.text_)
+
+  # TODO(joi) May need to override the Translate() method to change the
+  # "Translation" VALUE block to indicate the correct language code.
+
+
+class RCData(Section):
+  '''A resource section that contains some data .'''
+
+  # A typical rcdataresource section looks like this:
+  #
+  # IDR_BLAH        RCDATA      { 1, 2, 3, 4 }
+
+  dialog_re_ = lazy_re.compile(r'''
+    ^(?P<id1>[A-Z0-9_]+)\s+RCDATA\s+(DISCARDABLE)?\s+\{.*?\}
+    ''', re.MULTILINE | re.VERBOSE | re.DOTALL)
+
+  def Parse(self):
+    '''Implementation for resource types w/braces (not BEGIN/END)
+    '''
+    rc_text = self._LoadInputFile()
+
+    out = ''
+    begin_count = 0
+    openbrace_count = 0
+    assert self.extkey
+    first_line_re = re.compile(r'\s*' + self.extkey + r'\b')
+    for line in rc_text.splitlines(True):
+      if out or first_line_re.match(line):
+        out += line
+
+      # We stop once the braces balance (could happen in one line).
+      begin_count_was = begin_count
+      if len(out) > 0:
+        openbrace_count += line.count('{')
+        begin_count += line.count('{')
+        begin_count -= line.count('}')
+      if ((begin_count_was == 1 and begin_count == 0) or
+         (openbrace_count > 0 and begin_count == 0)):
+        break
+
+    if len(out) == 0:
+      raise exception.SectionNotFound('%s in file %s' % (self.extkey, self.rc_file))
+
+    self.text_ = out
+
+    self._RegExpParse(self.dialog_re_, out)
+
+
+class Accelerators(Section):
+  '''An ACCELERATORS table.
+  '''
+
+  # A typical ACCELERATORS section looks like this:
+  #
+  # IDR_ACCELERATOR1 ACCELERATORS
+  # BEGIN
+  #   "^C",           ID_ACCELERATOR32770,    ASCII,  NOINVERT
+  #   "^V",           ID_ACCELERATOR32771,    ASCII,  NOINVERT
+  #   VK_INSERT,      ID_ACCELERATOR32772,    VIRTKEY, CONTROL, NOINVERT
+  # END
+
+  accelerators_re_ = lazy_re.compile(r'''
+    # Match the ID on the first line
+    ^(?P<id1>[A-Z0-9_]+)\s+ACCELERATORS\s+
+    |
+    # Match accelerators specified as VK_XXX
+    \s+VK_[A-Z0-9_]+,\s*(?P<id2>[A-Z0-9_]+)\s*,
+    |
+    # Match accelerators specified as e.g. "^C"
+    \s+"[^"]*",\s+(?P<id3>[A-Z0-9_]+)\s*,
+    ''', re.MULTILINE | re.VERBOSE)
+
+  def Parse(self):
+    '''Knows how to parse ACCELERATORS resource sections.'''
+    self.ReadSection()
+    self._RegExpParse(self.accelerators_re_, self.text_)
diff --git a/tools/grit/grit/gather/rc_unittest.py b/tools/grit/grit/gather/rc_unittest.py
new file mode 100644
index 0000000000..3c26a4342a
--- /dev/null
+++ b/tools/grit/grit/gather/rc_unittest.py
@@ -0,0 +1,372 @@
+#!/usr/bin/env python
+# Copyright (c) 2012 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.
+
+'''Unit tests for grit.gather.rc'''
+
+from __future__ import print_function
+
+import os
+import sys
+if __name__ == '__main__':
+  sys.path.append(os.path.join(os.path.dirname(__file__), '../..'))
+
+import unittest
+
+from six import StringIO
+
+from grit.gather import rc
+from grit import util
+
+
+class RcUnittest(unittest.TestCase):
+
+  part_we_want = '''IDC_KLONKACC ACCELERATORS
+BEGIN
+    "?",            IDM_ABOUT,              ASCII,  ALT
+    "/",            IDM_ABOUT,              ASCII,  ALT
+END'''
+
+  def testSectionFromFile(self):
+    buf = '''IDC_SOMETHINGELSE BINGO
+BEGIN
+    BLA BLA
+    BLA BLA
+END
+%s
+
+IDC_KLONK BINGOBONGO
+BEGIN
+  HONGO KONGO
+END
+''' % self.part_we_want
+
+    f = StringIO(buf)
+
+    out = rc.Section(f, 'IDC_KLONKACC')
+    out.ReadSection()
+    self.failUnless(out.GetText() == self.part_we_want)
+
+    out = rc.Section(util.PathFromRoot(r'grit/testdata/klonk.rc'),
+                     'IDC_KLONKACC',
+                     encoding='utf-16')
+    out.ReadSection()
+    out_text = out.GetText().replace('\t', '')
+    out_text = out_text.replace(' ', '')
+    self.part_we_want = self.part_we_want.replace(' ', '')
+    self.failUnless(out_text.strip() == self.part_we_want.strip())
+
+
+  def testDialog(self):
+    dlg = rc.Dialog(StringIO('''IDD_ABOUTBOX DIALOGEX 22, 17, 230, 75
+STYLE DS_SETFONT | DS_MODALFRAME | WS_CAPTION | WS_SYSMENU
+CAPTION "About"
+FONT 8, "System", 0, 0, 0x0
+BEGIN
+    ICON            IDI_KLONK,IDC_MYICON,14,9,20,20
+    LTEXT           "klonk Version ""yibbee"" 1.0",IDC_STATIC,49,10,119,8,
+                    SS_NOPREFIX
+    LTEXT           "Copyright (C) 2005",IDC_STATIC,49,20,119,8
+    DEFPUSHBUTTON   "OK",IDOK,195,6,30,11,WS_GROUP
+    CONTROL         "Jack ""Black"" Daniels",IDC_RADIO1,"Button",
+                    BS_AUTORADIOBUTTON,46,51,84,10
+    // try a line where the ID is on the continuation line
+    LTEXT           "blablablabla blablabla blablablablablablablabla blablabla",
+                    ID_SMURF, whatever...
+END
+'''), 'IDD_ABOUTBOX')
+    dlg.Parse()
+    self.failUnless(len(dlg.GetTextualIds()) == 7)
+    self.failUnless(len(dlg.GetCliques()) == 6)
+    self.failUnless(dlg.GetCliques()[1].GetMessage().GetRealContent() ==
+                    'klonk Version "yibbee" 1.0')
+
+    transl = dlg.Translate('en')
+    self.failUnless(transl.strip() == dlg.GetText().strip())
+
+  def testAlternateSkeleton(self):
+    dlg = rc.Dialog(StringIO('''IDD_ABOUTBOX DIALOGEX 22, 17, 230, 75
+STYLE DS_SETFONT | DS_MODALFRAME | WS_CAPTION | WS_SYSMENU
+CAPTION "About"
+FONT 8, "System", 0, 0, 0x0
+BEGIN
+    LTEXT           "Yipee skippy",IDC_STATIC,49,10,119,8,
+                    SS_NOPREFIX
+END
+'''), 'IDD_ABOUTBOX')
+    dlg.Parse()
+
+    alt_dlg = rc.Dialog(StringIO('''IDD_ABOUTBOX DIALOGEX 040704, 17, 230, 75
+STYLE DS_SETFONT | DS_MODALFRAME | WS_CAPTION | WS_SYSMENU
+CAPTION "XXXXXXXXX"
+FONT 8, "System", 0, 0, 0x0
+BEGIN
+    LTEXT           "XXXXXXXXXXXXXXXXX",IDC_STATIC,110978,10,119,8,
+                    SS_NOPREFIX
+END
+'''), 'IDD_ABOUTBOX')
+    alt_dlg.Parse()
+
+    transl = dlg.Translate('en', skeleton_gatherer=alt_dlg)
+    self.failUnless(transl.count('040704') and
+                    transl.count('110978'))
+    self.failUnless(transl.count('Yipee skippy'))
+
+  def testMenu(self):
+    menu = rc.Menu(StringIO('''IDC_KLONK MENU
+BEGIN
+    POPUP "&File """
+    BEGIN
+        MENUITEM "E&xit",                       IDM_EXIT
+        MENUITEM "This be ""Klonk"" me like",   ID_FILE_THISBE
+        POPUP "gonk"
+        BEGIN
+            MENUITEM "Klonk && is ""good""",           ID_GONK_KLONKIS
+        END
+        MENUITEM "This is a very long menu caption to try to see if we can make the ID go to a continuation line, blablabla blablabla bla blabla blablabla blablabla blablabla blablabla...",
+                                        ID_FILE_THISISAVERYLONGMENUCAPTIONTOTRYTOSEEIFWECANMAKETHEIDGOTOACONTINUATIONLINE
+    END
+    POPUP "&Help"
+    BEGIN
+        MENUITEM "&About ...",                  IDM_ABOUT
+    END
+END'''), 'IDC_KLONK')
+
+    menu.Parse()
+    self.failUnless(len(menu.GetTextualIds()) == 6)
+    self.failUnless(len(menu.GetCliques()) == 1)
+    self.failUnless(len(menu.GetCliques()[0].GetMessage().GetPlaceholders()) ==
+                    9)
+
+    transl = menu.Translate('en')
+    self.failUnless(transl.strip() == menu.GetText().strip())
+
+  def testVersion(self):
+    version = rc.Version(StringIO('''
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION 1,0,0,1
+ PRODUCTVERSION 1,0,0,1
+ FILEFLAGSMASK 0x3fL
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x4L
+ FILETYPE 0x2L
+ FILESUBTYPE 0x0L
+BEGIN
+    BLOCK "StringFileInfo"
+    BEGIN
+        BLOCK "040904e4"
+        BEGIN
+            VALUE "CompanyName", "TODO: <Company name>"
+            VALUE "FileDescription", "TODO: <File description>"
+            VALUE "FileVersion", "1.0.0.1"
+            VALUE "LegalCopyright", "TODO: (c) <Company name>.  All rights reserved."
+            VALUE "InternalName", "res_format_test.dll"
+            VALUE "OriginalFilename", "res_format_test.dll"
+            VALUE "ProductName", "TODO: <Product name>"
+            VALUE "ProductVersion", "1.0.0.1"
+        END
+    END
+    BLOCK "VarFileInfo"
+    BEGIN
+        VALUE "Translation", 0x409, 1252
+    END
+END
+'''.strip()), 'VS_VERSION_INFO')
+    version.Parse()
+    self.failUnless(len(version.GetTextualIds()) == 1)
+    self.failUnless(len(version.GetCliques()) == 4)
+
+    transl = version.Translate('en')
+    self.failUnless(transl.strip() == version.GetText().strip())
+
+
+  def testRegressionDialogBox(self):
+    dialog = rc.Dialog(StringIO('''
+IDD_SIDEBAR_WEATHER_PANEL_PROPPAGE DIALOGEX 0, 0, 205, 157
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+    EDITTEXT        IDC_SIDEBAR_WEATHER_NEW_CITY,3,27,112,14,ES_AUTOHSCROLL
+    DEFPUSHBUTTON   "Add Location",IDC_SIDEBAR_WEATHER_ADD,119,27,50,14
+    LISTBOX         IDC_SIDEBAR_WEATHER_CURR_CITIES,3,48,127,89,
+                    LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
+    PUSHBUTTON      "Move Up",IDC_SIDEBAR_WEATHER_MOVE_UP,134,104,50,14
+    PUSHBUTTON      "Move Down",IDC_SIDEBAR_WEATHER_MOVE_DOWN,134,121,50,14
+    PUSHBUTTON      "Remove",IDC_SIDEBAR_WEATHER_DELETE,134,48,50,14
+    LTEXT           "To see current weather conditions and forecasts in the USA, enter the zip code (example: 94043) or city and state (example: Mountain View, CA).",
+                    IDC_STATIC,3,0,199,25
+    CONTROL         "Fahrenheit",IDC_SIDEBAR_WEATHER_FAHRENHEIT,"Button",
+                    BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,3,144,51,10
+    CONTROL         "Celsius",IDC_SIDEBAR_WEATHER_CELSIUS,"Button",
+                    BS_AUTORADIOBUTTON,57,144,38,10
+END'''.strip()), 'IDD_SIDEBAR_WEATHER_PANEL_PROPPAGE')
+    dialog.Parse()
+    self.failUnless(len(dialog.GetTextualIds()) == 10)
+
+
+  def testRegressionDialogBox2(self):
+    dialog = rc.Dialog(StringIO('''
+IDD_SIDEBAR_EMAIL_PANEL_PROPPAGE DIALOG DISCARDABLE 0, 0, 264, 220
+STYLE WS_CHILD
+FONT 8, "MS Shell Dlg"
+BEGIN
+    GROUPBOX        "Email Filters",IDC_STATIC,7,3,250,190
+    LTEXT           "Click Add Filter to create the email filter.",IDC_STATIC,16,41,130,9
+    PUSHBUTTON      "Add Filter...",IDC_SIDEBAR_EMAIL_ADD_FILTER,196,38,50,14
+    PUSHBUTTON      "Remove",IDC_SIDEBAR_EMAIL_REMOVE,196,174,50,14
+    PUSHBUTTON      "", IDC_SIDEBAR_EMAIL_HIDDEN, 200, 178, 5, 5, NOT WS_VISIBLE
+    LISTBOX         IDC_SIDEBAR_EMAIL_LIST,16,60,230,108,
+                    LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
+    LTEXT           "You can prevent certain emails from showing up in the sidebar with a filter.",
+                    IDC_STATIC,16,18,234,18
+END'''.strip()), 'IDD_SIDEBAR_EMAIL_PANEL_PROPPAGE')
+    dialog.Parse()
+    self.failUnless('IDC_SIDEBAR_EMAIL_HIDDEN' in dialog.GetTextualIds())
+
+
+  def testRegressionMenuId(self):
+    menu = rc.Menu(StringIO('''
+IDR_HYPERMENU_FOLDER MENU
+BEGIN
+    POPUP "HyperFolder"
+    BEGIN
+        MENUITEM "Open Containing Folder",      IDM_OPENFOLDER
+    END
+END'''.strip()), 'IDR_HYPERMENU_FOLDER')
+    menu.Parse()
+    self.failUnless(len(menu.GetTextualIds()) == 2)
+
+  def testRegressionNewlines(self):
+    menu = rc.Menu(StringIO('''
+IDR_HYPERMENU_FOLDER MENU
+BEGIN
+    POPUP "Hyper\\nFolder"
+    BEGIN
+        MENUITEM "Open Containing Folder",      IDM_OPENFOLDER
+    END
+END'''.strip()), 'IDR_HYPERMENU_FOLDER')
+    menu.Parse()
+    transl = menu.Translate('en')
+    # Shouldn't find \\n (the \n shouldn't be changed to \\n)
+    self.failUnless(transl.find('\\\\n') == -1)
+
+  def testRegressionTabs(self):
+    menu = rc.Menu(StringIO('''
+IDR_HYPERMENU_FOLDER MENU
+BEGIN
+    POPUP "Hyper\\tFolder"
+    BEGIN
+        MENUITEM "Open Containing Folder",      IDM_OPENFOLDER
+    END
+END'''.strip()), 'IDR_HYPERMENU_FOLDER')
+    menu.Parse()
+    transl = menu.Translate('en')
+    # Shouldn't find \\t (the \t shouldn't be changed to \\t)
+    self.failUnless(transl.find('\\\\t') == -1)
+
+  def testEscapeUnescape(self):
+    original = 'Hello "bingo"\n How\\are\\you\\n?'
+    escaped = rc.Section.Escape(original)
+    self.failUnless(escaped == 'Hello ""bingo""\\n How\\\\are\\\\you\\\\n?')
+    unescaped = rc.Section.UnEscape(escaped)
+    self.failUnless(unescaped == original)
+
+  def testRegressionPathsWithSlashN(self):
+    original = '..\\\\..\\\\trs\\\\res\\\\nav_first.gif'
+    unescaped = rc.Section.UnEscape(original)
+    self.failUnless(unescaped == '..\\..\\trs\\res\\nav_first.gif')
+
+  def testRegressionDialogItemsTextOnly(self):
+    dialog = rc.Dialog(StringIO('''IDD_OPTIONS_SEARCH DIALOGEX 0, 0, 280, 292
+STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP |
+    WS_DISABLED | WS_CAPTION | WS_SYSMENU
+CAPTION "Search"
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+    GROUPBOX        "Select search buttons and options",-1,7,5,266,262
+    CONTROL         "",IDC_OPTIONS,"SysTreeView32",TVS_DISABLEDRAGDROP |
+                    WS_BORDER | WS_TABSTOP | 0x800,16,19,248,218
+    LTEXT           "Use Google site:",-1,26,248,52,8
+    COMBOBOX        IDC_GOOGLE_HOME,87,245,177,256,CBS_DROPDOWNLIST |
+                    WS_VSCROLL | WS_TABSTOP
+    PUSHBUTTON      "Restore Defaults...",IDC_RESET,187,272,86,14
+END'''), 'IDD_OPTIONS_SEARCH')
+    dialog.Parse()
+    translateables = [c.GetMessage().GetRealContent()
+                      for c in dialog.GetCliques()]
+    self.failUnless('Select search buttons and options' in translateables)
+    self.failUnless('Use Google site:' in translateables)
+
+  def testAccelerators(self):
+    acc = rc.Accelerators(StringIO('''\
+IDR_ACCELERATOR1 ACCELERATORS
+BEGIN
+    "^C",           ID_ACCELERATOR32770,    ASCII,  NOINVERT
+    "^V",           ID_ACCELERATOR32771,    ASCII,  NOINVERT
+    VK_INSERT,      ID_ACCELERATOR32772,    VIRTKEY, CONTROL, NOINVERT
+END
+'''), 'IDR_ACCELERATOR1')
+    acc.Parse()
+    self.failUnless(len(acc.GetTextualIds()) == 4)
+    self.failUnless(len(acc.GetCliques()) == 0)
+
+    transl = acc.Translate('en')
+    self.failUnless(transl.strip() == acc.GetText().strip())
+
+
+  def testRegressionEmptyString(self):
+    dlg = rc.Dialog(StringIO('''\
+IDD_CONFIRM_QUIT_GD_DLG DIALOGEX 0, 0, 267, 108
+STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP |
+    WS_CAPTION
+EXSTYLE WS_EX_TOPMOST
+CAPTION "Google Desktop"
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+    DEFPUSHBUTTON   "&Yes",IDYES,82,87,50,14
+    PUSHBUTTON      "&No",IDNO,136,87,50,14
+    ICON            32514,IDC_STATIC,7,9,21,20
+    EDITTEXT        IDC_TEXTBOX,34,7,231,60,ES_MULTILINE | ES_READONLY | NOT WS_BORDER
+    CONTROL         "",
+                    IDC_ENABLE_GD_AUTOSTART,"Button",BS_AUTOCHECKBOX |
+                    WS_TABSTOP,33,70,231,10
+END'''), 'IDD_CONFIRM_QUIT_GD_DLG')
+    dlg.Parse()
+
+    def Check():
+      self.failUnless(transl.count('IDC_ENABLE_GD_AUTOSTART'))
+      self.failUnless(transl.count('END'))
+
+    transl = dlg.Translate('de', pseudo_if_not_available=True,
+                           fallback_to_english=True)
+    Check()
+    transl = dlg.Translate('de', pseudo_if_not_available=True,
+                           fallback_to_english=False)
+    Check()
+    transl = dlg.Translate('de', pseudo_if_not_available=False,
+                           fallback_to_english=True)
+    Check()
+    transl = dlg.Translate('de', pseudo_if_not_available=False,
+                           fallback_to_english=False)
+    Check()
+    transl = dlg.Translate('en', pseudo_if_not_available=True,
+                           fallback_to_english=True)
+    Check()
+    transl = dlg.Translate('en', pseudo_if_not_available=True,
+                           fallback_to_english=False)
+    Check()
+    transl = dlg.Translate('en', pseudo_if_not_available=False,
+                           fallback_to_english=True)
+    Check()
+    transl = dlg.Translate('en', pseudo_if_not_available=False,
+                           fallback_to_english=False)
+    Check()
+
+
+if __name__ == '__main__':
+  unittest.main()
diff --git a/tools/grit/grit/gather/regexp.py b/tools/grit/grit/gather/regexp.py
new file mode 100644
index 0000000000..97ce2cfbf7
--- /dev/null
+++ b/tools/grit/grit/gather/regexp.py
@@ -0,0 +1,82 @@
+# Copyright (c) 2012 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.
+
+'''A baseclass for simple gatherers based on regular expressions.
+'''
+
+from __future__ import print_function
+
+from grit.gather import skeleton_gatherer
+
+
+class RegexpGatherer(skeleton_gatherer.SkeletonGatherer):
+  '''Common functionality of gatherers based on parsing using a single
+  regular expression.
+  '''
+
+  DescriptionMapping_ = {
+      'CAPTION' : 'This is a caption for a dialog',
+      'CHECKBOX' : 'This is a label for a checkbox',
+      'CONTROL': 'This is the text on a control',
+      'CTEXT': 'This is a label for a control',
+      'DEFPUSHBUTTON': 'This is a button definition',
+      'GROUPBOX': 'This is a label for a grouping',
+      'ICON': 'This is a label for an icon',
+      'LTEXT': 'This is the text for a label',
+      'PUSHBUTTON': 'This is the text for a button',
+    }
+
+  # Contextualization elements. Used for adding additional information
+  # to the message bundle description string from RC files.
+  def AddDescriptionElement(self, string):
+    if string in self.DescriptionMapping_:
+      description = self.DescriptionMapping_[string]
+    else:
+      description = string
+    if self.single_message_:
+      self.single_message_.SetDescription(description)
+    else:
+      if (self.translatable_chunk_):
+        message = self.skeleton_[len(self.skeleton_) - 1].GetMessage()
+        message.SetDescription(description)
+
+  def _RegExpParse(self, regexp, text_to_parse):
+    '''An implementation of Parse() that can be used for resource sections that
+    can be parsed using a single multi-line regular expression.
+
+    All translateables must be in named groups that have names starting with
+    'text'.  All textual IDs must be in named groups that have names starting
+    with 'id'. All type definitions that can be included in the description
+    field for contextualization purposes should have a name that starts with
+    'type'.
+
+    Args:
+      regexp: re.compile('...', re.MULTILINE)
+      text_to_parse:
+    '''
+    chunk_start = 0
+    for match in regexp.finditer(text_to_parse):
+      groups = match.groupdict()
+      keys = sorted(groups.keys())
+      self.translatable_chunk_ = False
+      for group in keys:
+        if group.startswith('id') and groups[group]:
+          self._AddTextualId(groups[group])
+        elif group.startswith('text') and groups[group]:
+          self._AddNontranslateableChunk(
+            text_to_parse[chunk_start : match.start(group)])
+          chunk_start = match.end(group)  # Next chunk will start after the match
+          self._AddTranslateableChunk(groups[group])
+        elif group.startswith('type') and groups[group]:
+          # Add the description to the skeleton_ list. This works because
+          # we are using a sort set of keys, and because we assume that the
+          # group name used for descriptions (type) will come after the "text"
+          # group in alphabetical order. We also assume that there cannot be
+          # more than one description per regular expression match.
+          self.AddDescriptionElement(groups[group])
+
+    self._AddNontranslateableChunk(text_to_parse[chunk_start:])
+
+    if self.single_message_:
+      self.skeleton_.append(self.uberclique.MakeClique(self.single_message_))
diff --git a/tools/grit/grit/gather/skeleton_gatherer.py b/tools/grit/grit/gather/skeleton_gatherer.py
new file mode 100644
index 0000000000..b11862b314
--- /dev/null
+++ b/tools/grit/grit/gather/skeleton_gatherer.py
@@ -0,0 +1,149 @@
+# Copyright (c) 2012 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.
+
+'''A baseclass for simple gatherers that store their gathered resource in a
+list.
+'''
+
+from __future__ import print_function
+
+import six
+
+from grit.gather import interface
+from grit import clique
+from grit import exception
+from grit import tclib
+
+
+class SkeletonGatherer(interface.GathererBase):
+  '''Common functionality of gatherers that parse their input as a skeleton of
+  translatable and nontranslatable chunks.
+  '''
+
+  def __init__(self, *args, **kwargs):
+    super(SkeletonGatherer, self).__init__(*args, **kwargs)
+    # List of parts of the document. Translateable parts are
+    # clique.MessageClique objects, nontranslateable parts are plain strings.
+    # Translated messages are inserted back into the skeleton using the quoting
+    # rules defined by self.Escape()
+    self.skeleton_ = []
+    # A list of the names of IDs that need to be defined for this resource
+    # section to compile correctly.
+    self.ids_ = []
+    # True if Parse() has already been called.
+    self.have_parsed_ = False
+    # True if a translatable chunk has been added
+    self.translatable_chunk_ = False
+    # If not None, all parts of the document will be put into this single
+    # message; otherwise the normal skeleton approach is used.
+    self.single_message_ = None
+    # Number to use for the next placeholder name.  Used only if single_message
+    # is not None
+    self.ph_counter_ = 1
+
+  def GetText(self):
+    '''Returns the original text of the section'''
+    return self.text_
+
+  def Escape(self, text):
+    '''Subclasses can override.  Base impl is identity.
+    '''
+    return text
+
+  def UnEscape(self, text):
+    '''Subclasses can override. Base impl is identity.
+    '''
+    return text
+
+  def GetTextualIds(self):
+    '''Returns the list of textual IDs that need to be defined for this
+    resource section to compile correctly.'''
+    return self.ids_
+
+  def _AddTextualId(self, id):
+    self.ids_.append(id)
+
+  def GetCliques(self):
+    '''Returns the message cliques for each translateable message in the
+    resource section.'''
+    return [x for x in self.skeleton_ if isinstance(x, clique.MessageClique)]
+
+  def Translate(self, lang, pseudo_if_not_available=True,
+                skeleton_gatherer=None, fallback_to_english=False):
+    if len(self.skeleton_) == 0:
+      raise exception.NotReady()
+    if skeleton_gatherer:
+      assert len(skeleton_gatherer.skeleton_) == len(self.skeleton_)
+
+    out = []
+    for ix in range(len(self.skeleton_)):
+      if isinstance(self.skeleton_[ix], six.string_types):
+        if skeleton_gatherer:
+          # Make sure the skeleton is like the original
+          assert(isinstance(skeleton_gatherer.skeleton_[ix], six.string_types))
+          out.append(skeleton_gatherer.skeleton_[ix])
+        else:
+          out.append(self.skeleton_[ix])
+      else:
+        if skeleton_gatherer:  # Make sure the skeleton is like the original
+          assert(not isinstance(skeleton_gatherer.skeleton_[ix],
+                                six.string_types))
+        msg = self.skeleton_[ix].MessageForLanguage(lang,
+                                                    pseudo_if_not_available,
+                                                    fallback_to_english)
+
+        def MyEscape(text):
+          return self.Escape(text)
+        text = msg.GetRealContent(escaping_function=MyEscape)
+        out.append(text)
+    return ''.join(out)
+
+  def Parse(self):
+    '''Parses the section.  Implemented by subclasses.  Idempotent.'''
+    raise NotImplementedError()
+
+  def _AddNontranslateableChunk(self, chunk):
+    '''Adds a nontranslateable chunk.'''
+    if self.single_message_:
+      ph = tclib.Placeholder('XX%02dXX' % self.ph_counter_, chunk, chunk)
+      self.ph_counter_ += 1
+      self.single_message_.AppendPlaceholder(ph)
+    else:
+      self.skeleton_.append(chunk)
+
+  def _AddTranslateableChunk(self, chunk):
+    '''Adds a translateable chunk.  It will be unescaped before being added.'''
+    # We don't want empty messages since they are redundant and the TC
+    # doesn't allow them.
+    if chunk == '':
+      return
+
+    unescaped_text = self.UnEscape(chunk)
+    if self.single_message_:
+      self.single_message_.AppendText(unescaped_text)
+    else:
+      self.skeleton_.append(self.uberclique.MakeClique(
+        tclib.Message(text=unescaped_text)))
+      self.translatable_chunk_ = True
+
+  def SubstituteMessages(self, substituter):
+    '''Applies substitutions to all messages in the tree.
+
+    Goes through the skeleton and finds all MessageCliques.
+
+    Args:
+      substituter: a grit.util.Substituter object.
+    '''
+    if self.single_message_:
+      self.single_message_ = substituter.SubstituteMessage(self.single_message_)
+    new_skel = []
+    for chunk in self.skeleton_:
+      if isinstance(chunk, clique.MessageClique):
+        old_message = chunk.GetMessage()
+        new_message = substituter.SubstituteMessage(old_message)
+        if new_message is not old_message:
+          new_skel.append(self.uberclique.MakeClique(new_message))
+          continue
+      new_skel.append(chunk)
+    self.skeleton_ = new_skel
diff --git a/tools/grit/grit/gather/tr_html.py b/tools/grit/grit/gather/tr_html.py
new file mode 100644
index 0000000000..60a9bfaf4e
--- /dev/null
+++ b/tools/grit/grit/gather/tr_html.py
@@ -0,0 +1,743 @@
+# Copyright (c) 2012 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.
+
+'''A gatherer for the TotalRecall brand of HTML templates with replaceable
+portions.  We wanted to reuse extern.tclib.api.handlers.html.TCHTMLParser
+but this proved impossible due to the fact that the TotalRecall HTML templates
+are in general quite far from parseable HTML and the TCHTMLParser derives
+
+from HTMLParser.HTMLParser which requires relatively well-formed HTML.  Some
+examples of "HTML" from the TotalRecall HTML templates that wouldn't be
+parseable include things like:
+
+  <a [PARAMS]>blabla</a>  (not parseable because attributes are invalid)
+
+  <table><tr><td>[LOTSOFSTUFF]</tr></table> (not parseable because closing
+                                            </td> is in the HTML [LOTSOFSTUFF]
+                                            is replaced by)
+
+The other problem with using general parsers (such as TCHTMLParser) is that
+we want to make sure we output the TotalRecall template with as little changes
+as possible in terms of whitespace characters, layout etc.  With any parser
+that generates a parse tree, and generates output by dumping the parse tree,
+we would always have little inconsistencies which could cause bugs (the
+TotalRecall template stuff is quite brittle and can break if e.g. a tab
+character is replaced with spaces).
+
+The solution, which may be applicable to some other HTML-like template
+languages floating around Google, is to create a parser with a simple state
+machine that keeps track of what kind of tag it's inside, and whether it's in
+a translateable section or not.  Translateable sections are:
+
+a) text (including [BINGO] replaceables) inside of tags that
+   can contain translateable text (which is all tags except
+   for a few)
+
+b) text inside of an 'alt' attribute in an <image> element, or
+   the 'value' attribute of a <submit>, <button> or <text>
+   element.
+
+The parser does not build up a parse tree but rather a "skeleton" which
+is a list of nontranslateable strings intermingled with grit.clique.MessageClique
+objects.  This simplifies the parser considerably compared to a regular HTML
+parser.  To output a translated document, each item in the skeleton is
+printed out, with the relevant Translation from each MessageCliques being used
+for the requested language.
+
+This implementation borrows some code, constants and ideas from
+extern.tclib.api.handlers.html.TCHTMLParser.
+'''
+
+from __future__ import print_function
+
+import re
+
+import six
+
+from grit import clique
+from grit import exception
+from grit import lazy_re
+from grit import util
+from grit import tclib
+
+from grit.gather import interface
+
+
+# HTML tags which break (separate) chunks.
+_BLOCK_TAGS = ['script', 'p', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'hr', 'br',
+              'body', 'style', 'head', 'title', 'table', 'tr', 'td', 'th',
+              'ul', 'ol', 'dl', 'nl', 'li', 'div', 'object', 'center',
+              'html', 'link', 'form', 'select', 'textarea',
+              'button', 'option', 'map', 'area', 'blockquote', 'pre',
+              'meta', 'xmp', 'noscript', 'label', 'tbody', 'thead',
+              'script', 'style', 'pre', 'iframe', 'img', 'input', 'nowrap',
+              'fieldset', 'legend']
+
+# HTML tags which may appear within a chunk.
+_INLINE_TAGS = ['b', 'i', 'u', 'tt', 'code', 'font', 'a', 'span', 'small',
+               'key', 'nobr', 'url', 'em', 's', 'sup', 'strike',
+               'strong']
+
+# HTML tags within which linebreaks are significant.
+_PREFORMATTED_TAGS = ['textarea', 'xmp', 'pre']
+
+# An array mapping some of the inline HTML tags to more meaningful
+# names for those tags.  This will be used when generating placeholders
+# representing these tags.
+_HTML_PLACEHOLDER_NAMES = { 'a' : 'link', 'br' : 'break', 'b' : 'bold',
+  'i' : 'italic', 'li' : 'item', 'ol' : 'ordered_list', 'p' : 'paragraph',
+  'ul' : 'unordered_list', 'img' : 'image', 'em' : 'emphasis' }
+
+# We append each of these characters in sequence to distinguish between
+# different placeholders with basically the same name (e.g. BOLD1, BOLD2).
+# Keep in mind that a placeholder name must not be a substring of any other
+# placeholder name in the same message, so we can't simply count (BOLD_1
+# would be a substring of BOLD_10).
+_SUFFIXES = '123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+
+# Matches whitespace in an HTML document.  Also matches HTML comments, which are
+# treated as whitespace.
+_WHITESPACE = lazy_re.compile(r'(\s|&nbsp;|\\n|\\r|<!--\s*desc\s*=.*?-->)+',
+                              re.DOTALL)
+
+# Matches whitespace sequences which can be folded into a single whitespace
+# character.  This matches single characters so that non-spaces are replaced
+# with spaces.
+_FOLD_WHITESPACE = lazy_re.compile(r'\s+')
+
+# Finds a non-whitespace character
+_NON_WHITESPACE = lazy_re.compile(r'\S')
+
+# Matches two or more &nbsp; in a row (a single &nbsp is not changed into
+# placeholders because different languages require different numbers of spaces
+# and placeholders must match exactly; more than one is probably a "special"
+# whitespace sequence and should be turned into a placeholder).
+_NBSP = lazy_re.compile(r'&nbsp;(&nbsp;)+')
+
+# Matches nontranslateable chunks of the document
+_NONTRANSLATEABLES = lazy_re.compile(r'''
+  <\s*script.+?<\s*/\s*script\s*>
+  |
+  <\s*style.+?<\s*/\s*style\s*>
+  |
+  <!--.+?-->
+  |
+  <\?IMPORT\s.+?>           # import tag
+  |
+  <\s*[a-zA-Z_]+:.+?>       # custom tag (open)
+  |
+  <\s*/\s*[a-zA-Z_]+:.+?>   # custom tag (close)
+  |
+  <!\s*[A-Z]+\s*([^>]+|"[^"]+"|'[^']+')*?>
+  ''', re.MULTILINE | re.DOTALL | re.VERBOSE | re.IGNORECASE)
+
+# Matches a tag and its attributes
+_ELEMENT = lazy_re.compile(r'''
+  # Optional closing /, element name
+  <\s*(?P<closing>/)?\s*(?P<element>[a-zA-Z0-9]+)\s*
+  # Attributes and/or replaceables inside the tag, if any
+  (?P<atts>(
+    \s*([a-zA-Z_][-:.a-zA-Z_0-9]*) # Attribute name
+    (\s*=\s*(\'[^\']*\'|"[^"]*"|[-a-zA-Z0-9./,:;+*%?!&$\(\)_#=~\'"@]*))?
+    |
+    \s*\[(\$?\~)?([A-Z0-9-_]+?)(\~\$?)?\]
+  )*)
+  \s*(?P<empty>/)?\s*> # Optional empty-tag closing /, and tag close
+  ''',
+  re.MULTILINE | re.DOTALL | re.VERBOSE)
+
+# Matches elements that may have translateable attributes.  The value of these
+# special attributes is given by group 'value1' or 'value2'.  Note that this
+# regexp demands that the attribute value be quoted; this is necessary because
+# the non-tree-building nature of the parser means we don't know when we're
+# writing out attributes, so we wouldn't know to escape spaces.
+_SPECIAL_ELEMENT = lazy_re.compile(r'''
+  <\s*(
+    input[^>]+?value\s*=\s*(\'(?P<value3>[^\']*)\'|"(?P<value4>[^"]*)")
+    [^>]+type\s*=\s*"?'?(button|reset|text|submit)'?"?
+    |
+    (
+      table[^>]+?title\s*=
+      |
+      img[^>]+?alt\s*=
+      |
+      input[^>]+?type\s*=\s*"?'?(button|reset|text|submit)'?"?[^>]+?value\s*=
+    )
+    \s*(\'(?P<value1>[^\']*)\'|"(?P<value2>[^"]*)")
+  )[^>]*?>
+  ''', re.MULTILINE | re.DOTALL | re.VERBOSE | re.IGNORECASE)
+
+# Matches stuff that is translateable if it occurs in the right context
+# (between tags).  This includes all characters and character entities.
+# Note that this also matches &nbsp; which needs to be handled as whitespace
+# before this regexp is applied.
+_CHARACTERS = lazy_re.compile(r'''
+  (
+    \w
+    |
+    [\!\@\#\$\%\^\*\(\)\-\=\_\+\[\]\{\}\\\|\;\:\'\"\,\.\/\?\`\~]
+    |
+    &(\#[0-9]+|\#x[0-9a-fA-F]+|[A-Za-z0-9]+);
+  )+
+  ''', re.MULTILINE | re.DOTALL | re.VERBOSE)
+
+# Matches Total Recall's "replaceable" tags, which are just any text
+# in capitals enclosed by delimiters like [] or [~~] or [$~~$] (e.g. [HELLO],
+# [~HELLO~] and [$~HELLO~$]).
+_REPLACEABLE = lazy_re.compile(r'\[(\$?\~)?(?P<name>[A-Z0-9-_]+?)(\~\$?)?\]',
+                               re.MULTILINE)
+
+
+# Matches the silly [!]-prefixed "header" that is used in some TotalRecall
+# templates.
+_SILLY_HEADER = lazy_re.compile(r'\[!\]\ntitle\t(?P<title>[^\n]+?)\n.+?\n\n',
+                                re.MULTILINE | re.DOTALL)
+
+
+# Matches a comment that provides a description for the message it occurs in.
+_DESCRIPTION_COMMENT = lazy_re.compile(
+  r'<!--\s*desc\s*=\s*(?P<description>.+?)\s*-->', re.DOTALL)
+
+# Matches a comment which is used to break apart multiple messages.
+_MESSAGE_BREAK_COMMENT = lazy_re.compile(r'<!--\s*message-break\s*-->',
+                                         re.DOTALL)
+
+# Matches a comment which is used to prevent block tags from splitting a message
+_MESSAGE_NO_BREAK_COMMENT = re.compile(r'<!--\s*message-no-break\s*-->',
+                                       re.DOTALL)
+
+
+_DEBUG = 0
+def _DebugPrint(text):
+  if _DEBUG:
+    print(text.encode('utf-8'))
+
+
+class HtmlChunks(object):
+  '''A parser that knows how to break an HTML-like document into a list of
+  chunks, where each chunk is either translateable or non-translateable.
+  The chunks are unmodified sections of the original document, so concatenating
+  the text of all chunks would result in the original document.'''
+
+  def InTranslateable(self):
+    return self.last_translateable != -1
+
+  def Rest(self):
+    return self.text_[self.current:]
+
+  def StartTranslateable(self):
+    assert not self.InTranslateable()
+    if self.current != 0:
+      # Append a nontranslateable chunk
+      chunk_text = self.text_[self.chunk_start : self.last_nontranslateable + 1]
+      # Needed in the case where document starts with a translateable.
+      if len(chunk_text) > 0:
+        self.AddChunk(False, chunk_text)
+    self.chunk_start = self.last_nontranslateable + 1
+    self.last_translateable = self.current
+    self.last_nontranslateable = -1
+
+  def EndTranslateable(self):
+    assert self.InTranslateable()
+    # Append a translateable chunk
+    self.AddChunk(True,
+                  self.text_[self.chunk_start : self.last_translateable + 1])
+    self.chunk_start = self.last_translateable + 1
+    self.last_translateable = -1
+    self.last_nontranslateable = self.current
+
+  def AdvancePast(self, match):
+    self.current += match.end()
+
+  def AddChunk(self, translateable, text):
+    '''Adds a chunk to self, removing linebreaks and duplicate whitespace
+    if appropriate.
+    '''
+    m = _DESCRIPTION_COMMENT.search(text)
+    if m:
+      self.last_description = m.group('description')
+      # Remove the description from the output text
+      text = _DESCRIPTION_COMMENT.sub('', text)
+
+    m = _MESSAGE_BREAK_COMMENT.search(text)
+    if m:
+      # Remove the coment from the output text.  It should already effectively
+      # break apart messages.
+      text = _MESSAGE_BREAK_COMMENT.sub('', text)
+
+    if translateable and not self.last_element_ in _PREFORMATTED_TAGS:
+      if self.fold_whitespace_:
+        # Fold whitespace sequences if appropriate.  This is optional because it
+        # alters the output strings.
+        text = _FOLD_WHITESPACE.sub(' ', text)
+      else:
+        text = text.replace('\n', ' ')
+        text = text.replace('\r', ' ')
+        # This whitespace folding doesn't work in all cases, thus the
+        # fold_whitespace flag to support backwards compatibility.
+        text = text.replace('   ', ' ')
+        text = text.replace('  ', ' ')
+
+    if translateable:
+      description = self.last_description
+      self.last_description = ''
+    else:
+      description = ''
+
+    if text != '':
+      self.chunks_.append((translateable, text, description))
+
+  def Parse(self, text, fold_whitespace):
+    '''Parses self.text_ into an intermediate format stored in self.chunks_
+    which is translateable and nontranslateable chunks.  Also returns
+    self.chunks_
+
+    Args:
+      text: The HTML for parsing.
+      fold_whitespace: Whether whitespace sequences should be folded into a
+        single space.
+
+    Return:
+      [chunk1, chunk2, chunk3, ...]  (instances of class Chunk)
+    '''
+    #
+    # Chunker state
+    #
+
+    self.text_ = text
+    self.fold_whitespace_ = fold_whitespace
+
+    # A list of tuples (is_translateable, text) which represents the document
+    # after chunking.
+    self.chunks_ = []
+
+    # Start index of the last chunk, whether translateable or not
+    self.chunk_start = 0
+
+    # Index of the last for-sure translateable character if we are parsing
+    # a translateable chunk, -1 to indicate we are not in a translateable chunk.
+    # This is needed so that we don't include trailing whitespace in the
+    # translateable chunk (whitespace is neutral).
+    self.last_translateable = -1
+
+    # Index of the last for-sure nontranslateable character if we are parsing
+    # a nontranslateable chunk, -1 if we are not in a nontranslateable chunk.
+    # This is needed to make sure we can group e.g. "<b>Hello</b> there"
+    # together instead of just "Hello</b> there" which would be much worse
+    # for translation.
+    self.last_nontranslateable = -1
+
+    # Index of the character we're currently looking at.
+    self.current = 0
+
+    # The name of the last block element parsed.
+    self.last_element_ = ''
+
+    # The last explicit description we found.
+    self.last_description = ''
+
+    # Whether no-break was the last chunk seen
+    self.last_nobreak = False
+
+    while self.current < len(self.text_):
+      _DebugPrint('REST: %s' % self.text_[self.current:self.current+60])
+
+      m = _MESSAGE_NO_BREAK_COMMENT.match(self.Rest())
+      if m:
+        self.AdvancePast(m)
+        self.last_nobreak = True
+        continue
+
+      # Try to match whitespace
+      m = _WHITESPACE.match(self.Rest())
+      if m:
+        # Whitespace is neutral, it just advances 'current' and does not switch
+        # between translateable/nontranslateable.  If we are in a
+        # nontranslateable section that extends to the current point, we extend
+        # it to include the whitespace.  If we are in a translateable section,
+        # we do not extend it until we find
+        # more translateable parts, because we never want a translateable chunk
+        # to end with whitespace.
+        if (not self.InTranslateable() and
+            self.last_nontranslateable == self.current - 1):
+          self.last_nontranslateable = self.current + m.end() - 1
+        self.AdvancePast(m)
+        continue
+
+      # Then we try to match nontranslateables
+      m = _NONTRANSLATEABLES.match(self.Rest())
+      if m:
+        if self.InTranslateable():
+          self.EndTranslateable()
+        self.last_nontranslateable = self.current + m.end() - 1
+        self.AdvancePast(m)
+        continue
+
+      # Now match all other HTML element tags (opening, closing, or empty, we
+      # don't care).
+      m = _ELEMENT.match(self.Rest())
+      if m:
+        element_name = m.group('element').lower()
+        if element_name in _BLOCK_TAGS:
+          self.last_element_ = element_name
+          if self.InTranslateable():
+            if self.last_nobreak:
+              self.last_nobreak = False
+            else:
+              self.EndTranslateable()
+
+          # Check for "special" elements, i.e. ones that have a translateable
+          # attribute, and handle them correctly.  Note that all of the
+          # "special" elements are block tags, so no need to check for this
+          # if the tag is not a block tag.
+          sm = _SPECIAL_ELEMENT.match(self.Rest())
+          if sm:
+            # Get the appropriate group name
+            for group in sm.groupdict():
+              if sm.groupdict()[group]:
+                break
+
+            # First make a nontranslateable chunk up to and including the
+            # quote before the translateable attribute value
+            self.AddChunk(False, self.text_[
+              self.chunk_start : self.current + sm.start(group)])
+            # Then a translateable for the translateable bit
+            self.AddChunk(True, self.Rest()[sm.start(group) : sm.end(group)])
+            # Finally correct the data invariant for the parser
+            self.chunk_start = self.current + sm.end(group)
+
+          self.last_nontranslateable = self.current + m.end() - 1
+        elif self.InTranslateable():
+          # We're in a translateable and the tag is an inline tag, so we
+          # need to include it in the translateable.
+          self.last_translateable = self.current + m.end() - 1
+        self.AdvancePast(m)
+        continue
+
+      # Anything else we find must be translateable, so we advance one character
+      # at a time until one of the above matches.
+      if not self.InTranslateable():
+        self.StartTranslateable()
+      else:
+        self.last_translateable = self.current
+      self.current += 1
+
+    # Close the final chunk
+    if self.InTranslateable():
+      self.AddChunk(True, self.text_[self.chunk_start : ])
+    else:
+      self.AddChunk(False, self.text_[self.chunk_start : ])
+
+    return self.chunks_
+
+
+def HtmlToMessage(html, include_block_tags=False, description=''):
+  '''Takes a bit of HTML, which must contain only "inline" HTML elements,
+  and changes it into a tclib.Message.  This involves escaping any entities and
+  replacing any HTML code with placeholders.
+
+  If include_block_tags is true, no error will be given if block tags (e.g.
+  <p> or <br>) are included in the HTML.
+
+  Args:
+    html: 'Hello <b>[USERNAME]</b>, how&nbsp;<i>are</i> you?'
+    include_block_tags: False
+
+  Return:
+    tclib.Message('Hello START_BOLD1USERNAMEEND_BOLD, '
+                  'howNBSPSTART_ITALICareEND_ITALIC you?',
+                  [ Placeholder('START_BOLD', '<b>', ''),
+                    Placeholder('USERNAME', '[USERNAME]', ''),
+                    Placeholder('END_BOLD', '</b>', ''),
+                    Placeholder('START_ITALIC', '<i>', ''),
+                    Placeholder('END_ITALIC', '</i>', ''), ])
+  '''
+  # Approach is:
+  # - first placeholderize, finding <elements>, [REPLACEABLES] and &nbsp;
+  # - then escape all character entities in text in-between placeholders
+
+  parts = []  # List of strings (for text chunks) and tuples (ID, original)
+              # for placeholders
+
+  count_names = {}  # Map of base names to number of times used
+  end_names = {}  # Map of base names to stack of end tags (for correct nesting)
+
+  def MakeNameClosure(base, type = ''):
+    '''Returns a closure that can be called once all names have been allocated
+    to return the final name of the placeholder.  This allows us to minimally
+    number placeholders for non-overlap.
+
+    Also ensures that END_XXX_Y placeholders have the same Y as the
+    corresponding BEGIN_XXX_Y placeholder when we have nested tags of the same
+    type.
+
+    Args:
+      base: 'phname'
+      type: '' | 'begin' | 'end'
+
+    Return:
+      Closure()
+    '''
+    name = base.upper()
+    if type != '':
+      name = ('%s_%s' % (type, base)).upper()
+
+    count_names.setdefault(name, 0)
+    count_names[name] += 1
+
+    def MakeFinalName(name_ = name, index = count_names[name] - 1):
+      if type.lower() == 'end' and end_names.get(base):
+        return end_names[base].pop(-1)  # For correct nesting
+      if count_names[name_] != 1:
+        name_ = '%s_%s' % (name_, _SUFFIXES[index])
+        # We need to use a stack to ensure that the end-tag suffixes match
+        # the begin-tag suffixes.  Only needed when more than one tag of the
+        # same type.
+        if type == 'begin':
+          end_name = ('END_%s_%s' % (base, _SUFFIXES[index])).upper()
+          if base in end_names:
+            end_names[base].append(end_name)
+          else:
+            end_names[base] = [end_name]
+
+      return name_
+
+    return MakeFinalName
+
+  current = 0
+  last_nobreak = False
+
+  while current < len(html):
+    m = _MESSAGE_NO_BREAK_COMMENT.match(html[current:])
+    if m:
+      last_nobreak = True
+      current += m.end()
+      continue
+
+    m = _NBSP.match(html[current:])
+    if m:
+      parts.append((MakeNameClosure('SPACE'), m.group()))
+      current += m.end()
+      continue
+
+    m = _REPLACEABLE.match(html[current:])
+    if m:
+      # Replaceables allow - but placeholders don't, so replace - with _
+      ph_name = MakeNameClosure('X_%s_X' % m.group('name').replace('-', '_'))
+      parts.append((ph_name, m.group()))
+      current += m.end()
+      continue
+
+    m = _SPECIAL_ELEMENT.match(html[current:])
+    if m:
+      if not include_block_tags:
+        if last_nobreak:
+          last_nobreak = False
+        else:
+          raise exception.BlockTagInTranslateableChunk(html)
+      element_name = 'block'  # for simplification
+      # Get the appropriate group name
+      for group in m.groupdict():
+        if m.groupdict()[group]:
+          break
+      parts.append((MakeNameClosure(element_name, 'begin'),
+                    html[current : current + m.start(group)]))
+      parts.append(m.group(group))
+      parts.append((MakeNameClosure(element_name, 'end'),
+                    html[current + m.end(group) : current + m.end()]))
+      current += m.end()
+      continue
+
+    m = _ELEMENT.match(html[current:])
+    if m:
+      element_name = m.group('element').lower()
+      if not include_block_tags and not element_name in _INLINE_TAGS:
+        if last_nobreak:
+          last_nobreak = False
+        else:
+          raise exception.BlockTagInTranslateableChunk(html[current:])
+      if element_name in _HTML_PLACEHOLDER_NAMES:  # use meaningful names
+        element_name = _HTML_PLACEHOLDER_NAMES[element_name]
+
+      # Make a name for the placeholder
+      type = ''
+      if not m.group('empty'):
+        if m.group('closing'):
+          type = 'end'
+        else:
+          type = 'begin'
+      parts.append((MakeNameClosure(element_name, type), m.group()))
+      current += m.end()
+      continue
+
+    if len(parts) and isinstance(parts[-1], six.string_types):
+      parts[-1] += html[current]
+    else:
+      parts.append(html[current])
+    current += 1
+
+  msg_text = ''
+  placeholders = []
+  for part in parts:
+    if isinstance(part, tuple):
+      final_name = part[0]()
+      original = part[1]
+      msg_text += final_name
+      placeholders.append(tclib.Placeholder(final_name, original, '(HTML code)'))
+    else:
+      msg_text += part
+
+  msg = tclib.Message(text=msg_text, placeholders=placeholders,
+                      description=description)
+  content = msg.GetContent()
+  for ix in range(len(content)):
+    if isinstance(content[ix], six.string_types):
+      content[ix] = util.UnescapeHtml(content[ix], replace_nbsp=False)
+
+  return msg
+
+
+class TrHtml(interface.GathererBase):
+  '''Represents a document or message in the template format used by
+  Total Recall for HTML documents.'''
+
+  def __init__(self, *args, **kwargs):
+    super(TrHtml, self).__init__(*args, **kwargs)
+    self.have_parsed_ = False
+    self.skeleton_ = []  # list of strings and MessageClique objects
+    self.fold_whitespace_ = False
+
+  def SetAttributes(self, attrs):
+    '''Sets node attributes used by the gatherer.
+
+    This checks the fold_whitespace attribute.
+
+    Args:
+      attrs: The mapping of node attributes.
+    '''
+    self.fold_whitespace_ = ('fold_whitespace' in attrs and
+                             attrs['fold_whitespace'] == 'true')
+
+  def GetText(self):
+    '''Returns the original text of the HTML document'''
+    return self.text_
+
+  def GetTextualIds(self):
+    return [self.extkey]
+
+  def GetCliques(self):
+    '''Returns the message cliques for each translateable message in the
+    document.'''
+    return [x for x in self.skeleton_ if isinstance(x, clique.MessageClique)]
+
+  def Translate(self, lang, pseudo_if_not_available=True,
+                skeleton_gatherer=None, fallback_to_english=False):
+    '''Returns this document with translateable messages filled with
+    the translation for language 'lang'.
+
+    Args:
+      lang: 'en'
+      pseudo_if_not_available: True
+
+    Return:
+      'ID_THIS_SECTION TYPE\n...BEGIN\n  "Translated message"\n......\nEND
+
+    Raises:
+      grit.exception.NotReady() if used before Parse() has been successfully
+      called.
+      grit.exception.NoSuchTranslation() if 'pseudo_if_not_available' is false
+      and there is no translation for the requested language.
+    '''
+    if len(self.skeleton_) == 0:
+      raise exception.NotReady()
+
+    # TODO(joi) Implement support for skeleton gatherers here.
+
+    out = []
+    for item in self.skeleton_:
+      if isinstance(item, six.string_types):
+        out.append(item)
+      else:
+        msg = item.MessageForLanguage(lang,
+                                      pseudo_if_not_available,
+                                      fallback_to_english)
+        for content in msg.GetContent():
+          if isinstance(content, tclib.Placeholder):
+            out.append(content.GetOriginal())
+          else:
+            # We escape " characters to increase the chance that attributes
+            # will be properly escaped.
+            out.append(util.EscapeHtml(content, True))
+
+    return ''.join(out)
+
+  def Parse(self):
+    if self.have_parsed_:
+      return
+    self.have_parsed_ = True
+
+    text = self._LoadInputFile()
+
+    # Ignore the BOM character if the document starts with one.
+    if text.startswith(u'\ufeff'):
+      text = text[1:]
+
+    self.text_ = text
+
+    # Parsing is done in two phases:  First, we break the document into
+    # translateable and nontranslateable chunks.  Second, we run through each
+    # translateable chunk and insert placeholders for any HTML elements,
+    # unescape escaped characters, etc.
+
+    # First handle the silly little [!]-prefixed header because it's not
+    # handled by our HTML parsers.
+    m = _SILLY_HEADER.match(text)
+    if m:
+      self.skeleton_.append(text[:m.start('title')])
+      self.skeleton_.append(self.uberclique.MakeClique(
+        tclib.Message(text=text[m.start('title'):m.end('title')])))
+      self.skeleton_.append(text[m.end('title') : m.end()])
+      text = text[m.end():]
+
+    chunks = HtmlChunks().Parse(text, self.fold_whitespace_)
+
+    for chunk in chunks:
+      if chunk[0]:  # Chunk is translateable
+        self.skeleton_.append(self.uberclique.MakeClique(
+          HtmlToMessage(chunk[1], description=chunk[2])))
+      else:
+        self.skeleton_.append(chunk[1])
+
+    # Go through the skeleton and change any messages that consist solely of
+    # placeholders and whitespace into nontranslateable strings.
+    for ix in range(len(self.skeleton_)):
+      got_text = False
+      if isinstance(self.skeleton_[ix], clique.MessageClique):
+        msg = self.skeleton_[ix].GetMessage()
+        for item in msg.GetContent():
+          if (isinstance(item, six.string_types)
+              and _NON_WHITESPACE.search(item) and item != '&nbsp;'):
+            got_text = True
+            break
+        if not got_text:
+          self.skeleton_[ix] = msg.GetRealContent()
+
+  def SubstituteMessages(self, substituter):
+    '''Applies substitutions to all messages in the tree.
+
+    Goes through the skeleton and finds all MessageCliques.
+
+    Args:
+      substituter: a grit.util.Substituter object.
+    '''
+    new_skel = []
+    for chunk in self.skeleton_:
+      if isinstance(chunk, clique.MessageClique):
+        old_message = chunk.GetMessage()
+        new_message = substituter.SubstituteMessage(old_message)
+        if new_message is not old_message:
+          new_skel.append(self.uberclique.MakeClique(new_message))
+          continue
+      new_skel.append(chunk)
+    self.skeleton_ = new_skel
diff --git a/tools/grit/grit/gather/tr_html_unittest.py b/tools/grit/grit/gather/tr_html_unittest.py
new file mode 100644
index 0000000000..1194853d9a
--- /dev/null
+++ b/tools/grit/grit/gather/tr_html_unittest.py
@@ -0,0 +1,524 @@
+#!/usr/bin/env python
+# Copyright (c) 2012 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.
+
+'''Unit tests for grit.gather.tr_html'''
+
+from __future__ import print_function
+
+import os
+import sys
+if __name__ == '__main__':
+  sys.path.append(os.path.join(os.path.dirname(__file__), '../..'))
+
+import unittest
+
+import six
+from six import StringIO
+
+from grit.gather import tr_html
+from grit import clique
+from grit import util
+
+
+class ParserUnittest(unittest.TestCase):
+  def testChunkingWithoutFoldWhitespace(self):
+    self.VerifyChunking(False)
+
+  def testChunkingWithFoldWhitespace(self):
+    self.VerifyChunking(True)
+
+  def VerifyChunking(self, fold_whitespace):
+    """Use a single function to run all chunking testing.
+
+    This makes it easier to run chunking with fold_whitespace both on and off,
+    to make sure the outputs are the same.
+
+    Args:
+      fold_whitespace: Whether whitespace sequences should be folded into a
+        single space.
+    """
+    self.VerifyChunkingBasic(fold_whitespace)
+    self.VerifyChunkingDescriptions(fold_whitespace)
+    self.VerifyChunkingReplaceables(fold_whitespace)
+    self.VerifyChunkingLineBreaks(fold_whitespace)
+    self.VerifyChunkingMessageBreak(fold_whitespace)
+    self.VerifyChunkingMessageNoBreak(fold_whitespace)
+
+  def VerifyChunkingBasic(self, fold_whitespace):
+    p = tr_html.HtmlChunks()
+    chunks = p.Parse('<p>Hello <b>dear</b> how <i>are</i>you?<p>Fine!',
+                     fold_whitespace)
+    self.failUnlessEqual(chunks, [
+      (False, '<p>', ''), (True, 'Hello <b>dear</b> how <i>are</i>you?', ''),
+      (False, '<p>', ''), (True, 'Fine!', '')])
+
+    chunks = p.Parse('<p> Hello <b>dear</b> how <i>are</i>you? <p>Fine!',
+                     fold_whitespace)
+    self.failUnlessEqual(chunks, [
+      (False, '<p> ', ''), (True, 'Hello <b>dear</b> how <i>are</i>you?', ''),
+      (False, ' <p>', ''), (True, 'Fine!', '')])
+
+    chunks = p.Parse('<p> Hello <b>dear how <i>are you? <p> Fine!',
+                     fold_whitespace)
+    self.failUnlessEqual(chunks, [
+      (False, '<p> ', ''), (True, 'Hello <b>dear how <i>are you?', ''),
+      (False, ' <p> ', ''), (True, 'Fine!', '')])
+
+    # Ensure translateable sections that start with inline tags contain
+    # the starting inline tag.
+    chunks = p.Parse('<b>Hello!</b> how are you?<p><i>I am fine.</i>',
+                     fold_whitespace)
+    self.failUnlessEqual(chunks, [
+      (True, '<b>Hello!</b> how are you?', ''), (False, '<p>', ''),
+      (True, '<i>I am fine.</i>', '')])
+
+    # Ensure translateable sections that end with inline tags contain
+    # the ending inline tag.
+    chunks = p.Parse("Hello! How are <b>you?</b><p><i>I'm fine!</i>",
+                     fold_whitespace)
+    self.failUnlessEqual(chunks, [
+      (True, 'Hello! How are <b>you?</b>', ''), (False, '<p>', ''),
+      (True, "<i>I'm fine!</i>", '')])
+
+  def VerifyChunkingDescriptions(self, fold_whitespace):
+    p = tr_html.HtmlChunks()
+    # Check capitals and explicit descriptions
+    chunks = p.Parse('<!-- desc=bingo! --><B>Hello!</B> how are you?<P>'
+                     '<I>I am fine.</I>', fold_whitespace)
+    self.failUnlessEqual(chunks, [
+      (True, '<B>Hello!</B> how are you?', 'bingo!'), (False, '<P>', ''),
+      (True, '<I>I am fine.</I>', '')])
+    chunks = p.Parse('<B><!-- desc=bingo! -->Hello!</B> how are you?<P>'
+                     '<I>I am fine.</I>', fold_whitespace)
+    self.failUnlessEqual(chunks, [
+      (True, '<B>Hello!</B> how are you?', 'bingo!'), (False, '<P>', ''),
+      (True, '<I>I am fine.</I>', '')])
+    # Linebreaks get handled by the tclib message.
+    chunks = p.Parse('<B>Hello!</B> <!-- desc=bi\nngo\n! -->how are you?<P>'
+                     '<I>I am fine.</I>', fold_whitespace)
+    self.failUnlessEqual(chunks, [
+      (True, '<B>Hello!</B> how are you?', 'bi\nngo\n!'), (False, '<P>', ''),
+      (True, '<I>I am fine.</I>', '')])
+
+    # In this case, because the explicit description appears after the first
+    # translateable, it will actually apply to the second translateable.
+    chunks = p.Parse('<B>Hello!</B> how are you?<!-- desc=bingo! --><P>'
+                     '<I>I am fine.</I>', fold_whitespace)
+    self.failUnlessEqual(chunks, [
+      (True, '<B>Hello!</B> how are you?', ''), (False, '<P>', ''),
+      (True, '<I>I am fine.</I>', 'bingo!')])
+
+  def VerifyChunkingReplaceables(self, fold_whitespace):
+    # Check that replaceables within block tags (where attributes would go) are
+    # handled correctly.
+    p = tr_html.HtmlChunks()
+    chunks = p.Parse('<b>Hello!</b> how are you?<p [BINGO] [$~BONGO~$]>'
+                     '<i>I am fine.</i>', fold_whitespace)
+    self.failUnlessEqual(chunks, [
+      (True, '<b>Hello!</b> how are you?', ''),
+      (False, '<p [BINGO] [$~BONGO~$]>', ''),
+      (True, '<i>I am fine.</i>', '')])
+
+  def VerifyChunkingLineBreaks(self, fold_whitespace):
+    # Check that the contents of preformatted tags preserve line breaks.
+    p = tr_html.HtmlChunks()
+    chunks = p.Parse('<textarea>Hello\nthere\nhow\nare\nyou?</textarea>',
+                     fold_whitespace)
+    self.failUnlessEqual(chunks, [(False, '<textarea>', ''),
+      (True, 'Hello\nthere\nhow\nare\nyou?', ''), (False, '</textarea>', '')])
+
+    # ...and that other tags' line breaks are converted to spaces
+    chunks = p.Parse('<p>Hello\nthere\nhow\nare\nyou?</p>', fold_whitespace)
+    self.failUnlessEqual(chunks, [(False, '<p>', ''),
+      (True, 'Hello there how are you?', ''), (False, '</p>', '')])
+
+  def VerifyChunkingMessageBreak(self, fold_whitespace):
+    p = tr_html.HtmlChunks()
+    # Make sure that message-break comments work properly.
+    chunks = p.Parse('Break<!-- message-break --> apart '
+                     '<!--message-break-->messages', fold_whitespace)
+    self.failUnlessEqual(chunks, [(True, 'Break', ''),
+                                  (False, ' ', ''),
+                                  (True, 'apart', ''),
+                                  (False, ' ', ''),
+                                  (True, 'messages', '')])
+
+    # Make sure message-break comments work in an inline tag.
+    chunks = p.Parse('<a href=\'google.com\'><!-- message-break -->Google'
+                     '<!--message-break--></a>', fold_whitespace)
+    self.failUnlessEqual(chunks, [(False, '<a href=\'google.com\'>', ''),
+                                  (True, 'Google', ''),
+                                  (False, '</a>', '')])
+
+  def VerifyChunkingMessageNoBreak(self, fold_whitespace):
+    p = tr_html.HtmlChunks()
+    # Make sure that message-no-break comments work properly.
+    chunks = p.Parse('Please <!-- message-no-break --> <br />don\'t break',
+                     fold_whitespace)
+    self.failUnlessEqual(chunks, [(True, 'Please <!-- message-no-break --> '
+                         '<br />don\'t break', '')])
+
+    chunks = p.Parse('Please <br /> break. <!-- message-no-break --> <br /> '
+                     'But not this time.', fold_whitespace)
+    self.failUnlessEqual(chunks, [(True, 'Please', ''),
+                                  (False, ' <br /> ', ''),
+                                  (True, 'break. <!-- message-no-break --> '
+                                         '<br /> But not this time.', '')])
+
+  def testTranslateableAttributes(self):
+    p = tr_html.HtmlChunks()
+
+    # Check that the translateable attributes in <img>, <submit>, <button> and
+    # <text> elements buttons are handled correctly.
+    chunks = p.Parse('<img src=bingo.jpg alt="hello there">'
+                     '<input type=submit value="hello">'
+                     '<input type="button" value="hello">'
+                     '<input type=\'text\' value=\'Howdie\'>', False)
+    self.failUnlessEqual(chunks, [
+      (False, '<img src=bingo.jpg alt="', ''), (True, 'hello there', ''),
+      (False, '"><input type=submit value="', ''), (True, 'hello', ''),
+      (False, '"><input type="button" value="', ''), (True, 'hello', ''),
+      (False, '"><input type=\'text\' value=\'', ''), (True, 'Howdie', ''),
+      (False, '\'>', '')])
+
+
+  def testTranslateableHtmlToMessage(self):
+    msg = tr_html.HtmlToMessage(
+      'Hello <b>[USERNAME]</b>, &lt;how&gt;&nbsp;<i>are</i> you?')
+    pres = msg.GetPresentableContent()
+    self.failUnless(pres ==
+                    'Hello BEGIN_BOLDX_USERNAME_XEND_BOLD, '
+                    '<how>&nbsp;BEGIN_ITALICareEND_ITALIC you?')
+
+    msg = tr_html.HtmlToMessage('<b>Hello</b><I>Hello</I><b>Hello</b>')
+    pres = msg.GetPresentableContent()
+    self.failUnless(pres ==
+                    'BEGIN_BOLD_1HelloEND_BOLD_1BEGIN_ITALICHelloEND_ITALIC'
+                    'BEGIN_BOLD_2HelloEND_BOLD_2')
+
+    # Check that nesting (of the <font> tags) is handled correctly - i.e. that
+    # the closing placeholder numbers match the opening placeholders.
+    msg = tr_html.HtmlToMessage(
+      '''<font size=-1><font color=#FF0000>Update!</font> '''
+      '''<a href='http://desktop.google.com/whatsnew.html?hl=[$~LANG~$]'>'''
+      '''New Features</a>: Now search PDFs, MP3s, Firefox web history, and '''
+      '''more</font>''')
+    pres = msg.GetPresentableContent()
+    self.failUnless(pres ==
+                    'BEGIN_FONT_1BEGIN_FONT_2Update!END_FONT_2 BEGIN_LINK'
+                    'New FeaturesEND_LINK: Now search PDFs, MP3s, Firefox '
+                    'web history, and moreEND_FONT_1')
+
+    msg = tr_html.HtmlToMessage('''<a href='[$~URL~$]'><b>[NUM][CAT]</b></a>''')
+    pres = msg.GetPresentableContent()
+    self.failUnless(pres == 'BEGIN_LINKBEGIN_BOLDX_NUM_XX_CAT_XEND_BOLDEND_LINK')
+
+    msg = tr_html.HtmlToMessage(
+      '''<font size=-1><a class=q onClick='return window.qs?qs(this):1' '''
+      '''href='http://[WEBSERVER][SEARCH_URI]'>Desktop</a></font>&nbsp;&nbsp;'''
+      '''&nbsp;&nbsp;''')
+    pres = msg.GetPresentableContent()
+    self.failUnless(pres ==
+                    '''BEGIN_FONTBEGIN_LINKDesktopEND_LINKEND_FONTSPACE''')
+
+    msg = tr_html.HtmlToMessage(
+      '''<br><br><center><font size=-2>&copy;2005 Google </font></center>''', 1)
+    pres = msg.GetPresentableContent()
+    self.failUnless(pres ==
+                    u'BEGIN_BREAK_1BEGIN_BREAK_2BEGIN_CENTERBEGIN_FONT\xa92005'
+                    u' Google END_FONTEND_CENTER')
+
+    msg = tr_html.HtmlToMessage(
+      '''&nbsp;-&nbsp;<a class=c href=[$~CACHE~$]>Cached</a>''')
+    pres = msg.GetPresentableContent()
+    self.failUnless(pres ==
+                    '&nbsp;-&nbsp;BEGIN_LINKCachedEND_LINK')
+
+    # Check that upper-case tags are handled correctly.
+    msg = tr_html.HtmlToMessage(
+      '''You can read the <A HREF='http://desktop.google.com/privacypolicy.'''
+      '''html?hl=[LANG_CODE]'>Privacy Policy</A> and <A HREF='http://desktop'''
+      '''.google.com/privacyfaq.html?hl=[LANG_CODE]'>Privacy FAQ</A> online.''')
+    pres = msg.GetPresentableContent()
+    self.failUnless(pres ==
+                    'You can read the BEGIN_LINK_1Privacy PolicyEND_LINK_1 and '
+                    'BEGIN_LINK_2Privacy FAQEND_LINK_2 online.')
+
+    # Check that tags with linebreaks immediately preceding them are handled
+    # correctly.
+    msg = tr_html.HtmlToMessage(
+      '''You can read the
+<A HREF='http://desktop.google.com/privacypolicy.html?hl=[LANG_CODE]'>Privacy Policy</A>
+and <A HREF='http://desktop.google.com/privacyfaq.html?hl=[LANG_CODE]'>Privacy FAQ</A> online.''')
+    pres = msg.GetPresentableContent()
+    self.failUnless(pres == '''You can read the
+BEGIN_LINK_1Privacy PolicyEND_LINK_1
+and BEGIN_LINK_2Privacy FAQEND_LINK_2 online.''')
+
+    # Check that message-no-break comments are handled correctly.
+    msg = tr_html.HtmlToMessage('''Please <!-- message-no-break --><br /> don't break''')
+    pres = msg.GetPresentableContent()
+    self.failUnlessEqual(pres, '''Please BREAK don't break''')
+
+class TrHtmlUnittest(unittest.TestCase):
+  def testSetAttributes(self):
+    html = tr_html.TrHtml(StringIO(''))
+    self.failUnlessEqual(html.fold_whitespace_, False)
+    html.SetAttributes({})
+    self.failUnlessEqual(html.fold_whitespace_, False)
+    html.SetAttributes({'fold_whitespace': 'false'})
+    self.failUnlessEqual(html.fold_whitespace_, False)
+    html.SetAttributes({'fold_whitespace': 'true'})
+    self.failUnlessEqual(html.fold_whitespace_, True)
+
+  def testFoldWhitespace(self):
+    text = '<td>   Test     Message   </td>'
+
+    html = tr_html.TrHtml(StringIO(text))
+    html.Parse()
+    self.failUnlessEqual(html.skeleton_[1].GetMessage().GetPresentableContent(),
+                         'Test  Message')
+
+    html = tr_html.TrHtml(StringIO(text))
+    html.fold_whitespace_ = True
+    html.Parse()
+    self.failUnlessEqual(html.skeleton_[1].GetMessage().GetPresentableContent(),
+                         'Test Message')
+
+  def testTable(self):
+    html = tr_html.TrHtml(StringIO('''<table class="shaded-header"><tr>
+<td class="header-element b expand">Preferences</td>
+<td class="header-element s">
+<a href="http://desktop.google.com/preferences.html">Preferences&nbsp;Help</a>
+</td>
+</tr></table>'''))
+    html.Parse()
+    self.failUnless(html.skeleton_[3].GetMessage().GetPresentableContent() ==
+                    'BEGIN_LINKPreferences&nbsp;HelpEND_LINK')
+
+  def testSubmitAttribute(self):
+    html = tr_html.TrHtml(StringIO('''</td>
+<td class="header-element"><input type=submit value="Save Preferences"
+name=submit2></td>
+</tr></table>'''))
+    html.Parse()
+    self.failUnless(html.skeleton_[1].GetMessage().GetPresentableContent() ==
+                    'Save Preferences')
+
+  def testWhitespaceAfterInlineTag(self):
+    '''Test that even if there is whitespace after an inline tag at the start
+    of a translateable section the inline tag will be included.
+    '''
+    html = tr_html.TrHtml(
+        StringIO('''<label for=DISPLAYNONE><font size=-1> Hello</font>'''))
+    html.Parse()
+    self.failUnless(html.skeleton_[1].GetMessage().GetRealContent() ==
+                    '<font size=-1> Hello</font>')
+
+  def testSillyHeader(self):
+    html = tr_html.TrHtml(StringIO('''[!]
+title\tHello
+bingo
+bongo
+bla
+
+<p>Other stuff</p>'''))
+    html.Parse()
+    content = html.skeleton_[1].GetMessage().GetRealContent()
+    self.failUnless(content == 'Hello')
+    self.failUnless(html.skeleton_[-1] == '</p>')
+    # Right after the translateable the nontranslateable should start with
+    # a linebreak (this catches a bug we had).
+    self.failUnless(html.skeleton_[2][0] == '\n')
+
+
+  def testExplicitDescriptions(self):
+    html = tr_html.TrHtml(
+        StringIO('Hello [USER]<br/><!-- desc=explicit -->'
+                          '<input type="button">Go!</input>'))
+    html.Parse()
+    msg = html.GetCliques()[1].GetMessage()
+    self.failUnlessEqual(msg.GetDescription(), 'explicit')
+    self.failUnlessEqual(msg.GetRealContent(), 'Go!')
+
+    html = tr_html.TrHtml(
+        StringIO('Hello [USER]<br/><!-- desc=explicit\nmultiline -->'
+                          '<input type="button">Go!</input>'))
+    html.Parse()
+    msg = html.GetCliques()[1].GetMessage()
+    self.failUnlessEqual(msg.GetDescription(), 'explicit multiline')
+    self.failUnlessEqual(msg.GetRealContent(), 'Go!')
+
+
+  def testRegressionInToolbarAbout(self):
+    html = tr_html.TrHtml(util.PathFromRoot(r'grit/testdata/toolbar_about.html'))
+    html.Parse()
+    cliques = html.GetCliques()
+    for cl in cliques:
+      content = cl.GetMessage().GetRealContent()
+      if content.count('De parvis grandis acervus erit'):
+        self.failIf(content.count('$/translate'))
+
+
+  def HtmlFromFileWithManualCheck(self, f):
+    html = tr_html.TrHtml(f)
+    html.Parse()
+
+    # For manual results inspection only...
+    list = []
+    for item in html.skeleton_:
+      if isinstance(item, six.string_types):
+        list.append(item)
+      else:
+        list.append(item.GetMessage().GetPresentableContent())
+
+    return html
+
+
+  def testPrivacyHtml(self):
+    html = self.HtmlFromFileWithManualCheck(
+      util.PathFromRoot(r'grit/testdata/privacy.html'))
+
+    self.failUnless(html.skeleton_[1].GetMessage().GetRealContent() ==
+                    'Privacy and Google Desktop Search')
+    self.failUnless(html.skeleton_[3].startswith('<'))
+    self.failUnless(len(html.skeleton_) > 10)
+
+
+  def testPreferencesHtml(self):
+    html = self.HtmlFromFileWithManualCheck(
+      util.PathFromRoot(r'grit/testdata/preferences.html'))
+
+    # Verify that we don't get '[STATUS-MESSAGE]' as the original content of
+    # one of the MessageClique objects (it would be a placeholder-only message
+    # and we're supposed to have stripped those).
+
+    for item in [x for x in html.skeleton_
+                 if isinstance(x, clique.MessageClique)]:
+      if (item.GetMessage().GetRealContent() == '[STATUS-MESSAGE]' or
+          item.GetMessage().GetRealContent() == '[ADDIN-DO] [ADDIN-OPTIONS]'):
+        self.fail()
+
+    self.failUnless(len(html.skeleton_) > 100)
+
+  def AssertNumberOfTranslateables(self, files, num):
+    '''Fails if any of the files in files don't have exactly
+    num translateable sections.
+
+    Args:
+      files: ['file1', 'file2']
+      num: 3
+    '''
+    for f in files:
+      f = util.PathFromRoot(r'grit/testdata/%s' % f)
+      html = self.HtmlFromFileWithManualCheck(f)
+      self.failUnless(len(html.GetCliques()) == num)
+
+  def testFewTranslateables(self):
+    self.AssertNumberOfTranslateables(['browser.html', 'email_thread.html',
+                                       'header.html', 'mini.html',
+                                       'oneclick.html', 'script.html',
+                                       'time_related.html', 'versions.html'], 0)
+    self.AssertNumberOfTranslateables(['footer.html', 'hover.html'], 1)
+
+  def testOtherHtmlFilesForManualInspection(self):
+    files = [
+      'about.html', 'bad_browser.html', 'cache_prefix.html',
+      'cache_prefix_file.html', 'chat_result.html', 'del_footer.html',
+      'del_header.html', 'deleted.html', 'details.html', 'email_result.html',
+      'error.html', 'explicit_web.html', 'footer.html',
+      'homepage.html', 'indexing_speed.html',
+      'install_prefs.html', 'install_prefs2.html',
+      'oem_enable.html', 'oem_non_admin.html', 'onebox.html',
+      'password.html', 'quit_apps.html', 'recrawl.html',
+      'searchbox.html', 'sidebar_h.html', 'sidebar_v.html', 'status.html',
+    ]
+    for f in files:
+      self.HtmlFromFileWithManualCheck(
+        util.PathFromRoot(r'grit/testdata/%s' % f))
+
+  def testTranslate(self):
+    # Note that the English translation of documents that use character
+    # literals (e.g. &copy;) will not be the same as the original document
+    # because the character literal will be transformed into the Unicode
+    # character itself.  So for this test we choose some relatively complex
+    # HTML without character entities (but with &nbsp; because that's handled
+    # specially).
+    html = tr_html.TrHtml(StringIO('''  <script>
+      <!--
+      function checkOffice() { var w = document.getElementById("h7");
+      var e = document.getElementById("h8"); var o = document.getElementById("h10");
+      if (!(w.checked || e.checked)) { o.checked=0;o.disabled=1;} else {o.disabled=0;} }
+      // -->
+        </script>
+        <input type=checkbox [CHECK-DOC] name=DOC id=h7 onclick='checkOffice()'>
+        <label for=h7> Word</label><br>
+        <input type=checkbox [CHECK-XLS] name=XLS id=h8 onclick='checkOffice()'>
+        <label for=h8> Excel</label><br>
+        <input type=checkbox [CHECK-PPT] name=PPT id=h9>
+        <label for=h9> PowerPoint</label><br>
+        </span></td><td nowrap valign=top><span class="s">
+        <input type=checkbox [CHECK-PDF] name=PDF id=hpdf>
+        <label for=hpdf> PDF</label><br>
+        <input type=checkbox [CHECK-TXT] name=TXT id=h6>
+        <label for=h6> Text, media, and other files</label><br>
+       </tr>&nbsp;&nbsp;
+       <tr><td nowrap valign=top colspan=3><span class="s"><br />
+       <input type=checkbox [CHECK-SECUREOFFICE] name=SECUREOFFICE id=h10>
+        <label for=h10> Password-protected Office documents (Word, Excel)</label><br />
+        <input type=checkbox [DISABLED-HTTPS] [CHECK-HTTPS] name=HTTPS id=h12><label
+        for=h12> Secure pages (HTTPS) in web history</label></span></td></tr>
+      </table>'''))
+    html.Parse()
+    trans = html.Translate('en')
+    if (html.GetText() != trans):
+      self.fail()
+
+
+  def testHtmlToMessageWithBlockTags(self):
+    msg = tr_html.HtmlToMessage(
+      'Hello<p>Howdie<img alt="bingo" src="image.gif">', True)
+    result = msg.GetPresentableContent()
+    self.failUnless(
+      result == 'HelloBEGIN_PARAGRAPHHowdieBEGIN_BLOCKbingoEND_BLOCK')
+
+    msg = tr_html.HtmlToMessage(
+      'Hello<p>Howdie<input type="button" value="bingo">', True)
+    result = msg.GetPresentableContent()
+    self.failUnless(
+      result == 'HelloBEGIN_PARAGRAPHHowdieBEGIN_BLOCKbingoEND_BLOCK')
+
+
+  def testHtmlToMessageRegressions(self):
+    msg = tr_html.HtmlToMessage(' - ', True)
+    result = msg.GetPresentableContent()
+    self.failUnless(result == ' - ')
+
+
+  def testEscapeUnescaped(self):
+    text = '&copy;&nbsp; & &quot;&lt;hello&gt;&quot;'
+    unescaped = util.UnescapeHtml(text)
+    self.failUnless(unescaped == u'\u00a9\u00a0 & "<hello>"')
+    escaped_unescaped = util.EscapeHtml(unescaped, True)
+    self.failUnless(escaped_unescaped ==
+                    u'\u00a9\u00a0 &amp; &quot;&lt;hello&gt;&quot;')
+
+  def testRegressionCjkHtmlFile(self):
+    # TODO(joi) Fix this problem where unquoted attributes that
+    # have a value that is CJK characters causes the regular expression
+    # match never to return.  (culprit is the _ELEMENT regexp(
+    if False:
+      html = self.HtmlFromFileWithManualCheck(util.PathFromRoot(
+        r'grit/testdata/ko_oem_enable_bug.html'))
+      self.failUnless(True)
+
+  def testRegressionCpuHang(self):
+    # If this regression occurs, the unit test will never return
+    html = tr_html.TrHtml(StringIO(
+      '''<input type=text size=12 id=advFileTypeEntry [~SHOW-FILETYPE-BOX~] value="[EXT]" name=ext>'''))
+    html.Parse()
+
+if __name__ == '__main__':
+  unittest.main()
diff --git a/tools/grit/grit/gather/txt.py b/tools/grit/grit/gather/txt.py
new file mode 100644
index 0000000000..e5c10abc28
--- /dev/null
+++ b/tools/grit/grit/gather/txt.py
@@ -0,0 +1,38 @@
+# Copyright (c) 2012 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.
+
+'''Supports making amessage from a text file.
+'''
+
+from __future__ import print_function
+
+from grit.gather import interface
+from grit import tclib
+
+
+class TxtFile(interface.GathererBase):
+  '''A text file gatherer.  Very simple, all text from the file becomes a
+  single clique.
+  '''
+
+  def Parse(self):
+    self.text_ = self._LoadInputFile()
+    self.clique_ = self.uberclique.MakeClique(tclib.Message(text=self.text_))
+
+  def GetText(self):
+    '''Returns the text of what is being gathered.'''
+    return self.text_
+
+  def GetTextualIds(self):
+    return [self.extkey]
+
+  def GetCliques(self):
+    '''Returns the MessageClique objects for all translateable portions.'''
+    return [self.clique_]
+
+  def Translate(self, lang, pseudo_if_not_available=True,
+                skeleton_gatherer=None, fallback_to_english=False):
+    return self.clique_.MessageForLanguage(lang,
+                                           pseudo_if_not_available,
+                                           fallback_to_english).GetRealContent()
diff --git a/tools/grit/grit/gather/txt_unittest.py b/tools/grit/grit/gather/txt_unittest.py
new file mode 100644
index 0000000000..abb9ed98d7
--- /dev/null
+++ b/tools/grit/grit/gather/txt_unittest.py
@@ -0,0 +1,35 @@
+#!/usr/bin/env python
+# Copyright (c) 2012 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.
+
+'''Unit tests for TxtFile gatherer'''
+
+from __future__ import print_function
+
+import os
+import sys
+if __name__ == '__main__':
+  sys.path.append(os.path.join(os.path.dirname(__file__), '../..'))
+
+
+import unittest
+
+from six import StringIO
+
+from grit.gather import txt
+
+
+class TxtUnittest(unittest.TestCase):
+  def testGather(self):
+    input = StringIO('Hello there\nHow are you?')
+    gatherer = txt.TxtFile(input)
+    gatherer.Parse()
+    self.failUnless(gatherer.GetText() == input.getvalue())
+    self.failUnless(len(gatherer.GetCliques()) == 1)
+    self.failUnless(gatherer.GetCliques()[0].GetMessage().GetRealContent() ==
+                    input.getvalue())
+
+
+if __name__ == '__main__':
+  unittest.main()
diff --git a/tools/grit/grit/grd_reader.py b/tools/grit/grit/grd_reader.py
new file mode 100644
index 0000000000..b7bb782977
--- /dev/null
+++ b/tools/grit/grit/grd_reader.py
@@ -0,0 +1,238 @@
+#!/usr/bin/env python
+# Copyright (c) 2012 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.
+
+'''Class for reading GRD files into memory, without processing them.
+'''
+
+from __future__ import print_function
+
+import os.path
+import sys
+import xml.sax
+import xml.sax.handler
+
+import six
+
+from grit import exception
+from grit import util
+from grit.node import mapping
+from grit.node import misc
+
+
+class StopParsingException(Exception):
+  '''An exception used to stop parsing.'''
+  pass
+
+
+class GrdContentHandler(xml.sax.handler.ContentHandler):
+  def __init__(self, stop_after, debug, dir, defines, tags_to_ignore,
+               target_platform, source):
+    # Invariant of data:
+    # 'root' is the root of the parse tree being created, or None if we haven't
+    # parsed out any elements.
+    # 'stack' is the a stack of elements that we push new nodes onto and
+    # pop from when they finish parsing, or [] if we are not currently parsing.
+    # 'stack[-1]' is the top of the stack.
+    self.root = None
+    self.stack = []
+    self.stop_after = stop_after
+    self.debug = debug
+    self.dir = dir
+    self.defines = defines
+    self.tags_to_ignore = tags_to_ignore or set()
+    self.ignore_depth = 0
+    self.target_platform = target_platform
+    self.source = source
+
+  def startElement(self, name, attrs):
+    if self.ignore_depth or name in self.tags_to_ignore:
+      if self.debug and self.ignore_depth == 0:
+        print("Ignoring element %s and its children" % name)
+      self.ignore_depth += 1
+      return
+
+    if self.debug:
+      attr_list = ' '.join('%s="%s"' % kv for kv in attrs.items())
+      print("Starting parsing of element %s with attributes %r" %
+            (name, attr_list or '(none)'))
+
+    typeattr = attrs.get('type')
+    node = mapping.ElementToClass(name, typeattr)()
+    node.source = self.source
+
+    if self.stack:
+      self.stack[-1].AddChild(node)
+      node.StartParsing(name, self.stack[-1])
+    else:
+      assert self.root is None
+      self.root = node
+      if isinstance(self.root, misc.GritNode):
+        if self.target_platform:
+          self.root.SetTargetPlatform(self.target_platform)
+      node.StartParsing(name, None)
+      if self.defines:
+        node.SetDefines(self.defines)
+    self.stack.append(node)
+
+    for attr, attrval in attrs.items():
+      node.HandleAttribute(attr, attrval)
+
+  def endElement(self, name):
+    if self.ignore_depth:
+      self.ignore_depth -= 1
+      return
+
+    if name == 'part':
+      partnode = self.stack[-1]
+      partnode.started_inclusion = True
+      # Add the contents of the sub-grd file as children of the <part> node.
+      partname = os.path.join(self.dir, partnode.GetInputPath())
+      # Check the GRDP file exists.
+      if not os.path.exists(partname):
+        raise exception.FileNotFound(partname)
+      # Exceptions propagate to the handler in grd_reader.Parse().
+      oldsource = self.source
+      try:
+        self.source = partname
+        xml.sax.parse(partname, GrdPartContentHandler(self))
+      finally:
+        self.source = oldsource
+
+    if self.debug:
+      print("End parsing of element %s" % name)
+    self.stack.pop().EndParsing()
+
+    if name == self.stop_after:
+      raise StopParsingException()
+
+  def characters(self, content):
+    if self.ignore_depth == 0:
+      if self.stack[-1]:
+        self.stack[-1].AppendContent(content)
+
+  def ignorableWhitespace(self, whitespace):
+    # TODO(joi): This is not supported by expat. Should use a different XML
+    # parser?
+    pass
+
+
+class GrdPartContentHandler(xml.sax.handler.ContentHandler):
+  def __init__(self, parent):
+    self.parent = parent
+    self.depth = 0
+
+  def startElement(self, name, attrs):
+    if self.depth:
+      self.parent.startElement(name, attrs)
+    else:
+      if name != 'grit-part':
+        raise exception.MissingElement("root tag must be <grit-part>")
+      if attrs:
+        raise exception.UnexpectedAttribute(
+            "<grit-part> tag must not have attributes")
+    self.depth += 1
+
+  def endElement(self, name):
+    self.depth -= 1
+    if self.depth:
+      self.parent.endElement(name)
+
+  def characters(self, content):
+    self.parent.characters(content)
+
+  def ignorableWhitespace(self, whitespace):
+    self.parent.ignorableWhitespace(whitespace)
+
+
+def Parse(filename_or_stream, dir=None, stop_after=None, first_ids_file=None,
+          debug=False, defines=None, tags_to_ignore=None, target_platform=None,
+          predetermined_ids_file=None):
+  '''Parses a GRD file into a tree of nodes (from grit.node).
+
+  If filename_or_stream is a stream, 'dir' should point to the directory
+  notionally containing the stream (this feature is only used in unit tests).
+
+  If 'stop_after' is provided, the parsing will stop once the first node
+  with this name has been fully parsed (including all its contents).
+
+  If 'debug' is true, lots of information about the parsing events will be
+  printed out during parsing of the file.
+
+  If 'first_ids_file' is non-empty, it is used to override the setting for the
+  first_ids_file attribute of the <grit> root node. Note that the first_ids_file
+  parameter should be relative to the cwd, even though the first_ids_file
+  attribute of the <grit> node is relative to the grd file.
+
+  If 'target_platform' is set, this is used to determine the target
+  platform of builds, instead of using |sys.platform|.
+
+  Args:
+    filename_or_stream: './bla.xml'
+    dir: None (if filename_or_stream is a filename) or '.'
+    stop_after: 'inputs'
+    first_ids_file: 'GRIT_DIR/../gritsettings/resource_ids'
+    debug: False
+    defines: dictionary of defines, like {'chromeos': '1'}
+    target_platform: None or the value that would be returned by sys.platform
+        on your target platform.
+    predetermined_ids_file: File path to a file containing a pre-determined
+        mapping from resource names to resource ids which will be used to assign
+        resource ids to those resources.
+
+  Return:
+    Subclass of grit.node.base.Node
+
+  Throws:
+    grit.exception.Parsing
+  '''
+
+  if isinstance(filename_or_stream, six.string_types):
+    source = filename_or_stream
+    if dir is None:
+      dir = util.dirname(filename_or_stream)
+  else:
+    source = None
+
+  handler = GrdContentHandler(stop_after=stop_after, debug=debug, dir=dir,
+                              defines=defines, tags_to_ignore=tags_to_ignore,
+                              target_platform=target_platform, source=source)
+  try:
+    xml.sax.parse(filename_or_stream, handler)
+  except StopParsingException:
+    assert stop_after
+    pass
+  except:
+    if not debug:
+      print("parse exception: run GRIT with the -x flag to debug .grd problems")
+    raise
+
+  if handler.root.name != 'grit':
+    raise exception.MissingElement("root tag must be <grit>")
+
+  if hasattr(handler.root, 'SetOwnDir'):
+    # Fix up the base_dir so it is relative to the input file.
+    assert dir is not None
+    handler.root.SetOwnDir(dir)
+
+  if isinstance(handler.root, misc.GritNode):
+    handler.root.SetPredeterminedIdsFile(predetermined_ids_file)
+    if first_ids_file:
+      # Make the path to the first_ids_file relative to the grd file,
+      # unless it begins with GRIT_DIR.
+      GRIT_DIR_PREFIX = 'GRIT_DIR'
+      if not (first_ids_file.startswith(GRIT_DIR_PREFIX)
+          and first_ids_file[len(GRIT_DIR_PREFIX)] in ['/', '\\']):
+        rel_dir = os.path.relpath(os.getcwd(), dir)
+        first_ids_file = util.normpath(os.path.join(rel_dir, first_ids_file))
+      handler.root.attrs['first_ids_file'] = first_ids_file
+    # Assign first ids to the nodes that don't have them.
+    handler.root.AssignFirstIds(filename_or_stream, defines)
+
+  return handler.root
+
+
+if __name__ == '__main__':
+  util.ChangeStdoutEncoding()
+  print(six.text_type(Parse(sys.argv[1])))
diff --git a/tools/grit/grit/grd_reader_unittest.py b/tools/grit/grit/grd_reader_unittest.py
new file mode 100644
index 0000000000..920a92f9c0
--- /dev/null
+++ b/tools/grit/grit/grd_reader_unittest.py
@@ -0,0 +1,346 @@
+#!/usr/bin/env python
+# Copyright (c) 2012 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.
+
+'''Unit tests for grd_reader package'''
+
+from __future__ import print_function
+
+import os
+import sys
+if __name__ == '__main__':
+  sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
+
+import unittest
+
+import six
+from six import StringIO
+
+from grit import exception
+from grit import grd_reader
+from grit import util
+from grit.node import empty
+from grit.node import message
+
+
+class GrdReaderUnittest(unittest.TestCase):
+  def testParsingAndXmlOutput(self):
+    input = u'''<?xml version="1.0" encoding="UTF-8"?>
+<grit base_dir="." current_release="3" latest_public_release="2" source_lang_id="en-US">
+  <release seq="3">
+    <includes>
+      <include file="images/logo.gif" name="ID_LOGO" type="gif" />
+    </includes>
+    <messages>
+      <if expr="True">
+        <message desc="Printed to greet the currently logged in user" name="IDS_GREETING">
+          Hello <ph name="USERNAME">%s<ex>Joi</ex></ph>, how are you doing today?
+        </message>
+      </if>
+    </messages>
+    <structures>
+      <structure file="rc_files/dialogs.rc" name="IDD_NARROW_DIALOG" type="dialog">
+        <skeleton expr="lang == 'fr-FR'" file="bla.rc" variant_of_revision="3" />
+      </structure>
+      <structure file="rc_files/version.rc" name="VS_VERSION_INFO" type="version" />
+    </structures>
+  </release>
+  <translations>
+    <file lang="nl" path="nl_translations.xtb" />
+  </translations>
+  <outputs>
+    <output filename="resource.h" type="rc_header" />
+    <output filename="resource.rc" lang="en-US" type="rc_all" />
+  </outputs>
+</grit>'''
+    pseudo_file = StringIO(input)
+    tree = grd_reader.Parse(pseudo_file, '.')
+    output = six.text_type(tree)
+    expected_output = input.replace(u' base_dir="."', u'')
+    self.assertEqual(expected_output, output)
+    self.failUnless(tree.GetNodeById('IDS_GREETING'))
+
+
+  def testStopAfter(self):
+    input = u'''<?xml version="1.0" encoding="UTF-8"?>
+<grit latest_public_release="2" source_lang_id="en-US" current_release="3" base_dir=".">
+  <outputs>
+    <output filename="resource.h" type="rc_header" />
+    <output filename="resource.rc" lang="en-US" type="rc_all" />
+  </outputs>
+  <release seq="3">
+    <includes>
+      <include type="gif" name="ID_LOGO" file="images/logo.gif"/>
+    </includes>
+  </release>
+</grit>'''
+    pseudo_file = StringIO(input)
+    tree = grd_reader.Parse(pseudo_file, '.', stop_after='outputs')
+    # only an <outputs> child
+    self.failUnless(len(tree.children) == 1)
+    self.failUnless(tree.children[0].name == 'outputs')
+
+  def testLongLinesWithComments(self):
+    input = u'''<?xml version="1.0" encoding="UTF-8"?>
+<grit latest_public_release="2" source_lang_id="en-US" current_release="3" base_dir=".">
+  <release seq="3">
+    <messages>
+      <message name="IDS_GREETING" desc="Printed to greet the currently logged in user">
+        This is a very long line with no linebreaks yes yes it stretches on <!--
+        -->and on <!--
+        -->and on!
+      </message>
+    </messages>
+  </release>
+</grit>'''
+    pseudo_file = StringIO(input)
+    tree = grd_reader.Parse(pseudo_file, '.')
+
+    greeting = tree.GetNodeById('IDS_GREETING')
+    self.failUnless(greeting.GetCliques()[0].GetMessage().GetRealContent() ==
+                    'This is a very long line with no linebreaks yes yes it '
+                    'stretches on and on and on!')
+
+  def doTestAssignFirstIds(self, first_ids_path):
+    input = u'''<?xml version="1.0" encoding="UTF-8"?>
+<grit latest_public_release="2" source_lang_id="en-US" current_release="3"
+      base_dir="." first_ids_file="%s">
+  <release seq="3">
+    <messages>
+      <message name="IDS_TEST" desc="test">
+        test
+      </message>
+    </messages>
+  </release>
+</grit>''' % first_ids_path
+    pseudo_file = StringIO(input)
+    grit_root_dir = os.path.join(os.path.abspath(os.path.dirname(__file__)),
+                                 '..')
+    fake_input_path = os.path.join(
+        grit_root_dir, "grit/testdata/chrome/app/generated_resources.grd")
+    root = grd_reader.Parse(pseudo_file, os.path.split(fake_input_path)[0])
+    root.AssignFirstIds(fake_input_path, {})
+    messages_node = root.children[0].children[0]
+    self.failUnless(isinstance(messages_node, empty.MessagesNode))
+    self.failUnless(messages_node.attrs["first_id"] !=
+        empty.MessagesNode().DefaultAttributes()["first_id"])
+
+  def testAssignFirstIds(self):
+    self.doTestAssignFirstIds("../../tools/grit/resource_ids")
+
+  def testAssignFirstIdsUseGritDir(self):
+    self.doTestAssignFirstIds("GRIT_DIR/grit/testdata/tools/grit/resource_ids")
+
+  def testAssignFirstIdsMultipleMessages(self):
+    """If there are multiple messages sections, the resource_ids file
+    needs to list multiple first_id values."""
+    input = u'''<?xml version="1.0" encoding="UTF-8"?>
+<grit latest_public_release="2" source_lang_id="en-US" current_release="3"
+      base_dir="." first_ids_file="resource_ids">
+  <release seq="3">
+    <messages>
+      <message name="IDS_TEST" desc="test">
+        test
+      </message>
+    </messages>
+    <messages>
+      <message name="IDS_TEST2" desc="test">
+        test2
+      </message>
+    </messages>
+  </release>
+</grit>'''
+    pseudo_file = StringIO(input)
+    grit_root_dir = os.path.join(os.path.abspath(os.path.dirname(__file__)),
+                                 '..')
+    fake_input_path = os.path.join(grit_root_dir, "grit/testdata/test.grd")
+
+    root = grd_reader.Parse(pseudo_file, os.path.split(fake_input_path)[0])
+    root.AssignFirstIds(fake_input_path, {})
+    messages_node = root.children[0].children[0]
+    self.assertTrue(isinstance(messages_node, empty.MessagesNode))
+    self.assertEqual('100', messages_node.attrs["first_id"])
+    messages_node = root.children[0].children[1]
+    self.assertTrue(isinstance(messages_node, empty.MessagesNode))
+    self.assertEqual('10000', messages_node.attrs["first_id"])
+
+  def testUseNameForIdAndPpIfdef(self):
+    input = u'''<?xml version="1.0" encoding="UTF-8"?>
+<grit latest_public_release="2" source_lang_id="en-US" current_release="3" base_dir=".">
+  <release seq="3">
+    <messages>
+      <if expr="pp_ifdef('hello')">
+        <message name="IDS_HELLO" use_name_for_id="true">
+          Hello!
+        </message>
+      </if>
+    </messages>
+  </release>
+</grit>'''
+    pseudo_file = StringIO(input)
+    root = grd_reader.Parse(pseudo_file, '.', defines={'hello': '1'})
+
+    # Check if the ID is set to the name. In the past, there was a bug
+    # that caused the ID to be a generated number.
+    hello = root.GetNodeById('IDS_HELLO')
+    self.failUnless(hello.GetCliques()[0].GetId() == 'IDS_HELLO')
+
+  def testUseNameForIdWithIfElse(self):
+    input = u'''<?xml version="1.0" encoding="UTF-8"?>
+<grit latest_public_release="2" source_lang_id="en-US" current_release="3" base_dir=".">
+  <release seq="3">
+    <messages>
+      <if expr="pp_ifdef('hello')">
+        <then>
+          <message name="IDS_HELLO" use_name_for_id="true">
+            Hello!
+          </message>
+        </then>
+        <else>
+          <message name="IDS_HELLO" use_name_for_id="true">
+            Yellow!
+          </message>
+        </else>
+      </if>
+    </messages>
+  </release>
+</grit>'''
+    pseudo_file = StringIO(input)
+    root = grd_reader.Parse(pseudo_file, '.', defines={'hello': '1'})
+
+    # Check if the ID is set to the name. In the past, there was a bug
+    # that caused the ID to be a generated number.
+    hello = root.GetNodeById('IDS_HELLO')
+    self.failUnless(hello.GetCliques()[0].GetId() == 'IDS_HELLO')
+
+  def testPartInclusionAndCorrectSource(self):
+    arbitrary_path_grd = u'''\
+        <grit-part>
+          <message name="IDS_TEST5" desc="test5">test5</message>
+        </grit-part>'''
+    tmp_dir = util.TempDir({'arbitrary_path.grp': arbitrary_path_grd})
+    arbitrary_path_grd_file = tmp_dir.GetPath('arbitrary_path.grp')
+    top_grd = u'''\
+        <grit latest_public_release="2" current_release="3">
+          <release seq="3">
+            <messages>
+              <message name="IDS_TEST" desc="test">
+                test
+              </message>
+              <part file="sub.grp" />
+              <part file="%s" />
+            </messages>
+          </release>
+        </grit>''' % arbitrary_path_grd_file
+    sub_grd = u'''\
+        <grit-part>
+          <message name="IDS_TEST2" desc="test2">test2</message>
+          <part file="subsub.grp" />
+          <message name="IDS_TEST3" desc="test3">test3</message>
+        </grit-part>'''
+    subsub_grd = u'''\
+        <grit-part>
+          <message name="IDS_TEST4" desc="test4">test4</message>
+        </grit-part>'''
+    expected_output = u'''\
+        <grit current_release="3" latest_public_release="2">
+          <release seq="3">
+            <messages>
+              <message desc="test" name="IDS_TEST">
+                test
+              </message>
+              <part file="sub.grp">
+                <message desc="test2" name="IDS_TEST2">
+                  test2
+                </message>
+                <part file="subsub.grp">
+                  <message desc="test4" name="IDS_TEST4">
+                    test4
+                  </message>
+                </part>
+                <message desc="test3" name="IDS_TEST3">
+                  test3
+                </message>
+              </part>
+              <part file="%s">
+                <message desc="test5" name="IDS_TEST5">
+                  test5
+                </message>
+              </part>
+            </messages>
+          </release>
+        </grit>''' % arbitrary_path_grd_file
+
+    with util.TempDir({'sub.grp': sub_grd,
+                       'subsub.grp': subsub_grd}) as tmp_sub_dir:
+      output = grd_reader.Parse(StringIO(top_grd),
+                                tmp_sub_dir.GetPath())
+      correct_sources = {
+        'IDS_TEST': None,
+        'IDS_TEST2': tmp_sub_dir.GetPath('sub.grp'),
+        'IDS_TEST3': tmp_sub_dir.GetPath('sub.grp'),
+        'IDS_TEST4': tmp_sub_dir.GetPath('subsub.grp'),
+        'IDS_TEST5': arbitrary_path_grd_file,
+      }
+
+    for node in output.ActiveDescendants():
+      with node:
+        if isinstance(node, message.MessageNode):
+          self.assertEqual(correct_sources[node.attrs.get('name')], node.source)
+    self.assertEqual(expected_output.split(), output.FormatXml().split())
+    tmp_dir.CleanUp()
+
+  def testPartInclusionFailure(self):
+    template = u'''
+      <grit latest_public_release="2" current_release="3">
+        <outputs>
+          %s
+        </outputs>
+      </grit>'''
+
+    part_failures = [
+        (exception.UnexpectedContent, u'<part file="x">fnord</part>'),
+        (exception.UnexpectedChild,
+         u'<part file="x"><output filename="x" type="y" /></part>'),
+        (exception.FileNotFound, u'<part file="yet_created_x" />'),
+    ]
+    for raises, data in part_failures:
+      data = StringIO(template % data)
+      self.assertRaises(raises, grd_reader.Parse, data, '.')
+
+    gritpart_failures = [
+        (exception.UnexpectedAttribute, u'<grit-part file="xyz"></grit-part>'),
+        (exception.MissingElement, u'<output filename="x" type="y" />'),
+    ]
+    for raises, data in gritpart_failures:
+      top_grd = StringIO(template % u'<part file="bad.grp" />')
+      with util.TempDir({'bad.grp': data}) as temp_dir:
+        self.assertRaises(raises, grd_reader.Parse, top_grd, temp_dir.GetPath())
+
+  def testEarlyEnoughPlatformSpecification(self):
+    # This is a regression test for issue
+    # https://code.google.com/p/grit-i18n/issues/detail?id=23
+    grd_text = u'''<?xml version="1.0" encoding="UTF-8"?>
+      <grit latest_public_release="1" current_release="1">
+        <release seq="1">
+          <messages>
+            <if expr="not pp_ifdef('use_titlecase')">
+              <message name="IDS_XYZ">foo</message>
+            </if>
+            <!-- The assumption is that use_titlecase is never true for
+                 this platform. When the platform isn't set to 'android'
+                 early enough, we get a duplicate message name. -->
+            <if expr="os == '%s'">
+              <message name="IDS_XYZ">boo</message>
+            </if>
+          </messages>
+        </release>
+      </grit>''' % sys.platform
+    with util.TempDir({}) as temp_dir:
+      grd_reader.Parse(StringIO(grd_text), temp_dir.GetPath(),
+                       target_platform='android')
+
+
+if __name__ == '__main__':
+  unittest.main()
diff --git a/tools/grit/grit/grit-todo.xml b/tools/grit/grit/grit-todo.xml
new file mode 100644
index 0000000000..b8c20fdfad
--- /dev/null
+++ b/tools/grit/grit/grit-todo.xml
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="windows-1252"?>
+<TODOLIST FILEFORMAT="6" PROJECTNAME="GRIT" NEXTUNIQUEID="56" FILEVERSION="69" LASTMODIFIED="2005-08-19">
+    <TASK STARTDATESTRING="2005-04-08" PRIORITY="5" TIMEESPENTUNITS="H" LASTMOD="38453.49975694" TITLE="check 'name' attribute is unique" TIMEESTUNITS="H" ID="2" PERCENTDONE="100" STARTDATE="38450.00000000" DONEDATESTRING="2005-04-11" POS="22" DONEDATE="38453.00000000"/>
+    <TASK STARTDATESTRING="2005-04-08" PRIORITY="5" TIMEESPENTUNITS="H" LASTMOD="38488.48189815" TITLE="import id-calculating code" TIMEESTUNITS="H" ID="3" PERCENTDONE="100" STARTDATE="38450.00000000" DONEDATESTRING="2005-05-16" POS="13" DONEDATE="38488.00000000"/>
+    <TASK STARTDATESTRING="2005-05-16" PRIORITY="5" TIMEESPENTUNITS="H" LASTMOD="38488.48209491" TITLE="Import tool for existing translations" TIMEESTUNITS="H" ID="6" PERCENTDONE="100" STARTDATE="38488.00000000" DONEDATESTRING="2005-06-16" POS="12" DONEDATE="38519.00000000"/>
+    <TASK STARTDATESTRING="2005-05-16" PRIORITY="5" TIMEESPENTUNITS="H" LASTMOD="38511.00805556" TITLE="Export XMBs" TIMEESTUNITS="H" ID="8" PERCENTDONE="100" STARTDATE="38488.00000000" DONEDATESTRING="2005-06-08" POS="20" DONEDATE="38511.00000000"/>
+    <TASK STARTDATESTRING="2005-05-16" PRIORITY="5" TIMEESPENTUNITS="H" LASTMOD="38511.00924769" TITLE="Initial Integration" TIMEESTUNITS="H" ID="10" PERCENTDONE="100" STARTDATE="38488.00000000" DONEDATESTRING="2005-06-08" POS="10" DONEDATE="38511.00000000">
+        <TASK STARTDATESTRING="2005-05-16" PRIORITY="5" TIMEESPENTUNITS="H" LASTMOD="38496.54048611" TITLE="parser for %s strings" TIMEESTUNITS="H" ID="4" PERCENTDONE="100" STARTDATE="38488.00000000" DONEDATESTRING="2005-05-24" POS="2" DONEDATE="38496.00000000"/>
+        <TASK STARTDATESTRING="2005-05-16" PRIORITY="5" TIMEESPENTUNITS="H" LASTMOD="38497.00261574" TITLE="import tool for existing RC files" TIMEESTUNITS="H" ID="5" PERCENTDONE="100" STARTDATE="38488.00000000" DONEDATESTRING="2005-05-25" POS="4" DONEDATE="38497.00000000">
+            <TASK STARTDATESTRING="2005-05-24" PRIORITY="5" TIMEESPENTUNITS="H" LASTMOD="38496.92990741" TITLE="handle button value= and img alt= in message HTML text" TIMEESTUNITS="H" ID="22" PERCENTDONE="100" STARTDATE="38496.00000000" DONEDATESTRING="2005-05-24" POS="1" DONEDATE="38496.00000000"/>
+            <TASK STARTDATESTRING="2005-05-24" PRIORITY="5" TIMEESPENTUNITS="H" LASTMOD="38497.00258102" TITLE="&amp;nbsp; bug" TIMEESTUNITS="H" ID="23" PERCENTDONE="100" STARTDATE="38496.00000000" DONEDATESTRING="2005-05-25" POS="2" DONEDATE="38497.00000000"/>
+        </TASK>
+        <TASK STARTDATESTRING="2005-05-16" PRIORITY="5" TIMEESPENTUNITS="H" LASTMOD="38490.61171296" TITLE="grit build" TIMEESTUNITS="H" ID="7" PERCENTDONE="100" STARTDATE="38488.00000000" DONEDATESTRING="2005-05-18" POS="6" DONEDATE="38490.00000000">
+            <TASK STARTDATESTRING="2005-05-16" PRIORITY="5" TIMEESPENTUNITS="H" LASTMOD="38490.61168981" TITLE="use IDs gathered from gatherers for .h file" TIMEESTUNITS="H" ID="20" PERCENTDONE="100" STARTDATE="38488.00000000" DONEDATESTRING="2005-05-18" POS="1" DONEDATE="38490.00000000"/>
+        </TASK>
+        <TASK STARTDATESTRING="2005-05-16" PRIORITY="5" TIMEESPENTUNITS="H" LASTMOD="38504.55199074" TITLE="SCons Integration" TIMEESTUNITS="H" ID="9" PERCENTDONE="100" STARTDATE="38488.00000000" DONEDATESTRING="2005-06-01" POS="1" DONEDATE="38504.00000000"/>
+        <TASK STARTDATESTRING="2005-05-16" PRIORITY="5" TIMEESPENTUNITS="H" LASTMOD="38490.61181713" TITLE="handle includes" TIMEESTUNITS="H" ID="12" PERCENTDONE="100" STARTDATE="38488.00000000" DONEDATESTRING="2005-05-18" POS="5" DONEDATE="38490.00000000"/>
+        <TASK STARTDATESTRING="2005-05-24" PRIORITY="5" TIMEESPENTUNITS="H" LASTMOD="38507.98567130" TITLE="output translated HTML templates" TIMEESTUNITS="H" ID="25" PERCENTDONE="100" STARTDATE="38496.00000000" DONEDATESTRING="2005-06-04" POS="3" DONEDATE="38507.00000000"/>
+        <TASK STARTDATESTRING="2005-05-31" PRIORITY="5" TIMEESPENTUNITS="H" LASTMOD="38507.99394676" TITLE="bug: re-escape too much in RC dialogs etc." TIMEESTUNITS="H" ID="38" PERCENTDONE="100" STARTDATE="38503.00000000" DONEDATESTRING="2005-06-04" POS="7" DONEDATE="38507.00000000"/>
+    </TASK>
+    <TASK STARTDATESTRING="2005-05-16" PRIORITY="5" TIMEESPENTUNITS="H" LASTMOD="38489.46444444" TITLE="handle structure variants" TIMEESTUNITS="H" ID="11" PERCENTDONE="100" STARTDATE="38488.00000000" DONEDATESTRING="2005-06-16" POS="15" DONEDATE="38519.00000000"/>
+    <TASK STARTDATESTRING="2005-05-16" PRIORITY="5" TIMEESPENTUNITS="H" LASTMOD="38489.46456019" TITLE="handle include variants" TIMEESTUNITS="H" ID="13" PERCENTDONE="100" STARTDATE="38488.00000000" DONEDATESTRING="2005-06-16" POS="17" DONEDATE="38519.00000000"/>
+    <TASK STARTDATESTRING="2005-05-16" PRIORITY="5" TIMEESPENTUNITS="H" LASTMOD="38489.46537037" TITLE="handle translateable text for includes (e.g. image text)" TIMEESTUNITS="H" ID="14" PERCENTDONE="100" STARTDATE="38488.00000000" DONEDATESTRING="2005-06-16" POS="14" DONEDATE="38519.00000000"/>
+    <TASK STARTDATESTRING="2005-05-16" PRIORITY="5" TIMEESPENTUNITS="H" LASTMOD="38489.46712963" TITLE="ddoc" TIMEESTUNITS="H" ID="15" STARTDATE="38488.00000000" POS="4">
+        <TASK STARTDATESTRING="2005-05-16" PRIORITY="5" TIMEESPENTUNITS="H" LASTMOD="38489.46718750" TITLE="review comments miket" TIMEESTUNITS="H" ID="16" STARTDATE="38488.00000000" POS="2"/>
+        <TASK STARTDATESTRING="2005-05-16" PRIORITY="5" TIMEESPENTUNITS="H" LASTMOD="38489.46722222" TITLE="review comments pdoyle" TIMEESTUNITS="H" ID="17" STARTDATE="38488.00000000" POS="1"/>
+        <TASK STARTDATESTRING="2005-05-16" PRIORITY="5" TIMEESPENTUNITS="H" LASTMOD="38489.46732639" TITLE="remove 'extkey' from structure" TIMEESTUNITS="H" ID="18" STARTDATE="38488.00000000" POS="3"/>
+        <TASK STARTDATESTRING="2005-05-16" PRIORITY="5" TIMEESPENTUNITS="H" LASTMOD="38489.53537037" TITLE="add 'encoding' to structure" TIMEESTUNITS="H" ID="19" STARTDATE="38488.00000000" POS="6"/>
+        <TASK STARTDATESTRING="2005-05-31" PRIORITY="5" TIMEESPENTUNITS="H" LASTMOD="38503.55304398" TITLE="document limitation: emitter doesn't emit the translated HTML templates" TIMEESTUNITS="H" ID="30" STARTDATE="38503.00000000" POS="4"/>
+        <TASK STARTDATESTRING="2005-05-31" PRIORITY="5" TIMEESPENTUNITS="H" LASTMOD="38504.58541667" TITLE="add 'internal_comment' to &lt;message&gt;" TIMEESTUNITS="H" ID="32" STARTDATE="38503.00000000" POS="5"/>
+        <TASK STARTDATESTRING="2005-05-31" PRIORITY="5" TIMEESPENTUNITS="H" LASTMOD="38505.73391204" TITLE="&lt;outputs&gt; can not have paths (because of SCons integration - goes to build dir)" TIMEESTUNITS="H" ID="36" STARTDATE="38503.00000000" POS="9"/>
+        <TASK STARTDATESTRING="2005-05-31" PRIORITY="5" TIMEESPENTUNITS="H" LASTMOD="38506.64265046" TITLE="&lt;identifers&gt; and &lt;identifier&gt; nodes" TIMEESTUNITS="H" ID="37" STARTDATE="38503.00000000" POS="10"/>
+        <TASK STARTDATESTRING="2005-06-23" PRIORITY="5" TIMEESPENTUNITS="H" LASTMOD="38526.62344907" TITLE="&lt;structure&gt; can have 'exclude_from_rc' attribute (default false)" TIMEESTUNITS="H" ID="47" STARTDATE="38526.00000000" POS="8"/>
+        <TASK STARTDATESTRING="2005-06-23" PRIORITY="5" TIMEESPENTUNITS="H" LASTMOD="38531.94135417" TITLE="add 'enc_check' to &lt;grit&gt;" TIMEESTUNITS="H" ID="48" STARTDATE="38526.00000000" POS="7"/>
+    </TASK>
+    <TASK STARTDATESTRING="2005-05-18" PRIORITY="5" TIMEESPENTUNITS="H" LASTMOD="38492.51549769" TITLE="handle nontranslateable messages (in MessageClique?)" TIMEESTUNITS="H" ID="21" PERCENTDONE="100" STARTDATE="38490.00000000" DONEDATESTRING="2005-06-16" POS="16" DONEDATE="38519.00000000"/>
+    <TASK STARTDATESTRING="2005-05-24" PRIORITY="5" TIMEESPENTUNITS="H" LASTMOD="38505.70454861" TITLE="ask cprince about SCons builder in new mk system" TIMEESTUNITS="H" ID="24" PERCENTDONE="100" STARTDATE="38496.00000000" DONEDATESTRING="2005-06-02" POS="25" DONEDATE="38505.00000000"/>
+    <TASK STARTDATESTRING="2005-05-24" PRIORITY="5" TIMEESPENTUNITS="H" LASTMOD="38504.57436343" TITLE="fix AOL resource in trunk (&quot;???????&quot;)" TIMEESTUNITS="H" ID="26" PERCENTDONE="100" STARTDATE="38496.00000000" DONEDATESTRING="2005-06-01" POS="19" DONEDATE="38504.00000000"/>
+    <TASK STARTDATESTRING="2005-05-24" PRIORITY="5" TIMEESPENTUNITS="H" LASTMOD="38498.53893519" TITLE="rc_all vs. rc_translateable vs. rc_nontranslateable" TIMEESTUNITS="H" ID="27" PERCENTDONE="100" STARTDATE="38496.00000000" DONEDATESTRING="2005-06-16" POS="6" DONEDATE="38519.00000000"/>
+    <TASK STARTDATESTRING="2005-05-31" PRIORITY="5" TIMEESPENTUNITS="H" LASTMOD="38509.45532407" TITLE="make separate .grb &quot;outputs&quot; file (and change SCons integ)  (??)" TIMEESTUNITS="H" ID="28" PERCENTDONE="100" STARTDATE="38503.00000000" DONEDATESTRING="2005-06-06" POS="8" DONEDATE="38509.00000000"/>
+    <TASK STARTDATESTRING="2005-05-31" PRIORITY="5" TIMEESPENTUNITS="H" LASTMOD="38511.00939815" TITLE="fix unit tests so they run from any directory" TIMEESTUNITS="H" ID="33" PERCENTDONE="100" STARTDATE="38503.00000000" DONEDATESTRING="2005-06-08" POS="18" DONEDATE="38511.00000000"/>
+    <TASK STARTDATESTRING="2005-05-31" PRIORITY="5" TIMEESPENTUNITS="H" LASTMOD="38508.96640046" TITLE="Change R4 tool to CC correct team(s) on GRIT changes" TIMEESTUNITS="H" ID="39" PERCENTDONE="100" STARTDATE="38503.00000000" DONEDATESTRING="2005-06-05" POS="23" DONEDATE="38508.00000000"/>
+    <TASK STARTDATESTRING="2005-06-07" PRIORITY="5" TIMEESPENTUNITS="H" LASTMOD="38511.00881944" TITLE="Document why wrapper.rc" TIMEESTUNITS="H" ID="40" PERCENTDONE="100" STARTDATE="38510.00000000" DONEDATESTRING="2005-06-08" POS="21" DONEDATE="38511.00000000"/>
+    <TASK STARTDATESTRING="2005-06-08" PRIORITY="5" TIMEESPENTUNITS="H" LASTMOD="38511.00804398" TITLE="import XTBs" TIMEESTUNITS="H" ID="41" PERCENTDONE="100" STARTDATE="38511.00000000" DONEDATESTRING="2005-06-16" POS="11" DONEDATE="38519.00000000"/>
+    <TASK STARTDATESTRING="2005-06-08" PRIORITY="5" TIMEESPENTUNITS="H" LASTMOD="38511.00875000" TITLE="Nightly build integration" TIMEESTUNITS="H" ID="42" STARTDATE="38511.00000000" POS="3"/>
+    <TASK STARTDATESTRING="2005-06-08" PRIORITY="5" TIMEESPENTUNITS="H" LASTMOD="38511.00891204" TITLE="BUGS" TIMEESTUNITS="H" ID="43" STARTDATE="38511.00000000" POS="24">
+        <TASK STARTDATESTRING="2005-06-08" PRIORITY="5" TIMEESPENTUNITS="H" LASTMOD="38513.03375000" TITLE="Should report error if RC-section structure refers to does not exist" TIMEESTUNITS="H" ID="44" PERCENTDONE="100" STARTDATE="38511.00000000" DONEDATESTRING="2005-06-10" POS="1" DONEDATE="38513.00000000"/>
+    </TASK>
+    <TASK STARTDATESTRING="2005-06-08" PRIORITY="5" TIMEESPENTUNITS="H" LASTMOD="38511.00981481" TITLE="NEW FEATURES" TIMEESTUNITS="H" ID="45" PERCENTDONE="100" STARTDATE="38511.00000000" DONEDATESTRING="2005-06-16" POS="7" DONEDATE="38519.00000000">
+        <TASK STARTDATESTRING="2005-05-31" PRIORITY="5" TIMEESPENTUNITS="H" LASTMOD="38505.70077546" TITLE="Implement line-continuation feature (\ at end of line?)" TIMEESTUNITS="H" ID="34" PERCENTDONE="100" STARTDATE="38503.00000000" DONEDATESTRING="2005-06-16" POS="1" DONEDATE="38519.00000000"/>
+        <TASK STARTDATESTRING="2005-05-31" PRIORITY="5" TIMEESPENTUNITS="H" LASTMOD="38505.70262731" TITLE="Implement conditional inclusion &amp; reflect the conditionals from R3 RC file" TIMEESTUNITS="H" ID="35" PERCENTDONE="100" STARTDATE="38503.00000000" DONEDATESTRING="2005-06-16" POS="2" DONEDATE="38519.00000000"/>
+    </TASK>
+    <TASK STARTDATESTRING="2005-06-08" PRIORITY="5" TIMEESPENTUNITS="H" LASTMOD="38511.01046296" TITLE="TC integration (one-way TO the TC)" TIMEESTUNITS="H" ID="46" PERCENTDONE="100" STARTDATE="38511.00000000" DONEDATESTRING="2005-06-16" POS="5" DONEDATE="38519.00000000"/>
+    <TASK STARTDATESTRING="2005-06-30" PRIORITY="5" TIMEESPENTUNITS="H" LASTMOD="38533.59072917" TITLE="bazaar20 ad for GRIT help" TIMEESTUNITS="H" ID="49" STARTDATE="38533.00000000" POS="2">
+        <TASK STARTDATESTRING="2005-08-19" PRIORITY="5" TIMEESPENTUNITS="H" LASTMOD="38583.72346065" TITLE="bazaar20 ideas" TIMEESTUNITS="H" ID="51" STARTDATE="38583.00000000" POS="1">
+            <TASK STARTDATESTRING="2005-08-19" PRIORITY="5" TIMEESPENTUNITS="H" LASTMOD="38583.72354167" TITLE="GUI for adding/editing messages" TIMEESTUNITS="H" ID="52" STARTDATE="38583.00000000" POS="2"/>
+            <TASK STARTDATESTRING="2005-08-19" PRIORITY="5" TIMEESPENTUNITS="H" LASTMOD="38583.72365741" TITLE="XLIFF import/export" TIMEESTUNITS="H" ID="54" STARTDATE="38583.00000000" POS="1"/>
+        </TASK>
+    </TASK>
+    <TASK STARTDATESTRING="2005-06-30" PRIORITY="5" TIMEESPENTUNITS="H" LASTMOD="38583.73721065" TITLE="internal_comment for all resource nodes (not just &lt;message&gt;)" TIMEESTUNITS="H" ID="50" PERCENTDONE="100" STARTDATE="38533.00000000" DONEDATESTRING="2005-08-19" POS="9" DONEDATE="38583.73721065"/>
+    <TASK STARTDATESTRING="2005-08-19" PRIORITY="5" TIMEESPENTUNITS="H" LASTMOD="38583.73743056" TITLE="Preserve XML comments - this gives us line continuation and more" TIMEESTUNITS="H" ID="55" STARTDATE="38583.72326389" POS="1"/>
+</TODOLIST>
diff --git a/tools/grit/grit/grit_runner.py b/tools/grit/grit/grit_runner.py
new file mode 100644
index 0000000000..26aa0d58c4
--- /dev/null
+++ b/tools/grit/grit/grit_runner.py
@@ -0,0 +1,334 @@
+#!/usr/bin/env python
+# Copyright (c) 2012 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.
+
+"""Command processor for GRIT.  This is the script you invoke to run the various
+GRIT tools.
+"""
+
+from __future__ import print_function
+
+import os
+import sys
+if __name__ == '__main__':
+  sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
+
+import getopt
+
+from grit import util
+
+import grit.extern.FP
+
+# Tool info factories; these import only within each factory to avoid
+# importing most of the GRIT code until required.
+def ToolFactoryBuild():
+  import grit.tool.build
+  return grit.tool.build.RcBuilder()
+
+def ToolFactoryBuildInfo():
+  import grit.tool.buildinfo
+  return grit.tool.buildinfo.DetermineBuildInfo()
+
+def ToolFactoryCount():
+  import grit.tool.count
+  return grit.tool.count.CountMessage()
+
+def ToolFactoryDiffStructures():
+  import grit.tool.diff_structures
+  return grit.tool.diff_structures.DiffStructures()
+
+def ToolFactoryMenuTranslationsFromParts():
+  import grit.tool.menu_from_parts
+  return grit.tool.menu_from_parts.MenuTranslationsFromParts()
+
+def ToolFactoryNewGrd():
+  import grit.tool.newgrd
+  return grit.tool.newgrd.NewGrd()
+
+def ToolFactoryResizeDialog():
+  import grit.tool.resize
+  return grit.tool.resize.ResizeDialog()
+
+def ToolFactoryRc2Grd():
+  import grit.tool.rc2grd
+  return grit.tool.rc2grd.Rc2Grd()
+
+def ToolFactoryTest():
+  import grit.tool.test
+  return grit.tool.test.TestTool()
+
+def ToolFactoryTranslationToTc():
+  import grit.tool.transl2tc
+  return grit.tool.transl2tc.TranslationToTc()
+
+def ToolFactoryUnit():
+  import grit.tool.unit
+  return grit.tool.unit.UnitTestTool()
+
+
+def ToolFactoryUpdateResourceIds():
+  import grit.tool.update_resource_ids
+  return grit.tool.update_resource_ids.UpdateResourceIds()
+
+
+def ToolFactoryXmb():
+  import grit.tool.xmb
+  return grit.tool.xmb.OutputXmb()
+
+def ToolAndroid2Grd():
+  import grit.tool.android2grd
+  return grit.tool.android2grd.Android2Grd()
+
+# Keys for the following map
+_FACTORY = 1
+_REQUIRES_INPUT = 2
+_HIDDEN = 3  # optional key - presence indicates tool is hidden
+
+# Maps tool names to the tool's module.  Done as a list of (key, value) tuples
+# instead of a map to preserve ordering.
+_TOOLS = [
+    ['android2grd', {
+        _FACTORY: ToolAndroid2Grd,
+        _REQUIRES_INPUT: False
+    }],
+    ['build', {
+        _FACTORY: ToolFactoryBuild,
+        _REQUIRES_INPUT: True
+    }],
+    ['buildinfo', {
+        _FACTORY: ToolFactoryBuildInfo,
+        _REQUIRES_INPUT: True
+    }],
+    ['count', {
+        _FACTORY: ToolFactoryCount,
+        _REQUIRES_INPUT: True
+    }],
+    [
+        'menufromparts',
+        {
+            _FACTORY: ToolFactoryMenuTranslationsFromParts,
+            _REQUIRES_INPUT: True,
+            _HIDDEN: True
+        }
+    ],
+    ['newgrd', {
+        _FACTORY: ToolFactoryNewGrd,
+        _REQUIRES_INPUT: False
+    }],
+    ['rc2grd', {
+        _FACTORY: ToolFactoryRc2Grd,
+        _REQUIRES_INPUT: False
+    }],
+    ['resize', {
+        _FACTORY: ToolFactoryResizeDialog,
+        _REQUIRES_INPUT: True
+    }],
+    ['sdiff', {
+        _FACTORY: ToolFactoryDiffStructures,
+        _REQUIRES_INPUT: False
+    }],
+    ['test', {
+        _FACTORY: ToolFactoryTest,
+        _REQUIRES_INPUT: True,
+        _HIDDEN: True
+    }],
+    [
+        'transl2tc',
+        {
+            _FACTORY: ToolFactoryTranslationToTc,
+            _REQUIRES_INPUT: False
+        }
+    ],
+    ['unit', {
+        _FACTORY: ToolFactoryUnit,
+        _REQUIRES_INPUT: False
+    }],
+    [
+        'update_resource_ids',
+        {
+            _FACTORY: ToolFactoryUpdateResourceIds,
+            _REQUIRES_INPUT: False
+        }
+    ],
+    ['xmb', {
+        _FACTORY: ToolFactoryXmb,
+        _REQUIRES_INPUT: True
+    }],
+]
+
+
+def PrintUsage():
+  tool_list = ''
+  for (tool, info) in _TOOLS:
+    if not _HIDDEN in info:
+      tool_list += '    %-12s %s\n' % (
+          tool, info[_FACTORY]().ShortDescription())
+
+  print("""GRIT - the Google Resource and Internationalization Tool
+
+Usage: grit [GLOBALOPTIONS] TOOL [args to tool]
+
+Global options:
+
+  -i INPUT  Specifies the INPUT file to use (a .grd file).  If this is not
+            specified, GRIT will look for the environment variable GRIT_INPUT.
+            If it is not present either, GRIT will try to find an input file
+            named 'resource.grd' in the current working directory.
+
+  -h MODULE Causes GRIT to use MODULE.UnsignedFingerPrint instead of
+            grit.extern.FP.UnsignedFingerprint.  MODULE must be
+            available somewhere in the PYTHONPATH search path.
+
+  -v        Print more verbose runtime information.
+
+  -x        Print extremely verbose runtime information.  Implies -v
+
+  -p FNAME  Specifies that GRIT should profile its execution and output the
+            results to the file FNAME.
+
+Tools:
+
+  TOOL can be one of the following:
+%s
+  For more information on how to use a particular tool, and the specific
+  arguments you can send to that tool, execute 'grit help TOOL'
+""" % (tool_list))
+
+
+class Options(object):
+  """Option storage and parsing."""
+
+  def __init__(self):
+    self.hash = None
+    self.input = None
+    self.verbose = False
+    self.extra_verbose = False
+    self.output_stream = sys.stdout
+    self.profile_dest = None
+
+  def ReadOptions(self, args):
+    """Reads options from the start of args and returns the remainder."""
+    (opts, args) = getopt.getopt(args, 'vxi:p:h:', ('help',))
+    for (key, val) in opts:
+      if key == '-h': self.hash = val
+      elif key == '-i': self.input = val
+      elif key == '-v':
+        self.verbose = True
+        util.verbose = True
+      elif key == '-x':
+        self.verbose = True
+        util.verbose = True
+        self.extra_verbose = True
+        util.extra_verbose = True
+      elif key == '-p': self.profile_dest = val
+      elif key == '--help':
+        PrintUsage()
+        sys.exit(0)
+
+    if not self.input:
+      if 'GRIT_INPUT' in os.environ:
+        self.input = os.environ['GRIT_INPUT']
+      else:
+        self.input = 'resource.grd'
+
+    return args
+
+  def __repr__(self):
+    return '(verbose: %d, input: %s)' % (
+        self.verbose, self.input)
+
+
+def _GetToolInfo(tool):
+  """Returns the info map for the tool named 'tool' or None if there is no
+  such tool."""
+  matches = [t for t in _TOOLS if t[0] == tool]
+  if not matches:
+    return None
+  else:
+    return matches[0][1]
+
+
+def Main(args=None):
+  """Parses arguments and does the appropriate thing."""
+  util.ChangeStdoutEncoding()
+
+  # Support for setuptools console wrappers.
+  if args is None:
+    args = sys.argv[1:]
+
+  options = Options()
+  try:
+    args = options.ReadOptions(args)  # args may be shorter after this
+  except getopt.GetoptError as e:
+    print("grit:", str(e))
+    print("Try running 'grit help' for valid options.")
+    return 1
+  if not args:
+    print("No tool provided.  Try running 'grit help' for a list of tools.")
+    return 2
+
+  tool = args[0]
+  if tool == 'help':
+    if len(args) == 1:
+      PrintUsage()
+      return 0
+    else:
+      tool = args[1]
+      if not _GetToolInfo(tool):
+        print("No such tool.  Try running 'grit help' for a list of tools.")
+        return 2
+
+      print("Help for 'grit %s' (for general help, run 'grit help'):\n" %
+            (tool,))
+      _GetToolInfo(tool)[_FACTORY]().ShowUsage()
+      return 0
+  if not _GetToolInfo(tool):
+    print("No such tool.  Try running 'grit help' for a list of tools.")
+    return 2
+
+  try:
+    if _GetToolInfo(tool)[_REQUIRES_INPUT]:
+      os.stat(options.input)
+  except OSError:
+    print('Input file %s not found.\n'
+          'To specify a different input file:\n'
+          '  1. Use the GRIT_INPUT environment variable.\n'
+          '  2. Use the -i command-line option.  This overrides '
+          'GRIT_INPUT.\n'
+          '  3. Specify neither GRIT_INPUT or -i and GRIT will try to load '
+          "'resource.grd'\n"
+          '     from the current directory.' % options.input)
+    return 2
+
+  if options.hash:
+    grit.extern.FP.UseUnsignedFingerPrintFromModule(options.hash)
+
+  try:
+    toolobject = _GetToolInfo(tool)[_FACTORY]()
+    if options.profile_dest:
+      import hotshot
+      prof = hotshot.Profile(options.profile_dest)
+      return prof.runcall(toolobject.Run, options, args[1:])
+    else:
+      return toolobject.Run(options, args[1:])
+  except getopt.GetoptError as e:
+    print("grit: %s: %s" % (tool, str(e)))
+    print("Try running 'grit help %s' for valid options." % (tool,))
+    return 1
+
+
+if __name__ == '__main__':
+  sys.path.append(
+      os.path.join(
+          os.path.dirname(
+              os.path.dirname(os.path.dirname(os.path.abspath(__file__)))),
+          'diagnosis'))
+  try:
+    import crbug_1001171
+    with crbug_1001171.DumpStateOnLookupError():
+      sys.exit(Main(sys.argv[1:]))
+  except ImportError:
+    pass
+
+  sys.exit(Main(sys.argv[1:]))
diff --git a/tools/grit/grit/grit_runner_unittest.py b/tools/grit/grit/grit_runner_unittest.py
new file mode 100644
index 0000000000..1487001d81
--- /dev/null
+++ b/tools/grit/grit/grit_runner_unittest.py
@@ -0,0 +1,42 @@
+#!/usr/bin/env python
+# Copyright (c) 2012 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.
+
+'''Unit tests for grit.py'''
+
+from __future__ import print_function
+
+import os
+import sys
+if __name__ == '__main__':
+  sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
+
+import unittest
+
+from six import StringIO
+
+from grit import util
+import grit.grit_runner
+
+class OptionArgsUnittest(unittest.TestCase):
+  def setUp(self):
+    self.buf = StringIO()
+    self.old_stdout = sys.stdout
+    sys.stdout = self.buf
+
+  def tearDown(self):
+    sys.stdout = self.old_stdout
+
+  def testSimple(self):
+    grit.grit_runner.Main(['-i',
+                           util.PathFromRoot('grit/testdata/simple-input.xml'),
+                           'test', 'bla', 'voff', 'ga'])
+    output = self.buf.getvalue()
+    self.failUnless(output.count("'test'") == 0)  # tool name doesn't occur
+    self.failUnless(output.count('bla'))
+    self.failUnless(output.count('simple-input.xml'))
+
+
+if __name__ == '__main__':
+  unittest.main()
diff --git a/tools/grit/grit/lazy_re.py b/tools/grit/grit/lazy_re.py
new file mode 100644
index 0000000000..5c461e87e7
--- /dev/null
+++ b/tools/grit/grit/lazy_re.py
@@ -0,0 +1,46 @@
+# Copyright (c) 2012 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.
+
+'''In GRIT, we used to compile a lot of regular expressions at parse
+time.  Since many of them never get used, we use lazy_re to compile
+them on demand the first time they are used, thus speeding up startup
+time in some cases.
+'''
+
+from __future__ import print_function
+
+import re
+
+
+class LazyRegexObject(object):
+  '''This object creates a RegexObject with the arguments passed in
+  its constructor, the first time any attribute except the several on
+  the class itself is accessed.  This accomplishes lazy compilation of
+  the regular expression while maintaining a nearly-identical
+  interface.
+  '''
+
+  def __init__(self, *args, **kwargs):
+    self._stash_args = args
+    self._stash_kwargs = kwargs
+    self._lazy_re = None
+
+  def _LazyInit(self):
+    if not self._lazy_re:
+      self._lazy_re = re.compile(*self._stash_args, **self._stash_kwargs)
+
+  def __getattribute__(self, name):
+    if name in ('_LazyInit', '_lazy_re', '_stash_args', '_stash_kwargs'):
+      return object.__getattribute__(self, name)
+    else:
+      self._LazyInit()
+      return getattr(self._lazy_re, name)
+
+
+def compile(*args, **kwargs):
+  '''Creates a LazyRegexObject that, when invoked on, will compile a
+  re.RegexObject (via re.compile) with the same arguments passed to
+  this function, and delegate almost all of its methods to it.
+  '''
+  return LazyRegexObject(*args, **kwargs)
diff --git a/tools/grit/grit/lazy_re_unittest.py b/tools/grit/grit/lazy_re_unittest.py
new file mode 100644
index 0000000000..8488b454ee
--- /dev/null
+++ b/tools/grit/grit/lazy_re_unittest.py
@@ -0,0 +1,40 @@
+#!/usr/bin/env python
+# Copyright (c) 2012 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.
+
+'''Unit test for lazy_re.
+'''
+
+from __future__ import print_function
+
+import os
+import sys
+if __name__ == '__main__':
+  sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
+
+import re
+import unittest
+
+from grit import lazy_re
+
+
+class LazyReUnittest(unittest.TestCase):
+
+  def testCreatedOnlyOnDemand(self):
+    rex = lazy_re.compile('bingo')
+    self.assertEqual(None, rex._lazy_re)
+    self.assertTrue(rex.match('bingo'))
+    self.assertNotEqual(None, rex._lazy_re)
+
+  def testJustKwargsWork(self):
+    rex = lazy_re.compile(flags=re.I, pattern='BiNgO')
+    self.assertTrue(rex.match('bingo'))
+
+  def testPositionalAndKwargsWork(self):
+    rex = lazy_re.compile('BiNgO', flags=re.I)
+    self.assertTrue(rex.match('bingo'))
+
+
+if __name__ == '__main__':
+  unittest.main()
diff --git a/tools/grit/grit/node/__init__.py b/tools/grit/grit/node/__init__.py
new file mode 100644
index 0000000000..2fc0d3360c
--- /dev/null
+++ b/tools/grit/grit/node/__init__.py
@@ -0,0 +1,8 @@
+# Copyright (c) 2012 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.
+
+'''Package 'grit.node'
+'''
+
+pass
diff --git a/tools/grit/grit/node/base.py b/tools/grit/grit/node/base.py
new file mode 100644
index 0000000000..40859d301d
--- /dev/null
+++ b/tools/grit/grit/node/base.py
@@ -0,0 +1,670 @@
+# Copyright (c) 2012 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.
+
+'''Base types for nodes in a GRIT resource tree.
+'''
+
+from __future__ import print_function
+
+import ast
+import os
+import struct
+import sys
+from xml.sax import saxutils
+
+import six
+
+from grit import constants
+from grit import clique
+from grit import exception
+from grit import util
+from grit.node import brotli_util
+import grit.format.gzip_string
+
+
+class Node(object):
+  '''An item in the tree that has children.'''
+
+  # Valid content types that can be returned by _ContentType()
+  _CONTENT_TYPE_NONE = 0   # No CDATA content but may have children
+  _CONTENT_TYPE_CDATA = 1  # Only CDATA, no children.
+  _CONTENT_TYPE_MIXED = 2  # CDATA and children, possibly intermingled
+
+  # Types of files to be compressed by default.
+  _COMPRESS_BY_DEFAULT_EXTENSIONS = ('.js', '.html', '.css', '.svg')
+
+  # Default nodes to not whitelist skipped
+  _whitelist_marked_as_skip = False
+
+  # A class-static cache to speed up EvaluateExpression().
+  # Keys are expressions (e.g. 'is_ios and lang == "fr"'). Values are tuples
+  # (code, variables_in_expr) where code is the compiled expression and can be
+  # directly eval'd, and variables_in_expr is the list of variable and method
+  # names used in the expression (e.g. ['is_ios', 'lang']).
+  eval_expr_cache = {}
+
+  def __init__(self):
+    self.children = []        # A list of child elements
+    self.mixed_content = []   # A list of u'' and/or child elements (this
+    # duplicates 'children' but
+    # is needed to preserve markup-type content).
+    self.name = u''           # The name of this element
+    self.attrs = {}           # The set of attributes (keys to values)
+    self.parent = None        # Our parent unless we are the root element.
+    self.uberclique = None    # Allows overriding uberclique for parts of tree
+    self.source = None        # File that this node was parsed from
+
+  # This context handler allows you to write "with node:" and get a
+  # line identifying the offending node if an exception escapes from the body
+  # of the with statement.
+  def __enter__(self):
+    return self
+
+  def __exit__(self, exc_type, exc_value, traceback):
+    if exc_type is not None:
+      print(u'Error processing node %s: %s' % (six.text_type(self), exc_value))
+
+  def __iter__(self):
+    '''A preorder iteration through the tree that this node is the root of.'''
+    return self.Preorder()
+
+  def Preorder(self):
+    '''Generator that generates first this node, then the same generator for
+    any child nodes.'''
+    yield self
+    for child in self.children:
+      for iterchild in child.Preorder():
+        yield iterchild
+
+  def ActiveChildren(self):
+    '''Returns the children of this node that should be included in the current
+    configuration. Overridden by <if>.'''
+    return [node for node in self.children if not node.WhitelistMarkedAsSkip()]
+
+  def ActiveDescendants(self):
+    '''Yields the current node and all descendants that should be included in
+    the current configuration, in preorder.'''
+    yield self
+    for child in self.ActiveChildren():
+      for descendant in child.ActiveDescendants():
+        yield descendant
+
+  def GetRoot(self):
+    '''Returns the root Node in the tree this Node belongs to.'''
+    curr = self
+    while curr.parent:
+      curr = curr.parent
+    return curr
+
+    # TODO(joi) Use this (currently untested) optimization?:
+    #if hasattr(self, '_root'):
+    #  return self._root
+    #curr = self
+    #while curr.parent and not hasattr(curr, '_root'):
+    #  curr = curr.parent
+    #if curr.parent:
+    #  self._root = curr._root
+    #else:
+    #  self._root = curr
+    #return self._root
+
+  def StartParsing(self, name, parent):
+    '''Called at the start of parsing.
+
+    Args:
+      name: u'elementname'
+      parent: grit.node.base.Node or subclass or None
+    '''
+    assert isinstance(name, six.string_types)
+    assert not parent or isinstance(parent, Node)
+    self.name = name
+    self.parent = parent
+
+  def AddChild(self, child):
+    '''Adds a child to the list of children of this node, if it is a valid
+    child for the node.'''
+    assert isinstance(child, Node)
+    if (not self._IsValidChild(child) or
+        self._ContentType() == self._CONTENT_TYPE_CDATA):
+      explanation = 'invalid child %s for parent %s' % (str(child), self.name)
+      raise exception.UnexpectedChild(explanation)
+    self.children.append(child)
+    self.mixed_content.append(child)
+
+  def RemoveChild(self, child_id):
+    '''Removes the first node that has a "name" attribute which
+    matches "child_id" in the list of immediate children of
+    this node.
+
+    Args:
+      child_id: String identifying the child to be removed
+    '''
+    index = 0
+    # Safe not to copy since we only remove the first element found
+    for child in self.children:
+      name_attr = child.attrs['name']
+      if name_attr == child_id:
+        self.children.pop(index)
+        self.mixed_content.pop(index)
+        break
+      index += 1
+
+  def AppendContent(self, content):
+    '''Appends a chunk of text as content of this node.
+
+    Args:
+      content: u'hello'
+
+    Return:
+      None
+    '''
+    assert isinstance(content, six.string_types)
+    if self._ContentType() != self._CONTENT_TYPE_NONE:
+      self.mixed_content.append(content)
+    elif content.strip() != '':
+      raise exception.UnexpectedContent()
+
+  def HandleAttribute(self, attrib, value):
+    '''Informs the node of an attribute that was parsed out of the GRD file
+    for it.
+
+    Args:
+      attrib: 'name'
+      value: 'fooblat'
+
+    Return:
+      None
+    '''
+    assert isinstance(attrib, six.string_types)
+    assert isinstance(value, six.string_types)
+    if self._IsValidAttribute(attrib, value):
+      self.attrs[attrib] = value
+    else:
+      raise exception.UnexpectedAttribute(attrib)
+
+  def EndParsing(self):
+    '''Called at the end of parsing.'''
+
+    # TODO(joi) Rewrite this, it's extremely ugly!
+    if len(self.mixed_content):
+      if isinstance(self.mixed_content[0], six.string_types):
+        # Remove leading and trailing chunks of pure whitespace.
+        while (len(self.mixed_content) and
+               isinstance(self.mixed_content[0], six.string_types) and
+               self.mixed_content[0].strip() == ''):
+          self.mixed_content = self.mixed_content[1:]
+        # Strip leading and trailing whitespace from mixed content chunks
+        # at front and back.
+        if (len(self.mixed_content) and
+            isinstance(self.mixed_content[0], six.string_types)):
+          self.mixed_content[0] = self.mixed_content[0].lstrip()
+        # Remove leading and trailing ''' (used to demarcate whitespace)
+        if (len(self.mixed_content) and
+            isinstance(self.mixed_content[0], six.string_types)):
+          if self.mixed_content[0].startswith("'''"):
+            self.mixed_content[0] = self.mixed_content[0][3:]
+    if len(self.mixed_content):
+      if isinstance(self.mixed_content[-1], six.string_types):
+        # Same stuff all over again for the tail end.
+        while (len(self.mixed_content) and
+               isinstance(self.mixed_content[-1], six.string_types) and
+               self.mixed_content[-1].strip() == ''):
+          self.mixed_content = self.mixed_content[:-1]
+        if (len(self.mixed_content) and
+            isinstance(self.mixed_content[-1], six.string_types)):
+          self.mixed_content[-1] = self.mixed_content[-1].rstrip()
+        if (len(self.mixed_content) and
+            isinstance(self.mixed_content[-1], six.string_types)):
+          if self.mixed_content[-1].endswith("'''"):
+            self.mixed_content[-1] = self.mixed_content[-1][:-3]
+
+    # Check that all mandatory attributes are there.
+    for node_mandatt in self.MandatoryAttributes():
+      mandatt_list = []
+      if node_mandatt.find('|') >= 0:
+        mandatt_list = node_mandatt.split('|')
+      else:
+        mandatt_list.append(node_mandatt)
+
+      mandatt_option_found = False
+      for mandatt in mandatt_list:
+        assert mandatt not in self.DefaultAttributes()
+        if mandatt in self.attrs:
+          if not mandatt_option_found:
+            mandatt_option_found = True
+          else:
+            raise exception.MutuallyExclusiveMandatoryAttribute(mandatt)
+
+      if not mandatt_option_found:
+        raise exception.MissingMandatoryAttribute(mandatt)
+
+    # Add default attributes if not specified in input file.
+    for defattr in self.DefaultAttributes():
+      if not defattr in self.attrs:
+        self.attrs[defattr] = self.DefaultAttributes()[defattr]
+
+  def GetCdata(self):
+    '''Returns all CDATA of this element, concatenated into a single
+    string.  Note that this ignores any elements embedded in CDATA.'''
+    return ''.join([c for c in self.mixed_content
+                    if isinstance(c, six.string_types)])
+
+  def __str__(self):
+    '''Returns this node and all nodes below it as an XML document in a Unicode
+    string.'''
+    header = u'<?xml version="1.0" encoding="UTF-8"?>\n'
+    return header + self.FormatXml()
+
+  # Some Python 2 glue.
+  __unicode__ = __str__
+
+  def FormatXml(self, indent = u'', one_line = False):
+    '''Returns this node and all nodes below it as an XML
+    element in a Unicode string.  This differs from __unicode__ in that it does
+    not include the <?xml> stuff at the top of the string.  If one_line is true,
+    children and CDATA are layed out in a way that preserves internal
+    whitespace.
+    '''
+    assert isinstance(indent, six.string_types)
+
+    content_one_line = (one_line or
+                        self._ContentType() == self._CONTENT_TYPE_MIXED)
+    inside_content = self.ContentsAsXml(indent, content_one_line)
+
+    # Then the attributes for this node.
+    attribs = u''
+    default_attribs = self.DefaultAttributes()
+    for attrib, value in sorted(self.attrs.items()):
+      # Only print an attribute if it is other than the default value.
+      if attrib not in default_attribs or value != default_attribs[attrib]:
+        attribs += u' %s=%s' % (attrib, saxutils.quoteattr(value))
+
+    # Finally build the XML for our node and return it
+    if len(inside_content) > 0:
+      if one_line:
+        return u'<%s%s>%s</%s>' % (self.name, attribs, inside_content,
+                                   self.name)
+      elif content_one_line:
+        return u'%s<%s%s>\n%s  %s\n%s</%s>' % (
+          indent, self.name, attribs,
+          indent, inside_content,
+          indent, self.name)
+      else:
+        return u'%s<%s%s>\n%s\n%s</%s>' % (
+          indent, self.name, attribs,
+          inside_content,
+          indent, self.name)
+    else:
+      return u'%s<%s%s />' % (indent, self.name, attribs)
+
+  def ContentsAsXml(self, indent, one_line):
+    '''Returns the contents of this node (CDATA and child elements) in XML
+    format.  If 'one_line' is true, the content will be laid out on one line.'''
+    assert isinstance(indent, six.string_types)
+
+    # Build the contents of the element.
+    inside_parts = []
+    last_item = None
+    for mixed_item in self.mixed_content:
+      if isinstance(mixed_item, Node):
+        inside_parts.append(mixed_item.FormatXml(indent + u'  ', one_line))
+        if not one_line:
+          inside_parts.append(u'\n')
+      else:
+        message = mixed_item
+        # If this is the first item and it starts with whitespace, we add
+        # the ''' delimiter.
+        if not last_item and message.lstrip() != message:
+          message = u"'''" + message
+        inside_parts.append(util.EncodeCdata(message))
+      last_item = mixed_item
+
+    # If there are only child nodes and no cdata, there will be a spurious
+    # trailing \n
+    if len(inside_parts) and inside_parts[-1] == '\n':
+      inside_parts = inside_parts[:-1]
+
+    # If the last item is a string (not a node) and ends with whitespace,
+    # we need to add the ''' delimiter.
+    if (isinstance(last_item, six.string_types) and
+        last_item.rstrip() != last_item):
+      inside_parts[-1] = inside_parts[-1] + u"'''"
+
+    return u''.join(inside_parts)
+
+  def SubstituteMessages(self, substituter):
+    '''Applies substitutions to all messages in the tree.
+
+    Called as a final step of RunGatherers.
+
+    Args:
+      substituter: a grit.util.Substituter object.
+    '''
+    for child in self.children:
+      child.SubstituteMessages(substituter)
+
+  def _IsValidChild(self, child):
+    '''Returns true if 'child' is a valid child of this node.
+    Overridden by subclasses.'''
+    return False
+
+  def _IsValidAttribute(self, name, value):
+    '''Returns true if 'name' is the name of a valid attribute of this element
+    and 'value' is a valid value for that attribute.  Overriden by
+    subclasses unless they have only mandatory attributes.'''
+    return (name in self.MandatoryAttributes() or
+            name in self.DefaultAttributes())
+
+  def _ContentType(self):
+    '''Returns the type of content this element can have.  Overridden by
+    subclasses.  The content type can be one of the _CONTENT_TYPE_XXX constants
+    above.'''
+    return self._CONTENT_TYPE_NONE
+
+  def MandatoryAttributes(self):
+    '''Returns a list of attribute names that are mandatory (non-optional)
+    on the current element. One can specify a list of
+    "mutually exclusive mandatory" attributes by specifying them as one
+    element in the list, separated by a "|" character.
+    '''
+    return []
+
+  def DefaultAttributes(self):
+    '''Returns a dictionary of attribute names that have defaults, mapped to
+    the default value.  Overridden by subclasses.'''
+    return {}
+
+  def GetCliques(self):
+    '''Returns all MessageClique objects belonging to this node.  Overridden
+    by subclasses.
+
+    Return:
+      [clique1, clique2] or []
+    '''
+    return []
+
+  def ToRealPath(self, path_from_basedir):
+    '''Returns a real path (which can be absolute or relative to the current
+    working directory), given a path that is relative to the base directory
+    set for the GRIT input file.
+
+    Args:
+      path_from_basedir: '..'
+
+    Return:
+      'resource'
+    '''
+    return util.normpath(os.path.join(self.GetRoot().GetBaseDir(),
+                                      os.path.expandvars(path_from_basedir)))
+
+  def GetInputPath(self):
+    '''Returns a path, relative to the base directory set for the grd file,
+    that points to the file the node refers to.
+    '''
+    # This implementation works for most nodes that have an input file.
+    return self.attrs['file']
+
+  def UberClique(self):
+    '''Returns the uberclique that should be used for messages originating in
+    a given node.  If the node itself has its uberclique set, that is what we
+    use, otherwise we search upwards until we find one.  If we do not find one
+    even at the root node, we set the root node's uberclique to a new
+    uberclique instance.
+    '''
+    node = self
+    while not node.uberclique and node.parent:
+      node = node.parent
+    if not node.uberclique:
+      node.uberclique = clique.UberClique()
+    return node.uberclique
+
+  def IsTranslateable(self):
+    '''Returns false if the node has contents that should not be translated,
+    otherwise returns false (even if the node has no contents).
+    '''
+    if not 'translateable' in self.attrs:
+      return True
+    else:
+      return self.attrs['translateable'] == 'true'
+
+  def IsAccessibilityWithNoUI(self):
+    '''Returns true if the node is marked as an accessibility label and the
+    message isn't shown in the UI. Otherwise returns false. This label is
+    used to determine if the text requires screenshots.'''
+    if not 'is_accessibility_with_no_ui' in self.attrs:
+      return False
+    else:
+      return self.attrs['is_accessibility_with_no_ui'] == 'true'
+
+  def GetNodeById(self, id):
+    '''Returns the node in the subtree parented by this node that has a 'name'
+    attribute matching 'id'.  Returns None if no such node is found.
+    '''
+    for node in self:
+      if 'name' in node.attrs and node.attrs['name'] == id:
+        return node
+    return None
+
+  def GetChildrenOfType(self, type):
+    '''Returns a list of all subnodes (recursing to all leaves) of this node
+    that are of the indicated type (or tuple of types).
+
+    Args:
+      type: A type you could use with isinstance().
+
+    Return:
+      A list, possibly empty.
+    '''
+    return [child for child in self if isinstance(child, type)]
+
+  def GetTextualIds(self):
+    '''Returns a list of the textual ids of this node.
+    '''
+    if 'name' in self.attrs:
+      return [self.attrs['name']]
+    return []
+
+  @classmethod
+  def EvaluateExpression(cls, expr, defs, target_platform, extra_variables={}):
+    '''Worker for EvaluateCondition (below) and conditions in XTB files.'''
+    if expr in cls.eval_expr_cache:
+      code, variables_in_expr = cls.eval_expr_cache[expr]
+    else:
+      # Get a list of all variable and method names used in the expression.
+      syntax_tree = ast.parse(expr, mode='eval')
+      variables_in_expr = [node.id for node in ast.walk(syntax_tree) if
+          isinstance(node, ast.Name) and node.id not in ('True', 'False')]
+      code = compile(syntax_tree, filename='<string>', mode='eval')
+      cls.eval_expr_cache[expr] = code, variables_in_expr
+
+    # Set values only for variables that are needed to eval the expression.
+    variable_map = {}
+    for name in variables_in_expr:
+      if name == 'os':
+        value = target_platform
+      elif name == 'defs':
+        value = defs
+
+      elif name == 'is_linux':
+        value = target_platform.startswith('linux')
+      elif name == 'is_macosx':
+        value = target_platform == 'darwin'
+      elif name == 'is_win':
+        value = target_platform in ('cygwin', 'win32')
+      elif name == 'is_android':
+        value = target_platform == 'android'
+      elif name == 'is_ios':
+        value = target_platform == 'ios'
+      elif name == 'is_bsd':
+        value = 'bsd' in target_platform
+      elif name == 'is_posix':
+        value = (target_platform in ('darwin', 'linux2', 'linux3', 'sunos5',
+                                     'android', 'ios')
+                 or 'bsd' in target_platform)
+
+      elif name == 'pp_ifdef':
+        def pp_ifdef(symbol):
+          return symbol in defs
+        value = pp_ifdef
+      elif name == 'pp_if':
+        def pp_if(symbol):
+          return defs.get(symbol, False)
+        value = pp_if
+
+      elif name in defs:
+        value = defs[name]
+      elif name in extra_variables:
+        value = extra_variables[name]
+      else:
+        # Undefined variables default to False.
+        value = False
+
+      variable_map[name] = value
+
+    eval_result = eval(code, {}, variable_map)
+    assert isinstance(eval_result, bool)
+    return eval_result
+
+  def EvaluateCondition(self, expr):
+    '''Returns true if and only if the Python expression 'expr' evaluates
+    to true.
+
+    The expression is given a few local variables:
+      - 'lang' is the language currently being output
+           (the 'lang' attribute of the <output> element).
+      - 'context' is the current output context
+           (the 'context' attribute of the <output> element).
+      - 'defs' is a map of C preprocessor-style symbol names to their values.
+      - 'os' is the current platform (likely 'linux2', 'win32' or 'darwin').
+      - 'pp_ifdef(symbol)' is a shorthand for "symbol in defs".
+      - 'pp_if(symbol)' is a shorthand for "symbol in defs and defs[symbol]".
+      - 'is_linux', 'is_macosx', 'is_win', 'is_posix' are true if 'os'
+           matches the given platform.
+    '''
+    root = self.GetRoot()
+    lang = getattr(root, 'output_language', '')
+    context = getattr(root, 'output_context', '')
+    defs = getattr(root, 'defines', {})
+    target_platform = getattr(root, 'target_platform', '')
+    extra_variables = {
+        'lang': lang,
+        'context': context,
+    }
+    return Node.EvaluateExpression(
+        expr, defs, target_platform, extra_variables)
+
+  def OnlyTheseTranslations(self, languages):
+    '''Turns off loading of translations for languages not in the provided list.
+
+    Attrs:
+      languages: ['fr', 'zh_cn']
+    '''
+    for node in self:
+      if (hasattr(node, 'IsTranslation') and
+          node.IsTranslation() and
+          node.GetLang() not in languages):
+        node.DisableLoading()
+
+  def FindBooleanAttribute(self, attr, default, skip_self):
+    '''Searches all ancestors of the current node for the nearest enclosing
+    definition of the given boolean attribute.
+
+    Args:
+      attr: 'fallback_to_english'
+      default: What to return if no node defines the attribute.
+      skip_self: Don't check the current node, only its parents.
+    '''
+    p = self.parent if skip_self else self
+    while p:
+      value = p.attrs.get(attr, 'default').lower()
+      if value != 'default':
+        return (value == 'true')
+      p = p.parent
+    return default
+
+  def PseudoIsAllowed(self):
+    '''Returns true if this node is allowed to use pseudo-translations.  This
+    is true by default, unless this node is within a <release> node that has
+    the allow_pseudo attribute set to false.
+    '''
+    return self.FindBooleanAttribute('allow_pseudo',
+                                     default=True, skip_self=True)
+
+  def ShouldFallbackToEnglish(self):
+    '''Returns true iff this node should fall back to English when
+    pseudotranslations are disabled and no translation is available for a
+    given message.
+    '''
+    return self.FindBooleanAttribute('fallback_to_english',
+                                     default=False, skip_self=True)
+
+  def WhitelistMarkedAsSkip(self):
+    '''Returns true if the node is marked to be skipped in the output by a
+    whitelist.
+    '''
+    return self._whitelist_marked_as_skip
+
+  def SetWhitelistMarkedAsSkip(self, mark_skipped):
+    '''Sets WhitelistMarkedAsSkip.
+    '''
+    self._whitelist_marked_as_skip = mark_skipped
+
+  def ExpandVariables(self):
+    '''Whether we need to expand variables on a given node.'''
+    return False
+
+  def IsResourceMapSource(self):
+    '''Whether this node is a resource map source.'''
+    return False
+
+  def CompressDataIfNeeded(self, data):
+    '''Compress data using the format specified in the compress attribute.
+
+    Args:
+      data: The data to compressed.
+    Returns:
+      The data in gzipped or brotli compressed format. If the format is
+      unspecified then this returns the data uncompressed.
+    '''
+
+    compress = self.attrs.get('compress')
+
+    # Compress JS, HTML, CSS and SVG files by default (gzip), unless |compress|
+    # is explicitly specified.
+    compress_by_default = (compress == 'default'
+                           and self.attrs.get('file').endswith(
+                               self._COMPRESS_BY_DEFAULT_EXTENSIONS))
+
+    if compress == 'gzip' or compress_by_default:
+      # We only use rsyncable compression on Linux.
+      # We exclude ChromeOS since ChromeOS bots are Linux based but do not have
+      # the --rsyncable option built in for gzip. See crbug.com/617950.
+      if sys.platform == 'linux2' and 'chromeos' not in self.GetRoot().defines:
+        return grit.format.gzip_string.GzipStringRsyncable(data)
+      return grit.format.gzip_string.GzipString(data)
+
+    if compress == 'brotli':
+      # The length of the uncompressed data as 8 bytes little-endian.
+      size_bytes = struct.pack("<q", len(data))
+      data = brotli_util.BrotliCompress(data)
+      # BROTLI_CONST is prepended to brotli decompressed data in order to
+      # easily check if a resource has been brotli compressed.
+      # The length of the uncompressed data is also appended to the start,
+      # truncated to 6 bytes, little-endian. size_bytes is 8 bytes,
+      # need to truncate further to 6.
+      formatter = b'%ds %dx %ds' % (6, 2, len(size_bytes) - 8)
+      return (constants.BROTLI_CONST +
+             b''.join(struct.unpack(formatter, size_bytes)) +
+             data)
+
+    if compress == 'false' or compress == 'default':
+      return data
+
+    raise Exception('Invalid value for compression')
+
+
+class ContentNode(Node):
+  '''Convenience baseclass for nodes that can have content.'''
+  def _ContentType(self):
+    return self._CONTENT_TYPE_MIXED
diff --git a/tools/grit/grit/node/base_unittest.py b/tools/grit/grit/node/base_unittest.py
new file mode 100644
index 0000000000..32a5a0ca59
--- /dev/null
+++ b/tools/grit/grit/node/base_unittest.py
@@ -0,0 +1,259 @@
+#!/usr/bin/env python
+# Copyright (c) 2012 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.
+
+'''Unit tests for base.Node functionality (as used in various subclasses)'''
+
+from __future__ import print_function
+
+import os
+import sys
+if __name__ == '__main__':
+  sys.path.append(os.path.join(os.path.dirname(__file__), '../..'))
+
+import unittest
+
+from six import StringIO
+
+from grit import grd_reader
+from grit import util
+from grit.node import base
+from grit.node import message
+
+
+def MakePlaceholder(phname='BINGO'):
+  ph = message.PhNode()
+  ph.StartParsing(u'ph', None)
+  ph.HandleAttribute(u'name', phname)
+  ph.AppendContent(u'bongo')
+  ph.EndParsing()
+  return ph
+
+
+class NodeUnittest(unittest.TestCase):
+  def testWhitespaceHandling(self):
+    # We test using the Message node type.
+    node = message.MessageNode()
+    node.StartParsing(u'hello', None)
+    node.HandleAttribute(u'name', u'bla')
+    node.AppendContent(u" '''  two spaces  ")
+    node.EndParsing()
+    self.failUnless(node.GetCdata() == u'  two spaces')
+
+    node = message.MessageNode()
+    node.StartParsing(u'message', None)
+    node.HandleAttribute(u'name', u'bla')
+    node.AppendContent(u"  two spaces  '''  ")
+    node.EndParsing()
+    self.failUnless(node.GetCdata() == u'two spaces  ')
+
+  def testWhitespaceHandlingWithChildren(self):
+    # We test using the Message node type.
+    node = message.MessageNode()
+    node.StartParsing(u'message', None)
+    node.HandleAttribute(u'name', u'bla')
+    node.AppendContent(u" '''  two spaces  ")
+    node.AddChild(MakePlaceholder())
+    node.AppendContent(u' space before and after ')
+    node.AddChild(MakePlaceholder('BONGO'))
+    node.AppendContent(u" space before two after  '''")
+    node.EndParsing()
+    self.failUnless(node.mixed_content[0] == u'  two spaces  ')
+    self.failUnless(node.mixed_content[2] == u' space before and after ')
+    self.failUnless(node.mixed_content[-1] == u' space before two after  ')
+
+  def testXmlFormatMixedContent(self):
+    # Again test using the Message node type, because it is the only mixed
+    # content node.
+    node = message.MessageNode()
+    node.StartParsing(u'message', None)
+    node.HandleAttribute(u'name', u'name')
+    node.AppendContent(u'Hello <young> ')
+
+    ph = message.PhNode()
+    ph.StartParsing(u'ph', None)
+    ph.HandleAttribute(u'name', u'USERNAME')
+    ph.AppendContent(u'$1')
+    ex = message.ExNode()
+    ex.StartParsing(u'ex', None)
+    ex.AppendContent(u'Joi')
+    ex.EndParsing()
+    ph.AddChild(ex)
+    ph.EndParsing()
+
+    node.AddChild(ph)
+    node.EndParsing()
+
+    non_indented_xml = node.FormatXml()
+    self.failUnless(non_indented_xml == u'<message name="name">\n  Hello '
+                    u'&lt;young&gt; <ph name="USERNAME">$1<ex>Joi</ex></ph>'
+                    u'\n</message>')
+
+    indented_xml = node.FormatXml(u'  ')
+    self.failUnless(indented_xml == u'  <message name="name">\n    Hello '
+                    u'&lt;young&gt; <ph name="USERNAME">$1<ex>Joi</ex></ph>'
+                    u'\n  </message>')
+
+  def testXmlFormatMixedContentWithLeadingWhitespace(self):
+    # Again test using the Message node type, because it is the only mixed
+    # content node.
+    node = message.MessageNode()
+    node.StartParsing(u'message', None)
+    node.HandleAttribute(u'name', u'name')
+    node.AppendContent(u"'''   Hello <young> ")
+
+    ph = message.PhNode()
+    ph.StartParsing(u'ph', None)
+    ph.HandleAttribute(u'name', u'USERNAME')
+    ph.AppendContent(u'$1')
+    ex = message.ExNode()
+    ex.StartParsing(u'ex', None)
+    ex.AppendContent(u'Joi')
+    ex.EndParsing()
+    ph.AddChild(ex)
+    ph.EndParsing()
+
+    node.AddChild(ph)
+    node.AppendContent(u" yessiree '''")
+    node.EndParsing()
+
+    non_indented_xml = node.FormatXml()
+    self.failUnless(non_indented_xml ==
+                    u"<message name=\"name\">\n  '''   Hello"
+                    u' &lt;young&gt; <ph name="USERNAME">$1<ex>Joi</ex></ph>'
+                    u" yessiree '''\n</message>")
+
+    indented_xml = node.FormatXml(u'  ')
+    self.failUnless(indented_xml ==
+                    u"  <message name=\"name\">\n    '''   Hello"
+                    u' &lt;young&gt; <ph name="USERNAME">$1<ex>Joi</ex></ph>'
+                    u" yessiree '''\n  </message>")
+
+    self.failUnless(node.GetNodeById('name'))
+
+  def testXmlFormatContentWithEntities(self):
+    '''Tests a bug where &nbsp; would not be escaped correctly.'''
+    from grit import tclib
+    msg_node = message.MessageNode.Construct(None, tclib.Message(
+      text = 'BEGIN_BOLDHelloWHITESPACEthere!END_BOLD Bingo!',
+      placeholders = [
+        tclib.Placeholder('BEGIN_BOLD', '<b>', 'bla'),
+        tclib.Placeholder('WHITESPACE', '&nbsp;', 'bla'),
+        tclib.Placeholder('END_BOLD', '</b>', 'bla')]),
+                                             'BINGOBONGO')
+    xml = msg_node.FormatXml()
+    self.failUnless(xml.find('&nbsp;') == -1, 'should have no entities')
+
+  def testIter(self):
+    # First build a little tree of message and ph nodes.
+    node = message.MessageNode()
+    node.StartParsing(u'message', None)
+    node.HandleAttribute(u'name', u'bla')
+    node.AppendContent(u" '''  two spaces  ")
+    node.AppendContent(u' space before and after ')
+    ph = message.PhNode()
+    ph.StartParsing(u'ph', None)
+    ph.AddChild(message.ExNode())
+    ph.HandleAttribute(u'name', u'BINGO')
+    ph.AppendContent(u'bongo')
+    node.AddChild(ph)
+    node.AddChild(message.PhNode())
+    node.AppendContent(u" space before two after  '''")
+
+    order = [message.MessageNode, message.PhNode, message.ExNode, message.PhNode]
+    for n in node:
+      self.failUnless(type(n) == order[0])
+      order = order[1:]
+    self.failUnless(len(order) == 0)
+
+  def testGetChildrenOfType(self):
+    xml = '''<?xml version="1.0" encoding="UTF-8"?>
+      <grit latest_public_release="2" source_lang_id="en-US"
+            current_release="3" base_dir=".">
+        <outputs>
+          <output filename="resource.h" type="rc_header" />
+          <output filename="en/generated_resources.rc" type="rc_all"
+                  lang="en" />
+          <if expr="pp_if('NOT_TRUE')">
+            <output filename="de/generated_resources.rc" type="rc_all"
+                    lang="de" />
+          </if>
+        </outputs>
+        <release seq="3">
+          <messages>
+            <message name="ID_HELLO">Hello!</message>
+          </messages>
+        </release>
+      </grit>'''
+    grd = grd_reader.Parse(StringIO(xml),
+                           util.PathFromRoot('grit/test/data'))
+    from grit.node import node_io
+    output_nodes = grd.GetChildrenOfType(node_io.OutputNode)
+    self.failUnlessEqual(len(output_nodes), 3)
+    self.failUnlessEqual(output_nodes[2].attrs['filename'],
+                         'de/generated_resources.rc')
+
+  def testEvaluateExpression(self):
+    def AssertExpr(expected_value, expr, defs, target_platform,
+                   extra_variables):
+      self.failUnlessEqual(expected_value, base.Node.EvaluateExpression(
+          expr, defs, target_platform, extra_variables))
+
+    AssertExpr(True, "True", {}, 'linux', {})
+    AssertExpr(False, "False", {}, 'linux', {})
+    AssertExpr(True, "True or False", {}, 'linux', {})
+    AssertExpr(False, "True and False", {}, 'linux', {})
+    AssertExpr(True, "os == 'linux'", {}, 'linux', {})
+    AssertExpr(False, "os == 'linux'", {}, 'ios', {})
+    AssertExpr(True, "'foo' in defs", {'foo': 'bar'}, 'ios', {})
+    AssertExpr(False, "'foo' in defs", {'baz': 'bar'}, 'ios', {})
+    AssertExpr(False, "'foo' in defs", {}, 'ios', {})
+    AssertExpr(True, "is_linux", {}, 'linux2', {})
+    AssertExpr(False, "is_linux", {}, 'win32', {})
+    AssertExpr(True, "is_macosx", {}, 'darwin', {})
+    AssertExpr(False, "is_macosx", {}, 'ios', {})
+    AssertExpr(True, "is_win", {}, 'win32', {})
+    AssertExpr(False, "is_win", {}, 'darwin', {})
+    AssertExpr(True, "is_android", {}, 'android', {})
+    AssertExpr(False, "is_android", {}, 'linux3', {})
+    AssertExpr(True, "is_ios", {}, 'ios', {})
+    AssertExpr(False, "is_ios", {}, 'darwin', {})
+    AssertExpr(True, "is_posix", {}, 'linux2', {})
+    AssertExpr(True, "is_posix", {}, 'darwin', {})
+    AssertExpr(True, "is_posix", {}, 'android', {})
+    AssertExpr(True, "is_posix", {}, 'ios', {})
+    AssertExpr(True, "is_posix", {}, 'freebsd7', {})
+    AssertExpr(False, "is_posix", {}, 'win32', {})
+    AssertExpr(True, "pp_ifdef('foo')", {'foo': True}, 'win32', {})
+    AssertExpr(True, "pp_ifdef('foo')", {'foo': False}, 'win32', {})
+    AssertExpr(False, "pp_ifdef('foo')", {'bar': True}, 'win32', {})
+    AssertExpr(True, "pp_if('foo')", {'foo': True}, 'win32', {})
+    AssertExpr(False, "pp_if('foo')", {'foo': False}, 'win32', {})
+    AssertExpr(False, "pp_if('foo')", {'bar': True}, 'win32', {})
+    AssertExpr(True, "foo", {'foo': True}, 'win32', {})
+    AssertExpr(False, "foo", {'foo': False}, 'win32', {})
+    AssertExpr(False, "foo", {'bar': True}, 'win32', {})
+    AssertExpr(True, "foo == 'baz'", {'foo': 'baz'}, 'win32', {})
+    AssertExpr(False, "foo == 'baz'", {'foo': True}, 'win32', {})
+    AssertExpr(False, "foo == 'baz'", {}, 'win32', {})
+    AssertExpr(True, "lang == 'de'", {}, 'win32', {'lang': 'de'})
+    AssertExpr(False, "lang == 'de'", {}, 'win32', {'lang': 'fr'})
+    AssertExpr(False, "lang == 'de'", {}, 'win32', {})
+
+    # Test a couple more complex expressions for good measure.
+    AssertExpr(True, "is_ios and (lang in ['de', 'fr'] or foo)",
+               {'foo': 'bar'}, 'ios', {'lang': 'fr', 'context': 'today'})
+    AssertExpr(False, "is_ios and (lang in ['de', 'fr'] or foo)",
+               {'foo': False}, 'linux2', {'lang': 'fr', 'context': 'today'})
+    AssertExpr(False, "is_ios and (lang in ['de', 'fr'] or foo)",
+               {'baz': 'bar'}, 'ios', {'lang': 'he', 'context': 'today'})
+    AssertExpr(True, "foo == 'bar' or not baz",
+               {'foo': 'bar', 'fun': True}, 'ios', {'lang': 'en'})
+    AssertExpr(True, "foo == 'bar' or not baz",
+               {}, 'ios', {'lang': 'en', 'context': 'java'})
+    AssertExpr(False, "foo == 'bar' or not baz",
+               {'foo': 'ruz', 'baz': True}, 'ios', {'lang': 'en'})
+
+if __name__ == '__main__':
+  unittest.main()
diff --git a/tools/grit/grit/node/brotli_util.py b/tools/grit/grit/node/brotli_util.py
new file mode 100644
index 0000000000..77f70e49d5
--- /dev/null
+++ b/tools/grit/grit/node/brotli_util.py
@@ -0,0 +1,29 @@
+# Copyright 2019 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.
+
+"""Framework for compressing resources using Brotli."""
+
+import subprocess
+
+__brotli_executable = None
+
+
+def SetBrotliCommand(brotli):
+  # brotli is a list. In production it contains the path to the Brotli executable.
+  # During testing it contains [python, mock_brotli.py] for testing on Windows.
+  global __brotli_executable
+  __brotli_executable = brotli
+
+
+def BrotliCompress(data):
+  if not __brotli_executable:
+    raise Exception('Add "use_brotli = true" to you GN grit(...) target ' +
+                    'if you want to use brotli.')
+  compress = subprocess.Popen(__brotli_executable + ['-', '-f'],
+                              stdin=subprocess.PIPE, stdout=subprocess.PIPE)
+  return compress.communicate(data)[0]
+
+def IsInitialized():
+  global __brotli_executable
+  return __brotli_executable is not None
diff --git a/tools/grit/grit/node/custom/__init__.py b/tools/grit/grit/node/custom/__init__.py
new file mode 100644
index 0000000000..e179cf7730
--- /dev/null
+++ b/tools/grit/grit/node/custom/__init__.py
@@ -0,0 +1,8 @@
+# Copyright (c) 2012 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.
+
+'''Package 'grit.node.custom'
+'''
+
+pass
diff --git a/tools/grit/grit/node/custom/filename.py b/tools/grit/grit/node/custom/filename.py
new file mode 100644
index 0000000000..55a27e58c1
--- /dev/null
+++ b/tools/grit/grit/node/custom/filename.py
@@ -0,0 +1,29 @@
+# Copyright (c) 2012 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.
+
+'''A CustomType for filenames.'''
+
+from __future__ import print_function
+
+from grit import clique
+from grit import lazy_re
+
+
+class WindowsFilename(clique.CustomType):
+  '''Validates that messages can be used as Windows filenames, and strips
+  illegal characters out of translations.
+  '''
+
+  BANNED = lazy_re.compile(r'\+|:|\/|\\\\|\*|\?|\"|\<|\>|\|')
+
+  def Validate(self, message):
+    return not self.BANNED.search(message.GetPresentableContent())
+
+  def ValidateAndModify(self, lang, translation):
+    is_ok = self.Validate(translation)
+    self.ModifyEachTextPart(lang, translation)
+    return is_ok
+
+  def ModifyTextPart(self, lang, text):
+    return self.BANNED.sub(' ', text)
diff --git a/tools/grit/grit/node/custom/filename_unittest.py b/tools/grit/grit/node/custom/filename_unittest.py
new file mode 100644
index 0000000000..8e2a6dd64a
--- /dev/null
+++ b/tools/grit/grit/node/custom/filename_unittest.py
@@ -0,0 +1,34 @@
+#!/usr/bin/env python
+# Copyright (c) 2012 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.
+
+'''Unit tests for grit.node.custom.filename'''
+
+from __future__ import print_function
+
+import os
+import sys
+if __name__ == '__main__':
+  sys.path.append(os.path.join(os.path.dirname(__file__), '../../..'))
+
+import unittest
+from grit.node.custom import filename
+from grit import clique
+from grit import tclib
+
+
+class WindowsFilenameUnittest(unittest.TestCase):
+
+  def testValidate(self):
+    factory = clique.UberClique()
+    msg = tclib.Message(text='Bingo bongo')
+    c = factory.MakeClique(msg)
+    c.SetCustomType(filename.WindowsFilename())
+    translation = tclib.Translation(id=msg.GetId(), text='Bilingo bolongo:')
+    c.AddTranslation(translation, 'fr')
+    self.failUnless(c.MessageForLanguage('fr').GetRealContent() == 'Bilingo bolongo ')
+
+
+if __name__ == '__main__':
+  unittest.main()
diff --git a/tools/grit/grit/node/empty.py b/tools/grit/grit/node/empty.py
new file mode 100644
index 0000000000..e19d2c4ddb
--- /dev/null
+++ b/tools/grit/grit/node/empty.py
@@ -0,0 +1,64 @@
+# Copyright (c) 2012 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.
+
+'''Container nodes that don't have any logic.
+'''
+
+from __future__ import print_function
+
+from grit.node import base
+from grit.node import include
+from grit.node import message
+from grit.node import misc
+from grit.node import node_io
+from grit.node import structure
+
+
+class GroupingNode(base.Node):
+  '''Base class for all the grouping elements (<structures>, <includes>,
+  <messages> and <identifiers>).'''
+  def DefaultAttributes(self):
+    return {
+      'first_id' : '',
+      'comment' : '',
+      'fallback_to_english' : 'false',
+      'fallback_to_low_resolution' : 'false',
+    }
+
+
+class IncludesNode(GroupingNode):
+  '''The <includes> element.'''
+  def _IsValidChild(self, child):
+    return isinstance(child, (include.IncludeNode, misc.IfNode, misc.PartNode))
+
+
+class MessagesNode(GroupingNode):
+  '''The <messages> element.'''
+  def _IsValidChild(self, child):
+    return isinstance(child, (message.MessageNode, misc.IfNode, misc.PartNode))
+
+
+class StructuresNode(GroupingNode):
+  '''The <structures> element.'''
+  def _IsValidChild(self, child):
+    return isinstance(child, (structure.StructureNode,
+                              misc.IfNode, misc.PartNode))
+
+
+class TranslationsNode(base.Node):
+  '''The <translations> element.'''
+  def _IsValidChild(self, child):
+    return isinstance(child, (node_io.FileNode, misc.IfNode, misc.PartNode))
+
+
+class OutputsNode(base.Node):
+  '''The <outputs> element.'''
+  def _IsValidChild(self, child):
+    return isinstance(child, (node_io.OutputNode, misc.IfNode, misc.PartNode))
+
+
+class IdentifiersNode(GroupingNode):
+  '''The <identifiers> element.'''
+  def _IsValidChild(self, child):
+    return isinstance(child, misc.IdentifierNode)
diff --git a/tools/grit/grit/node/include.py b/tools/grit/grit/node/include.py
new file mode 100644
index 0000000000..b06b9889bb
--- /dev/null
+++ b/tools/grit/grit/node/include.py
@@ -0,0 +1,170 @@
+# Copyright (c) 2012 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.
+
+"""Handling of the <include> element.
+"""
+
+from __future__ import print_function
+
+import os
+
+from grit import util
+import grit.format.html_inline
+import grit.format.rc
+from grit.format import minifier
+from grit.node import base
+
+class IncludeNode(base.Node):
+  """An <include> element."""
+
+  def __init__(self):
+    super(IncludeNode, self).__init__()
+
+    # Cache flattened data so that we don't flatten the same file
+    # multiple times.
+    self._flattened_data = None
+    # Also keep track of the last filename we flattened to, so we can
+    # avoid doing it more than once.
+    self._last_flat_filename = None
+
+  def _IsValidChild(self, child):
+    return False
+
+  def _GetFlattenedData(
+      self, allow_external_script=False, preprocess_only=False):
+    if not self._flattened_data:
+      filename = self.ToRealPath(self.GetInputPath())
+      self._flattened_data = (
+          grit.format.html_inline.InlineToString(filename, self,
+              preprocess_only=preprocess_only,
+              allow_external_script=allow_external_script))
+    return self._flattened_data.encode('utf-8')
+
+  def MandatoryAttributes(self):
+    return ['name', 'type', 'file']
+
+  def DefaultAttributes(self):
+    """Attributes:
+       translateable:         False if the node has contents that should not be
+                              translated.
+       preprocess:            Takes the same code path as flattenhtml, but it
+                              disables any  processing/inlining outside of <if>
+                              and <include>.
+       compress:              The format to compress the data with, e.g. 'gzip'
+                              or 'false' if data should not be compressed.
+       skip_minify:           If true, skips minifying the node's contents.
+       skip_in_resource_map:  If true, do not add to the resource map.
+    """
+    return {
+        'translateable': 'true',
+        'generateid': 'true',
+        'filenameonly': 'false',
+        'mkoutput': 'false',
+        'preprocess': 'false',
+        'flattenhtml': 'false',
+        'compress': 'default',
+        'allowexternalscript': 'false',
+        'relativepath': 'false',
+        'use_base_dir': 'true',
+        'skip_minify': 'false',
+        'skip_in_resource_map': 'false',
+    }
+
+  def GetInputPath(self):
+    # Do not mess with absolute paths, that would make them invalid.
+    if os.path.isabs(os.path.expandvars(self.attrs['file'])):
+      return self.attrs['file']
+
+    # We have no control over code that calls ToRealPath later, so convert
+    # the path to be relative against our basedir.
+    if self.attrs.get('use_base_dir', 'true') != 'true':
+      # Normalize the directory path to use the appropriate OS separator.
+      # GetBaseDir() may return paths\like\this or paths/like/this, since it is
+      # read from the base_dir attribute in the grd file.
+      norm_base_dir = util.normpath(self.GetRoot().GetBaseDir())
+      return os.path.relpath(self.attrs['file'], norm_base_dir)
+
+    return self.attrs['file']
+
+  def FileForLanguage(self, lang, output_dir):
+    """Returns the file for the specified language.  This allows us to return
+    different files for different language variants of the include file.
+    """
+    input_path = self.GetInputPath()
+    if input_path is None:
+      return None
+
+    return self.ToRealPath(input_path)
+
+  def GetDataPackValue(self, lang, encoding):
+    '''Returns bytes or a str represenation for a data_pack entry.'''
+    filename = self.ToRealPath(self.GetInputPath())
+    if self.attrs['flattenhtml'] == 'true':
+      allow_external_script = self.attrs['allowexternalscript'] == 'true'
+      data = self._GetFlattenedData(allow_external_script=allow_external_script)
+    elif self.attrs['preprocess'] == 'true':
+      data = self._GetFlattenedData(preprocess_only=True)
+    else:
+      data = util.ReadFile(filename, util.BINARY)
+
+    if self.attrs['skip_minify'] != 'true':
+      # Note that the minifier will only do anything if a minifier command
+      # has been set in the command line.
+      data = minifier.Minify(data, filename)
+
+    # Include does not care about the encoding, because it only returns binary
+    # data.
+    return self.CompressDataIfNeeded(data)
+
+  def Process(self, output_dir):
+    """Rewrite file references to be base64 encoded data URLs.  The new file
+    will be written to output_dir and the name of the new file is returned."""
+    filename = self.ToRealPath(self.GetInputPath())
+    flat_filename = os.path.join(output_dir,
+        self.attrs['name'] + '_' + os.path.basename(filename))
+
+    if self._last_flat_filename == flat_filename:
+      return
+
+    with open(flat_filename, 'wb') as outfile:
+      outfile.write(self._GetFlattenedData())
+
+    self._last_flat_filename = flat_filename
+    return os.path.basename(flat_filename)
+
+  def GetHtmlResourceFilenames(self):
+    """Returns a set of all filenames inlined by this file."""
+    allow_external_script = self.attrs['allowexternalscript'] == 'true'
+    return grit.format.html_inline.GetResourceFilenames(
+         self.ToRealPath(self.GetInputPath()),
+         self,
+         allow_external_script=allow_external_script)
+
+  def IsResourceMapSource(self):
+    skip = self.attrs.get('skip_in_resource_map', 'false') == 'true'
+    return not skip
+
+  @staticmethod
+  def Construct(parent, name, type, file, translateable=True,
+                filenameonly=False, mkoutput=False, relativepath=False):
+    """Creates a new node which is a child of 'parent', with attributes set
+    by parameters of the same name.
+    """
+    # Convert types to appropriate strings
+    translateable = util.BoolToString(translateable)
+    filenameonly = util.BoolToString(filenameonly)
+    mkoutput = util.BoolToString(mkoutput)
+    relativepath = util.BoolToString(relativepath)
+
+    node = IncludeNode()
+    node.StartParsing('include', parent)
+    node.HandleAttribute('name', name)
+    node.HandleAttribute('type', type)
+    node.HandleAttribute('file', file)
+    node.HandleAttribute('translateable', translateable)
+    node.HandleAttribute('filenameonly', filenameonly)
+    node.HandleAttribute('mkoutput', mkoutput)
+    node.HandleAttribute('relativepath', relativepath)
+    node.EndParsing()
+    return node
diff --git a/tools/grit/grit/node/include_unittest.py b/tools/grit/grit/node/include_unittest.py
new file mode 100644
index 0000000000..4c658f1ffe
--- /dev/null
+++ b/tools/grit/grit/node/include_unittest.py
@@ -0,0 +1,134 @@
+#!/usr/bin/env python
+# Copyright (c) 2013 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.
+
+'''Unit tests for include.IncludeNode'''
+
+from __future__ import print_function
+
+import os
+import sys
+import unittest
+import zlib
+
+if __name__ == '__main__':
+  sys.path.append(os.path.join(os.path.dirname(__file__), '../..'))
+
+from grit.node import misc
+from grit.node import include
+from grit.node import empty
+from grit import util
+
+
+def checkIsGzipped(filename, compress_attr):
+  test_data_root = util.PathFromRoot('grit/testdata')
+  root = util.ParseGrdForUnittest(
+      '''
+      <includes>
+        <include name="TEST_TXT" file="%s" %s type="BINDATA"/>
+      </includes>''' % (filename, compress_attr),
+      base_dir=test_data_root)
+  node, = root.GetChildrenOfType(include.IncludeNode)
+  compressed = node.GetDataPackValue(lang='en', encoding=util.BINARY)
+
+  decompressed_data = zlib.decompress(compressed, 16 + zlib.MAX_WBITS)
+  expected = util.ReadFile(os.path.join(test_data_root, filename), util.BINARY)
+  return expected == decompressed_data
+
+
+class IncludeNodeUnittest(unittest.TestCase):
+  def testGetPath(self):
+    root = misc.GritNode()
+    root.StartParsing(u'grit', None)
+    root.HandleAttribute(u'latest_public_release', u'0')
+    root.HandleAttribute(u'current_release', u'1')
+    root.HandleAttribute(u'base_dir', r'..\resource')
+    release = misc.ReleaseNode()
+    release.StartParsing(u'release', root)
+    release.HandleAttribute(u'seq', u'1')
+    root.AddChild(release)
+    includes = empty.IncludesNode()
+    includes.StartParsing(u'includes', release)
+    release.AddChild(includes)
+    include_node = include.IncludeNode()
+    include_node.StartParsing(u'include', includes)
+    include_node.HandleAttribute(u'file', r'flugel\kugel.pdf')
+    includes.AddChild(include_node)
+    root.EndParsing()
+
+    self.assertEqual(root.ToRealPath(include_node.GetInputPath()),
+                     util.normpath(
+                       os.path.join(r'../resource', r'flugel/kugel.pdf')))
+
+  def testGetPathNoBasedir(self):
+    root = misc.GritNode()
+    root.StartParsing(u'grit', None)
+    root.HandleAttribute(u'latest_public_release', u'0')
+    root.HandleAttribute(u'current_release', u'1')
+    root.HandleAttribute(u'base_dir', r'..\resource')
+    release = misc.ReleaseNode()
+    release.StartParsing(u'release', root)
+    release.HandleAttribute(u'seq', u'1')
+    root.AddChild(release)
+    includes = empty.IncludesNode()
+    includes.StartParsing(u'includes', release)
+    release.AddChild(includes)
+    include_node = include.IncludeNode()
+    include_node.StartParsing(u'include', includes)
+    include_node.HandleAttribute(u'file', r'flugel\kugel.pdf')
+    include_node.HandleAttribute(u'use_base_dir', u'false')
+    includes.AddChild(include_node)
+    root.EndParsing()
+
+    last_dir = os.path.basename(os.getcwd())
+    expected_path = util.normpath(os.path.join(
+        u'..', last_dir, u'flugel/kugel.pdf'))
+    self.assertEqual(root.ToRealPath(include_node.GetInputPath()),
+                     expected_path)
+
+  def testCompressGzip(self):
+    self.assertTrue(checkIsGzipped('test_text.txt', 'compress="gzip"'))
+
+  def testCompressGzipByDefault(self):
+    self.assertTrue(checkIsGzipped('test_html.html', ''))
+    self.assertTrue(checkIsGzipped('test_js.js', ''))
+    self.assertTrue(checkIsGzipped('test_css.css', ''))
+    self.assertTrue(checkIsGzipped('test_svg.svg', ''))
+
+    self.assertTrue(checkIsGzipped('test_html.html', 'compress="default"'))
+    self.assertTrue(checkIsGzipped('test_js.js', 'compress="default"'))
+    self.assertTrue(checkIsGzipped('test_css.css', 'compress="default"'))
+    self.assertTrue(checkIsGzipped('test_svg.svg', 'compress="default"'))
+
+  def testSkipInResourceMap(self):
+    root = util.ParseGrdForUnittest('''
+        <includes>
+          <include name="TEST1_TXT" file="test1_text.txt" type="BINDATA"/>
+          <include name="TEST2_TXT" file="test1_text.txt" type="BINDATA"
+                                    skip_in_resource_map="true"/>
+          <include name="TEST3_TXT" file="test1_text.txt" type="BINDATA"
+                                    skip_in_resource_map="false"/>
+        </includes>''', base_dir = util.PathFromRoot('grit/testdata'))
+    inc = root.GetChildrenOfType(include.IncludeNode)
+    self.assertTrue(inc[0].IsResourceMapSource())
+    self.assertFalse(inc[1].IsResourceMapSource())
+    self.assertTrue(inc[2].IsResourceMapSource())
+
+  def testAcceptsPreprocess(self):
+    root = util.ParseGrdForUnittest(
+        '''
+        <includes>
+          <include name="PREPROCESS_TEST" file="preprocess_test.html"
+                   preprocess="true" compress="false" type="chrome_html"/>
+        </includes>''',
+        base_dir=util.PathFromRoot('grit/testdata'))
+    inc, = root.GetChildrenOfType(include.IncludeNode)
+    result = inc.GetDataPackValue(lang='en', encoding=util.BINARY)
+    self.assertIn(b'should be kept', result)
+    self.assertIn(b'in the middle...', result)
+    self.assertNotIn(b'should be removed', result)
+
+
+if __name__ == '__main__':
+  unittest.main()
diff --git a/tools/grit/grit/node/mapping.py b/tools/grit/grit/node/mapping.py
new file mode 100644
index 0000000000..6297f0b666
--- /dev/null
+++ b/tools/grit/grit/node/mapping.py
@@ -0,0 +1,60 @@
+# Copyright (c) 2012 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.
+
+'''Maps each node type to an implementation class.
+When adding a new node type, you add to this mapping.
+'''
+
+from __future__ import print_function
+
+from grit import exception
+
+from grit.node import empty
+from grit.node import include
+from grit.node import message
+from grit.node import misc
+from grit.node import node_io
+from grit.node import structure
+from grit.node import variant
+
+
+_ELEMENT_TO_CLASS = {
+  'identifiers'   : empty.IdentifiersNode,
+  'includes'      : empty.IncludesNode,
+  'messages'      : empty.MessagesNode,
+  'outputs'       : empty.OutputsNode,
+  'structures'    : empty.StructuresNode,
+  'translations'  : empty.TranslationsNode,
+  'include'       : include.IncludeNode,
+  'emit'          : node_io.EmitNode,
+  'file'          : node_io.FileNode,
+  'output'        : node_io.OutputNode,
+  'ex'            : message.ExNode,
+  'message'       : message.MessageNode,
+  'ph'            : message.PhNode,
+  'else'          : misc.ElseNode,
+  'grit'          : misc.GritNode,
+  'identifier'    : misc.IdentifierNode,
+  'if'            : misc.IfNode,
+  'part'          : misc.PartNode,
+  'release'       : misc.ReleaseNode,
+  'then'          : misc.ThenNode,
+  'structure'     : structure.StructureNode,
+  'skeleton'      : variant.SkeletonNode,
+}
+
+
+def ElementToClass(name, typeattr):
+  '''Maps an element to a class that handles the element.
+
+  Args:
+    name: 'element' (the name of the element)
+    typeattr: 'type' (the value of the type attribute, if present, else None)
+
+  Return:
+    type
+  '''
+  if name not in _ELEMENT_TO_CLASS:
+    raise exception.UnknownElement()
+  return _ELEMENT_TO_CLASS[name]
diff --git a/tools/grit/grit/node/message.py b/tools/grit/grit/node/message.py
new file mode 100644
index 0000000000..4fa83cf26b
--- /dev/null
+++ b/tools/grit/grit/node/message.py
@@ -0,0 +1,362 @@
+# Copyright (c) 2012 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.
+
+'''Handling of the <message> element.
+'''
+
+from __future__ import print_function
+
+import re
+
+import six
+
+from grit.node import base
+
+from grit import clique
+from grit import exception
+from grit import lazy_re
+from grit import tclib
+from grit import util
+
+
+# Matches exactly three dots ending a line or followed by whitespace.
+_ELLIPSIS_PATTERN = lazy_re.compile(r'(?<!\.)\.\.\.(?=$|\s)')
+_ELLIPSIS_SYMBOL = u'\u2026'  # Ellipsis
+
+# Finds whitespace at the start and end of a string which can be multiline.
+_WHITESPACE = lazy_re.compile(r'(?P<start>\s*)(?P<body>.+?)(?P<end>\s*)\Z',
+                              re.DOTALL | re.MULTILINE)
+
+# <ph> placeholder elements should contain the special character formatters
+# used to format <ph> element content.
+# Android format.
+_ANDROID_FORMAT = (r'%[1-9]+\$'
+                   r'([-#+ 0,(]*)([0-9]+)?(\.[0-9]+)?'
+                   r'([bBhHsScCdoxXeEfgGaAtT%n])')
+# Chrome l10n format.
+_CHROME_FORMAT = r'\$+\d'
+# Windows EWT numeric and GRIT %s %d formats.
+_OTHER_FORMAT = r'%[0-9sd]'
+
+# Finds formatters that must be in a placeholder (<ph>) element.
+_FORMATTERS = lazy_re.compile(
+    '(%s)|(%s)|(%s)' % (_ANDROID_FORMAT, _CHROME_FORMAT, _OTHER_FORMAT))
+_BAD_PLACEHOLDER_MSG = ('ERROR: Placeholder formatter found outside of <ph> '
+                        'tag in message "%s" in %s.')
+_INVALID_PH_CHAR_MSG = ('ERROR: Invalid format characters found in message '
+                        '"%s" <ph> tag in %s.')
+
+# Finds HTML tag tokens.
+_HTMLTOKEN = lazy_re.compile(r'<[/]?[a-z][a-z0-9]*[^>]*>', re.I)
+
+# Finds HTML entities.
+_HTMLENTITY = lazy_re.compile(r'&[^\s]*;')
+
+
+class MessageNode(base.ContentNode):
+  '''A <message> element.'''
+
+  # For splitting a list of things that can be separated by commas or
+  # whitespace
+  _SPLIT_RE = lazy_re.compile(r'\s*,\s*|\s+')
+
+  def __init__(self):
+    super(MessageNode, self).__init__()
+    # Valid after EndParsing, this is the MessageClique that contains the
+    # source message and any translations of it that have been loaded.
+    self.clique = None
+
+    # We don't send leading and trailing whitespace into the translation
+    # console, but rather tack it onto the source message and any
+    # translations when formatting them into RC files or what have you.
+    self.ws_at_start = ''  # Any whitespace characters at the start of the text
+    self.ws_at_end = ''  # --"-- at the end of the text
+
+    # A list of "shortcut groups" this message is in.  We check to make sure
+    # that shortcut keys (e.g. &J) within each shortcut group are unique.
+    self.shortcut_groups_ = []
+
+    # Formatter-specific data used to control the output of individual strings.
+    # formatter_data is a space separated list of C preprocessor-style
+    # definitions. Names without values are given the empty string value.
+    # Example: "foo=5 bar baz=100"
+    self.formatter_data = {}
+
+    # Whether or not to convert ... -> U+2026 within Translate().
+    self._replace_ellipsis = False
+
+  def _IsValidChild(self, child):
+    return isinstance(child, (PhNode))
+
+  def _IsValidAttribute(self, name, value):
+    if name not in [
+        'name', 'offset', 'translateable', 'desc', 'meaning',
+        'internal_comment', 'shortcut_groups', 'custom_type', 'validation_expr',
+        'use_name_for_id', 'sub_variable', 'formatter_data',
+        'is_accessibility_with_no_ui'
+    ]:
+      return False
+    if (name in ('translateable', 'sub_variable') and
+        value not in ['true', 'false']):
+      return False
+    return True
+
+  def SetReplaceEllipsis(self, value):
+    r'''Sets whether to replace ... with \u2026.
+    '''
+    self._replace_ellipsis = value
+
+  def MandatoryAttributes(self):
+    return ['name|offset']
+
+  def DefaultAttributes(self):
+    return {
+        'custom_type': '',
+        'desc': '',
+        'formatter_data': '',
+        'internal_comment': '',
+        'is_accessibility_with_no_ui': 'false',
+        'meaning': '',
+        'shortcut_groups': '',
+        'sub_variable': 'false',
+        'translateable': 'true',
+        'use_name_for_id': 'false',
+        'validation_expr': '',
+    }
+
+  def HandleAttribute(self, attrib, value):
+    base.ContentNode.HandleAttribute(self, attrib, value)
+    if attrib != 'formatter_data':
+      return
+
+    # Parse value, a space-separated list of defines, into a dict.
+    # Example: "foo=5 bar" -> {'foo':'5', 'bar':''}
+    for item in value.split():
+      name, _, val = item.partition('=')
+      self.formatter_data[name] = val
+
+  def GetTextualIds(self):
+    '''
+    Returns the concatenation of the parent's node first_id and
+    this node's offset if it has one, otherwise just call the
+    superclass' implementation
+    '''
+    if 'offset' not in self.attrs:
+      return super(MessageNode, self).GetTextualIds()
+
+    # we search for the first grouping node in the parents' list
+    # to take care of the case where the first parent is an <if> node
+    grouping_parent = self.parent
+    import grit.node.empty
+    while grouping_parent and not isinstance(grouping_parent,
+                                             grit.node.empty.GroupingNode):
+      grouping_parent = grouping_parent.parent
+
+    assert 'first_id' in grouping_parent.attrs
+    return [grouping_parent.attrs['first_id'] + '_' + self.attrs['offset']]
+
+  def IsTranslateable(self):
+    return self.attrs['translateable'] == 'true'
+
+  def EndParsing(self):
+    super(MessageNode, self).EndParsing()
+
+    # Make the text (including placeholder references) and list of placeholders,
+    # verify placeholder formats, then strip and store leading and trailing
+    # whitespace and create the tclib.Message() and a clique to contain it.
+
+    text = ''
+    placeholders = []
+
+    for item in self.mixed_content:
+      if isinstance(item, six.string_types):
+        # Not a <ph> element: fail if any <ph> formatters are detected.
+        if _FORMATTERS.search(item):
+          print(_BAD_PLACEHOLDER_MSG % (item, self.source))
+          raise exception.PlaceholderNotInsidePhNode
+        text += item
+      else:
+        # Extract the <ph> element components.
+        presentation = item.attrs['name'].upper()
+        text += presentation
+        ex = ' '  # <ex> example element cdata if present.
+        if len(item.children):
+          ex = item.children[0].GetCdata()
+        original = item.GetCdata()
+
+        # Sanity check the <ph> element content.
+        cdata = original
+        # Replace all HTML tag tokens in cdata.
+        match = _HTMLTOKEN.search(cdata)
+        while match:
+          cdata = cdata.replace(match.group(0), '_')
+          match = _HTMLTOKEN.search(cdata)
+        # Replace all HTML entities in cdata.
+        match = _HTMLENTITY.search(cdata)
+        while match:
+          cdata = cdata.replace(match.group(0), '_')
+          match = _HTMLENTITY.search(cdata)
+        # Remove first matching formatter from cdata.
+        match = _FORMATTERS.search(cdata)
+        if match:
+          cdata = cdata.replace(match.group(0), '')
+        # Fail if <ph> special chars remain in cdata.
+        if re.search(r'[%\$]', cdata):
+          message_id = self.attrs['name'] + ' ' + original;
+          print(_INVALID_PH_CHAR_MSG % (message_id, self.source))
+          raise exception.InvalidCharactersInsidePhNode
+
+        # Otherwise, accept this <ph> placeholder.
+        placeholders.append(tclib.Placeholder(presentation, original, ex))
+
+    m = _WHITESPACE.match(text)
+    if m:
+      self.ws_at_start = m.group('start')
+      self.ws_at_end = m.group('end')
+      text = m.group('body')
+
+    self.shortcut_groups_ = self._SPLIT_RE.split(self.attrs['shortcut_groups'])
+    self.shortcut_groups_ = [i for i in self.shortcut_groups_ if i != '']
+
+    description_or_id = self.attrs['desc']
+    if description_or_id == '' and 'name' in self.attrs:
+      description_or_id = 'ID: %s' % self.attrs['name']
+
+    assigned_id = None
+    if self.attrs['use_name_for_id'] == 'true':
+      assigned_id = self.attrs['name']
+    message = tclib.Message(text=text, placeholders=placeholders,
+                            description=description_or_id,
+                            meaning=self.attrs['meaning'],
+                            assigned_id=assigned_id)
+    self.InstallMessage(message)
+
+  def InstallMessage(self, message):
+    '''Sets this node's clique from a tclib.Message instance.
+
+    Args:
+      message: A tclib.Message.
+    '''
+    self.clique = self.UberClique().MakeClique(message, self.IsTranslateable())
+    for group in self.shortcut_groups_:
+      self.clique.AddToShortcutGroup(group)
+    if self.attrs['custom_type'] != '':
+      self.clique.SetCustomType(util.NewClassInstance(self.attrs['custom_type'],
+                                                      clique.CustomType))
+    elif self.attrs['validation_expr'] != '':
+      self.clique.SetCustomType(
+        clique.OneOffCustomType(self.attrs['validation_expr']))
+
+  def SubstituteMessages(self, substituter):
+    '''Applies substitution to this message.
+
+    Args:
+      substituter: a grit.util.Substituter object.
+    '''
+    message = substituter.SubstituteMessage(self.clique.GetMessage())
+    if message is not self.clique.GetMessage():
+      self.InstallMessage(message)
+
+  def GetCliques(self):
+    return [self.clique] if self.clique else []
+
+  def Translate(self, lang):
+    '''Returns a translated version of this message.
+    '''
+    assert self.clique
+    msg = self.clique.MessageForLanguage(lang,
+                                         self.PseudoIsAllowed(),
+                                         self.ShouldFallbackToEnglish()
+                                         ).GetRealContent()
+    if self._replace_ellipsis:
+      msg = _ELLIPSIS_PATTERN.sub(_ELLIPSIS_SYMBOL, msg)
+    # Always remove all byte order marks (\uFEFF) https://crbug.com/1033305
+    msg = msg.replace(u'\uFEFF','')
+    return msg.replace('[GRITLANGCODE]', lang)
+
+  def NameOrOffset(self):
+    key = 'name' if 'name' in self.attrs else 'offset'
+    return self.attrs[key]
+
+  def ExpandVariables(self):
+    '''We always expand variables on Messages.'''
+    return True
+
+  def GetDataPackValue(self, lang, encoding):
+    '''Returns a str represenation for a data_pack entry.'''
+    message = self.ws_at_start + self.Translate(lang) + self.ws_at_end
+    return util.Encode(message, encoding)
+
+  def IsResourceMapSource(self):
+    return True
+
+  @staticmethod
+  def Construct(parent, message, name, desc='', meaning='', translateable=True):
+    '''Constructs a new message node that is a child of 'parent', with the
+    name, desc, meaning and translateable attributes set using the same-named
+    parameters and the text of the message and any placeholders taken from
+    'message', which must be a tclib.Message() object.'''
+    # Convert type to appropriate string
+    translateable = 'true' if translateable else 'false'
+
+    node = MessageNode()
+    node.StartParsing('message', parent)
+    node.HandleAttribute('name', name)
+    node.HandleAttribute('desc', desc)
+    node.HandleAttribute('meaning', meaning)
+    node.HandleAttribute('translateable', translateable)
+
+    items = message.GetContent()
+    for ix, item in enumerate(items):
+      if isinstance(item, six.string_types):
+        # Ensure whitespace at front and back of message is correctly handled.
+        if ix == 0:
+          item = "'''" + item
+        if ix == len(items) - 1:
+          item = item + "'''"
+
+        node.AppendContent(item)
+      else:
+        phnode = PhNode()
+        phnode.StartParsing('ph', node)
+        phnode.HandleAttribute('name', item.GetPresentation())
+        phnode.AppendContent(item.GetOriginal())
+
+        if len(item.GetExample()) and item.GetExample() != ' ':
+          exnode = ExNode()
+          exnode.StartParsing('ex', phnode)
+          exnode.AppendContent(item.GetExample())
+          exnode.EndParsing()
+          phnode.AddChild(exnode)
+
+        phnode.EndParsing()
+        node.AddChild(phnode)
+
+    node.EndParsing()
+    return node
+
+
+class PhNode(base.ContentNode):
+  '''A <ph> element.'''
+
+  def _IsValidChild(self, child):
+    return isinstance(child, ExNode)
+
+  def MandatoryAttributes(self):
+    return ['name']
+
+  def EndParsing(self):
+    super(PhNode, self).EndParsing()
+    # We only allow a single example for each placeholder
+    if len(self.children) > 1:
+      raise exception.TooManyExamples()
+
+  def GetTextualIds(self):
+    # The 'name' attribute is not an ID.
+    return []
+
+
+class ExNode(base.ContentNode):
+  '''An <ex> element.'''
+  pass
diff --git a/tools/grit/grit/node/message_unittest.py b/tools/grit/grit/node/message_unittest.py
new file mode 100644
index 0000000000..7a4cbbedc2
--- /dev/null
+++ b/tools/grit/grit/node/message_unittest.py
@@ -0,0 +1,380 @@
+#!/usr/bin/env python
+# Copyright (c) 2012 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.
+
+'''Unit tests for grit.node.message'''
+
+from __future__ import print_function
+
+import os
+import sys
+import unittest
+
+if __name__ == '__main__':
+  sys.path.append(os.path.join(os.path.dirname(__file__), '../..'))
+
+from grit import exception
+from grit import tclib
+from grit import util
+from grit.node import message
+
+class MessageUnittest(unittest.TestCase):
+  def testMessage(self):
+    root = util.ParseGrdForUnittest('''
+        <messages>
+        <message name="IDS_GREETING"
+                 desc="Printed to greet the currently logged in user">
+        Hello <ph name="USERNAME">%s<ex>Joi</ex></ph>, how are you doing today?
+        </message>
+        </messages>''')
+    msg, = root.GetChildrenOfType(message.MessageNode)
+    cliques = msg.GetCliques()
+    content = cliques[0].GetMessage().GetPresentableContent()
+    self.failUnless(content == 'Hello USERNAME, how are you doing today?')
+
+  def testMessageWithWhitespace(self):
+    root = util.ParseGrdForUnittest("""\
+        <messages>
+        <message name="IDS_BLA" desc="">
+        '''  Hello there <ph name="USERNAME">%s</ph>   '''
+        </message>
+        </messages>""")
+    msg, = root.GetChildrenOfType(message.MessageNode)
+    content = msg.GetCliques()[0].GetMessage().GetPresentableContent()
+    self.failUnless(content == 'Hello there USERNAME')
+    self.failUnless(msg.ws_at_start == '  ')
+    self.failUnless(msg.ws_at_end == '   ')
+
+  def testConstruct(self):
+    msg = tclib.Message(text="   Hello USERNAME, how are you?   BINGO\t\t",
+                        placeholders=[tclib.Placeholder('USERNAME', '%s', 'Joi'),
+                                      tclib.Placeholder('BINGO', '%d', '11')])
+    msg_node = message.MessageNode.Construct(None, msg, 'BINGOBONGO')
+    self.failUnless(msg_node.children[0].name == 'ph')
+    self.failUnless(msg_node.children[0].children[0].name == 'ex')
+    self.failUnless(msg_node.children[0].children[0].GetCdata() == 'Joi')
+    self.failUnless(msg_node.children[1].children[0].GetCdata() == '11')
+    self.failUnless(msg_node.ws_at_start == '   ')
+    self.failUnless(msg_node.ws_at_end == '\t\t')
+
+  def testUnicodeConstruct(self):
+    text = u'Howdie \u00fe'
+    msg = tclib.Message(text=text)
+    msg_node = message.MessageNode.Construct(None, msg, 'BINGOBONGO')
+    msg_from_node = msg_node.GetCdata()
+    self.failUnless(msg_from_node == text)
+
+  def testFormatterData(self):
+    root = util.ParseGrdForUnittest("""\
+        <messages>
+        <message name="IDS_BLA" desc="" formatter_data="  foo=123 bar  qux=low">
+          Text
+        </message>
+        </messages>""")
+    msg, = root.GetChildrenOfType(message.MessageNode)
+    expected_formatter_data = {
+        'foo': '123',
+        'bar': '',
+        'qux': 'low'}
+
+    # Can't use assertDictEqual, not available in Python 2.6, so do it
+    # by hand.
+    self.failUnlessEqual(len(expected_formatter_data),
+                         len(msg.formatter_data))
+    for key in expected_formatter_data:
+      self.failUnlessEqual(expected_formatter_data[key],
+                           msg.formatter_data[key])
+
+  def testReplaceEllipsis(self):
+    root = util.ParseGrdForUnittest('''
+        <messages>
+        <message name="IDS_GREETING" desc="">
+        A...B.... <ph name="PH">%s<ex>A</ex></ph>... B... C...
+        </message>
+        </messages>''')
+    msg, = root.GetChildrenOfType(message.MessageNode)
+    msg.SetReplaceEllipsis(True)
+    content = msg.Translate('en')
+    self.failUnlessEqual(u'A...B.... %s\u2026 B\u2026 C\u2026', content)
+
+  def testRemoveByteOrderMark(self):
+    root = util.ParseGrdForUnittest(u'''
+        <messages>
+        <message name="IDS_HAS_BOM" desc="">
+        \uFEFFThis\uFEFF i\uFEFFs OK\uFEFF
+        </message>
+        </messages>''')
+    msg, = root.GetChildrenOfType(message.MessageNode)
+    content = msg.Translate('en')
+    self.failUnlessEqual(u'This is OK', content)
+
+  def testPlaceholderHasTooManyExamples(self):
+    try:
+      util.ParseGrdForUnittest("""\
+        <messages>
+        <message name="IDS_FOO" desc="foo">
+          Hi <ph name="NAME">$1<ex>Joi</ex><ex>Joy</ex></ph>
+        </message>
+        </messages>""")
+    except exception.TooManyExamples:
+      return
+    self.fail('Should have gotten exception')
+
+  def testPlaceholderHasInvalidName(self):
+    try:
+      util.ParseGrdForUnittest("""\
+        <messages>
+        <message name="IDS_FOO" desc="foo">
+          Hi <ph name="ABC!">$1</ph>
+        </message>
+        </messages>""")
+    except exception.InvalidPlaceholderName:
+      return
+    self.fail('Should have gotten exception')
+
+  def testChromeLocalizedFormatIsInsidePhNode(self):
+    try:
+      util.ParseGrdForUnittest("""\
+        <messages>
+        <message name="IDS_CHROME_L10N" desc="l10n format">
+          This message is missing the ph node: $1
+        </message>
+        </messages>""")
+    except exception.PlaceholderNotInsidePhNode:
+      return
+    self.fail('Should have gotten exception')
+
+  def testAndroidStringFormatIsInsidePhNode(self):
+    try:
+      util.ParseGrdForUnittest("""\
+        <messages>
+        <message name="IDS_ANDROID" desc="string format">
+          This message is missing a ph node: %1$s
+        </message>
+        </messages>""")
+    except exception.PlaceholderNotInsidePhNode:
+      return
+    self.fail('Should have gotten exception')
+
+  def testAndroidIntegerFormatIsInsidePhNode(self):
+    try:
+      util.ParseGrdForUnittest("""\
+        <messages>
+        <message name="IDS_ANDROID" desc="integer format">
+          This message is missing a ph node: %2$d
+        </message>
+        </messages>""")
+    except exception.PlaceholderNotInsidePhNode:
+      return
+    self.fail('Should have gotten exception')
+
+  def testAndroidIntegerWidthFormatIsInsidePhNode(self):
+    try:
+      util.ParseGrdForUnittest("""\
+        <messages>
+        <message name="IDS_ANDROID" desc="integer width format">
+          This message is missing a ph node: %2$3d
+        </message>
+        </messages>""")
+    except exception.PlaceholderNotInsidePhNode:
+      return
+    self.fail('Should have gotten exception')
+
+  def testValidAndroidIntegerWidthFormatInPhNode(self):
+    try:
+      util.ParseGrdForUnittest("""\
+        <messages>
+        <message name="IDS_ANDROID_WIDTH">
+          <ph name="VALID">%2$3d<ex>042</ex></ph>
+        </message>
+        </messages>""")
+    except:
+      self.fail('Should not have gotten exception')
+
+  def testAndroidFloatFormatIsInsidePhNode(self):
+    try:
+      util.ParseGrdForUnittest("""\
+        <messages>
+        <message name="IDS_ANDROID" desc="float number format">
+          This message is missing a ph node: %3$4.5f
+        </message>
+        </messages>""")
+    except exception.PlaceholderNotInsidePhNode:
+      return
+    self.fail('Should have gotten exception')
+
+  def testGritStringFormatIsInsidePhNode(self):
+    try:
+      util.ParseGrdForUnittest("""\
+        <messages>
+        <message name="IDS_GRIT_STRING" desc="grit string format">
+          This message is missing the ph node: %s
+        </message>
+        </messages>""")
+    except exception.PlaceholderNotInsidePhNode:
+      return
+    self.fail('Should have gotten exception')
+
+  def testGritIntegerFormatIsInsidePhNode(self):
+    try:
+      util.ParseGrdForUnittest("""\
+        <messages>
+        <message name="IDS_GRIT_INTEGER" desc="grit integer format">
+          This message is missing the ph node: %d
+        </message>
+        </messages>""")
+    except exception.PlaceholderNotInsidePhNode:
+      return
+    self.fail('Should have gotten exception')
+
+  def testWindowsETWIntegerFormatIsInsidePhNode(self):
+    try:
+      util.ParseGrdForUnittest("""\
+        <messages>
+        <message name="IDS_WINDOWS_ETW" desc="ETW tracing integer">
+          This message is missing the ph node: %1
+        </message>
+        </messages>""")
+    except exception.PlaceholderNotInsidePhNode:
+      return
+    self.fail('Should have gotten exception')
+
+  def testValidMultipleFormattersInsidePhNodes(self):
+    root = util.ParseGrdForUnittest("""\
+      <messages>
+      <message name="IDS_MULTIPLE_FORMATTERS">
+        <ph name="ERROR_COUNT">%1$d<ex>1</ex></ph> error, <ph name="WARNING_COUNT">%2$d<ex>1</ex></ph> warning
+      </message>
+      </messages>""")
+    msg, = root.GetChildrenOfType(message.MessageNode)
+    cliques = msg.GetCliques()
+    content = cliques[0].GetMessage().GetPresentableContent()
+    self.failUnless(content == 'ERROR_COUNT error, WARNING_COUNT warning')
+
+  def testMultipleFormattersAreInsidePhNodes(self):
+    failed = True
+    try:
+      util.ParseGrdForUnittest("""\
+        <messages>
+        <message name="IDS_MULTIPLE_FORMATTERS">
+          %1$d error, %2$d warning
+        </message>
+        </messages>""")
+    except exception.PlaceholderNotInsidePhNode:
+      failed = False
+    if failed:
+      self.fail('Should have gotten exception')
+      return
+
+    failed = True
+    try:
+      util.ParseGrdForUnittest("""\
+        <messages>
+        <message name="IDS_MULTIPLE_FORMATTERS">
+          <ph name="ERROR_COUNT">%1$d<ex>1</ex></ph> error, %2$d warning
+        </message>
+        </messages>""")
+    except exception.PlaceholderNotInsidePhNode:
+      failed = False
+    if failed:
+      self.fail('Should have gotten exception')
+      return
+
+    failed = True
+    try:
+      util.ParseGrdForUnittest("""\
+        <messages>
+        <message name="IDS_MULTIPLE_FORMATTERS">
+          <ph name="INVALID">%1$d %2$d</ph>
+        </message>
+        </messages>""")
+    except exception.InvalidCharactersInsidePhNode:
+      failed = False
+    if failed:
+      self.fail('Should have gotten exception')
+      return
+
+  def testValidHTMLFormatInsidePhNode(self):
+    try:
+      util.ParseGrdForUnittest("""\
+        <messages>
+        <message name="IDS_HTML">
+          <ph name="VALID">&lt;span&gt;$1&lt;/span&gt;<ex>1</ex></ph>
+        </message>
+        </messages>""")
+    except:
+      self.fail('Should not have gotten exception')
+
+  def testValidHTMLWithAttributesFormatInsidePhNode(self):
+    try:
+      util.ParseGrdForUnittest("""\
+        <messages>
+        <message name="IDS_HTML_ATTRIBUTE">
+          <ph name="VALID">&lt;span attribute="js:$this %"&gt;$2&lt;/span&gt;<ex>2</ex></ph>
+        </message>
+        </messages>""")
+    except:
+      self.fail('Should not have gotten exception')
+
+  def testValidHTMLEntityFormatInsidePhNode(self):
+    try:
+      util.ParseGrdForUnittest("""\
+        <messages>
+        <message name="IDS_ENTITY">
+          <ph name="VALID">&gt;%1$d&lt;<ex>1</ex></ph>
+        </message>
+        </messages>""")
+    except:
+      self.fail('Should not have gotten exception')
+
+  def testValidMultipleDollarFormatInsidePhNode(self):
+    try:
+      util.ParseGrdForUnittest("""\
+        <messages>
+        <message name="IDS_DOLLARS" desc="l10n dollars format">
+          <ph name="VALID">$$1</ph>
+        </message>
+        </messages>""")
+    except:
+      self.fail('Should not have gotten exception')
+
+  def testInvalidDollarCharacterInsidePhNode(self):
+    try:
+      util.ParseGrdForUnittest("""\
+        <messages>
+        <message name="IDS_BAD_DOLLAR">
+          <ph name="INVALID">%1$d $</ph>
+        </message>
+        </messages>""")
+    except exception.InvalidCharactersInsidePhNode:
+      return
+    self.fail('Should have gotten exception')
+
+  def testInvalidPercentCharacterInsidePhNode(self):
+    try:
+      util.ParseGrdForUnittest("""\
+        <messages>
+        <message name="IDS_BAD_PERCENT">
+          <ph name="INVALID">%1$d %</ph>
+        </message>
+        </messages>""")
+    except exception.InvalidCharactersInsidePhNode:
+      return
+    self.fail('Should have gotten exception')
+
+  def testInvalidMixedFormatCharactersInsidePhNode(self):
+    try:
+      util.ParseGrdForUnittest("""\
+        <messages>
+        <message name="IDS_MIXED_FORMATS">
+          <ph name="INVALID">%1$2</ph>
+        </message>
+        </messages>""")
+    except exception.InvalidCharactersInsidePhNode:
+      return
+    self.fail('Should have gotten exception')
+
+
+if __name__ == '__main__':
+  unittest.main()
diff --git a/tools/grit/grit/node/misc.py b/tools/grit/grit/node/misc.py
new file mode 100644
index 0000000000..2d8b06d6a5
--- /dev/null
+++ b/tools/grit/grit/node/misc.py
@@ -0,0 +1,707 @@
+# Copyright (c) 2012 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.
+
+"""Miscellaneous node types.
+"""
+
+from __future__ import print_function
+
+import os.path
+import re
+import sys
+
+import six
+
+from grit import constants
+from grit import exception
+from grit import util
+from grit.extern import FP
+from grit.node import base
+from grit.node import message
+from grit.node import node_io
+
+
+# Python 3 doesn't have long() as int() works everywhere.  But we really do need
+# the long() behavior on Python 2 as our ids are much too large for int().
+try:
+  long
+except NameError:
+  long = int
+
+
+# RTL languages
+# TODO(jennyz): remove this fixed set of RTL language array
+# now that generic expand_variable code exists.
+_RTL_LANGS = (
+    'ar',  # Arabic
+    'fa',  # Farsi
+    'iw',  # Hebrew
+    'ks',  # Kashmiri
+    'ku',  # Kurdish
+    'ps',  # Pashto
+    'ur',  # Urdu
+    'yi',  # Yiddish
+)
+
+
+def _ReadFirstIdsFromFile(filename, defines):
+  """Read the starting resource id values from |filename|.  We also
+  expand variables of the form <(FOO) based on defines passed in on
+  the command line.
+
+  Returns a tuple, the absolute path of SRCDIR followed by the
+  first_ids dictionary.
+  """
+  first_ids_dict = eval(util.ReadFile(filename, 'utf-8'))
+  src_root_dir = os.path.abspath(os.path.join(os.path.dirname(filename),
+                                              first_ids_dict['SRCDIR']))
+
+  def ReplaceVariable(matchobj):
+    for key, value in defines.items():
+      if matchobj.group(1) == key:
+        return value
+    return ''
+
+  renames = []
+  for grd_filename in first_ids_dict:
+    new_grd_filename = re.sub(r'<\(([A-Za-z_]+)\)', ReplaceVariable,
+                              grd_filename)
+    if new_grd_filename != grd_filename:
+      abs_grd_filename = os.path.abspath(new_grd_filename)
+      if abs_grd_filename[:len(src_root_dir)] != src_root_dir:
+        new_grd_filename = os.path.basename(abs_grd_filename)
+      else:
+        new_grd_filename = abs_grd_filename[len(src_root_dir) + 1:]
+        new_grd_filename = new_grd_filename.replace('\\', '/')
+      renames.append((grd_filename, new_grd_filename))
+
+  for grd_filename, new_grd_filename in renames:
+    first_ids_dict[new_grd_filename] = first_ids_dict[grd_filename]
+    del(first_ids_dict[grd_filename])
+
+  return (src_root_dir, first_ids_dict)
+
+
+def _ComputeIds(root, predetermined_tids):
+  """Returns a dict of textual id -> numeric id for all nodes in root.
+
+  IDs are mostly assigned sequentially, but will vary based on:
+    * first_id node attribute (from first_ids_file)
+    * hash of textual id (if not first_id is defined)
+    * offset node attribute
+    * whether the textual id matches a system id
+    * whether the node generates its own ID via GetId()
+
+  Args:
+    predetermined_tids: Dict of textual id -> numeric id to use in return dict.
+  """
+  from grit.node import empty, include, misc, structure
+
+  ids = {}  # Maps numeric id to textual id
+  tids = {}  # Maps textual id to numeric id
+  id_reasons = {}  # Maps numeric id to text id and a human-readable explanation
+  group = None
+  last_id = None
+  predetermined_ids = {value: key
+                       for key, value in predetermined_tids.items()}
+
+  for item in root:
+    if isinstance(item, empty.GroupingNode):
+      # Note: this won't work if any GroupingNode can be contained inside
+      # another.
+      group = item
+      last_id = None
+      continue
+
+    assert not item.GetTextualIds() or isinstance(item,
+        (include.IncludeNode, message.MessageNode,
+         misc.IdentifierNode, structure.StructureNode))
+
+    # Resources that use the RES protocol don't need
+    # any numerical ids generated, so we skip them altogether.
+    # This is accomplished by setting the flag 'generateid' to false
+    # in the GRD file.
+    if item.attrs.get('generateid', 'true') == 'false':
+      continue
+
+    for tid in item.GetTextualIds():
+      if util.SYSTEM_IDENTIFIERS.match(tid):
+        # Don't emit a new ID for predefined IDs
+        continue
+
+      if tid in tids:
+        continue
+
+      if predetermined_tids and tid in predetermined_tids:
+        id = predetermined_tids[tid]
+        reason = "from predetermined_tids map"
+
+      # Some identifier nodes can provide their own id,
+      # and we use that id in the generated header in that case.
+      elif hasattr(item, 'GetId') and item.GetId():
+        id = long(item.GetId())
+        reason = 'returned by GetId() method'
+
+      elif ('offset' in item.attrs and group and
+            group.attrs.get('first_id', '') != ''):
+        offset_text = item.attrs['offset']
+        parent_text = group.attrs['first_id']
+
+        try:
+          offset_id = long(offset_text)
+        except ValueError:
+          offset_id = tids[offset_text]
+
+        try:
+          parent_id = long(parent_text)
+        except ValueError:
+          parent_id = tids[parent_text]
+
+        id = parent_id + offset_id
+        reason = 'first_id %d + offset %d' % (parent_id, offset_id)
+
+      # We try to allocate IDs sequentially for blocks of items that might
+      # be related, for instance strings in a stringtable (as their IDs might be
+      # used e.g. as IDs for some radio buttons, in which case the IDs must
+      # be sequential).
+      #
+      # We do this by having the first item in a section store its computed ID
+      # (computed from a fingerprint) in its parent object.  Subsequent children
+      # of the same parent will then try to get IDs that sequentially follow
+      # the currently stored ID (on the parent) and increment it.
+      elif last_id is None:
+        # First check if the starting ID is explicitly specified by the parent.
+        if group and group.attrs.get('first_id', '') != '':
+          id = long(group.attrs['first_id'])
+          reason = "from parent's first_id attribute"
+        else:
+          # Automatically generate the ID based on the first clique from the
+          # first child of the first child node of our parent (i.e. when we
+          # first get to this location in the code).
+
+          # According to
+          # http://msdn.microsoft.com/en-us/library/t2zechd4(VS.71).aspx
+          # the safe usable range for resource IDs in Windows is from decimal
+          # 101 to 0x7FFF.
+
+          id = FP.UnsignedFingerPrint(tid)
+          id = id % (0x7FFF - 101) + 101
+          reason = 'chosen by random fingerprint -- use first_id to override'
+
+        last_id = id
+      else:
+        id = last_id = last_id + 1
+        reason = 'sequentially assigned'
+
+      reason = "%s (%s)" % (tid, reason)
+      # Don't fail when 'offset' is specified, as the base and the 0th
+      # offset will have the same ID.
+      if id in id_reasons and not 'offset' in item.attrs:
+        raise exception.IdRangeOverlap('ID %d was assigned to both %s and %s.'
+                                       % (id, id_reasons[id], reason))
+
+      if id < 101:
+        print('WARNING: Numeric resource IDs should be greater than 100 to\n'
+              'avoid conflicts with system-defined resource IDs.')
+
+      if tid not in predetermined_tids and id in predetermined_ids:
+        raise exception.IdRangeOverlap('ID %d overlaps between %s and %s'
+                                       % (id, tid, predetermined_ids[tid]))
+
+      ids[id] = tid
+      tids[tid] = id
+      id_reasons[id] = reason
+
+  return tids
+
+class SplicingNode(base.Node):
+  """A node whose children should be considered to be at the same level as
+  its siblings for most purposes. This includes <if> and <part> nodes.
+  """
+
+  def _IsValidChild(self, child):
+    assert self.parent, '<%s> node should never be root.' % self.name
+    if isinstance(child, SplicingNode):
+      return True  # avoid O(n^2) behavior
+    return self.parent._IsValidChild(child)
+
+
+class IfNode(SplicingNode):
+  """A node for conditional inclusion of resources.
+  """
+
+  def MandatoryAttributes(self):
+    return ['expr']
+
+  def _IsValidChild(self, child):
+    return (isinstance(child, (ThenNode, ElseNode)) or
+            super(IfNode, self)._IsValidChild(child))
+
+  def EndParsing(self):
+    children = self.children
+    self.if_then_else = False
+    if any(isinstance(node, (ThenNode, ElseNode)) for node in children):
+      if (len(children) != 2 or not isinstance(children[0], ThenNode) or
+                                not isinstance(children[1], ElseNode)):
+        raise exception.UnexpectedChild(
+            '<if> element must be <if><then>...</then><else>...</else></if>')
+      self.if_then_else = True
+
+  def ActiveChildren(self):
+    cond = self.EvaluateCondition(self.attrs['expr'])
+    if self.if_then_else:
+      return self.children[0 if cond else 1].ActiveChildren()
+    else:
+      # Equivalent to having all children inside <then> with an empty <else>
+      return super(IfNode, self).ActiveChildren() if cond else []
+
+
+class ThenNode(SplicingNode):
+  """A <then> node. Can only appear directly inside an <if> node."""
+  pass
+
+
+class ElseNode(SplicingNode):
+  """An <else> node. Can only appear directly inside an <if> node."""
+  pass
+
+
+class PartNode(SplicingNode):
+  """A node for inclusion of sub-grd (*.grp) files.
+  """
+
+  def __init__(self):
+    super(PartNode, self).__init__()
+    self.started_inclusion = False
+
+  def MandatoryAttributes(self):
+    return ['file']
+
+  def _IsValidChild(self, child):
+    return self.started_inclusion and super(PartNode, self)._IsValidChild(child)
+
+
+class ReleaseNode(base.Node):
+  """The <release> element."""
+
+  def _IsValidChild(self, child):
+    from grit.node import empty
+    return isinstance(child, (empty.IncludesNode, empty.MessagesNode,
+                              empty.StructuresNode, empty.IdentifiersNode))
+
+  def _IsValidAttribute(self, name, value):
+    return (
+      (name == 'seq' and int(value) <= self.GetRoot().GetCurrentRelease()) or
+      name == 'allow_pseudo'
+    )
+
+  def MandatoryAttributes(self):
+    return ['seq']
+
+  def DefaultAttributes(self):
+    return { 'allow_pseudo' : 'true' }
+
+
+class GritNode(base.Node):
+  """The <grit> root element."""
+
+  def __init__(self):
+    super(GritNode, self).__init__()
+    self.output_language = ''
+    self.defines = {}
+    self.substituter = None
+    self.target_platform = sys.platform
+    self.whitelist_support = False
+    self._predetermined_ids_file = None
+    self._id_map = None  # Dict of textual_id -> numeric_id.
+
+  def _IsValidChild(self, child):
+    from grit.node import empty
+    return isinstance(child, (ReleaseNode, empty.TranslationsNode,
+                              empty.OutputsNode))
+
+  def _IsValidAttribute(self, name, value):
+    if name not in ['base_dir', 'first_ids_file', 'source_lang_id',
+                    'latest_public_release', 'current_release',
+                    'enc_check', 'tc_project', 'grit_version',
+                    'output_all_resource_defines']:
+      return False
+    if name in ['latest_public_release', 'current_release'] and value.strip(
+      '0123456789') != '':
+      return False
+    return True
+
+  def MandatoryAttributes(self):
+    return ['latest_public_release', 'current_release']
+
+  def DefaultAttributes(self):
+    return {
+      'base_dir' : '.',
+      'first_ids_file': '',
+      'grit_version': 1,
+      'source_lang_id' : 'en',
+      'enc_check' : constants.ENCODING_CHECK,
+      'tc_project' : 'NEED_TO_SET_tc_project_ATTRIBUTE',
+    }
+
+  def EndParsing(self):
+    super(GritNode, self).EndParsing()
+    if (int(self.attrs['latest_public_release'])
+        > int(self.attrs['current_release'])):
+      raise exception.Parsing('latest_public_release cannot have a greater '
+                              'value than current_release')
+
+    self.ValidateUniqueIds()
+
+    # Add the encoding check if it's not present (should ensure that it's always
+    # present in all .grd files generated by GRIT). If it's present, assert if
+    # it's not correct.
+    if 'enc_check' not in self.attrs or self.attrs['enc_check'] == '':
+      self.attrs['enc_check'] = constants.ENCODING_CHECK
+    else:
+      assert self.attrs['enc_check'] == constants.ENCODING_CHECK, (
+        'Are you sure your .grd file is in the correct encoding (UTF-8)?')
+
+  def ValidateUniqueIds(self):
+    """Validate that 'name' attribute is unique in all nodes in this tree
+    except for nodes that are children of <if> nodes.
+    """
+    unique_names = {}
+    duplicate_names = []
+    # To avoid false positives from mutually exclusive <if> clauses, check
+    # against whatever the output condition happens to be right now.
+    # TODO(benrg): do something better.
+    for node in self.ActiveDescendants():
+      if node.attrs.get('generateid', 'true') == 'false':
+        continue  # Duplication not relevant in that case
+
+      for node_id in node.GetTextualIds():
+        if util.SYSTEM_IDENTIFIERS.match(node_id):
+          continue  # predefined IDs are sometimes used more than once
+
+        if node_id in unique_names and node_id not in duplicate_names:
+          duplicate_names.append(node_id)
+        unique_names[node_id] = 1
+
+    if len(duplicate_names):
+      raise exception.DuplicateKey(', '.join(duplicate_names))
+
+
+  def GetCurrentRelease(self):
+    """Returns the current release number."""
+    return int(self.attrs['current_release'])
+
+  def GetLatestPublicRelease(self):
+    """Returns the latest public release number."""
+    return int(self.attrs['latest_public_release'])
+
+  def GetSourceLanguage(self):
+    """Returns the language code of the source language."""
+    return self.attrs['source_lang_id']
+
+  def GetTcProject(self):
+    """Returns the name of this project in the TranslationConsole, or
+    'NEED_TO_SET_tc_project_ATTRIBUTE' if it is not defined."""
+    return self.attrs['tc_project']
+
+  def SetOwnDir(self, dir):
+    """Informs the 'grit' element of the directory the file it is in resides.
+    This allows it to calculate relative paths from the input file, which is
+    what we desire (rather than from the current path).
+
+    Args:
+      dir: r'c:\bla'
+
+    Return:
+      None
+    """
+    assert dir
+    self.base_dir = os.path.normpath(os.path.join(dir, self.attrs['base_dir']))
+
+  def GetBaseDir(self):
+    """Returns the base directory, relative to the working directory.  To get
+    the base directory as set in the .grd file, use GetOriginalBaseDir()
+    """
+    if hasattr(self, 'base_dir'):
+      return self.base_dir
+    else:
+      return self.GetOriginalBaseDir()
+
+  def GetOriginalBaseDir(self):
+    """Returns the base directory, as set in the .grd file.
+    """
+    return self.attrs['base_dir']
+
+  def IsWhitelistSupportEnabled(self):
+    return self.whitelist_support
+
+  def SetWhitelistSupportEnabled(self, whitelist_support):
+    self.whitelist_support = whitelist_support
+
+  def GetInputFiles(self):
+    """Returns the list of files that are read to produce the output."""
+
+    # Importing this here avoids a circular dependency in the imports.
+    # pylint: disable-msg=C6204
+    from grit.node import include
+    from grit.node import misc
+    from grit.node import structure
+    from grit.node import variant
+
+    # Check if the input is required for any output configuration.
+    input_files = set()
+    # Collect even inactive PartNodes since they affect ID assignments.
+    for node in self:
+      if isinstance(node, misc.PartNode):
+        input_files.add(self.ToRealPath(node.GetInputPath()))
+
+    old_output_language = self.output_language
+    for lang, ctx, fallback in self.GetConfigurations():
+      self.SetOutputLanguage(lang or self.GetSourceLanguage())
+      self.SetOutputContext(ctx)
+      self.SetFallbackToDefaultLayout(fallback)
+
+      for node in self.ActiveDescendants():
+        if isinstance(node, (node_io.FileNode, include.IncludeNode,
+                             structure.StructureNode, variant.SkeletonNode)):
+          input_path = node.GetInputPath()
+          if input_path is not None:
+            input_files.add(self.ToRealPath(input_path))
+
+          # If it's a flattened node, grab inlined resources too.
+          if ((node.name == 'structure' or node.name == 'include')
+              and node.attrs['flattenhtml'] == 'true'):
+            if node.name == 'structure':
+              node.RunPreSubstitutionGatherer()
+            input_files.update(node.GetHtmlResourceFilenames())
+
+    self.SetOutputLanguage(old_output_language)
+    return sorted(input_files)
+
+  def GetFirstIdsFile(self):
+    """Returns a usable path to the first_ids file, if set, otherwise
+    returns None.
+
+    The first_ids_file attribute is by default relative to the
+    base_dir of the .grd file, but may be prefixed by GRIT_DIR/,
+    which makes it relative to the directory of grit.py
+    (e.g. GRIT_DIR/../gritsettings/resource_ids).
+    """
+    if not self.attrs['first_ids_file']:
+      return None
+
+    path = self.attrs['first_ids_file']
+    GRIT_DIR_PREFIX = 'GRIT_DIR'
+    if (path.startswith(GRIT_DIR_PREFIX)
+        and path[len(GRIT_DIR_PREFIX)] in ['/', '\\']):
+      return util.PathFromRoot(path[len(GRIT_DIR_PREFIX) + 1:])
+    else:
+      return self.ToRealPath(path)
+
+  def GetOutputFiles(self):
+    """Returns the list of <output> nodes that are descendants of this node's
+    <outputs> child and are not enclosed by unsatisfied <if> conditionals.
+    """
+    for child in self.children:
+      if child.name == 'outputs':
+        return [node for node in child.ActiveDescendants()
+                     if node.name == 'output']
+    raise exception.MissingElement()
+
+  def GetConfigurations(self):
+    """Returns the distinct (language, context, fallback_to_default_layout)
+    triples from the output nodes.
+    """
+    return set((n.GetLanguage(), n.GetContext(), n.GetFallbackToDefaultLayout())
+               for n in self.GetOutputFiles())
+
+  def GetSubstitutionMessages(self):
+    """Returns the list of <message sub_variable="true"> nodes."""
+    return [n for n in self.ActiveDescendants()
+            if isinstance(n, message.MessageNode)
+                and n.attrs['sub_variable'] == 'true']
+
+  def SetOutputLanguage(self, output_language):
+    """Set the output language. Prepares substitutions.
+
+    The substitutions are reset every time the language is changed.
+    They include messages designated as variables, and language codes for html
+    and rc files.
+
+    Args:
+      output_language: a two-letter language code (eg: 'en', 'ar'...) or ''
+    """
+    if not output_language:
+      # We do not specify the output language for .grh files,
+      # so we get an empty string as the default.
+      # The value should match grit.clique.MessageClique.source_language.
+      output_language = self.GetSourceLanguage()
+    if output_language != self.output_language:
+      self.output_language = output_language
+      self.substituter = None  # force recalculate
+
+  def SetOutputContext(self, output_context):
+    self.output_context = output_context
+    self.substituter = None  # force recalculate
+
+  def SetFallbackToDefaultLayout(self, fallback_to_default_layout):
+    self.fallback_to_default_layout = fallback_to_default_layout
+    self.substituter = None  # force recalculate
+
+  def SetDefines(self, defines):
+    self.defines = defines
+    self.substituter = None  # force recalculate
+
+  def SetTargetPlatform(self, target_platform):
+    self.target_platform = target_platform
+
+  def GetSubstituter(self):
+    if self.substituter is None:
+      self.substituter = util.Substituter()
+      self.substituter.AddMessages(self.GetSubstitutionMessages(),
+                                   self.output_language)
+      if self.output_language in _RTL_LANGS:
+        direction = 'dir="RTL"'
+      else:
+        direction = 'dir="LTR"'
+      self.substituter.AddSubstitutions({
+          'GRITLANGCODE': self.output_language,
+          'GRITDIR': direction,
+      })
+      from grit.format import rc  # avoid circular dep
+      rc.RcSubstitutions(self.substituter, self.output_language)
+    return self.substituter
+
+  def AssignFirstIds(self, filename_or_stream, defines):
+    """Assign first ids to each grouping node based on values from the
+    first_ids file (if specified on the <grit> node).
+    """
+    assert self._id_map is None, 'AssignFirstIds() after InitializeIds()'
+    # If the input is a stream, then we're probably in a unit test and
+    # should skip this step.
+    if not isinstance(filename_or_stream, six.string_types):
+      return
+
+    # Nothing to do if the first_ids_filename attribute isn't set.
+    first_ids_filename = self.GetFirstIdsFile()
+    if not first_ids_filename:
+      return
+
+    src_root_dir, first_ids = _ReadFirstIdsFromFile(first_ids_filename,
+                                                    defines)
+    from grit.node import empty
+    for node in self.Preorder():
+      if isinstance(node, empty.GroupingNode):
+        abs_filename = os.path.abspath(filename_or_stream)
+        if abs_filename[:len(src_root_dir)] != src_root_dir:
+          filename = os.path.basename(filename_or_stream)
+        else:
+          filename = abs_filename[len(src_root_dir) + 1:]
+          filename = filename.replace('\\', '/')
+
+        if node.attrs['first_id'] != '':
+          raise Exception(
+              "Don't set the first_id attribute when using the first_ids_file "
+              "attribute on the <grit> node, update %s instead." %
+              first_ids_filename)
+
+        try:
+          id_list = first_ids[filename][node.name]
+        except KeyError as e:
+          print('-' * 78)
+          print('Resource id not set for %s (%s)!' % (filename, node.name))
+          print('Please update %s to include an entry for %s.  See the '
+                'comments in resource_ids for information on why you need to '
+                'update that file.' % (first_ids_filename, filename))
+          print('-' * 78)
+          raise e
+
+        try:
+          node.attrs['first_id'] = str(id_list.pop(0))
+        except IndexError as e:
+          raise Exception('Please update %s and add a first id for %s (%s).'
+                          % (first_ids_filename, filename, node.name))
+
+  def GetIdMap(self):
+    '''Return a dictionary mapping textual ids to numeric ids.'''
+    return self._id_map
+
+  def SetPredeterminedIdsFile(self, predetermined_ids_file):
+    assert self._id_map is None, (
+        'SetPredeterminedIdsFile() after InitializeIds()')
+    self._predetermined_ids_file = predetermined_ids_file
+
+  def InitializeIds(self):
+    '''Initializes the text ID -> numeric ID mapping.'''
+    predetermined_id_map = {}
+    if self._predetermined_ids_file:
+      with open(self._predetermined_ids_file) as f:
+        for line in f:
+          tid, nid = line.split()
+          predetermined_id_map[tid] = int(nid)
+    self._id_map = _ComputeIds(self, predetermined_id_map)
+
+  def RunGatherers(self, debug=False):
+    '''Call RunPreSubstitutionGatherer() on every node of the tree, then apply
+    substitutions, then call RunPostSubstitutionGatherer() on every node.
+
+    The substitutions step requires that the output language has been set.
+    Locally, get the Substitution messages and add them to the substituter.
+    Also add substitutions for language codes in the Rc.
+
+    Args:
+      debug: will print information while running gatherers.
+    '''
+    for node in self.ActiveDescendants():
+      if hasattr(node, 'RunPreSubstitutionGatherer'):
+        with node:
+          node.RunPreSubstitutionGatherer(debug=debug)
+
+    assert self.output_language
+    self.SubstituteMessages(self.GetSubstituter())
+
+    for node in self.ActiveDescendants():
+      if hasattr(node, 'RunPostSubstitutionGatherer'):
+        with node:
+          node.RunPostSubstitutionGatherer(debug=debug)
+
+
+class IdentifierNode(base.Node):
+  """A node for specifying identifiers that should appear in the resource
+  header file, and be unique amongst all other resource identifiers, but don't
+  have any other attributes or reference any resources.
+  """
+
+  def MandatoryAttributes(self):
+    return ['name']
+
+  def DefaultAttributes(self):
+    return { 'comment' : '', 'id' : '', 'systemid': 'false' }
+
+  def GetId(self):
+    """Returns the id of this identifier if it has one, None otherwise
+    """
+    if 'id' in self.attrs:
+      return self.attrs['id']
+    return None
+
+  def EndParsing(self):
+    """Handles system identifiers."""
+    super(IdentifierNode, self).EndParsing()
+    if self.attrs['systemid'] == 'true':
+      util.SetupSystemIdentifiers((self.attrs['name'],))
+
+  @staticmethod
+  def Construct(parent, name, id, comment, systemid='false'):
+    """Creates a new node which is a child of 'parent', with attributes set
+    by parameters of the same name.
+    """
+    node = IdentifierNode()
+    node.StartParsing('identifier', parent)
+    node.HandleAttribute('name', name)
+    node.HandleAttribute('id', id)
+    node.HandleAttribute('comment', comment)
+    node.HandleAttribute('systemid', systemid)
+    node.EndParsing()
+    return node
diff --git a/tools/grit/grit/node/misc_unittest.py b/tools/grit/grit/node/misc_unittest.py
new file mode 100644
index 0000000000..c192b096f4
--- /dev/null
+++ b/tools/grit/grit/node/misc_unittest.py
@@ -0,0 +1,590 @@
+#!/usr/bin/env python
+# Copyright (c) 2012 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.
+
+'''Unit tests for misc.GritNode'''
+
+from __future__ import print_function
+
+import contextlib
+import os
+import sys
+import tempfile
+import unittest
+
+if __name__ == '__main__':
+  sys.path.append(os.path.join(os.path.dirname(__file__), '../..'))
+
+from six import StringIO
+
+from grit import grd_reader
+import grit.exception
+from grit import util
+from grit.format import rc
+from grit.format import rc_header
+from grit.node import misc
+
+
+@contextlib.contextmanager
+def _MakeTempPredeterminedIdsFile(content):
+  """Write the |content| string to a temporary file.
+
+  The temporary file must be deleted by the caller.
+
+  Example:
+    with _MakeTempPredeterminedIdsFile('foo') as path:
+      ...
+      os.remove(path)
+
+  Args:
+    content: The string to write.
+
+  Yields:
+    The name of the temporary file.
+  """
+  with tempfile.NamedTemporaryFile(mode='w', delete=False) as f:
+    f.write(content)
+    f.flush()
+    f.close()
+    yield f.name
+
+
+class GritNodeUnittest(unittest.TestCase):
+  def testUniqueNameAttribute(self):
+    try:
+      restree = grd_reader.Parse(
+        util.PathFromRoot('grit/testdata/duplicate-name-input.xml'))
+      self.fail('Expected parsing exception because of duplicate names.')
+    except grit.exception.Parsing:
+      pass  # Expected case
+
+  def testReadFirstIdsFromFile(self):
+    test_resource_ids = os.path.join(os.path.dirname(__file__), '..',
+                                     'testdata', 'resource_ids')
+    base_dir = os.path.dirname(test_resource_ids)
+
+    src_dir, id_dict = misc._ReadFirstIdsFromFile(
+        test_resource_ids,
+        {
+          'FOO': os.path.join(base_dir, 'bar'),
+          'SHARED_INTERMEDIATE_DIR': os.path.join(base_dir,
+                                                  'out/Release/obj/gen'),
+        })
+    self.assertEqual({}, id_dict.get('bar/file.grd', None))
+    self.assertEqual({},
+        id_dict.get('out/Release/obj/gen/devtools/devtools.grd', None))
+
+    src_dir, id_dict = misc._ReadFirstIdsFromFile(
+        test_resource_ids,
+        {
+          'SHARED_INTERMEDIATE_DIR': '/outside/src_dir',
+        })
+    self.assertEqual({}, id_dict.get('devtools.grd', None))
+
+  # Verifies that GetInputFiles() returns the correct list of files
+  # corresponding to ChromeScaledImage nodes when assets are missing.
+  def testGetInputFilesChromeScaledImage(self):
+    chrome_html_path = util.PathFromRoot('grit/testdata/chrome_html.html')
+    xml = '''<?xml version="1.0" encoding="utf-8"?>
+      <grit latest_public_release="0" current_release="1">
+        <outputs>
+          <output filename="default.pak" type="data_package" context="default_100_percent" />
+          <output filename="special.pak" type="data_package" context="special_100_percent" fallback_to_default_layout="false" />
+        </outputs>
+        <release seq="1">
+          <structures fallback_to_low_resolution="true">
+            <structure type="chrome_scaled_image" name="IDR_A" file="a.png" />
+            <structure type="chrome_scaled_image" name="IDR_B" file="b.png" />
+            <structure type="chrome_html" name="HTML_FILE1" file="%s" flattenhtml="true" />
+          </structures>
+        </release>
+      </grit>''' % chrome_html_path
+
+    grd = grd_reader.Parse(StringIO(xml),
+                           util.PathFromRoot('grit/testdata'))
+    expected = ['chrome_html.html', 'default_100_percent/a.png',
+                'default_100_percent/b.png', 'included_sample.html',
+                'special_100_percent/a.png']
+    actual = [os.path.relpath(path, util.PathFromRoot('grit/testdata')) for
+              path in grd.GetInputFiles()]
+    # Convert path separator for Windows paths.
+    actual = [path.replace('\\', '/') for path in actual]
+    self.assertEquals(expected, actual)
+
+  # Verifies that GetInputFiles() returns the correct list of files
+  # when files include other files.
+  def testGetInputFilesFromIncludes(self):
+    chrome_html_path = util.PathFromRoot('grit/testdata/chrome_html.html')
+    xml = '''<?xml version="1.0" encoding="utf-8"?>
+      <grit latest_public_release="0" current_release="1">
+        <outputs>
+          <output filename="default.pak" type="data_package" context="default_100_percent" />
+          <output filename="special.pak" type="data_package" context="special_100_percent" fallback_to_default_layout="false" />
+        </outputs>
+        <release seq="1">
+          <includes>
+            <include name="IDR_TESTDATA_CHROME_HTML" file="%s" flattenhtml="true"
+ allowexternalscript="true" type="BINDATA" />
+          </includes>
+        </release>
+      </grit>''' % chrome_html_path
+
+    grd = grd_reader.Parse(StringIO(xml), util.PathFromRoot('grit/testdata'))
+    expected = ['chrome_html.html', 'included_sample.html']
+    actual = [os.path.relpath(path, util.PathFromRoot('grit/testdata')) for
+              path in grd.GetInputFiles()]
+    # Convert path separator for Windows paths.
+    actual = [path.replace('\\', '/') for path in actual]
+    self.assertEquals(expected, actual)
+
+  def testNonDefaultEntry(self):
+    grd = util.ParseGrdForUnittest('''
+      <messages>
+        <message name="IDS_A" desc="foo">bar</message>
+        <if expr="lang == 'fr'">
+          <message name="IDS_B" desc="foo">bar</message>
+        </if>
+      </messages>''')
+    grd.SetOutputLanguage('fr')
+    output = ''.join(rc_header.Format(grd, 'fr', '.'))
+    self.assertIn('#define IDS_A 2378\n#define IDS_B 2379', output)
+
+  def testExplicitFirstIdOverlaps(self):
+    # second first_id will overlap preexisting range
+    self.assertRaises(grit.exception.IdRangeOverlap,
+                      util.ParseGrdForUnittest, '''
+        <includes first_id="300" comment="bingo">
+          <include type="gif" name="ID_LOGO" file="images/logo.gif" />
+          <include type="gif" name="ID_LOGO2" file="images/logo2.gif" />
+        </includes>
+        <messages first_id="301">
+          <message name="IDS_GREETING" desc="Printed to greet the currently logged in user">
+            Hello <ph name="USERNAME">%s<ex>Joi</ex></ph>, how are you doing today?
+          </message>
+          <message name="IDS_SMURFGEBURF">Frubegfrums</message>
+        </messages>''')
+
+  def testImplicitOverlapsPreexisting(self):
+    # second message in <messages> will overlap preexisting range
+    self.assertRaises(grit.exception.IdRangeOverlap,
+                      util.ParseGrdForUnittest, '''
+        <includes first_id="301" comment="bingo">
+          <include type="gif" name="ID_LOGO" file="images/logo.gif" />
+          <include type="gif" name="ID_LOGO2" file="images/logo2.gif" />
+        </includes>
+        <messages first_id="300">
+          <message name="IDS_GREETING" desc="Printed to greet the currently logged in user">
+            Hello <ph name="USERNAME">%s<ex>Joi</ex></ph>, how are you doing today?
+          </message>
+          <message name="IDS_SMURFGEBURF">Frubegfrums</message>
+        </messages>''')
+
+  def testPredeterminedIds(self):
+    with _MakeTempPredeterminedIdsFile('IDS_A 101\nIDS_B 102') as ids_file:
+      grd = util.ParseGrdForUnittest('''
+          <includes first_id="300" comment="bingo">
+            <include type="gif" name="IDS_B" file="images/logo.gif" />
+          </includes>
+          <messages first_id="10000">
+            <message name="IDS_GREETING" desc="Printed to greet the currently logged in user">
+              Hello <ph name="USERNAME">%s<ex>Joi</ex></ph>, how are you doing today?
+            </message>
+            <message name="IDS_A">
+              Bongo!
+            </message>
+          </messages>''', predetermined_ids_file=ids_file)
+      output = rc_header.FormatDefines(grd)
+      self.assertEqual(('#define IDS_B 102\n'
+                        '#define IDS_GREETING 10000\n'
+                        '#define IDS_A 101\n'), ''.join(output))
+      os.remove(ids_file)
+
+  def testPredeterminedIdsOverlap(self):
+    with _MakeTempPredeterminedIdsFile('ID_LOGO 10000') as ids_file:
+      self.assertRaises(grit.exception.IdRangeOverlap,
+                        util.ParseGrdForUnittest, '''
+          <includes first_id="300" comment="bingo">
+            <include type="gif" name="ID_LOGO" file="images/logo.gif" />
+          </includes>
+          <messages first_id="10000">
+            <message name="IDS_GREETING" desc="Printed to greet the currently logged in user">
+              Hello <ph name="USERNAME">%s<ex>Joi</ex></ph>, how are you doing today?
+            </message>
+            <message name="IDS_BONGO">
+              Bongo!
+            </message>
+          </messages>''', predetermined_ids_file=ids_file)
+      os.remove(ids_file)
+
+
+class IfNodeUnittest(unittest.TestCase):
+  def testIffyness(self):
+    grd = grd_reader.Parse(StringIO('''
+      <grit latest_public_release="2" source_lang_id="en-US" current_release="3" base_dir=".">
+        <release seq="3">
+          <messages>
+            <if expr="'bingo' in defs">
+              <message name="IDS_BINGO">
+                Bingo!
+              </message>
+            </if>
+            <if expr="'hello' in defs">
+              <message name="IDS_HELLO">
+                Hello!
+              </message>
+            </if>
+            <if expr="lang == 'fr' or 'FORCE_FRENCH' in defs">
+              <message name="IDS_HELLO" internal_comment="French version">
+                Good morning
+              </message>
+            </if>
+            <if expr="is_win">
+              <message name="IDS_ISWIN">is_win</message>
+            </if>
+          </messages>
+        </release>
+      </grit>'''), dir='.')
+
+    messages_node = grd.children[0].children[0]
+    bingo_message = messages_node.children[0].children[0]
+    hello_message = messages_node.children[1].children[0]
+    french_message = messages_node.children[2].children[0]
+    is_win_message = messages_node.children[3].children[0]
+
+    self.assertTrue(bingo_message.name == 'message')
+    self.assertTrue(hello_message.name == 'message')
+    self.assertTrue(french_message.name == 'message')
+
+    grd.SetOutputLanguage('fr')
+    grd.SetDefines({'hello': '1'})
+    active = set(grd.ActiveDescendants())
+    self.failUnless(bingo_message not in active)
+    self.failUnless(hello_message in active)
+    self.failUnless(french_message in active)
+
+    grd.SetOutputLanguage('en')
+    grd.SetDefines({'bingo': 1})
+    active = set(grd.ActiveDescendants())
+    self.failUnless(bingo_message in active)
+    self.failUnless(hello_message not in active)
+    self.failUnless(french_message not in active)
+
+    grd.SetOutputLanguage('en')
+    grd.SetDefines({'FORCE_FRENCH': '1', 'bingo': '1'})
+    active = set(grd.ActiveDescendants())
+    self.failUnless(bingo_message in active)
+    self.failUnless(hello_message not in active)
+    self.failUnless(french_message in active)
+
+    grd.SetOutputLanguage('en')
+    grd.SetDefines({})
+    self.failUnless(grd.target_platform == sys.platform)
+    grd.SetTargetPlatform('darwin')
+    active = set(grd.ActiveDescendants())
+    self.failUnless(is_win_message not in active)
+    grd.SetTargetPlatform('win32')
+    active = set(grd.ActiveDescendants())
+    self.failUnless(is_win_message in active)
+
+  def testElsiness(self):
+    grd = util.ParseGrdForUnittest('''
+        <messages>
+          <if expr="True">
+            <then> <message name="IDS_YES1"></message> </then>
+            <else> <message name="IDS_NO1"></message> </else>
+          </if>
+          <if expr="True">
+            <then> <message name="IDS_YES2"></message> </then>
+            <else> </else>
+          </if>
+          <if expr="True">
+            <then> </then>
+            <else> <message name="IDS_NO2"></message> </else>
+          </if>
+          <if expr="True">
+            <then> </then>
+            <else> </else>
+          </if>
+          <if expr="False">
+            <then> <message name="IDS_NO3"></message> </then>
+            <else> <message name="IDS_YES3"></message> </else>
+          </if>
+          <if expr="False">
+            <then> <message name="IDS_NO4"></message> </then>
+            <else> </else>
+          </if>
+          <if expr="False">
+            <then> </then>
+            <else> <message name="IDS_YES4"></message> </else>
+          </if>
+          <if expr="False">
+            <then> </then>
+            <else> </else>
+          </if>
+        </messages>''')
+    included = [msg.attrs['name'] for msg in grd.ActiveDescendants()
+                                  if msg.name == 'message']
+    self.assertEqual(['IDS_YES1', 'IDS_YES2', 'IDS_YES3', 'IDS_YES4'], included)
+
+  def testIffynessWithOutputNodes(self):
+    grd = grd_reader.Parse(StringIO('''
+      <grit latest_public_release="2" source_lang_id="en-US" current_release="3" base_dir=".">
+        <outputs>
+          <output filename="uncond1.rc" type="rc_data" />
+          <if expr="lang == 'fr' or 'hello' in defs">
+            <output filename="only_fr.adm" type="adm" />
+            <output filename="only_fr.plist" type="plist" />
+          </if>
+          <if expr="lang == 'ru'">
+            <output filename="doc.html" type="document" />
+          </if>
+          <output filename="uncond2.adm" type="adm" />
+          <output filename="iftest.h" type="rc_header">
+            <emit emit_type='prepend'></emit>
+          </output>
+        </outputs>
+      </grit>'''), dir='.')
+
+    outputs_node = grd.children[0]
+    uncond1_output = outputs_node.children[0]
+    only_fr_adm_output = outputs_node.children[1].children[0]
+    only_fr_plist_output = outputs_node.children[1].children[1]
+    doc_output = outputs_node.children[2].children[0]
+    uncond2_output = outputs_node.children[0]
+    self.assertTrue(uncond1_output.name == 'output')
+    self.assertTrue(only_fr_adm_output.name == 'output')
+    self.assertTrue(only_fr_plist_output.name == 'output')
+    self.assertTrue(doc_output.name == 'output')
+    self.assertTrue(uncond2_output.name == 'output')
+
+    grd.SetOutputLanguage('ru')
+    grd.SetDefines({'hello': '1'})
+    outputs = [output.GetFilename() for output in grd.GetOutputFiles()]
+    self.assertEquals(
+        outputs,
+        ['uncond1.rc', 'only_fr.adm', 'only_fr.plist', 'doc.html',
+         'uncond2.adm', 'iftest.h'])
+
+    grd.SetOutputLanguage('ru')
+    grd.SetDefines({'bingo': '2'})
+    outputs = [output.GetFilename() for output in grd.GetOutputFiles()]
+    self.assertEquals(
+        outputs,
+        ['uncond1.rc', 'doc.html', 'uncond2.adm', 'iftest.h'])
+
+    grd.SetOutputLanguage('fr')
+    grd.SetDefines({'hello': '1'})
+    outputs = [output.GetFilename() for output in grd.GetOutputFiles()]
+    self.assertEquals(
+        outputs,
+        ['uncond1.rc', 'only_fr.adm', 'only_fr.plist', 'uncond2.adm',
+         'iftest.h'])
+
+    grd.SetOutputLanguage('en')
+    grd.SetDefines({'bingo': '1'})
+    outputs = [output.GetFilename() for output in grd.GetOutputFiles()]
+    self.assertEquals(outputs, ['uncond1.rc', 'uncond2.adm', 'iftest.h'])
+
+    grd.SetOutputLanguage('fr')
+    grd.SetDefines({'bingo': '1'})
+    outputs = [output.GetFilename() for output in grd.GetOutputFiles()]
+    self.assertNotEquals(outputs, ['uncond1.rc', 'uncond2.adm', 'iftest.h'])
+
+  def testChildrenAccepted(self):
+    grd_reader.Parse(StringIO(r'''<?xml version="1.0"?>
+      <grit latest_public_release="2" source_lang_id="en-US" current_release="3" base_dir=".">
+        <release seq="3">
+          <includes>
+            <if expr="'bingo' in defs">
+              <include type="gif" name="ID_LOGO2" file="images/logo2.gif" />
+            </if>
+            <if expr="'bingo' in defs">
+              <if expr="'hello' in defs">
+                <include type="gif" name="ID_LOGO2" file="images/logo2.gif" />
+              </if>
+            </if>
+          </includes>
+          <structures>
+            <if expr="'bingo' in defs">
+              <structure type="dialog" name="IDD_ABOUTBOX" file="grit\test\data\klonk.rc" encoding="utf-16" />
+            </if>
+            <if expr="'bingo' in defs">
+              <if expr="'hello' in defs">
+                <structure type="dialog" name="IDD_ABOUTBOX" file="grit\test\data\klonk.rc" encoding="utf-16" />
+              </if>
+            </if>
+          </structures>
+          <messages>
+            <if expr="'bingo' in defs">
+              <message name="IDS_BINGO">Bingo!</message>
+            </if>
+            <if expr="'bingo' in defs">
+              <if expr="'hello' in defs">
+                <message name="IDS_BINGO">Bingo!</message>
+              </if>
+            </if>
+          </messages>
+        </release>
+        <translations>
+          <if expr="'bingo' in defs">
+            <file lang="nl" path="nl_translations.xtb" />
+          </if>
+          <if expr="'bingo' in defs">
+            <if expr="'hello' in defs">
+              <file lang="nl" path="nl_translations.xtb" />
+            </if>
+          </if>
+        </translations>
+      </grit>'''), dir='.')
+
+  def testIfBadChildrenNesting(self):
+    # includes
+    xml = StringIO(r'''<?xml version="1.0"?>
+      <grit latest_public_release="2" source_lang_id="en-US" current_release="3" base_dir=".">
+        <release seq="3">
+          <includes>
+            <if expr="'bingo' in defs">
+              <structure type="dialog" name="IDD_ABOUTBOX" file="grit\test\data\klonk.rc" encoding="utf-16" />
+            </if>
+          </includes>
+        </release>
+      </grit>''')
+    self.assertRaises(grit.exception.UnexpectedChild, grd_reader.Parse, xml)
+    # messages
+    xml = StringIO(r'''<?xml version="1.0"?>
+      <grit latest_public_release="2" source_lang_id="en-US" current_release="3" base_dir=".">
+        <release seq="3">
+          <messages>
+            <if expr="'bingo' in defs">
+              <structure type="dialog" name="IDD_ABOUTBOX" file="grit\test\data\klonk.rc" encoding="utf-16" />
+            </if>
+          </messages>
+        </release>
+      </grit>''')
+    self.assertRaises(grit.exception.UnexpectedChild, grd_reader.Parse, xml)
+    # structures
+    xml = StringIO('''<?xml version="1.0"?>
+      <grit latest_public_release="2" source_lang_id="en-US" current_release="3" base_dir=".">
+        <release seq="3">
+          <structures>
+            <if expr="'bingo' in defs">
+              <message name="IDS_BINGO">Bingo!</message>
+            </if>
+          </structures>
+        </release>
+      </grit>''')
+    # translations
+    self.assertRaises(grit.exception.UnexpectedChild, grd_reader.Parse, xml)
+    xml = StringIO('''<?xml version="1.0"?>
+      <grit latest_public_release="2" source_lang_id="en-US" current_release="3" base_dir=".">
+        <translations>
+          <if expr="'bingo' in defs">
+            <message name="IDS_BINGO">Bingo!</message>
+          </if>
+        </translations>
+      </grit>''')
+    self.assertRaises(grit.exception.UnexpectedChild, grd_reader.Parse, xml)
+    # same with nesting
+    xml = StringIO(r'''<?xml version="1.0"?>
+      <grit latest_public_release="2" source_lang_id="en-US" current_release="3" base_dir=".">
+        <release seq="3">
+          <includes>
+            <if expr="'bingo' in defs">
+              <if expr="'hello' in defs">
+                <structure type="dialog" name="IDD_ABOUTBOX" file="grit\test\data\klonk.rc" encoding="utf-16" />
+              </if>
+            </if>
+          </includes>
+        </release>
+      </grit>''')
+    self.assertRaises(grit.exception.UnexpectedChild, grd_reader.Parse, xml)
+    xml = StringIO(r'''<?xml version="1.0"?>
+      <grit latest_public_release="2" source_lang_id="en-US" current_release="3" base_dir=".">
+        <release seq="3">
+          <messages>
+            <if expr="'bingo' in defs">
+              <if expr="'hello' in defs">
+                <structure type="dialog" name="IDD_ABOUTBOX" file="grit\test\data\klonk.rc" encoding="utf-16" />
+              </if>
+            </if>
+          </messages>
+        </release>
+      </grit>''')
+    self.assertRaises(grit.exception.UnexpectedChild, grd_reader.Parse, xml)
+    xml = StringIO('''<?xml version="1.0"?>
+      <grit latest_public_release="2" source_lang_id="en-US" current_release="3" base_dir=".">
+        <release seq="3">
+          <structures>
+            <if expr="'bingo' in defs">
+              <if expr="'hello' in defs">
+                <message name="IDS_BINGO">Bingo!</message>
+              </if>
+            </if>
+          </structures>
+        </release>
+      </grit>''')
+    self.assertRaises(grit.exception.UnexpectedChild, grd_reader.Parse, xml)
+    xml = StringIO('''<?xml version="1.0"?>
+      <grit latest_public_release="2" source_lang_id="en-US" current_release="3" base_dir=".">
+        <translations>
+          <if expr="'bingo' in defs">
+            <if expr="'hello' in defs">
+              <message name="IDS_BINGO">Bingo!</message>
+            </if>
+          </if>
+        </translations>
+      </grit>''')
+    self.assertRaises(grit.exception.UnexpectedChild, grd_reader.Parse, xml)
+
+
+class ReleaseNodeUnittest(unittest.TestCase):
+  def testPseudoControl(self):
+    grd = grd_reader.Parse(StringIO('''<?xml version="1.0" encoding="UTF-8"?>
+      <grit latest_public_release="1" source_lang_id="en-US" current_release="2" base_dir=".">
+        <release seq="1" allow_pseudo="false">
+          <messages>
+            <message name="IDS_HELLO">
+              Hello
+            </message>
+          </messages>
+          <structures>
+            <structure type="dialog" name="IDD_ABOUTBOX" encoding="utf-16" file="klonk.rc" />
+          </structures>
+        </release>
+        <release seq="2">
+          <messages>
+            <message name="IDS_BINGO">
+              Bingo
+            </message>
+          </messages>
+          <structures>
+            <structure type="menu" name="IDC_KLONKMENU" encoding="utf-16" file="klonk.rc" />
+          </structures>
+        </release>
+      </grit>'''), util.PathFromRoot('grit/testdata'))
+    grd.SetOutputLanguage('en')
+    grd.RunGatherers()
+
+    hello = grd.GetNodeById('IDS_HELLO')
+    aboutbox = grd.GetNodeById('IDD_ABOUTBOX')
+    bingo = grd.GetNodeById('IDS_BINGO')
+    menu = grd.GetNodeById('IDC_KLONKMENU')
+
+    for node in [hello, aboutbox]:
+      self.failUnless(not node.PseudoIsAllowed())
+
+    for node in [bingo, menu]:
+      self.failUnless(node.PseudoIsAllowed())
+
+    # TODO(benrg): There was a test here that formatting hello and aboutbox with
+    # a pseudo language should fail, but they do not fail and the test was
+    # broken and failed to catch it. Fix this.
+
+    # Should not raise an exception since pseudo is allowed
+    rc.FormatMessage(bingo, 'xyz-pseudo')
+    rc.FormatStructure(menu, 'xyz-pseudo', '.')
+
+
+if __name__ == '__main__':
+  unittest.main()
diff --git a/tools/grit/grit/node/mock_brotli.py b/tools/grit/grit/node/mock_brotli.py
new file mode 100644
index 0000000000..14237aab20
--- /dev/null
+++ b/tools/grit/grit/node/mock_brotli.py
@@ -0,0 +1,10 @@
+#!/usr/bin/env python
+# Copyright 2019 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.
+
+"""Mock Brotli Executable for testing purposes."""
+
+import sys
+
+sys.stdout.write('This has been mock compressed!')
diff --git a/tools/grit/grit/node/node_io.py b/tools/grit/grit/node/node_io.py
new file mode 100644
index 0000000000..ccbc2c0647
--- /dev/null
+++ b/tools/grit/grit/node/node_io.py
@@ -0,0 +1,117 @@
+# Copyright (c) 2012 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.
+
+'''The <output> and <file> elements.
+'''
+
+from __future__ import print_function
+
+import os
+
+from grit import xtb_reader
+from grit.node import base
+
+
+class FileNode(base.Node):
+  '''A <file> element.'''
+
+  def __init__(self):
+    super(FileNode, self).__init__()
+    self.re = None
+    self.should_load_ = True
+
+  def IsTranslation(self):
+    return True
+
+  def GetLang(self):
+    return self.attrs['lang']
+
+  def DisableLoading(self):
+    self.should_load_ = False
+
+  def MandatoryAttributes(self):
+    return ['path', 'lang']
+
+  def RunPostSubstitutionGatherer(self, debug=False):
+    if not self.should_load_:
+      return
+
+    root = self.GetRoot()
+    defs = getattr(root, 'defines', {})
+    target_platform = getattr(root, 'target_platform', '')
+
+    xtb_file = open(self.ToRealPath(self.GetInputPath()), 'rb')
+    try:
+      lang = xtb_reader.Parse(xtb_file,
+                              self.UberClique().GenerateXtbParserCallback(
+                                  self.attrs['lang'], debug=debug),
+                              defs=defs,
+                              target_platform=target_platform)
+    except:
+      print("Exception during parsing of %s" % self.GetInputPath())
+      raise
+    # Translation console uses non-standard language codes 'iw' and 'no' for
+    # Hebrew and Norwegian Bokmal instead of 'he' and 'nb' used in Chrome.
+    # Note that some Chrome's .grd still use 'no' instead of 'nb', but 'nb' is
+    # always used for generated .pak files.
+    ALTERNATIVE_LANG_CODE_MAP = { 'he': 'iw', 'nb': 'no' }
+    assert (lang == self.attrs['lang'] or
+            lang == ALTERNATIVE_LANG_CODE_MAP[self.attrs['lang']]), (
+            'The XTB file you reference must contain messages in the language '
+            'specified\nby the \'lang\' attribute.')
+
+  def GetInputPath(self):
+    return os.path.expandvars(self.attrs['path'])
+
+
+class OutputNode(base.Node):
+  '''An <output> element.'''
+
+  def MandatoryAttributes(self):
+    return ['filename', 'type']
+
+  def DefaultAttributes(self):
+    return {
+      'lang' : '', # empty lang indicates all languages
+      'language_section' : 'neutral', # defines a language neutral section
+      'context' : '',
+      'fallback_to_default_layout' : 'true',
+    }
+
+  def GetType(self):
+    return self.attrs['type']
+
+  def GetLanguage(self):
+    '''Returns the language ID, default 'en'.'''
+    return self.attrs['lang']
+
+  def GetContext(self):
+    return self.attrs['context']
+
+  def GetFilename(self):
+    return self.attrs['filename']
+
+  def GetOutputFilename(self):
+    path = None
+    if hasattr(self, 'output_filename'):
+      path = self.output_filename
+    else:
+      path = self.attrs['filename']
+    return os.path.expandvars(path)
+
+  def GetFallbackToDefaultLayout(self):
+    return self.attrs['fallback_to_default_layout'].lower() == 'true'
+
+  def _IsValidChild(self, child):
+    return isinstance(child, EmitNode)
+
+class EmitNode(base.ContentNode):
+  ''' An <emit> element.'''
+
+  def DefaultAttributes(self):
+    return { 'emit_type' : 'prepend'}
+
+  def GetEmitType(self):
+    '''Returns the emit_type for this node. Default is 'append'.'''
+    return self.attrs['emit_type']
diff --git a/tools/grit/grit/node/node_io_unittest.py b/tools/grit/grit/node/node_io_unittest.py
new file mode 100644
index 0000000000..1f45e51af8
--- /dev/null
+++ b/tools/grit/grit/node/node_io_unittest.py
@@ -0,0 +1,182 @@
+#!/usr/bin/env python
+# Copyright (c) 2012 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.
+
+'''Unit tests for node_io.FileNode'''
+
+from __future__ import print_function
+
+import os
+import sys
+import unittest
+
+if __name__ == '__main__':
+  sys.path.append(os.path.join(os.path.dirname(__file__), '../..'))
+
+from six import StringIO
+
+from grit.node import misc
+from grit.node import node_io
+from grit.node import empty
+from grit import grd_reader
+from grit import util
+
+
+def _GetAllCliques(root_node):
+  """Return all cliques in the |root_node| tree."""
+  ret = []
+  for node in root_node:
+    ret.extend(node.GetCliques())
+  return ret
+
+
+class FileNodeUnittest(unittest.TestCase):
+  def testGetPath(self):
+    root = misc.GritNode()
+    root.StartParsing(u'grit', None)
+    root.HandleAttribute(u'latest_public_release', u'0')
+    root.HandleAttribute(u'current_release', u'1')
+    root.HandleAttribute(u'base_dir', r'..\resource')
+    translations = empty.TranslationsNode()
+    translations.StartParsing(u'translations', root)
+    root.AddChild(translations)
+    file_node = node_io.FileNode()
+    file_node.StartParsing(u'file', translations)
+    file_node.HandleAttribute(u'path', r'flugel\kugel.pdf')
+    translations.AddChild(file_node)
+    root.EndParsing()
+
+    self.failUnless(root.ToRealPath(file_node.GetInputPath()) ==
+                    util.normpath(
+                      os.path.join(r'../resource', r'flugel/kugel.pdf')))
+
+  def VerifyCliquesContainEnglishAndFrenchAndNothingElse(self, cliques):
+    self.assertEqual(2, len(cliques))
+    for clique in cliques:
+      self.assertEqual({'en', 'fr'}, set(clique.clique.keys()))
+
+  def testLoadTranslations(self):
+    xml = '''<?xml version="1.0" encoding="UTF-8"?>
+      <grit latest_public_release="2" source_lang_id="en-US" current_release="3" base_dir=".">
+        <translations>
+          <file path="generated_resources_fr.xtb" lang="fr" />
+        </translations>
+        <release seq="3">
+          <messages>
+            <message name="ID_HELLO">Hello!</message>
+            <message name="ID_HELLO_USER">Hello <ph name="USERNAME">%s<ex>Joi</ex></ph></message>
+          </messages>
+        </release>
+      </grit>'''
+    grd = grd_reader.Parse(StringIO(xml),
+                           util.PathFromRoot('grit/testdata'))
+    grd.SetOutputLanguage('en')
+    grd.RunGatherers()
+    self.VerifyCliquesContainEnglishAndFrenchAndNothingElse(_GetAllCliques(grd))
+
+  def testIffyness(self):
+    grd = grd_reader.Parse(StringIO('''<?xml version="1.0" encoding="UTF-8"?>
+      <grit latest_public_release="2" source_lang_id="en-US" current_release="3" base_dir=".">
+        <translations>
+          <if expr="lang == 'fr'">
+            <file path="generated_resources_fr.xtb" lang="fr" />
+          </if>
+        </translations>
+        <release seq="3">
+          <messages>
+            <message name="ID_HELLO">Hello!</message>
+            <message name="ID_HELLO_USER">Hello <ph name="USERNAME">%s<ex>Joi</ex></ph></message>
+          </messages>
+        </release>
+      </grit>'''), util.PathFromRoot('grit/testdata'))
+    grd.SetOutputLanguage('en')
+    grd.RunGatherers()
+    cliques = _GetAllCliques(grd)
+    self.assertEqual(2, len(cliques))
+    for clique in cliques:
+      self.assertEqual({'en'}, set(clique.clique.keys()))
+
+    grd.SetOutputLanguage('fr')
+    grd.RunGatherers()
+    self.VerifyCliquesContainEnglishAndFrenchAndNothingElse(_GetAllCliques(grd))
+
+  def testConditionalLoadTranslations(self):
+    xml = '''<?xml version="1.0" encoding="UTF-8"?>
+      <grit latest_public_release="2" source_lang_id="en-US" current_release="3"
+            base_dir=".">
+        <translations>
+          <if expr="True">
+            <file path="generated_resources_fr.xtb" lang="fr" />
+          </if>
+          <if expr="False">
+            <file path="no_such_file.xtb" lang="de" />
+          </if>
+        </translations>
+        <release seq="3">
+          <messages>
+            <message name="ID_HELLO">Hello!</message>
+            <message name="ID_HELLO_USER">Hello <ph name="USERNAME">%s<ex>
+              Joi</ex></ph></message>
+          </messages>
+        </release>
+      </grit>'''
+    grd = grd_reader.Parse(StringIO(xml),
+                           util.PathFromRoot('grit/testdata'))
+    grd.SetOutputLanguage('en')
+    grd.RunGatherers()
+    self.VerifyCliquesContainEnglishAndFrenchAndNothingElse(_GetAllCliques(grd))
+
+  def testConditionalOutput(self):
+    xml = '''<?xml version="1.0" encoding="UTF-8"?>
+      <grit latest_public_release="2" source_lang_id="en-US" current_release="3"
+            base_dir=".">
+        <outputs>
+          <output filename="resource.h" type="rc_header" />
+          <output filename="en/generated_resources.rc" type="rc_all"
+                  lang="en" />
+          <if expr="pp_if('NOT_TRUE')">
+            <output filename="de/generated_resources.rc" type="rc_all"
+                    lang="de" />
+          </if>
+        </outputs>
+        <release seq="3">
+          <messages>
+            <message name="ID_HELLO">Hello!</message>
+          </messages>
+        </release>
+      </grit>'''
+    grd = grd_reader.Parse(StringIO(xml),
+                           util.PathFromRoot('grit/test/data'),
+                           defines={})
+    grd.SetOutputLanguage('en')
+    grd.RunGatherers()
+    outputs = grd.GetChildrenOfType(node_io.OutputNode)
+    active = set(grd.ActiveDescendants())
+    self.failUnless(outputs[0] in active)
+    self.failUnless(outputs[0].GetType() == 'rc_header')
+    self.failUnless(outputs[1] in active)
+    self.failUnless(outputs[1].GetType() == 'rc_all')
+    self.failUnless(outputs[2] not in active)
+    self.failUnless(outputs[2].GetType() == 'rc_all')
+
+  # Verify that 'iw' and 'no' language codes in xtb files are mapped to 'he' and
+  # 'nb'.
+  def testLangCodeMapping(self):
+    grd = grd_reader.Parse(StringIO('''<?xml version="1.0" encoding="UTF-8"?>
+      <grit latest_public_release="2" source_lang_id="en-US" current_release="3" base_dir=".">
+        <translations>
+          <file path="generated_resources_no.xtb" lang="nb" />
+          <file path="generated_resources_iw.xtb" lang="he" />
+        </translations>
+        <release seq="3">
+          <messages></messages>
+        </release>
+      </grit>'''), util.PathFromRoot('grit/testdata'))
+    grd.SetOutputLanguage('en')
+    grd.RunGatherers()
+    self.assertEqual([], _GetAllCliques(grd))
+
+
+if __name__ == '__main__':
+  unittest.main()
diff --git a/tools/grit/grit/node/structure.py b/tools/grit/grit/node/structure.py
new file mode 100644
index 0000000000..ec170faebb
--- /dev/null
+++ b/tools/grit/grit/node/structure.py
@@ -0,0 +1,375 @@
+# Copyright (c) 2012 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.
+
+'''The <structure> element.
+'''
+
+from __future__ import print_function
+
+import os
+import platform
+import re
+
+from grit import exception
+from grit import util
+from grit.node import base
+from grit.node import variant
+
+import grit.gather.admin_template
+import grit.gather.chrome_html
+import grit.gather.chrome_scaled_image
+import grit.gather.policy_json
+import grit.gather.rc
+import grit.gather.tr_html
+import grit.gather.txt
+
+import grit.format.rc
+
+# Type of the gatherer to use for each type attribute
+_GATHERERS = {
+  'accelerators'        : grit.gather.rc.Accelerators,
+  'admin_template'      : grit.gather.admin_template.AdmGatherer,
+  'chrome_html'         : grit.gather.chrome_html.ChromeHtml,
+  'chrome_scaled_image' : grit.gather.chrome_scaled_image.ChromeScaledImage,
+  'dialog'              : grit.gather.rc.Dialog,
+  'menu'                : grit.gather.rc.Menu,
+  'rcdata'              : grit.gather.rc.RCData,
+  'tr_html'             : grit.gather.tr_html.TrHtml,
+  'txt'                 : grit.gather.txt.TxtFile,
+  'version'             : grit.gather.rc.Version,
+  'policy_template_metafile' : grit.gather.policy_json.PolicyJson,
+}
+
+
+# TODO(joi) Print a warning if the 'variant_of_revision' attribute indicates
+# that a skeleton variant is older than the original file.
+
+
+class StructureNode(base.Node):
+  '''A <structure> element.'''
+
+  # Regular expression for a local variable definition.  Each definition
+  # is of the form NAME=VALUE, where NAME cannot contain '=' or ',' and
+  # VALUE must escape all commas: ',' -> ',,'.  Each variable definition
+  # should be separated by a comma with no extra whitespace.
+  # Example: THING1=foo,THING2=bar
+  variable_pattern = re.compile(r'([^,=\s]+)=((?:,,|[^,])*)')
+
+  def __init__(self):
+    super(StructureNode, self).__init__()
+
+    # Keep track of the last filename we flattened to, so we can
+    # avoid doing it more than once.
+    self._last_flat_filename = None
+
+    # See _Substitute; this substituter is used for local variables and
+    # the root substituter is used for global variables.
+    self.substituter = None
+
+  def _IsValidChild(self, child):
+    return isinstance(child, variant.SkeletonNode)
+
+  def _ParseVariables(self, variables):
+    '''Parse a variable string into a dictionary.'''
+    matches = StructureNode.variable_pattern.findall(variables)
+    return dict((name, value.replace(',,', ',')) for name, value in matches)
+
+  def EndParsing(self):
+    super(StructureNode, self).EndParsing()
+
+    # Now that we have attributes and children, instantiate the gatherers.
+    gathertype = _GATHERERS[self.attrs['type']]
+
+    self.gatherer = gathertype(self.attrs['file'],
+                               self.attrs['name'],
+                               self.attrs['encoding'])
+    self.gatherer.SetGrdNode(self)
+    self.gatherer.SetUberClique(self.UberClique())
+    if hasattr(self.GetRoot(), 'defines'):
+      self.gatherer.SetDefines(self.GetRoot().defines)
+    self.gatherer.SetAttributes(self.attrs)
+    if self.ExpandVariables():
+      self.gatherer.SetFilenameExpansionFunction(self._Substitute)
+
+    # Parse local variables and instantiate the substituter.
+    if self.attrs['variables']:
+      variables = self.attrs['variables']
+      self.substituter = util.Substituter()
+      self.substituter.AddSubstitutions(self._ParseVariables(variables))
+
+    self.skeletons = {}  # Maps expressions to skeleton gatherers
+    for child in self.children:
+      assert isinstance(child, variant.SkeletonNode)
+      skel = gathertype(child.attrs['file'],
+                        self.attrs['name'],
+                        child.GetEncodingToUse(),
+                        is_skeleton=True)
+      skel.SetGrdNode(self)  # TODO(benrg): Or child? Only used for ToRealPath
+      skel.SetUberClique(self.UberClique())
+      if hasattr(self.GetRoot(), 'defines'):
+        skel.SetDefines(self.GetRoot().defines)
+      if self.ExpandVariables():
+        skel.SetFilenameExpansionFunction(self._Substitute)
+      self.skeletons[child.attrs['expr']] = skel
+
+  def MandatoryAttributes(self):
+    return ['type', 'name', 'file']
+
+  def DefaultAttributes(self):
+    return {
+        'encoding': 'cp1252',
+        'exclude_from_rc': 'false',
+        'line_end': 'unix',
+        'output_encoding': 'utf-8',
+        'generateid': 'true',
+        'expand_variables': 'false',
+        'output_filename': '',
+        'fold_whitespace': 'false',
+        # Run an arbitrary command after translation is complete
+        # so that it doesn't interfere with what's in translation
+        # console.
+        'run_command': '',
+        # Leave empty to run on all platforms, comma-separated
+        # for one or more specific platforms. Values must match
+        # output of platform.system().
+        'run_command_on_platforms': '',
+        'allowexternalscript': 'false',
+        # preprocess takes the same code path as flattenhtml, but it
+        # disables any processing/inlining outside of <if> and <include>.
+        'preprocess': 'false',
+        'flattenhtml': 'false',
+        'fallback_to_low_resolution': 'default',
+        'variables': '',
+        'compress': 'default',
+        'use_base_dir': 'true',
+    }
+
+  def IsExcludedFromRc(self):
+    return self.attrs['exclude_from_rc'] == 'true'
+
+  def Process(self, output_dir):
+    """Writes the processed data to output_dir.  In the case of a chrome_html
+    structure this will add references to other scale factors.  If flattening
+    this will also write file references to be base64 encoded data URLs.  The
+    name of the new file is returned."""
+    filename = self.ToRealPath(self.GetInputPath())
+    flat_filename = os.path.join(output_dir,
+        self.attrs['name'] + '_' + os.path.basename(filename))
+
+    if self._last_flat_filename == flat_filename:
+      return
+
+    with open(flat_filename, 'wb') as outfile:
+      if self.ExpandVariables():
+        text = self.gatherer.GetText()
+        file_contents = self._Substitute(text)
+      else:
+        file_contents = self.gatherer.GetData('', 'utf-8')
+      outfile.write(file_contents.encode('utf-8'))
+
+    self._last_flat_filename = flat_filename
+    return os.path.basename(flat_filename)
+
+  def GetLineEnd(self):
+    '''Returns the end-of-line character or characters for files output because
+    of this node ('\r\n', '\n', or '\r' depending on the 'line_end' attribute).
+    '''
+    if self.attrs['line_end'] == 'unix':
+      return '\n'
+    elif self.attrs['line_end'] == 'windows':
+      return '\r\n'
+    elif self.attrs['line_end'] == 'mac':
+      return '\r'
+    else:
+      raise exception.UnexpectedAttribute(
+        "Attribute 'line_end' must be one of 'unix' (default), 'windows' or "
+        "'mac'")
+
+  def GetCliques(self):
+    return self.gatherer.GetCliques()
+
+  def GetDataPackValue(self, lang, encoding):
+    """Returns a bytes representation for a data_pack entry."""
+    if self.ExpandVariables():
+      text = self.gatherer.GetText()
+      data = util.Encode(self._Substitute(text), encoding)
+    else:
+      data = self.gatherer.GetData(lang, encoding)
+    if encoding != util.BINARY:
+      data = data.encode(encoding)
+    return self.CompressDataIfNeeded(data)
+
+  def GetHtmlResourceFilenames(self):
+    """Returns a set of all filenames inlined by this node."""
+    return self.gatherer.GetHtmlResourceFilenames()
+
+  def GetInputPath(self):
+    path = self.gatherer.GetInputPath()
+    if path is None:
+      return path
+
+    # Do not mess with absolute paths, that would make them invalid.
+    if os.path.isabs(os.path.expandvars(path)):
+      return path
+
+    # We have no control over code that calls ToRealPath later, so convert
+    # the path to be relative against our basedir.
+    if self.attrs.get('use_base_dir', 'true') != 'true':
+      # Normalize the directory path to use the appropriate OS separator.
+      # GetBaseDir() may return paths\like\this or paths/like/this, since it is
+      # read from the base_dir attribute in the grd file.
+      norm_base_dir = util.normpath(self.GetRoot().GetBaseDir())
+      return os.path.relpath(path, norm_base_dir)
+
+    return path
+
+  def GetTextualIds(self):
+    if not hasattr(self, 'gatherer'):
+      # This case is needed because this method is called by
+      # GritNode.ValidateUniqueIds before RunGatherers has been called.
+      # TODO(benrg): Fix this?
+      return [self.attrs['name']]
+    return self.gatherer.GetTextualIds()
+
+  def RunPreSubstitutionGatherer(self, debug=False):
+    if debug:
+      print('Running gatherer %s for file %s' %
+            (type(self.gatherer), self.GetInputPath()))
+
+    # Note: Parse() is idempotent, therefore this method is also.
+    self.gatherer.Parse()
+    for skel in self.skeletons.values():
+      skel.Parse()
+
+  def GetSkeletonGatherer(self):
+    '''Returns the gatherer for the alternate skeleton that should be used,
+    based on the expressions for selecting skeletons, or None if the skeleton
+    from the English version of the structure should be used.
+    '''
+    for expr in self.skeletons:
+      if self.EvaluateCondition(expr):
+        return self.skeletons[expr]
+    return None
+
+  def HasFileForLanguage(self):
+    return self.attrs['type'] in ['tr_html', 'admin_template', 'txt',
+                                  'chrome_scaled_image',
+                                  'chrome_html']
+
+  def ExpandVariables(self):
+    '''Variable expansion on structures is controlled by an XML attribute.
+
+    However, old files assume that expansion is always on for Rc files.
+
+    Returns:
+      A boolean.
+    '''
+    attrs = self.GetRoot().attrs
+    if 'grit_version' in attrs and attrs['grit_version'] > 1:
+      return self.attrs['expand_variables'] == 'true'
+    else:
+      return (self.attrs['expand_variables'] == 'true' or
+              self.attrs['file'].lower().endswith('.rc'))
+
+  def _Substitute(self, text):
+    '''Perform local and global variable substitution.'''
+    if self.substituter:
+      text = self.substituter.Substitute(text)
+    return self.GetRoot().GetSubstituter().Substitute(text)
+
+  def RunCommandOnCurrentPlatform(self):
+    if self.attrs['run_command_on_platforms'] == '':
+      return True
+    else:
+      target_platforms = self.attrs['run_command_on_platforms'].split(',')
+      return platform.system() in target_platforms
+
+  def FileForLanguage(self, lang, output_dir, create_file=True,
+                      return_if_not_generated=True):
+    '''Returns the filename of the file associated with this structure,
+    for the specified language.
+
+    Args:
+      lang: 'fr'
+      output_dir: 'c:\temp'
+      create_file: True
+    '''
+    assert self.HasFileForLanguage()
+    # If the source language is requested, and no extra changes are requested,
+    # use the existing file.
+    if ((not lang or lang == self.GetRoot().GetSourceLanguage()) and
+        self.attrs['expand_variables'] != 'true' and
+        (not self.attrs['run_command'] or
+         not self.RunCommandOnCurrentPlatform())):
+      if return_if_not_generated:
+        input_path = self.GetInputPath()
+        if input_path is None:
+          return None
+        return self.ToRealPath(input_path)
+      else:
+        return None
+
+    if self.attrs['output_filename'] != '':
+      filename = self.attrs['output_filename']
+    else:
+      filename = os.path.basename(self.attrs['file'])
+    assert len(filename)
+    filename = '%s_%s' % (lang, filename)
+    filename = os.path.join(output_dir, filename)
+
+    # Only create the output if it was requested by the call.
+    if create_file:
+      text = self.gatherer.Translate(
+          lang,
+          pseudo_if_not_available=self.PseudoIsAllowed(),
+          fallback_to_english=self.ShouldFallbackToEnglish(),
+          skeleton_gatherer=self.GetSkeletonGatherer())
+
+      file_contents = util.FixLineEnd(text, self.GetLineEnd())
+      if self.ExpandVariables():
+        # Note that we reapply substitution a second time here.
+        # This is because a) we need to look inside placeholders
+        # b) the substitution values are language-dependent
+        file_contents = self._Substitute(file_contents)
+
+      with open(filename, 'wb') as file_object:
+        output_stream = util.WrapOutputStream(file_object,
+                                              self.attrs['output_encoding'])
+        output_stream.write(file_contents)
+
+      if self.attrs['run_command'] and self.RunCommandOnCurrentPlatform():
+        # Run arbitrary commands after translation is complete so that it
+        # doesn't interfere with what's in translation console.
+        command = self.attrs['run_command'] % {'filename': filename}
+        result = os.system(command)
+        assert result == 0, '"%s" failed.' % command
+
+    return filename
+
+  def IsResourceMapSource(self):
+    return True
+
+  @staticmethod
+  def Construct(parent, name, type, file, encoding='cp1252'):
+    '''Creates a new node which is a child of 'parent', with attributes set
+    by parameters of the same name.
+    '''
+    node = StructureNode()
+    node.StartParsing('structure', parent)
+    node.HandleAttribute('name', name)
+    node.HandleAttribute('type', type)
+    node.HandleAttribute('file', file)
+    node.HandleAttribute('encoding', encoding)
+    node.EndParsing()
+    return node
+
+  def SubstituteMessages(self, substituter):
+    '''Propagates substitution to gatherer.
+
+    Args:
+      substituter: a grit.util.Substituter object.
+    '''
+    assert hasattr(self, 'gatherer')
+    if self.ExpandVariables():
+      self.gatherer.SubstituteMessages(substituter)
diff --git a/tools/grit/grit/node/structure_unittest.py b/tools/grit/grit/node/structure_unittest.py
new file mode 100644
index 0000000000..0e66dce37a
--- /dev/null
+++ b/tools/grit/grit/node/structure_unittest.py
@@ -0,0 +1,178 @@
+#!/usr/bin/env python
+# Copyright (c) 2012 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.
+
+'''Unit tests for <structure> nodes.
+'''
+
+from __future__ import print_function
+
+import os
+import os.path
+import sys
+import zlib
+if __name__ == '__main__':
+  sys.path.append(os.path.join(os.path.dirname(__file__), '../..'))
+
+import platform
+import tempfile
+import unittest
+import struct
+
+from grit import constants
+from grit import util
+from grit.node import brotli_util
+from grit.node import structure
+from grit.format import rc
+
+
+def checkIsGzipped(filename, compress_attr):
+  test_data_root = util.PathFromRoot('grit/testdata')
+  root = util.ParseGrdForUnittest(
+      '''
+      <structures>
+        <structure name="TEST_TXT" file="%s" %s type="chrome_html"/>
+      </structures>''' % (filename, compress_attr),
+      base_dir=test_data_root)
+  node, = root.GetChildrenOfType(structure.StructureNode)
+  node.RunPreSubstitutionGatherer()
+  compressed = node.GetDataPackValue(lang='en', encoding=util.BINARY)
+
+  decompressed_data = zlib.decompress(compressed, 16 + zlib.MAX_WBITS)
+  expected = util.ReadFile(os.path.join(test_data_root, filename), util.BINARY)
+  return expected == decompressed_data
+
+
+class StructureUnittest(unittest.TestCase):
+  def testSkeleton(self):
+    grd = util.ParseGrdForUnittest('''
+        <structures>
+          <structure type="dialog" name="IDD_ABOUTBOX" file="klonk.rc" encoding="utf-16-le">
+            <skeleton expr="lang == 'fr'" variant_of_revision="1" file="klonk-alternate-skeleton.rc" />
+          </structure>
+        </structures>''', base_dir=util.PathFromRoot('grit/testdata'))
+    grd.SetOutputLanguage('fr')
+    grd.RunGatherers()
+    transl = ''.join(rc.Format(grd, 'fr', '.'))
+    self.failUnless(transl.count('040704') and transl.count('110978'))
+    self.failUnless(transl.count('2005",IDC_STATIC'))
+
+  def testRunCommandOnCurrentPlatform(self):
+    node = structure.StructureNode()
+    node.attrs = node.DefaultAttributes()
+    self.failUnless(node.RunCommandOnCurrentPlatform())
+    node.attrs['run_command_on_platforms'] = 'Nosuch'
+    self.failIf(node.RunCommandOnCurrentPlatform())
+    node.attrs['run_command_on_platforms'] = (
+        'Nosuch,%s,Othernot' % platform.system())
+    self.failUnless(node.RunCommandOnCurrentPlatform())
+
+  def testVariables(self):
+    grd = util.ParseGrdForUnittest('''
+        <structures>
+          <structure type="chrome_html" name="hello_tmpl" file="structure_variables.html" expand_variables="true" variables="GREETING=Hello,THINGS=foo,, bar,, baz,EQUATION=2+2==4,filename=simple" flattenhtml="true"></structure>
+        </structures>''', base_dir=util.PathFromRoot('grit/testdata'))
+    grd.SetOutputLanguage('en')
+    grd.RunGatherers()
+    node, = grd.GetChildrenOfType(structure.StructureNode)
+    filename = node.Process(tempfile.gettempdir())
+    filepath = os.path.join(tempfile.gettempdir(), filename)
+    with open(filepath) as f:
+      result = f.read()
+      self.failUnlessEqual(('<h1>Hello!</h1>\n'
+                            'Some cool things are foo, bar, baz.\n'
+                            'Did you know that 2+2==4?\n'
+                            '<p>\n'
+                            '  Hello!\n'
+                            '</p>\n'), result)
+    os.remove(filepath)
+
+  def testGetPath(self):
+    base_dir = util.PathFromRoot('grit/testdata')
+    grd = util.ParseGrdForUnittest('''
+        <structures>
+          <structure type="chrome_html" name="hello_tmpl" file="structure_variables.html" expand_variables="true" variables="GREETING=Hello,THINGS=foo,, bar,, baz,EQUATION=2+2==4,filename=simple" flattenhtml="true" use_base_dir="true"></structure>
+        </structures>''', base_dir)
+    grd.SetOutputLanguage('en')
+    grd.RunGatherers()
+    node, = grd.GetChildrenOfType(structure.StructureNode)
+    self.assertEqual(grd.ToRealPath(node.GetInputPath()),
+                     os.path.abspath(os.path.join(
+                         base_dir, r'structure_variables.html')))
+
+  def testGetPathNoBasedir(self):
+    base_dir = util.PathFromRoot('grit/testdata')
+    abs_path = os.path.join(base_dir, r'structure_variables.html')
+    rel_path = os.path.relpath(abs_path, os.getcwd())
+    grd = util.ParseGrdForUnittest('''
+        <structures>
+          <structure type="chrome_html" name="hello_tmpl" file="''' + rel_path + '''" expand_variables="true" variables="GREETING=Hello,THINGS=foo,, bar,, baz,EQUATION=2+2==4,filename=simple" flattenhtml="true" use_base_dir="false"></structure>
+        </structures>''', util.PathFromRoot('grit/testdata'))
+    grd.SetOutputLanguage('en')
+    grd.RunGatherers()
+    node, = grd.GetChildrenOfType(structure.StructureNode)
+    self.assertEqual(grd.ToRealPath(node.GetInputPath()),
+                     os.path.abspath(os.path.join(
+                         base_dir, r'structure_variables.html')))
+
+  def testCompressGzip(self):
+    self.assertTrue(checkIsGzipped('test_text.txt', 'compress="gzip"'))
+
+  def testCompressGzipByDefault(self):
+    self.assertTrue(checkIsGzipped('test_html.html', ''))
+    self.assertTrue(checkIsGzipped('test_js.js', ''))
+    self.assertTrue(checkIsGzipped('test_css.css', ''))
+    self.assertTrue(checkIsGzipped('test_svg.svg', ''))
+
+    self.assertTrue(checkIsGzipped('test_html.html', 'compress="default"'))
+    self.assertTrue(checkIsGzipped('test_js.js', 'compress="default"'))
+    self.assertTrue(checkIsGzipped('test_css.css', 'compress="default"'))
+    self.assertTrue(checkIsGzipped('test_svg.svg', 'compress="default"'))
+
+  def testCompressBrotli(self):
+    test_data_root = util.PathFromRoot('grit/testdata')
+    root = util.ParseGrdForUnittest(
+        '''
+        <structures>
+          <structure name="TEST_TXT" file="test_text.txt"
+                   compress="brotli" type="chrome_html" />
+        </structures>''',
+        base_dir=test_data_root)
+    node, = root.GetChildrenOfType(structure.StructureNode)
+    node.RunPreSubstitutionGatherer()
+
+    # Using the mock brotli decompression executable.
+    brotli_util.SetBrotliCommand([sys.executable,
+                                 os.path.join(os.path.dirname(__file__),
+                                 'mock_brotli.py')])
+    compressed = node.GetDataPackValue(lang='en', encoding=util.BINARY)
+    # Assert that the first two bytes in compressed format is BROTLI_CONST.
+    self.assertEqual(constants.BROTLI_CONST, compressed[0:2])
+
+    # Compare the actual size of the uncompressed test data with
+    # the size appended during compression.
+    actual_size = len(util.ReadFile(
+        os.path.join(test_data_root, 'test_text.txt'), util.BINARY))
+    uncompress_size = struct.unpack('<i', compressed[2:6])[0]
+    uncompress_size += struct.unpack('<h', compressed[6:8])[0] << 4*8
+    self.assertEqual(actual_size, uncompress_size)
+
+    self.assertEqual(b'This has been mock compressed!', compressed[8:])
+
+  def testNotCompressed(self):
+    test_data_root = util.PathFromRoot('grit/testdata')
+    root = util.ParseGrdForUnittest('''
+        <structures>
+          <structure name="TEST_TXT" file="test_text.txt" type="chrome_html" />
+        </structures>''', base_dir=test_data_root)
+    node, = root.GetChildrenOfType(structure.StructureNode)
+    node.RunPreSubstitutionGatherer()
+    data = node.GetDataPackValue(lang='en', encoding=util.BINARY)
+
+    self.assertEqual(util.ReadFile(
+        os.path.join(test_data_root, 'test_text.txt'), util.BINARY), data)
+
+
+if __name__ == '__main__':
+  unittest.main()
diff --git a/tools/grit/grit/node/variant.py b/tools/grit/grit/node/variant.py
new file mode 100644
index 0000000000..9f5845f954
--- /dev/null
+++ b/tools/grit/grit/node/variant.py
@@ -0,0 +1,41 @@
+# Copyright (c) 2012 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.
+
+'''The <skeleton> element.
+'''
+
+from __future__ import print_function
+
+from grit.node import base
+
+
+class SkeletonNode(base.Node):
+  '''A <skeleton> element.'''
+
+  # TODO(joi) Support inline skeleton variants as CDATA instead of requiring
+  # a 'file' attribute.
+
+  def MandatoryAttributes(self):
+    return ['expr', 'variant_of_revision', 'file']
+
+  def DefaultAttributes(self):
+    '''If not specified, 'encoding' will actually default to the parent node's
+    encoding.
+    '''
+    return {'encoding' : ''}
+
+  def _ContentType(self):
+    if 'file' in self.attrs:
+      return self._CONTENT_TYPE_NONE
+    else:
+      return self._CONTENT_TYPE_CDATA
+
+  def GetEncodingToUse(self):
+    if self.attrs['encoding'] == '':
+      return self.parent.attrs['encoding']
+    else:
+      return self.attrs['encoding']
+
+  def GetInputPath(self):
+    return self.attrs['file']
diff --git a/tools/grit/grit/pseudo.py b/tools/grit/grit/pseudo.py
new file mode 100644
index 0000000000..b607bfc6bb
--- /dev/null
+++ b/tools/grit/grit/pseudo.py
@@ -0,0 +1,129 @@
+# Copyright (c) 2012 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.
+
+'''Pseudotranslation support.  Our pseudotranslations are based on the
+P-language, which is a simple vowel-extending language.  Examples of P:
+  - "hello" becomes "hepellopo"
+  - "howdie" becomes "hopowdiepie"
+  - "because" becomes "bepecaupause" (but in our implementation we don't
+    handle the silent e at the end so it actually would return "bepecaupausepe"
+
+The P-language has the excellent quality of increasing the length of text
+by around 30-50% which is great for pseudotranslations, to stress test any
+GUI layouts etc.
+
+To make the pseudotranslations more obviously "not a translation" and to make
+them exercise any code that deals with encodings, we also transform all English
+vowels into equivalent vowels with diacriticals on them (rings, acutes,
+diaresis, and circumflex), and we write the "p" in the P-language as a Hebrew
+character Qof.  It looks sort of like a latin character "p" but it is outside
+the latin-1 character set which will stress character encoding bugs.
+'''
+
+from __future__ import print_function
+
+from grit import lazy_re
+from grit import tclib
+
+
+# An RFC language code for the P pseudolanguage.
+PSEUDO_LANG = 'x-P-pseudo'
+
+# Hebrew character Qof.  It looks kind of like a 'p' but is outside
+# the latin-1 character set which is good for our purposes.
+# TODO(joi) For now using P instead of Qof, because of some bugs it used.  Find
+# a better solution, i.e. one that introduces a non-latin1 character into the
+# pseudotranslation.
+#_QOF = u'\u05e7'
+_QOF = u'P'
+
+# How we map each vowel.
+_VOWELS = {
+  u'a' : u'\u00e5',  # a with ring
+  u'e' : u'\u00e9',  # e acute
+  u'i' : u'\u00ef',  # i diaresis
+  u'o' : u'\u00f4',  # o circumflex
+  u'u' : u'\u00fc',  # u diaresis
+  u'y' : u'\u00fd',  # y acute
+  u'A' : u'\u00c5',  # A with ring
+  u'E' : u'\u00c9',  # E acute
+  u'I' : u'\u00cf',  # I diaresis
+  u'O' : u'\u00d4',  # O circumflex
+  u'U' : u'\u00dc',  # U diaresis
+  u'Y' : u'\u00dd',  # Y acute
+}
+_VOWELS_KEYS = set(_VOWELS.keys())
+
+# Matches vowels and P
+_PSUB_RE = lazy_re.compile("(%s)" % '|'.join(_VOWELS_KEYS | {'P'}))
+
+
+# Pseudotranslations previously created.  This is important for performance
+# reasons, especially since we routinely pseudotranslate the whole project
+# several or many different times for each build.
+_existing_translations = {}
+
+
+def MapVowels(str, also_p = False):
+  '''Returns a copy of 'str' where characters that exist as keys in _VOWELS
+  have been replaced with the corresponding value.  If also_p is true, this
+  function will also change capital P characters into a Hebrew character Qof.
+  '''
+  def Repl(match):
+    if match.group() == 'p':
+      if also_p:
+        return _QOF
+      else:
+        return 'p'
+    else:
+      return _VOWELS[match.group()]
+  return _PSUB_RE.sub(Repl, str)
+
+
+def PseudoString(str):
+  '''Returns a pseudotranslation of the provided string, in our enhanced
+  P-language.'''
+  if str in _existing_translations:
+    return _existing_translations[str]
+
+  outstr = u''
+  ix = 0
+  while ix < len(str):
+    if str[ix] not in _VOWELS_KEYS:
+      outstr += str[ix]
+      ix += 1
+    else:
+      # We want to treat consecutive vowels as one composite vowel.  This is not
+      # always accurate e.g. in composite words but good enough.
+      consecutive_vowels = u''
+      while ix < len(str) and str[ix] in _VOWELS_KEYS:
+        consecutive_vowels += str[ix]
+        ix += 1
+      changed_vowels = MapVowels(consecutive_vowels)
+      outstr += changed_vowels
+      outstr += _QOF
+      outstr += changed_vowels
+
+  _existing_translations[str] = outstr
+  return outstr
+
+
+def PseudoMessage(message):
+  '''Returns a pseudotranslation of the provided message.
+
+  Args:
+    message: tclib.Message()
+
+  Return:
+    tclib.Translation()
+  '''
+  transl = tclib.Translation()
+
+  for part in message.GetContent():
+    if isinstance(part, tclib.Placeholder):
+      transl.AppendPlaceholder(part)
+    else:
+      transl.AppendText(PseudoString(part))
+
+  return transl
diff --git a/tools/grit/grit/pseudo_rtl.py b/tools/grit/grit/pseudo_rtl.py
new file mode 100644
index 0000000000..2240b571de
--- /dev/null
+++ b/tools/grit/grit/pseudo_rtl.py
@@ -0,0 +1,104 @@
+# Copyright (c) 2012 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.
+
+'''Pseudo RTL, (aka Fake Bidi) support. It simply wraps each word with
+Unicode RTL overrides.
+More info at https://sites.google.com/a/chromium.org/dev/Home/fake-bidi
+'''
+
+from __future__ import print_function
+
+import re
+
+from grit import lazy_re
+from grit import tclib
+
+ACCENTED_STRINGS = {
+  'a': u"\u00e5", 'e': u"\u00e9", 'i': u"\u00ee", 'o': u"\u00f6",
+  'u': u"\u00fb", 'A': u"\u00c5", 'E': u"\u00c9", 'I': u"\u00ce",
+  'O': u"\u00d6", 'U': u"\u00db", 'c': u"\u00e7", 'd': u"\u00f0",
+  'n': u"\u00f1", 'p': u"\u00fe", 'y': u"\u00fd", 'C': u"\u00c7",
+  'D': u"\u00d0", 'N': u"\u00d1", 'P': u"\u00de", 'Y': u"\u00dd",
+  'f': u"\u0192", 's': u"\u0161", 'S': u"\u0160", 'z': u"\u017e",
+  'Z': u"\u017d", 'g': u"\u011d", 'G': u"\u011c", 'h': u"\u0125",
+  'H': u"\u0124", 'j': u"\u0135", 'J': u"\u0134", 'k': u"\u0137",
+  'K': u"\u0136", 'l': u"\u013c", 'L': u"\u013b", 't': u"\u0163",
+  'T': u"\u0162", 'w': u"\u0175", 'W': u"\u0174",
+  '$': u"\u20ac", '?': u"\u00bf", 'R': u"\u00ae", r'!': u"\u00a1",
+}
+
+# a character set containing the keys in ACCENTED_STRINGS
+# We should not accent characters in an escape sequence such as "\n".
+# To be safe, we assume every character following a backslash is an escaped
+# character. We also need to consider the case like "\\n", which means
+# a blackslash and a character "n", we will accent the character "n".
+TO_ACCENT = lazy_re.compile(
+    r'[%s]|\\[a-z\\]' % ''.join(ACCENTED_STRINGS.keys()))
+
+# Lex text so that we don't interfere with html tokens and entities.
+# This lexing scheme will handle all well formed tags and entities, html or
+# xhtml.  It will not handle comments, CDATA sections, or the unescaping tags:
+# script, style, xmp or listing.  If any of those appear in messages,
+# something is wrong.
+TOKENS = [ lazy_re.compile(
+                           '^%s' % pattern,  # match at the beginning of input
+                           re.I | re.S  # html tokens are case-insensitive
+                         )
+           for pattern in
+           (
+            # a run of non html special characters
+            r'[^<&]+',
+            # a tag
+            (r'</?[a-z]\w*' # beginning of tag
+             r'(?:\s+\w+(?:\s*=\s*' # attribute start
+             r'(?:[^\s"\'>]+|"[^\"]*"|\'[^\']*\'))?' # attribute value
+             r')*\s*/?>'),
+            # an entity
+            r'&(?:[a-z]\w+|#\d+|#x[\da-f]+);',
+            # an html special character not part of a special sequence
+            r'.'
+           ) ]
+
+ALPHABETIC_RUN = lazy_re.compile(r'([^\W0-9_]+)')
+
+RLO = u'\u202e'
+PDF = u'\u202c'
+
+def PseudoRTLString(text):
+  '''Returns a fake bidirectional version of the source string. This code is
+    based on accentString above, in turn copied from Frank Tang.
+    '''
+  parts = []
+  while text:
+    m = None
+    for token in TOKENS:
+      m = token.search(text)
+      if m:
+        part = m.group(0)
+        text = text[len(part):]
+        if part[0] not in ('<', '&'):
+          # not a tag or entity, so accent
+          part = ALPHABETIC_RUN.sub(lambda run: RLO + run.group() + PDF, part)
+        parts.append(part)
+        break
+  return ''.join(parts)
+
+
+def PseudoRTLMessage(message):
+  '''Returns a pseudo-RTL (aka Fake-Bidi) translation of the provided message.
+
+  Args:
+    message: tclib.Message()
+
+  Return:
+    tclib.Translation()
+  '''
+  transl = tclib.Translation()
+  for part in message.GetContent():
+    if isinstance(part, tclib.Placeholder):
+      transl.AppendPlaceholder(part)
+    else:
+      transl.AppendText(PseudoRTLString(part))
+
+  return transl
diff --git a/tools/grit/grit/pseudo_unittest.py b/tools/grit/grit/pseudo_unittest.py
new file mode 100644
index 0000000000..b1d53ff401
--- /dev/null
+++ b/tools/grit/grit/pseudo_unittest.py
@@ -0,0 +1,55 @@
+#!/usr/bin/env python
+# Copyright (c) 2012 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.
+
+'''Unit tests for grit.pseudo'''
+
+from __future__ import print_function
+
+import os
+import sys
+if __name__ == '__main__':
+  sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
+
+import unittest
+
+from grit import pseudo
+from grit import tclib
+
+
+class PseudoUnittest(unittest.TestCase):
+  def testVowelMapping(self):
+    self.failUnless(pseudo.MapVowels('abebibobuby') ==
+                    u'\u00e5b\u00e9b\u00efb\u00f4b\u00fcb\u00fd')
+    self.failUnless(pseudo.MapVowels('ABEBIBOBUBY') ==
+                    u'\u00c5B\u00c9B\u00cfB\u00d4B\u00dcB\u00dd')
+
+  def testPseudoString(self):
+    out = pseudo.PseudoString('hello')
+    self.failUnless(out == pseudo.MapVowels(u'hePelloPo', True))
+
+  def testConsecutiveVowels(self):
+    out = pseudo.PseudoString("beautiful weather, ain't it?")
+    self.failUnless(out == pseudo.MapVowels(
+      u"beauPeautiPifuPul weaPeathePer, aiPain't iPit?", 1))
+
+  def testCapitals(self):
+    out = pseudo.PseudoString("HOWDIE DOODIE, DR. JONES")
+    self.failUnless(out == pseudo.MapVowels(
+      u"HOPOWDIEPIE DOOPOODIEPIE, DR. JOPONEPES", 1))
+
+  def testPseudoMessage(self):
+    msg = tclib.Message(text='Hello USERNAME, how are you?',
+                        placeholders=[
+                          tclib.Placeholder('USERNAME', '%s', 'Joi')])
+    trans = pseudo.PseudoMessage(msg)
+    # TODO(joi) It would be nicer if 'you' -> 'youPou' instead of
+    # 'you' -> 'youPyou' and if we handled the silent e in 'are'
+    self.failUnless(trans.GetPresentableContent() ==
+                    pseudo.MapVowels(
+                      u'HePelloPo USERNAME, hoPow aParePe youPyou?', 1))
+
+
+if __name__ == '__main__':
+  unittest.main()
diff --git a/tools/grit/grit/shortcuts.py b/tools/grit/grit/shortcuts.py
new file mode 100644
index 0000000000..0db2ce436c
--- /dev/null
+++ b/tools/grit/grit/shortcuts.py
@@ -0,0 +1,93 @@
+# Copyright (c) 2012 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.
+
+'''Stuff to prevent conflicting shortcuts.
+'''
+
+from __future__ import print_function
+
+from grit import lazy_re
+
+
+class ShortcutGroup(object):
+  '''Manages a list of cliques that belong together in a single shortcut
+  group.  Knows how to detect conflicting shortcut keys.
+  '''
+
+  # Matches shortcut keys, e.g. &J
+  SHORTCUT_RE = lazy_re.compile('([^&]|^)(&[A-Za-z])')
+
+  def __init__(self, name):
+    self.name = name
+    # Map of language codes to shortcut keys used (which is a map of
+    # shortcut keys to counts).
+    self.keys_by_lang = {}
+    # List of cliques in this group
+    self.cliques = []
+
+  def AddClique(self, c):
+    for existing_clique in self.cliques:
+      if existing_clique.GetId() == c.GetId():
+        # This happens e.g. when we have e.g.
+        # <if expr1><structure 1></if> <if expr2><structure 2></if>
+        # where only one will really be included in the output.
+        return
+
+    self.cliques.append(c)
+    for (lang, msg) in c.clique.items():
+      if lang not in self.keys_by_lang:
+        self.keys_by_lang[lang] = {}
+      keymap = self.keys_by_lang[lang]
+
+      content = msg.GetRealContent()
+      keys = [groups[1] for groups in self.SHORTCUT_RE.findall(content)]
+      for key in keys:
+        key = key.upper()
+        if key in keymap:
+          keymap[key] += 1
+        else:
+          keymap[key] = 1
+
+  def GenerateWarnings(self, tc_project):
+    # For any language that has more than one occurrence of any shortcut,
+    # make a list of the conflicting shortcuts.
+    problem_langs = {}
+    for (lang, keys) in self.keys_by_lang.items():
+      for (key, count) in keys.items():
+        if count > 1:
+          if lang not in problem_langs:
+            problem_langs[lang] = []
+          problem_langs[lang].append(key)
+
+    warnings = []
+    if len(problem_langs):
+      warnings.append("WARNING - duplicate keys exist in shortcut group %s" %
+                      self.name)
+      for (lang,keys) in problem_langs.items():
+        warnings.append("  %6s duplicates: %s" % (lang, ', '.join(keys)))
+    return warnings
+
+
+def GenerateDuplicateShortcutsWarnings(uberclique, tc_project):
+  '''Given an UberClique and a project name, will print out helpful warnings
+  if there are conflicting shortcuts within shortcut groups in the provided
+  UberClique.
+
+  Args:
+    uberclique: clique.UberClique()
+    tc_project: 'MyProjectNameInTheTranslationConsole'
+
+  Returns:
+    ['warning line 1', 'warning line 2', ...]
+  '''
+  warnings = []
+  groups = {}
+  for c in uberclique.AllCliques():
+    for group in c.shortcut_groups:
+      if group not in groups:
+        groups[group] = ShortcutGroup(group)
+      groups[group].AddClique(c)
+  for group in groups.values():
+    warnings += group.GenerateWarnings(tc_project)
+  return warnings
diff --git a/tools/grit/grit/shortcuts_unittest.py b/tools/grit/grit/shortcuts_unittest.py
new file mode 100644
index 0000000000..30e7c4f758
--- /dev/null
+++ b/tools/grit/grit/shortcuts_unittest.py
@@ -0,0 +1,79 @@
+# Copyright (c) 2012 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.
+
+'''Unit tests for grit.shortcuts
+'''
+
+from __future__ import print_function
+
+import os
+import sys
+if __name__ == '__main__':
+  sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
+
+import unittest
+
+from six import StringIO
+
+from grit import shortcuts
+from grit import clique
+from grit import tclib
+from grit.gather import rc
+
+class ShortcutsUnittest(unittest.TestCase):
+
+  def setUp(self):
+    self.uq = clique.UberClique()
+
+  def testFunctionality(self):
+    c = self.uq.MakeClique(tclib.Message(text="Hello &there"))
+    c.AddToShortcutGroup('group_name')
+    c = self.uq.MakeClique(tclib.Message(text="Howdie &there partner"))
+    c.AddToShortcutGroup('group_name')
+
+    warnings = shortcuts.GenerateDuplicateShortcutsWarnings(self.uq, 'PROJECT')
+    self.failUnless(warnings)
+
+  def testAmpersandEscaping(self):
+    c = self.uq.MakeClique(tclib.Message(text="Hello &there"))
+    c.AddToShortcutGroup('group_name')
+    c = self.uq.MakeClique(tclib.Message(text="S&&T are the &letters S and T"))
+    c.AddToShortcutGroup('group_name')
+
+    warnings = shortcuts.GenerateDuplicateShortcutsWarnings(self.uq, 'PROJECT')
+    self.failUnless(len(warnings) == 0)
+
+  def testDialog(self):
+    dlg = rc.Dialog(StringIO('''\
+IDD_SIDEBAR_RSS_PANEL_PROPPAGE DIALOGEX 0, 0, 239, 221
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+    PUSHBUTTON      "Add &URL",IDC_SIDEBAR_RSS_ADD_URL,182,53,57,14
+    EDITTEXT        IDC_SIDEBAR_RSS_NEW_URL,0,53,178,15,ES_AUTOHSCROLL
+    PUSHBUTTON      "&Remove",IDC_SIDEBAR_RSS_REMOVE,183,200,56,14
+    PUSHBUTTON      "&Edit",IDC_SIDEBAR_RSS_EDIT,123,200,56,14
+    CONTROL         "&Automatically add commonly viewed clips",
+                    IDC_SIDEBAR_RSS_AUTO_ADD,"Button",BS_AUTOCHECKBOX |
+                    BS_MULTILINE | WS_TABSTOP,0,200,120,17
+    PUSHBUTTON      "",IDC_SIDEBAR_RSS_HIDDEN,179,208,6,6,NOT WS_VISIBLE
+    LTEXT           "You can display clips from blogs, news sites, and other online sources.",
+                    IDC_STATIC,0,0,239,10
+    LISTBOX         IDC_SIDEBAR_DISPLAYED_FEED_LIST,0,69,239,127,LBS_SORT |
+                    LBS_OWNERDRAWFIXED | LBS_HASSTRINGS |
+                    LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_HSCROLL |
+                    WS_TABSTOP
+    LTEXT           "Add a clip from a recently viewed website by clicking Add Recent Clips.",
+                    IDC_STATIC,0,13,141,19
+    LTEXT           "Or, if you know a site supports RSS or Atom, you can enter the RSS or Atom URL below and add it to your list of Web Clips.",
+                    IDC_STATIC,0,33,239,18
+    PUSHBUTTON      "Add Recent &Clips (10)...",
+                    IDC_SIDEBAR_RSS_ADD_RECENT_CLIPS,146,14,93,14
+END'''), 'IDD_SIDEBAR_RSS_PANEL_PROPPAGE')
+    dlg.SetUberClique(self.uq)
+    dlg.Parse()
+
+    warnings = shortcuts.GenerateDuplicateShortcutsWarnings(self.uq, 'PROJECT')
+    self.failUnless(len(warnings) == 0)
+
diff --git a/tools/grit/grit/tclib.py b/tools/grit/grit/tclib.py
new file mode 100644
index 0000000000..27ba366924
--- /dev/null
+++ b/tools/grit/grit/tclib.py
@@ -0,0 +1,246 @@
+# Copyright (c) 2012 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.
+
+'''Adaptation of the extern.tclib classes for our needs.
+'''
+
+from __future__ import print_function
+
+import functools
+import re
+
+import six
+
+from grit import exception
+from grit import lazy_re
+import grit.extern.tclib
+
+
+# Matches whitespace sequences which can be folded into a single whitespace
+# character.  This matches single characters so that non-spaces are replaced
+# with spaces.
+_FOLD_WHITESPACE = re.compile(r'\s+')
+
+# Caches compiled regexp used to split tags in BaseMessage.__init__()
+_RE_CACHE = {}
+
+def Identity(i):
+  return i
+
+
+class BaseMessage(object):
+  '''Base class with methods shared by Message and Translation.
+  '''
+
+  def __init__(self, text='', placeholders=[], description='', meaning=''):
+    self.parts = []
+    self.placeholders = []
+    self.meaning = meaning
+    self.dirty = True  # True if self.id is (or might be) wrong
+    self.id = 0
+    self.SetDescription(description)
+
+    if text != '':
+      if not placeholders or placeholders == []:
+        self.AppendText(text)
+      else:
+        tag_map = {}
+        for placeholder in placeholders:
+          tag_map[placeholder.GetPresentation()] = [placeholder, 0]
+        # This creates a regexp like '(TAG1|TAG2|TAG3)'.
+        # The tags have to be sorted in order of decreasing length, so that
+        # longer tags are substituted before shorter tags that happen to be
+        # substrings of the longer tag.
+        # E.g. "EXAMPLE_FOO_NAME" must be matched before "EXAMPLE_FOO",
+        # otherwise "EXAMPLE_FOO" splits "EXAMPLE_FOO_NAME" too.
+        tags = sorted(tag_map.keys(),
+                      key=functools.cmp_to_key(
+                          lambda x, y: len(x) - len(y) or ((x > y) - (x < y))),
+                      reverse=True)
+        tag_re = '(' + '|'.join(tags) + ')'
+
+        # This caching improves the time to build
+        # chrome/app:generated_resources from 21.562s to 17.672s on Linux.
+        compiled_re = _RE_CACHE.get(tag_re, None)
+        if compiled_re is None:
+          compiled_re = re.compile(tag_re)
+          _RE_CACHE[tag_re] = compiled_re
+
+        chunked_text = compiled_re.split(text)
+
+        for chunk in chunked_text:
+          if chunk: # ignore empty chunk
+            if chunk in tag_map:
+              self.AppendPlaceholder(tag_map[chunk][0])
+              tag_map[chunk][1] += 1 # increase placeholder use count
+            else:
+              self.AppendText(chunk)
+        for key in tag_map:
+          assert tag_map[key][1] != 0
+
+  def GetRealContent(self, escaping_function=Identity):
+    '''Returns the original content, i.e. what your application and users
+    will see.
+
+    Specify a function to escape each translateable bit, if you like.
+    '''
+    bits = []
+    for item in self.parts:
+      if isinstance(item, six.string_types):
+        bits.append(escaping_function(item))
+      else:
+        bits.append(item.GetOriginal())
+    return ''.join(bits)
+
+  def GetPresentableContent(self):
+    presentable_content = []
+    for part in self.parts:
+      if isinstance(part, Placeholder):
+        presentable_content.append(part.GetPresentation())
+      else:
+        presentable_content.append(part)
+    return ''.join(presentable_content)
+
+  def AppendPlaceholder(self, placeholder):
+    assert isinstance(placeholder, Placeholder)
+    dup = False
+    for other in self.GetPlaceholders():
+      if other.presentation == placeholder.presentation:
+        assert other.original == placeholder.original
+        dup = True
+
+    if not dup:
+      self.placeholders.append(placeholder)
+    self.parts.append(placeholder)
+    self.dirty = True
+
+  def AppendText(self, text):
+    assert isinstance(text, six.string_types)
+    assert text != ''
+
+    self.parts.append(text)
+    self.dirty = True
+
+  def GetContent(self):
+    '''Returns the parts of the message.  You may modify parts if you wish.
+    Note that you must not call GetId() on this object until you have finished
+    modifying the contents.
+    '''
+    self.dirty = True  # user might modify content
+    return self.parts
+
+  def GetDescription(self):
+    return self.description
+
+  def SetDescription(self, description):
+    self.description = _FOLD_WHITESPACE.sub(' ', description)
+
+  def GetMeaning(self):
+    return self.meaning
+
+  def GetId(self):
+    if self.dirty:
+      self.id = self.GenerateId()
+      self.dirty = False
+    return self.id
+
+  def GenerateId(self):
+    return grit.extern.tclib.GenerateMessageId(self.GetPresentableContent(),
+                                               self.meaning)
+
+  def GetPlaceholders(self):
+    return self.placeholders
+
+  def FillTclibBaseMessage(self, msg):
+    msg.SetDescription(self.description.encode('utf-8'))
+
+    for part in self.parts:
+      if isinstance(part, Placeholder):
+        ph = grit.extern.tclib.Placeholder(
+          part.presentation.encode('utf-8'),
+          part.original.encode('utf-8'),
+          part.example.encode('utf-8'))
+        msg.AppendPlaceholder(ph)
+      else:
+        msg.AppendText(part.encode('utf-8'))
+
+
+class Message(BaseMessage):
+  '''A message.'''
+
+  def __init__(self, text='', placeholders=[], description='', meaning='',
+               assigned_id=None):
+    super(Message, self).__init__(text, placeholders, description, meaning)
+    self.assigned_id = assigned_id
+
+  def ToTclibMessage(self):
+    msg = grit.extern.tclib.Message('utf-8', meaning=self.meaning)
+    self.FillTclibBaseMessage(msg)
+    return msg
+
+  def GetId(self):
+    '''Use the assigned id if we have one.'''
+    if self.assigned_id:
+      return self.assigned_id
+
+    return super(Message, self).GetId()
+
+  def HasAssignedId(self):
+    '''Returns True if this message has an assigned id.'''
+    return bool(self.assigned_id)
+
+
+class Translation(BaseMessage):
+  '''A translation.'''
+
+  def __init__(self, text='', id='', placeholders=[], description='', meaning=''):
+    super(Translation, self).__init__(text, placeholders, description, meaning)
+    self.id = id
+
+  def GetId(self):
+    assert id != '', "ID has not been set."
+    return self.id
+
+  def SetId(self, id):
+    self.id = id
+
+  def ToTclibMessage(self):
+    msg = grit.extern.tclib.Message(
+      'utf-8', id=self.id, meaning=self.meaning)
+    self.FillTclibBaseMessage(msg)
+    return msg
+
+
+class Placeholder(grit.extern.tclib.Placeholder):
+  '''Modifies constructor to accept a Unicode string
+  '''
+
+  # Must match placeholder presentation names
+  _NAME_RE = lazy_re.compile('^[A-Za-z0-9_]+$')
+
+  def __init__(self, presentation, original, example):
+    '''Creates a new placeholder.
+
+    Args:
+      presentation: 'USERNAME'
+      original: '%s'
+      example: 'Joi'
+    '''
+    assert presentation != ''
+    assert original != ''
+    assert example != ''
+    if not self._NAME_RE.match(presentation):
+      raise exception.InvalidPlaceholderName(presentation)
+    self.presentation = presentation
+    self.original = original
+    self.example = example
+
+  def GetPresentation(self):
+    return self.presentation
+
+  def GetOriginal(self):
+    return self.original
+
+  def GetExample(self):
+    return self.example
diff --git a/tools/grit/grit/tclib_unittest.py b/tools/grit/grit/tclib_unittest.py
new file mode 100644
index 0000000000..7a08654e1b
--- /dev/null
+++ b/tools/grit/grit/tclib_unittest.py
@@ -0,0 +1,180 @@
+#!/usr/bin/env python
+# Copyright (c) 2012 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.
+
+'''Unit tests for grit.tclib'''
+
+from __future__ import print_function
+
+import sys
+import os.path
+if __name__ == '__main__':
+  sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
+
+import unittest
+
+import six
+
+from grit import tclib
+
+from grit import exception
+import grit.extern.tclib
+
+
+class TclibUnittest(unittest.TestCase):
+  def testInit(self):
+    msg = tclib.Message(text=u'Hello Earthlings',
+                        description='Greetings\n\t      message')
+    self.failUnlessEqual(msg.GetPresentableContent(), 'Hello Earthlings')
+    self.failUnless(isinstance(msg.GetPresentableContent(), six.string_types))
+    self.failUnlessEqual(msg.GetDescription(), 'Greetings message')
+
+  def testGetAttr(self):
+    msg = tclib.Message()
+    msg.AppendText(u'Hello')  # Tests __getattr__
+    self.failUnless(msg.GetPresentableContent() == 'Hello')
+    self.failUnless(isinstance(msg.GetPresentableContent(), six.string_types))
+
+  def testAll(self):
+    text = u'Howdie USERNAME'
+    phs = [tclib.Placeholder(u'USERNAME', u'%s', 'Joi')]
+    msg = tclib.Message(text=text, placeholders=phs)
+    self.failUnless(msg.GetPresentableContent() == 'Howdie USERNAME')
+
+    trans = tclib.Translation(text=text, placeholders=phs)
+    self.failUnless(trans.GetPresentableContent() == 'Howdie USERNAME')
+    self.failUnless(isinstance(trans.GetPresentableContent(), six.string_types))
+
+  def testUnicodeReturn(self):
+    text = u'\u00fe'
+    msg = tclib.Message(text=text)
+    self.failUnless(msg.GetPresentableContent() == text)
+    from_list = msg.GetContent()[0]
+    self.failUnless(from_list == text)
+
+  def testRegressionTranslationInherited(self):
+    '''Regression tests a bug that was caused by grit.tclib.Translation
+    inheriting from the translation console's Translation object
+    instead of only owning an instance of it.
+    '''
+    msg = tclib.Message(text=u"BLA1\r\nFrom: BLA2 \u00fe BLA3",
+                        placeholders=[
+                          tclib.Placeholder('BLA1', '%s', '%s'),
+                          tclib.Placeholder('BLA2', '%s', '%s'),
+                          tclib.Placeholder('BLA3', '%s', '%s')])
+    transl = tclib.Translation(text=msg.GetPresentableContent(),
+                               placeholders=msg.GetPlaceholders())
+    content = transl.GetContent()
+    self.failUnless(isinstance(content[3], six.string_types))
+
+  def testFingerprint(self):
+    # This has Windows line endings.  That is on purpose.
+    id = grit.extern.tclib.GenerateMessageId(
+      'Google Desktop for Enterprise\r\n'
+      'All Rights Reserved\r\n'
+      '\r\n'
+      '---------\r\n'
+      'Contents\r\n'
+      '---------\r\n'
+      'This distribution contains the following files:\r\n'
+      '\r\n'
+      'GoogleDesktopSetup.msi - Installation and setup program\r\n'
+      'GoogleDesktop.adm - Group Policy administrative template file\r\n'
+      'AdminGuide.pdf - Google Desktop for Enterprise administrative guide\r\n'
+      '\r\n'
+      '\r\n'
+      '--------------\r\n'
+      'Documentation\r\n'
+      '--------------\r\n'
+      'Full documentation and installation instructions are in the \r\n'
+      'administrative guide, and also online at \r\n'
+      'http://desktop.google.com/enterprise/adminguide.html.\r\n'
+      '\r\n'
+      '\r\n'
+      '------------------------\r\n'
+      'IBM Lotus Notes Plug-In\r\n'
+      '------------------------\r\n'
+      'The Lotus Notes plug-in is included in the release of Google \r\n'
+      'Desktop for Enterprise. The IBM Lotus Notes Plug-in for Google \r\n'
+      'Desktop indexes mail, calendar, task, contact and journal \r\n'
+      'documents from Notes.  Discussion documents including those from \r\n'
+      'the discussion and team room templates can also be indexed by \r\n'
+      'selecting an option from the preferences.  Once indexed, this data\r\n'
+      'will be returned in Google Desktop searches.  The corresponding\r\n'
+      'document can be opened in Lotus Notes from the Google Desktop \r\n'
+      'results page.\r\n'
+      '\r\n'
+      'Install: The plug-in will install automatically during the Google \r\n'
+      'Desktop setup process if Lotus Notes is already installed.  Lotus \r\n'
+      'Notes must not be running in order for the install to occur.  \r\n'
+      '\r\n'
+      'Preferences: Preferences and selection of databases to index are\r\n'
+      'set in the \'Google Desktop for Notes\' dialog reached through the \r\n'
+      '\'Actions\' menu.\r\n'
+      '\r\n'
+      'Reindexing: Selecting \'Reindex all databases\' will index all the \r\n'
+      'documents in each database again.\r\n'
+      '\r\n'
+      '\r\n'
+      'Notes Plug-in Known Issues\r\n'
+      '---------------------------\r\n'
+      '\r\n'
+      'If the \'Google Desktop for Notes\' item is not available from the \r\n'
+      'Lotus Notes Actions menu, then installation was not successful. \r\n'
+      'Installation consists of writing one file, notesgdsplugin.dll, to \r\n'
+      'the Notes application directory and a setting to the notes.ini \r\n'
+      'configuration file.  The most likely cause of an unsuccessful \r\n'
+      'installation is that the installer was not able to locate the \r\n'
+      'notes.ini file. Installation will complete if the user closes Notes\r\n'
+      'and manually adds the following setting to this file on a new line:\r\n'
+      'AddinMenus=notegdsplugin.dll\r\n'
+      '\r\n'
+      'If the notesgdsplugin.dll file is not in the application directory\r\n'
+      r'(e.g., C:\Program Files\Lotus\Notes) after Google Desktop \r\n'
+      'installation, it is likely that Notes was not installed correctly. \r\n'
+      '\r\n'
+      'Only local databases can be indexed.  If they can be determined, \r\n'
+      'the user\'s local mail file and address book will be included in the\r\n'
+      'list automatically.  Mail archives and other databases must be \r\n'
+      'added with the \'Add\' button.\r\n'
+      '\r\n'
+      'Some users may experience performance issues during the initial \r\n'
+      'indexing of a database.  The \'Perform the initial index of a \r\n'
+      'database only when I\'m idle\' option will limit the indexing process\r\n'
+      'to times when the user is not using the machine. If this does not \r\n'
+      'alleviate the problem or the user would like to continually index \r\n'
+      'but just do so more slowly or quickly, the GoogleWaitTime notes.ini\r\n'
+      'value can be set. Increasing the GoogleWaitTime value will slow \r\n'
+      'down the indexing process, and lowering the value will speed it up.\r\n'
+      'A value of zero causes the fastest possible indexing.  Removing the\r\n'
+      'ini parameter altogether returns it to the default (20).\r\n'
+      '\r\n'
+      'Crashes have been known to occur with certain types of history \r\n'
+      'bookmarks.  If the Notes client seems to crash randomly, try \r\n'
+      'disabling the \'Index note history\' option.  If it crashes before,\r\n'
+      'you can get to the preferences, add the following line to your \r\n'
+      'notes.ini file:\r\n'
+      'GDSNoIndexHistory=1\r\n')
+    self.assertEqual(id, '7660964495923572726')
+
+  def testPlaceholderNameChecking(self):
+    try:
+      ph = tclib.Placeholder('BINGO BONGO', 'bla', 'bla')
+      raise Exception("We shouldn't get here")
+    except exception.InvalidPlaceholderName:
+      pass  # Expect exception to be thrown because presentation contained space
+
+  def testTagsWithCommonSubstring(self):
+    word = 'ABCDEFGHIJ'
+    text = ' '.join([word[:i] for i in range(1, 11)])
+    phs = [tclib.Placeholder(word[:i], str(i), str(i)) for i in range(1, 11)]
+    try:
+      msg = tclib.Message(text=text, placeholders=phs)
+      self.failUnless(msg.GetRealContent() == '1 2 3 4 5 6 7 8 9 10')
+    except:
+      self.fail('tclib.Message() should handle placeholders that are '
+                'substrings of each other')
+
+if __name__ == '__main__':
+  unittest.main()
diff --git a/tools/grit/grit/test_suite_all.py b/tools/grit/grit/test_suite_all.py
new file mode 100644
index 0000000000..3bfe2a79d5
--- /dev/null
+++ b/tools/grit/grit/test_suite_all.py
@@ -0,0 +1,34 @@
+#!/usr/bin/env python3
+# Copyright (c) 2011 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.
+
+'''Unit test suite that collects all test cases for GRIT.'''
+
+from __future__ import print_function
+
+import os
+import sys
+
+
+CUR_DIR = os.path.dirname(os.path.realpath(__file__))
+SRC_DIR = os.path.dirname(os.path.dirname(os.path.dirname(CUR_DIR)))
+TYP_DIR = os.path.join(
+    SRC_DIR, 'third_party', 'catapult', 'third_party', 'typ')
+
+if TYP_DIR not in sys.path:
+    sys.path.insert(0, TYP_DIR)
+
+
+import typ  # pylint: disable=import-error,unused-import
+
+
+def main(args):
+    return typ.main(
+      top_level_dirs=[os.path.join(CUR_DIR, '..')],
+      skip=['grit.format.gen_predetermined_ids_unittest.*',
+            'grit.pseudo_unittest.*']
+      )
+
+if __name__ == '__main__':
+    sys.exit(main(sys.argv[1:]))
diff --git a/tools/grit/grit/testdata/GoogleDesktop.adm b/tools/grit/grit/testdata/GoogleDesktop.adm
new file mode 100644
index 0000000000..082f56bb1a
--- /dev/null
+++ b/tools/grit/grit/testdata/GoogleDesktop.adm
@@ -0,0 +1,945 @@
+CLASS MACHINE
+  CATEGORY !!Cat_Google
+    CATEGORY !!Cat_GoogleDesktopSearch
+      KEYNAME "Software\Policies\Google\Google Desktop"
+
+      CATEGORY !!Cat_Preferences
+        KEYNAME "Software\Policies\Google\Google Desktop\Preferences"
+
+        CATEGORY !!Cat_IndexAndCaptureControl
+          POLICY !!Blacklist_Email
+            EXPLAIN !!Explain_Blacklist_Email
+            KEYNAME "Software\Policies\Google\Google Desktop\Preferences\blacklist-1"
+            VALUENAME "1"
+          END POLICY
+
+          POLICY !!Blacklist_Gmail
+            EXPLAIN !!Explain_Blacklist_Gmail
+            KEYNAME "Software\Policies\Google\Google Desktop\Preferences\blacklist-pop"
+            VALUENAME "gmail"
+          END POLICY
+
+          POLICY !!Blacklist_WebHistory
+            EXPLAIN !!Explain_Blacklist_WebHistory
+            KEYNAME "Software\Policies\Google\Google Desktop\Preferences\blacklist-1"
+            VALUENAME "2"
+          END POLICY
+
+          POLICY !!Blacklist_Chat
+            EXPLAIN !!Explain_Blacklist_Chat
+            KEYNAME "Software\Policies\Google\Google Desktop\Preferences\blacklist-1"
+            ACTIONLISTON
+              VALUENAME "3"    VALUE NUMERIC 1
+            END ACTIONLISTON
+          END POLICY
+
+          POLICY !!Blacklist_Text
+            EXPLAIN !!Explain_Blacklist_Text
+            KEYNAME "Software\Policies\Google\Google Desktop\Preferences\blacklist-1"
+            ACTIONLISTON
+              VALUENAME "4"    VALUE NUMERIC 1
+            END ACTIONLISTON
+          END POLICY
+
+          POLICY !!Blacklist_Media
+            EXPLAIN !!Explain_Blacklist_Media
+            KEYNAME "Software\Policies\Google\Google Desktop\Preferences\blacklist-1"
+            ACTIONLISTON
+              VALUENAME "5"   VALUE NUMERIC 1
+            END ACTIONLISTON
+          END POLICY
+
+          POLICY !!Blacklist_Contact
+            EXPLAIN !!Explain_Blacklist_Contact
+            KEYNAME "Software\Policies\Google\Google Desktop\Preferences\blacklist-1"
+            ACTIONLISTON
+              VALUENAME "9"   VALUE NUMERIC 1
+            END ACTIONLISTON
+          END POLICY
+
+          POLICY !!Blacklist_Calendar
+            EXPLAIN !!Explain_Blacklist_Calendar
+            KEYNAME "Software\Policies\Google\Google Desktop\Preferences\blacklist-1"
+            ACTIONLISTON
+              VALUENAME "10"   VALUE NUMERIC 1
+            END ACTIONLISTON
+          END POLICY
+
+          POLICY !!Blacklist_Task
+            EXPLAIN !!Explain_Blacklist_Task
+            KEYNAME "Software\Policies\Google\Google Desktop\Preferences\blacklist-1"
+            ACTIONLISTON
+              VALUENAME "11"   VALUE NUMERIC 1
+            END ACTIONLISTON
+          END POLICY
+
+          POLICY !!Blacklist_Note
+            EXPLAIN !!Explain_Blacklist_Note
+            KEYNAME "Software\Policies\Google\Google Desktop\Preferences\blacklist-1"
+            ACTIONLISTON
+              VALUENAME "12"   VALUE NUMERIC 1
+            END ACTIONLISTON
+          END POLICY
+
+          POLICY !!Blacklist_Journal
+            EXPLAIN !!Explain_Blacklist_Journal
+            KEYNAME "Software\Policies\Google\Google Desktop\Preferences\blacklist-1"
+            ACTIONLISTON
+              VALUENAME "13"   VALUE NUMERIC 1
+            END ACTIONLISTON
+          END POLICY
+
+          POLICY !!Blacklist_Word
+            EXPLAIN !!Explain_Blacklist_Word
+            KEYNAME "Software\Policies\Google\Google Desktop\Preferences\blacklist-2"
+            VALUENAME "DOC"
+          END POLICY
+
+          POLICY !!Blacklist_Excel
+            EXPLAIN !!Explain_Blacklist_Excel
+            KEYNAME "Software\Policies\Google\Google Desktop\Preferences\blacklist-2"
+            VALUENAME "XLS"
+          END POLICY
+
+          POLICY !!Blacklist_Powerpoint
+            EXPLAIN !!Explain_Blacklist_Powerpoint
+            KEYNAME "Software\Policies\Google\Google Desktop\Preferences\blacklist-2"
+            VALUENAME "PPT"
+          END POLICY
+
+          POLICY !!Blacklist_PDF
+            EXPLAIN !!Explain_Blacklist_PDF
+            KEYNAME "Software\Policies\Google\Google Desktop\Preferences\blacklist-2"
+            VALUENAME "PDF"
+          END POLICY
+
+          POLICY !!Blacklist_ZIP
+            EXPLAIN !!Explain_Blacklist_ZIP
+            KEYNAME "Software\Policies\Google\Google Desktop\Preferences\blacklist-2"
+            VALUENAME "ZIP"
+          END POLICY
+
+          POLICY !!Blacklist_HTTPS
+            EXPLAIN !!Explain_Blacklist_HTTPS
+            KEYNAME "Software\Policies\Google\Google Desktop\Preferences\blacklist-3"
+            VALUENAME "HTTPS"
+          END POLICY
+
+          POLICY !!Blacklist_PasswordProtectedOffice
+            EXPLAIN !!Explain_Blacklist_PasswordProtectedOffice
+            KEYNAME "Software\Policies\Google\Google Desktop\Preferences\blacklist-13"
+            VALUENAME "SECUREOFFICE"
+          END POLICY
+
+          POLICY !!Blacklist_URI_Contains
+            EXPLAIN !!Explain_Blacklist_URI_Contains
+            KEYNAME "Software\Policies\Google\Google Desktop\Preferences\blacklist-6"
+            PART !!Blacklist_URI_Contains LISTBOX
+            END PART
+          END POLICY
+
+          POLICY !!Blacklist_Extensions
+            EXPLAIN !!Explain_Blacklist_Extensions
+            PART !!Blacklist_Extensions EDITTEXT
+              VALUENAME "file_extensions_to_skip"
+            END PART
+          END POLICY
+
+          POLICY !!Pol_Disallow_UserSearchLocations
+            EXPLAIN !!Explain_Disallow_UserSearchLocations
+            VALUENAME user_search_locations
+            VALUEON NUMERIC 1
+          END POLICY
+
+          POLICY !!Pol_Search_Location_Whitelist
+            EXPLAIN !!Explain_Search_Location_Whitelist
+            KEYNAME "Software\Policies\Google\Google Desktop\Preferences\policy_search_location_whitelist"
+            PART !!Search_Locations_Whitelist LISTBOX
+            END PART
+          END POLICY
+
+          POLICY !!Email_Retention
+            EXPLAIN !!Explain_Email_Retention
+            PART !!Email_Retention_Edit NUMERIC
+              VALUENAME "email_days_to_retain"
+              MIN 1 MAX 65535 DEFAULT 30 SPIN 1
+            END PART
+          END POLICY
+
+          POLICY !!Webpage_Retention
+            EXPLAIN !!Explain_Webpage_Retention
+            PART !!Webpage_Retention_Edit NUMERIC
+              VALUENAME "webpage_days_to_retain"
+              MIN 1 MAX 65535 DEFAULT 30 SPIN 1
+            END PART
+          END POLICY
+
+          POLICY !!File_Retention
+            EXPLAIN !!Explain_File_Retention
+            PART !!File_Retention_Edit NUMERIC
+              VALUENAME "file_days_to_retain"
+              MIN 1 MAX 65535 DEFAULT 30 SPIN 1
+            END PART
+          END POLICY
+
+          POLICY !!IM_Retention
+            EXPLAIN !!Explain_IM_Retention
+            PART !!IM_Retention_Edit NUMERIC
+              VALUENAME "im_days_to_retain"
+              MIN 1 MAX 65535 DEFAULT 30 SPIN 1
+            END PART
+          END POLICY
+
+          POLICY !!Pol_Remove_Deleted_Items
+            EXPLAIN !!Explain_Remove_Deleted_Items
+            VALUENAME remove_deleted_items
+            VALUEON   NUMERIC 1
+          END POLICY
+
+          POLICY !!Pol_Allow_Simultaneous_Indexing
+            EXPLAIN !!Explain_Allow_Simultaneous_Indexing
+            VALUENAME simultaneous_indexing
+            VALUEON   NUMERIC 1
+          END POLICY
+
+        END CATEGORY
+
+        POLICY !!Pol_TurnOffAdvancedFeatures
+          EXPLAIN !!Explain_TurnOffAdvancedFeatures
+          VALUENAME error_report_on
+          VALUEON   NUMERIC 0
+        END POLICY
+
+        POLICY !!Pol_TurnOffImproveGd
+          EXPLAIN !!Explain_TurnOffImproveGd
+          VALUENAME improve_gd
+          VALUEON   NUMERIC 0
+          VALUEOFF  NUMERIC 1
+        END POLICY
+
+        POLICY !!Pol_NoPersonalizationInfo
+          EXPLAIN !!Explain_NoPersonalizationInfo
+          VALUENAME send_personalization_info
+          VALUEON   NUMERIC 0
+          VALUEOFF  NUMERIC 1
+        END POLICY
+
+        POLICY !!Pol_OneBoxMode
+          EXPLAIN !!Explain_OneBoxMode
+          VALUENAME onebox_mode
+          VALUEON   NUMERIC 0
+        END POLICY
+
+        POLICY !!Pol_EncryptIndex
+          EXPLAIN !!Explain_EncryptIndex
+          VALUENAME encrypt_index
+          VALUEON   NUMERIC 1
+        END POLICY
+
+        POLICY !!Pol_Hyper
+          EXPLAIN !!Explain_Hyper
+          VALUENAME hyper_off
+          VALUEON   NUMERIC 1
+        END POLICY
+
+        POLICY !!Pol_Display_Mode
+          EXPLAIN !!Explain_Display_Mode
+          PART !!Pol_Display_Mode DROPDOWNLIST
+            VALUENAME display_mode
+            ITEMLIST
+              NAME !!Sidebar VALUE NUMERIC 1
+              NAME !!Deskbar VALUE NUMERIC 8
+              NAME !!FloatingDeskbar VALUE NUMERIC 4
+              NAME !!None VALUE NUMERIC 0
+            END ITEMLIST
+          END PART
+        END POLICY
+
+      END CATEGORY  ; Preferences
+
+      CATEGORY !!Cat_Enterprise
+        KEYNAME "Software\Policies\Google\Google Desktop\Enterprise"
+
+        POLICY !!Pol_Autoupdate
+          EXPLAIN !!Explain_Autoupdate
+          VALUENAME autoupdate_host
+          VALUEON ""
+        END POLICY
+
+        POLICY !!Pol_AutoupdateAsSystem
+          EXPLAIN !!Explain_AutoupdateAsSystem
+          VALUENAME autoupdate_impersonate_user
+          VALUEON   NUMERIC 0
+          VALUEOFF  NUMERIC 1
+        END POLICY
+
+        POLICY !!Pol_EnterpriseTab
+          EXPLAIN !!Explain_EnterpriseTab
+          PART !!EnterpriseTabText EDITTEXT
+            VALUENAME enterprise_tab_text
+          END PART
+          PART !!EnterpriseTabHomepage EDITTEXT
+            VALUENAME enterprise_tab_homepage
+          END PART
+          PART !!EnterpriseTabHomepageQuery CHECKBOX
+            VALUENAME enterprise_tab_homepage_query
+          END PART
+          PART !!EnterpriseTabResults EDITTEXT
+            VALUENAME enterprise_tab_results
+          END PART
+          PART !!EnterpriseTabResultsQuery CHECKBOX
+            VALUENAME enterprise_tab_results_query
+          END PART
+        END POLICY
+
+        POLICY !!Pol_GSAHosts
+          EXPLAIN !!Explain_GSAHosts
+          KEYNAME "Software\Policies\Google\Google Desktop\Enterprise\GSAHosts"
+          PART !!Pol_GSAHosts LISTBOX
+          END PART
+        END POLICY
+
+        POLICY !!Pol_PolicyUnawareClientProhibitedFlag
+          EXPLAIN !!Explain_PolicyUnawareClientProhibitedFlag
+          KEYNAME "Software\Policies\Google\Google Desktop"
+          VALUENAME PolicyUnawareClientProhibitedFlag
+        END POLICY
+
+        POLICY !!Pol_MinimumAllowedVersion
+          EXPLAIN !!Explain_MinimumAllowedVersion
+          PART !!Pol_MinimumAllowedVersion EDITTEXT
+            VALUENAME minimum_allowed_version
+          END PART
+        END POLICY
+
+        POLICY !!Pol_MaximumAllowedVersion
+          EXPLAIN !!Explain_MaximumAllowedVersion
+          PART !!Pol_MaximumAllowedVersion EDITTEXT
+            VALUENAME maximum_allowed_version
+          END PART
+        END POLICY
+
+        POLICY !!Pol_Disallow_Gadgets
+          EXPLAIN !!Explain_Disallow_Gadgets
+          VALUENAME disallow_gadgets
+          VALUEON   NUMERIC 1
+          PART !!Disallow_Only_Non_Builtin_Gadgets CHECKBOX DEFCHECKED
+            VALUENAME disallow_only_non_builtin_gadgets
+            VALUEON  NUMERIC 1
+            VALUEOFF NUMERIC 0
+          END PART
+        END POLICY
+
+        POLICY !!Pol_Gadget_Whitelist
+          EXPLAIN !!Explain_Gadget_Whitelist
+          KEYNAME "Software\Policies\Google\Google Desktop\Enterprise\gadget_whitelist"
+          PART !!Pol_Gadget_Whitelist LISTBOX
+          END PART
+        END POLICY
+
+        POLICY !!Pol_Gadget_Install_Confirmation_Whitelist
+          EXPLAIN !!Explain_Gadget_Install_Confirmation_Whitelist
+          KEYNAME "Software\Policies\Google\Google Desktop\Enterprise\install_confirmation_whitelist"
+          PART !!Pol_Gadget_Install_Confirmation_Whitelist LISTBOX
+          END PART
+        END POLICY
+
+        POLICY !!Pol_Alternate_User_Data_Dir
+          EXPLAIN !!Explain_Alternate_User_Data_Dir
+          PART !!Pol_Alternate_User_Data_Dir EDITTEXT
+            VALUENAME alternate_user_data_dir
+          END PART
+        END POLICY
+
+        POLICY !!Pol_MaxAllowedOutlookConnections
+          EXPLAIN !!Explain_MaxAllowedOutlookConnections
+          PART !!Pol_MaxAllowedOutlookConnections NUMERIC
+            VALUENAME max_allowed_outlook_connections
+            MIN 1 MAX 65535 DEFAULT 400 SPIN 1
+          END PART
+        END POLICY
+
+        POLICY !!Pol_DisallowSsdService
+          EXPLAIN !!Explain_DisallowSsdService
+          VALUENAME disallow_ssd_service
+          VALUEON   NUMERIC 1
+        END POLICY
+
+        POLICY !!Pol_DisallowSsdOutbound
+          EXPLAIN !!Explain_DisallowSsdOutbound
+          VALUENAME disallow_ssd_outbound
+          VALUEON   NUMERIC 1
+        END POLICY
+
+        POLICY !!Pol_Disallow_Store_Gadget_Service
+          EXPLAIN !!Explain_Disallow_Store_Gadget_Service
+          VALUENAME disallow_store_gadget_service
+          VALUEON   NUMERIC 1
+        END POLICY
+
+        POLICY !!Pol_MaxExchangeIndexingRate
+          EXPLAIN !!Explain_MaxExchangeIndexingRate
+          PART !!Pol_MaxExchangeIndexingRate NUMERIC
+            VALUENAME max_exchange_indexing_rate
+            MIN 1 MAX 1000 DEFAULT 60 SPIN 1
+          END PART
+        END POLICY
+
+        POLICY !!Pol_EnableSafeweb
+          EXPLAIN  !!Explain_Safeweb
+          VALUENAME safe_browsing
+          VALUEON   NUMERIC 1
+          VALUEOFF  NUMERIC 0
+        END POLICY
+
+      END CATEGORY  ; Enterprise
+
+    END CATEGORY  ; GoogleDesktopSearch
+  END CATEGORY  ; Google
+
+
+CLASS USER
+  CATEGORY !!Cat_Google
+    CATEGORY !!Cat_GoogleDesktopSearch
+      KEYNAME "Software\Policies\Google\Google Desktop"
+
+      CATEGORY !!Cat_Preferences
+        KEYNAME "Software\Policies\Google\Google Desktop\Preferences"
+
+        CATEGORY !!Cat_IndexAndCaptureControl
+          POLICY !!Blacklist_Email
+            EXPLAIN !!Explain_Blacklist_Email
+            KEYNAME "Software\Policies\Google\Google Desktop\Preferences\blacklist-1"
+            VALUENAME "1"
+          END POLICY
+
+          POLICY !!Blacklist_Gmail
+            EXPLAIN !!Explain_Blacklist_Gmail
+            KEYNAME "Software\Policies\Google\Google Desktop\Preferences\blacklist-pop"
+            VALUENAME "gmail"
+          END POLICY
+
+          POLICY !!Blacklist_WebHistory
+            EXPLAIN !!Explain_Blacklist_WebHistory
+            KEYNAME "Software\Policies\Google\Google Desktop\Preferences\blacklist-1"
+            VALUENAME "2"
+          END POLICY
+
+          POLICY !!Blacklist_Chat
+            EXPLAIN !!Explain_Blacklist_Chat
+            KEYNAME "Software\Policies\Google\Google Desktop\Preferences\blacklist-1"
+            ACTIONLISTON
+              VALUENAME "3"    VALUE NUMERIC 1
+            END ACTIONLISTON
+          END POLICY
+
+          POLICY !!Blacklist_Text
+            EXPLAIN !!Explain_Blacklist_Text
+            KEYNAME "Software\Policies\Google\Google Desktop\Preferences\blacklist-1"
+            ACTIONLISTON
+              VALUENAME "4"    VALUE NUMERIC 1
+            END ACTIONLISTON
+          END POLICY
+
+          POLICY !!Blacklist_Media
+            EXPLAIN !!Explain_Blacklist_Media
+            KEYNAME "Software\Policies\Google\Google Desktop\Preferences\blacklist-1"
+            ACTIONLISTON
+              VALUENAME "5"   VALUE NUMERIC 1
+            END ACTIONLISTON
+          END POLICY
+
+          POLICY !!Blacklist_Contact
+            EXPLAIN !!Explain_Blacklist_Contact
+            KEYNAME "Software\Policies\Google\Google Desktop\Preferences\blacklist-1"
+            ACTIONLISTON
+              VALUENAME "9"   VALUE NUMERIC 1
+            END ACTIONLISTON
+          END POLICY
+
+          POLICY !!Blacklist_Calendar
+            EXPLAIN !!Explain_Blacklist_Calendar
+            KEYNAME "Software\Policies\Google\Google Desktop\Preferences\blacklist-1"
+            ACTIONLISTON
+              VALUENAME "10"   VALUE NUMERIC 1
+            END ACTIONLISTON
+          END POLICY
+
+          POLICY !!Blacklist_Task
+            EXPLAIN !!Explain_Blacklist_Task
+            KEYNAME "Software\Policies\Google\Google Desktop\Preferences\blacklist-1"
+            ACTIONLISTON
+              VALUENAME "11"   VALUE NUMERIC 1
+            END ACTIONLISTON
+          END POLICY
+
+          POLICY !!Blacklist_Note
+            EXPLAIN !!Explain_Blacklist_Note
+            KEYNAME "Software\Policies\Google\Google Desktop\Preferences\blacklist-1"
+            ACTIONLISTON
+              VALUENAME "12"   VALUE NUMERIC 1
+            END ACTIONLISTON
+          END POLICY
+
+          POLICY !!Blacklist_Journal
+            EXPLAIN !!Explain_Blacklist_Journal
+            KEYNAME "Software\Policies\Google\Google Desktop\Preferences\blacklist-1"
+            ACTIONLISTON
+              VALUENAME "13"   VALUE NUMERIC 1
+            END ACTIONLISTON
+          END POLICY
+
+          POLICY !!Blacklist_Word
+            EXPLAIN !!Explain_Blacklist_Word
+            KEYNAME "Software\Policies\Google\Google Desktop\Preferences\blacklist-2"
+            VALUENAME "DOC"
+          END POLICY
+
+          POLICY !!Blacklist_Excel
+            EXPLAIN !!Explain_Blacklist_Excel
+            KEYNAME "Software\Policies\Google\Google Desktop\Preferences\blacklist-2"
+            VALUENAME "XLS"
+          END POLICY
+
+          POLICY !!Blacklist_Powerpoint
+            EXPLAIN !!Explain_Blacklist_Powerpoint
+            KEYNAME "Software\Policies\Google\Google Desktop\Preferences\blacklist-2"
+            VALUENAME "PPT"
+          END POLICY
+
+          POLICY !!Blacklist_PDF
+            EXPLAIN !!Explain_Blacklist_PDF
+            KEYNAME "Software\Policies\Google\Google Desktop\Preferences\blacklist-2"
+            VALUENAME "PDF"
+          END POLICY
+
+          POLICY !!Blacklist_ZIP
+            EXPLAIN !!Explain_Blacklist_ZIP
+            KEYNAME "Software\Policies\Google\Google Desktop\Preferences\blacklist-2"
+            VALUENAME "ZIP"
+          END POLICY
+
+          POLICY !!Blacklist_HTTPS
+            EXPLAIN !!Explain_Blacklist_HTTPS
+            KEYNAME "Software\Policies\Google\Google Desktop\Preferences\blacklist-3"
+            VALUENAME "HTTPS"
+          END POLICY
+
+          POLICY !!Blacklist_PasswordProtectedOffice
+            EXPLAIN !!Explain_Blacklist_PasswordProtectedOffice
+            KEYNAME "Software\Policies\Google\Google Desktop\Preferences\blacklist-13"
+            VALUENAME "SECUREOFFICE"
+          END POLICY
+
+          POLICY !!Blacklist_URI_Contains
+            EXPLAIN !!Explain_Blacklist_URI_Contains
+            KEYNAME "Software\Policies\Google\Google Desktop\Preferences\blacklist-6"
+            PART !!Blacklist_URI_Contains LISTBOX
+            END PART
+          END POLICY
+
+          POLICY !!Blacklist_Extensions
+            EXPLAIN !!Explain_Blacklist_Extensions
+            PART !!Blacklist_Extensions EDITTEXT
+              VALUENAME "file_extensions_to_skip"
+            END PART
+          END POLICY
+
+          POLICY !!Pol_Disallow_UserSearchLocations
+            EXPLAIN !!Explain_Disallow_UserSearchLocations
+            VALUENAME user_search_locations
+            VALUEON NUMERIC 1
+          END POLICY
+
+          POLICY !!Pol_Search_Location_Whitelist
+            EXPLAIN !!Explain_Search_Location_Whitelist
+            KEYNAME "Software\Policies\Google\Google Desktop\Preferences\policy_search_location_whitelist"
+            PART !!Search_Locations_Whitelist LISTBOX
+            END PART
+          END POLICY
+
+          POLICY !!Email_Retention
+            EXPLAIN !!Explain_Email_Retention
+            PART !!Email_Retention_Edit NUMERIC
+              VALUENAME "email_days_to_retain"
+              MIN 1 MAX 65535 DEFAULT 30 SPIN 1
+            END PART
+          END POLICY
+
+          POLICY !!Webpage_Retention
+            EXPLAIN !!Explain_Webpage_Retention
+            PART !!Webpage_Retention_Edit NUMERIC
+              VALUENAME "webpage_days_to_retain"
+              MIN 1 MAX 65535 DEFAULT 30 SPIN 1
+            END PART
+          END POLICY
+
+          POLICY !!File_Retention
+            EXPLAIN !!Explain_File_Retention
+            PART !!File_Retention_Edit NUMERIC
+              VALUENAME "file_days_to_retain"
+              MIN 1 MAX 65535 DEFAULT 30 SPIN 1
+            END PART
+          END POLICY
+
+          POLICY !!IM_Retention
+            EXPLAIN !!Explain_IM_Retention
+            PART !!IM_Retention_Edit NUMERIC
+              VALUENAME "im_days_to_retain"
+              MIN 1 MAX 65535 DEFAULT 30 SPIN 1
+            END PART
+          END POLICY
+
+          POLICY !!Pol_Remove_Deleted_Items
+            EXPLAIN !!Explain_Remove_Deleted_Items
+            VALUENAME remove_deleted_items
+            VALUEON   NUMERIC 1
+          END POLICY
+
+          POLICY !!Pol_Allow_Simultaneous_Indexing
+            EXPLAIN !!Explain_Allow_Simultaneous_Indexing
+            VALUENAME simultaneous_indexing
+            VALUEON   NUMERIC 1
+          END POLICY
+
+        END CATEGORY
+
+        POLICY !!Pol_TurnOffAdvancedFeatures
+          EXPLAIN !!Explain_TurnOffAdvancedFeatures
+          VALUENAME error_report_on
+          VALUEON   NUMERIC 0
+        END POLICY
+
+        POLICY !!Pol_TurnOffImproveGd
+          EXPLAIN !!Explain_TurnOffImproveGd
+          VALUENAME improve_gd
+          VALUEON   NUMERIC 0
+          VALUEOFF  NUMERIC 1
+        END POLICY
+
+        POLICY !!Pol_NoPersonalizationInfo
+          EXPLAIN !!Explain_NoPersonalizationInfo
+          VALUENAME send_personalization_info
+          VALUEON   NUMERIC 0
+          VALUEOFF  NUMERIC 1
+        END POLICY
+
+        POLICY !!Pol_OneBoxMode
+          EXPLAIN !!Explain_OneBoxMode
+          VALUENAME onebox_mode
+          VALUEON   NUMERIC 0
+        END POLICY
+
+        POLICY !!Pol_EncryptIndex
+          EXPLAIN !!Explain_EncryptIndex
+          VALUENAME encrypt_index
+          VALUEON   NUMERIC 1
+        END POLICY
+
+        POLICY !!Pol_Hyper
+          EXPLAIN !!Explain_Hyper
+          VALUENAME hyper_off
+          VALUEON   NUMERIC 1
+        END POLICY
+
+        POLICY !!Pol_Display_Mode
+          EXPLAIN !!Explain_Display_Mode
+          PART !!Pol_Display_Mode DROPDOWNLIST
+            VALUENAME display_mode
+            ITEMLIST
+              NAME !!Sidebar VALUE NUMERIC 1
+              NAME !!Deskbar VALUE NUMERIC 8
+              NAME !!FloatingDeskbar VALUE NUMERIC 4
+              NAME !!None VALUE NUMERIC 0
+            END ITEMLIST
+          END PART
+        END POLICY
+
+      END CATEGORY  ; Preferences
+
+      CATEGORY !!Cat_Enterprise
+        KEYNAME "Software\Policies\Google\Google Desktop\Enterprise"
+
+        POLICY !!Pol_Autoupdate
+          EXPLAIN !!Explain_Autoupdate
+          VALUENAME autoupdate_host
+          VALUEON ""
+        END POLICY
+
+        POLICY !!Pol_AutoupdateAsSystem
+          EXPLAIN !!Explain_AutoupdateAsSystem
+          VALUENAME autoupdate_impersonate_user
+          VALUEON   NUMERIC 0
+          VALUEOFF  NUMERIC 1
+        END POLICY
+
+        POLICY !!Pol_EnterpriseTab
+          EXPLAIN !!Explain_EnterpriseTab
+          PART !!EnterpriseTabText EDITTEXT
+            VALUENAME enterprise_tab_text
+          END PART
+          PART !!EnterpriseTabHomepage EDITTEXT
+            VALUENAME enterprise_tab_homepage
+          END PART
+          PART !!EnterpriseTabHomepageQuery CHECKBOX
+            VALUENAME enterprise_tab_homepage_query
+          END PART
+          PART !!EnterpriseTabResults EDITTEXT
+            VALUENAME enterprise_tab_results
+          END PART
+          PART !!EnterpriseTabResultsQuery CHECKBOX
+            VALUENAME enterprise_tab_results_query
+          END PART
+        END POLICY
+
+        POLICY !!Pol_GSAHosts
+          EXPLAIN !!Explain_GSAHosts
+          KEYNAME "Software\Policies\Google\Google Desktop\Enterprise\GSAHosts"
+          PART !!Pol_GSAHosts LISTBOX
+          END PART
+        END POLICY
+
+        POLICY !!Pol_Disallow_Gadgets
+          EXPLAIN !!Explain_Disallow_Gadgets
+          VALUENAME disallow_gadgets
+          VALUEON   NUMERIC 1
+          PART !!Disallow_Only_Non_Builtin_Gadgets CHECKBOX DEFCHECKED
+            VALUENAME disallow_only_non_builtin_gadgets
+            VALUEON  NUMERIC 1
+            VALUEOFF NUMERIC 0
+          END PART
+        END POLICY
+
+        POLICY !!Pol_Gadget_Whitelist
+          EXPLAIN !!Explain_Gadget_Whitelist
+          KEYNAME "Software\Policies\Google\Google Desktop\Enterprise\gadget_whitelist"
+          PART !!Pol_Gadget_Whitelist LISTBOX
+          END PART
+        END POLICY
+
+        POLICY !!Pol_Gadget_Install_Confirmation_Whitelist
+          EXPLAIN !!Explain_Gadget_Install_Confirmation_Whitelist
+          KEYNAME "Software\Policies\Google\Google Desktop\Enterprise\install_confirmation_whitelist"
+          PART !!Pol_Gadget_Install_Confirmation_Whitelist LISTBOX
+          END PART
+        END POLICY
+
+        POLICY !!Pol_Alternate_User_Data_Dir
+          EXPLAIN !!Explain_Alternate_User_Data_Dir
+          PART !!Pol_Alternate_User_Data_Dir EDITTEXT
+            VALUENAME alternate_user_data_dir
+          END PART
+        END POLICY
+
+        POLICY !!Pol_MaxAllowedOutlookConnections
+          EXPLAIN !!Explain_MaxAllowedOutlookConnections
+          PART !!Pol_MaxAllowedOutlookConnections NUMERIC
+            VALUENAME max_allowed_outlook_connections
+            MIN 1 MAX 65535 DEFAULT 400 SPIN 1
+          END PART
+        END POLICY
+
+        POLICY !!Pol_DisallowSsdService
+          EXPLAIN !!Explain_DisallowSsdService
+          VALUENAME disallow_ssd_service
+          VALUEON   NUMERIC 1
+        END POLICY
+
+        POLICY !!Pol_DisallowSsdOutbound
+          EXPLAIN !!Explain_DisallowSsdOutbound
+          VALUENAME disallow_ssd_outbound
+          VALUEON   NUMERIC 1
+        END POLICY
+
+        POLICY !!Pol_Disallow_Store_Gadget_Service
+          EXPLAIN !!Explain_Disallow_Store_Gadget_Service
+          VALUENAME disallow_store_gadget_service
+          VALUEON   NUMERIC 1
+        END POLICY
+
+        POLICY !!Pol_MaxExchangeIndexingRate
+          EXPLAIN !!Explain_MaxExchangeIndexingRate
+          PART !!Pol_MaxExchangeIndexingRate NUMERIC
+            VALUENAME max_exchange_indexing_rate
+            MIN 1 MAX 1000 DEFAULT 60 SPIN 1
+          END PART
+        END POLICY
+
+        POLICY !!Pol_EnableSafeweb
+          EXPLAIN  !!Explain_Safeweb
+          VALUENAME safe_browsing
+          VALUEON   NUMERIC 1
+          VALUEOFF  NUMERIC 0
+        END POLICY
+
+      END CATEGORY  ; Enterprise
+
+    END CATEGORY  ; GoogleDesktopSearch
+  END CATEGORY  ; Google
+
+;------------------------------------------------------------------------------
+
+[strings]
+Cat_Google="Google"
+Cat_GoogleDesktopSearch="Google Desktop"
+
+;------------------------------------------------------------------------------
+; Preferences
+;------------------------------------------------------------------------------
+Cat_Preferences="Preferences"
+Explain_Preferences="Controls Google Desktop preferences"
+
+Cat_IndexAndCaptureControl="Indexing and Capture Control"
+Explain_IndexAndCaptureControl="Controls what files, web pages, and other content will be indexed by Google Desktop."
+
+Blacklist_Email="Prevent indexing of email"
+Explain_Blacklist_Email="Enabling this policy will prevent Google Desktop from indexing emails.\n\nIf this policy is not configured, the user can choose whether or not to index emails."
+Blacklist_Gmail="Prevent indexing of Gmail"
+Explain_Blacklist_Gmail="Enabling this policy prevents Google Desktop from indexing Gmail messages.\n\nThis policy is in effect only when the policy "Prevent indexing of email" is disabled. When that policy is enabled, all email indexing is disabled, including Gmail indexing.\n\nIf both this policy and "Prevent indexing of email" are disabled or not configured, a user can choose whether or not to index Gmail messages."
+Blacklist_WebHistory="Prevent indexing of web pages"
+Explain_Blacklist_WebHistory="Enabling this policy will prevent Google Desktop from indexing web pages.\n\nIf this policy is disabled or not configured, the user can choose whether or not to index web pages."
+Blacklist_Text="Prevent indexing of text files"
+Explain_Blacklist_Text="Enabling this policy will prevent Google Desktop from indexing text files.\n\nIf this policy is disabled or not configured, the user can choose whether or not to index text files."
+Blacklist_Media="Prevent indexing of media files"
+Explain_Blacklist_Media="Enabling this policy will prevent Google Desktop from indexing media files.\n\nIf this policy is disabled or not configured, the user can choose whether or not to index media files."
+Blacklist_Contact="Prevent indexing of contacts"
+Explain_Blacklist_Contact="Enabling this policy will prevent Google Desktop from indexing contacts.\n\nIf this policy is disabled or not configured, the user can choose whether or not to index contacts."
+Blacklist_Calendar="Prevent indexing of calendar entries"
+Explain_Blacklist_Calendar="Enabling this policy will prevent Google Desktop from indexing calendar entries.\n\nIf this policy is disabled or not configured, the user can choose whether or not to index calendar entries."
+Blacklist_Task="Prevent indexing of tasks"
+Explain_Blacklist_Task="Enabling this policy will prevent Google Desktop from indexing tasks.\n\nIf this policy is disabled or not configured, the user can choose whether or not to index tasks."
+Blacklist_Note="Prevent indexing of notes"
+Explain_Blacklist_Note="Enabling this policy will prevent Google Desktop from indexing notes.\n\nIf this policy is disabled or not configured, the user can choose whether or not to index notes."
+Blacklist_Journal="Prevent indexing of journal entries"
+Explain_Blacklist_Journal="Enabling this policy will prevent Google Desktop from indexing journal entries.\n\nIf this policy is disabled or not configured, the user can choose whether or not to index journal entries."
+Blacklist_Word="Prevent indexing of Word documents"
+Explain_Blacklist_Word="Enabling this policy will prevent Google Desktop from indexing Word documents.\n\nIf this policy is disabled or not configured, the user can choose whether or not to index Word documents."
+Blacklist_Excel="Prevent indexing of Excel documents"
+Explain_Blacklist_Excel="Enabling this policy will prevent Google Desktop from indexing Excel documents.\n\nIf this policy is disabled or not configured, the user can choose whether or not to index Excel documents."
+Blacklist_Powerpoint="Prevent indexing of PowerPoint documents"
+Explain_Blacklist_Powerpoint="Enabling this policy will prevent Google Desktop from indexing PowerPoint documents.\n\nIf this policy is disabled or not configured, the user can choose whether or not to index PowerPoint documents."
+Blacklist_PDF="Prevent indexing of PDF documents"
+Explain_Blacklist_PDF="Enabling this policy will prevent Google Desktop from indexing PDF documents.\n\nIf this policy is disabled or not configured, the user can choose whether or not to index PDF documents."
+Blacklist_ZIP="Prevent indexing of ZIP files"
+Explain_Blacklist_ZIP="Enabling this policy will prevent Google Desktop from indexing ZIP files.\n\nIf this policy is disabled or not configured, the user can choose whether or not to index ZIP files."
+Blacklist_HTTPS="Prevent indexing of secure web pages"
+Explain_Blacklist_HTTPS="Enabling this policy will prevent Google Desktop from indexing secure web pages (pages with HTTPS in the URL).\n\nIf this policy is disabled or not configured, the user can choose whether or not to index secure web pages."
+Blacklist_URI_Contains="Prevent indexing of specific web sites and folders"
+Explain_Blacklist_URI_Contains="This policy allows you to prevent Google Desktop from indexing specific websites or folders.  If an item's URL or path name contains any of these specified strings, it will not be indexed.  These restrictions will be applied in addition to any websites or folders that the user has specified.\n\nThis policy has no effect when disabled or not configured."
+Blacklist_Chat="Prevent indexing of IM chats"
+Explain_Blacklist_Chat="Enabling this policy will prevent Google Desktop from indexing IM chat conversations.\n\nIf this policy is disabled or not configured, the user can choose whether or not to index IM chat conversations."
+Blacklist_PasswordProtectedOffice="Prevent indexing of password-protected Office documents (Word, Excel)"
+Explain_Blacklist_PasswordProtectedOffice="Enabling this policy will prevent Google Desktop from indexing password-protected office documents.\n\nIf this policy is disabled or not configured, the user can choose whether or not to index password-protected office documents."
+Blacklist_Extensions="Prevent indexing of specific file extensions"
+Explain_Blacklist_Extensions="This policy allows you to prevent Google Desktop from indexing files with specific extensions.  Enter a list of file extensions, separated by commas, that you wish to exclude from indexing.\n\nThis policy has no effect when disabled or not configured."
+Pol_Disallow_UserSearchLocations="Disallow adding search locations for indexing"
+Explain_Disallow_UserSearchLocations="Enabling this policy will prevent the user from specifying additional drives or networked folders to be indexed by Google Desktop.\n\nIf this policy is disabled or not configured, users may specify additional drives and networked folders to be indexed."
+Pol_Search_Location_Whitelist="Allow indexing of specific folders"
+Explain_Search_Location_Whitelist="This policy allows you to add additional drives and networked folders to index."
+Search_Locations_Whitelist="Search these locations"
+Email_Retention="Only retain emails that are less than x days old"
+Explain_Email_Retention="This policy allows you to configure Google Desktop to only retain emails that are less than the specified number of days old in the index.  Enter the number of days to retain emails for\n\nThis policy has no effect when disabled or not configured."
+Email_Retention_Edit="Number of days to retain emails"
+Webpage_Retention="Only retain webpages that are less than x days old"
+Explain_Webpage_Retention="This policy allows you to configure Google Desktop to only retain webpages that are less than the specified number of days old in the index.  Enter the number of days to retain webpages for\n\nThis policy has no effect when disabled or not configured."
+Webpage_Retention_Edit="Number of days to retain webpages"
+File_Retention="Only retain files that are less than x days old"
+Explain_File_Retention="This policy allows you to configure Google Desktop to only retain files that are less than the specified number of days old in the index.  Enter the number of days to retain files for\n\nThis policy has no effect when disabled or not configured."
+File_Retention_Edit="Number of days to retain files"
+IM_Retention="Only retain IM that are less than x days old"
+Explain_IM_Retention="This policy allows you to configure Google Desktop to only retain IM that are less than the specified number of days old in the index.  Enter the number of days to retain IM for\n\nThis policy has no effect when disabled or not configured."
+IM_Retention_Edit="Number of days to retain IM"
+
+Pol_Remove_Deleted_Items="Remove deleted items from the index."
+Explain_Remove_Deleted_Items="Enabling this policy will remove all deleted items from the index and cache. Any items that are deleted will no longer be searchable."
+
+Pol_Allow_Simultaneous_Indexing="Allow historical indexing for multiple users simultaneously."
+Explain_Allow_Simultaneous_Indexing="Enabling this policy will allow a computer to generate first-time indexes for multiple users simultaneously. \n\nIf this policy is disabled or not configured, historical indexing will happen only for the logged-in user that was connected last; historical indexing for any other logged-in user will happen the next time that other user connects."
+
+Pol_TurnOffAdvancedFeatures="Turn off Advanced Features options"
+Explain_TurnOffAdvancedFeatures="Enabling this policy will prevent Google Desktop from sending Advanced Features data to Google (for either improvements or personalization), and users won't be able to change these options. Enabling this policy also prevents older versions of Google Desktop from sending data.\n\nIf this policy is disabled or not configured and the user has a pre-5.5 version of Google Desktop, the user can choose whether or not to enable sending data to Google. If the user has version 5.5 or later, the 'Turn off Improve Google Desktop option' and 'Do not send personalization info' policies will be used instead."
+
+Pol_TurnOffImproveGd="Turn off Improve Google Desktop option"
+Explain_TurnOffImproveGd="Enabling this policy will prevent Google Desktop from sending improvement data, including crash reports and anonymous usage data, to Google.\n\nIf this policy is disabled, improvement data will be sent to Google and the user won't be able to change the option.\n\nIf this policy is not configured, the user can choose whether or not to enable the Improve Google Desktop option.\n\nNote that this policy applies only to version 5.5 or later and doesn't affect previous versions of Google Desktop.\n\nAlso note that this policy can be overridden by the 'Turn off Advanced Features options' policy."
+
+Pol_NoPersonalizationInfo="Do not send personalization info"
+Explain_NoPersonalizationInfo="Enabling this policy will prevent Google Desktop from displaying personalized content, such as news that reflects the user's past interest in articles. Personalized content is derived from anonymous usage data sent to Google.\n\nIf this policy is disabled, personalized content will be displayed for all users, and users won't be able to disable this feature.\n\nIf this policy is not configured, users can choose whether or not to enable personalization in each gadget that supports this feature.\n\nNote that this policy applies only to version 5.5 or later and doesn't affect previous versions of Google Desktop.\n\nAlso note that this policy can be overridden by the 'Turn off Advanced Features options' policy."
+
+Pol_OneBoxMode="Turn off Google Web Search Integration"
+Explain_OneBoxMode="Enabling this policy will prevent Google Desktop from displaying Desktop Search results in queries to google.com.\n\nIf this policy is disabled or not configured, the user can choose whether or not to include Desktop Search results in queries to google.com."
+
+Pol_EncryptIndex="Encrypt index data"
+Explain_EncryptIndex="Enabling this policy will cause Google Desktop to turn on Windows file encryption for the folder containing the Google Desktop index and related user data the next time it is run.\n\nNote that Windows EFS is only available on NTFS volumes.  If the user's data is stored on a FAT volume, this policy will have no effect.\n\nThis policy has no effect when disabled or not configured."
+
+Pol_Hyper="Turn off Quick Find"
+Explain_Hyper="Enabling this policy will cause Google Desktop to turn off Quick Find feature. Quick Find allows you to see results as you type.\n\nIf this policy is disabled or not configured, the user can choose whether or not to enable it."
+
+Pol_Display_Mode="Choose display option"
+Explain_Display_Mode="This policy sets the Google Desktop display option: Sidebar, Deskbar, Floating Deskbar or none.\n\nNote that on 64-bit systems, a setting of Deskbar will be interpreted as Floating Deskbar.\n\nIf this policy is disabled or not configured, the user can choose a display option."
+Sidebar="Sidebar"
+Deskbar="Deskbar"
+FloatingDeskbar="Floating Deskbar"
+None="None"
+
+;------------------------------------------------------------------------------
+; Enterprise
+;------------------------------------------------------------------------------
+Cat_Enterprise="Enterprise Integration"
+Explain_Enterprise="Controls features specific to Enterprise installations of Google Desktop"
+
+Pol_Autoupdate="Block Auto-update"
+Explain_Autoupdate="Enabling this policy prevents Google Desktop from automatically checking for and installing updates from google.com.\n\nIf you enable this policy, you must distribute updates to Google Desktop using Group Policy, SMS, or a similar enterprise software distribution mechanism.  You should check http://desktop.google.com/enterprise/ for updates.\n\nIf this policy is disabled or not configured, Google Desktop will periodically check for updates from desktop.google.com."
+
+Pol_AutoupdateAsSystem="Use system proxy settings when auto-updating"
+Explain_AutoupdateAsSystem="Enabling this policy makes Google Desktop use the machine-wide proxy settings (as specified using e.g. proxycfg.exe) when performing autoupdates (if enabled).\n\nIf this policy is disabled or not configured, Google Desktop will use the logged-on user's Internet Explorer proxy settings when checking for auto-updates (if enabled)."
+
+Pol_EnterpriseTab="Enterprise search tab"
+Explain_EnterpriseTab="This policy allows you to add a search tab for your Google Search Appliance to Google Desktop and google.com web pages.\n\nYou must provide the name of the tab, such as "Intranet", as well as URLs for the search homepage and for retrieving search results.  Use [DISP_QUERY] in place of the query term for the search results URL.\n\nSee the administrator's guide for more details."
+EnterpriseTabText="Tab name"
+EnterpriseTabHomepage="Search homepage URL"
+EnterpriseTabHomepageQuery="Check if search homepage supports '&&q=<query>'"
+EnterpriseTabResults="Search results URL"
+EnterpriseTabResultsQuery="Check if search results page supports '&&q=<query>'"
+
+Pol_GSAHosts="Google Search Appliances"
+Explain_GSAHosts="This policy allows you to list any Google Search Appliances in your intranet.  When properly configured, Google Desktop will insert Google Desktop results into the results of queries on the Google Search Appliance"
+
+Pol_PolicyUnawareClientProhibitedFlag="Prohibit Policy-Unaware versions"
+Explain_PolicyUnawareClientProhibitedFlag="Prohibits installation and execution of versions of Google Desktop that are unaware of group policy.\n\nEnabling this policy will prevent users from installing or running version 1.0 of Google Desktop.\n\nThis policy has no effect when disabled or not configured."
+
+Pol_MinimumAllowedVersion="Minimum allowed version"
+Explain_MinimumAllowedVersion="This policy allows you to prevent installation and/or execution of older versions of Google Desktop by specifying the minimum version you wish to allow.  When enabling this policy, you should also enable the "Prohibit Policy-Unaware versions" policy to block versions of Google Desktop that did not support group policy.\n\nThis policy has no effect when disabled or not configured."
+
+Pol_MaximumAllowedVersion="Maximum allowed version"
+Explain_MaximumAllowedVersion="This policy allows you to prevent installation and/or execution of newer versions of Google Desktop by specifying the maximum version you wish to allow.\n\nThis policy has no effect when disabled or not configured."
+
+Pol_Disallow_Gadgets="Disallow gadgets and indexing plug-ins"
+Explain_Disallow_Gadgets="This policy prevents the use of all Google Desktop gadgets and indexing plug-ins. The policy applies to gadgets that are included in the Google Desktop installation package (built-in gadgets), built-in indexing plug-ins (currently only the Lotus Notes plug-in), and to gadgets or indexing plug-ins that a user might want to add later (non-built-in gadgets and indexing plug-ins).\n\nYou can prohibit use of all non-built-in gadgets and indexing plug-ins, but allow use of built-in gadgets and indexing plug-ins. To do so, enable this policy and then select the option "Disallow only non-built-in gadgets and indexing plug-ins.\n\nYou can supersede this policy to allow specified built-in and non-built-in gadgets and indexing plug-ins. To do so, enable this policy and then specify the gadgets and/or indexing plug-ins you want to allow under "Gadget and Plug-in Whitelist.""
+Disallow_Only_Non_Builtin_Gadgets="Disallow only non-built-in gadgets and indexing plug-ins"
+
+Pol_Gadget_Whitelist="Gadget and plug-in whitelist"
+Explain_Gadget_Whitelist="This policy specifies a list of Google Desktop gadgets and indexing plug-ins that you want to allow, as exceptions to the "Disallow gadgets and indexing plug-ins" policy. This policy is valid only when the "Disallow gadgets and indexing plug-ins" policy is enabled.\n\nFor each gadget or indexing plug-in you wish to allow, add the CLSID or PROGID of the gadget or indexing plug-in (see the administrator's guide for more details).\n\nThis policy has no effect when disabled or not configured."
+
+Pol_Gadget_Install_Confirmation_Whitelist="Allow silent installation of gadgets"
+Explain_Gadget_Install_Confirmation_Whitelist="Enabling this policy lets you specify a list of Google Desktop gadgets or indexing plug-ins that can be installed without confirmation from the user.\n\nAdd a gadget or indexing plug-in by placing its class ID (CLSID) or program identifier (PROGID) in the list, surrounded with curly braces ({ }).\n\nThis policy has no effect when disabled or not configured."
+
+Pol_Alternate_User_Data_Dir="Alternate user data directory"
+Explain_Alternate_User_Data_Dir="This policy allows you to specify a directory to be used to store user data for Google Desktop (such as index data and cached documents).\n\nYou may use [USER_NAME] or [DOMAIN_NAME] in the path to specify the current user's name or domain. If [USER_NAME] is not specified, the user name will be appended at the end of the path.\n\nThis policy has no effect when disabled or not configured."
+
+Pol_MaxAllowedOutlookConnections="Maximum allowed Outlook connections"
+Explain_MaxAllowedOutlookConnections="This policy specifies the maximum number of open connections that Google Desktop maintains with the Exchange server.  Google Desktop opens a connection for each email folder that it indexes. If insufficient connections are allowed, Google Desktop cannot index all the user email folders.\n\nThe default value is 400. Because users rarely have as many as 400 email folders, Google Desktop rarely reaches the limit.\n\nIf you set this policy's value above 400, you must also configure the number of open connections between Outlook and the Exchange server. By default, approximately 400 connections are allowed. If Google Desktop uses too many of these connections, Outlook might be unable to access email.\n\nThis policy has no effect when disabled or not configured."
+
+Pol_DisallowSsdService="Disallow sharing and receiving of web history and documents across computers"
+Explain_DisallowSsdService="Enabling this policy will prevent Google Desktop from sharing the user's web history and document contents across the user's different Google Desktop installations, and will also prevent it from receiving such shared items from the user's other machines.  To allow reception but disallow sharing, use DisallowSsdOutbound.\nThis policy has no effect when disabled or not configured."
+
+Pol_DisallowSsdOutbound="Disallow sharing of web history and documents to user's other computers."
+Explain_DisallowSsdOutbound="Enabling this policy will prevent Google Desktop from sending the user's web history and document contents from this machine to the user's other machines.  It does not prevent reception of items from the user's other machines; to disallow both, use DisallowSsdService.\nThis policy has no effect when disabled or not configured."
+
+Pol_Disallow_Store_Gadget_Service="Disallow storage of gadget content and settings."
+Explain_Disallow_Store_Gadget_Service="Enabling this policy will prevent users from storing their gadget content and settings with Google. Users will be unable to access their gadget content and settings from other computers and all content and settings will be lost if Google Desktop is uninstalled."
+
+Pol_MaxExchangeIndexingRate="Maximum allowed Exchange indexing rate"
+Explain_MaxExchangeIndexingRate="This policy allows you to specify the maximum number of emails that are indexed per minute. \n\nThis policy has no effect when disabled or not configured."
+
+Pol_EnableSafeweb="Enable or disable safe browsing"
+Explain_Safeweb="Google Desktop safe browsing informs the user whenever they visit any site which is a suspected forgery site or may harm their computer. Enabling this policy turns on safe browsing; disabling the policy turns it off. \n\nIf this policy is not configured, the user can select whether to turn on safe browsing."
\ No newline at end of file
diff --git a/tools/grit/grit/testdata/README.txt b/tools/grit/grit/testdata/README.txt
new file mode 100644
index 0000000000..a683b3b9e3
--- /dev/null
+++ b/tools/grit/grit/testdata/README.txt
@@ -0,0 +1,87 @@
+Google Desktop for Enterprise
+Copyright (C) 2007 Google Inc.
+All Rights Reserved
+
+---------
+Contents
+---------
+This distribution contains the following files:
+
+GoogleDesktopSetup.msi - Installation and setup program
+GoogleDesktop.adm - Group Policy administrative template file
+AdminGuide.pdf - Google Desktop for Enterprise administrative guide
+
+
+--------------
+Documentation
+--------------
+Full documentation and installation instructions are in the 
+administrative guide, and also online at 
+http://desktop.google.com/enterprise/adminguide.html.
+
+
+------------------------
+IBM Lotus Notes Plug-In
+------------------------
+The Lotus Notes plug-in is included in the release of Google 
+Desktop for Enterprise. The IBM Lotus Notes Plug-in for Google 
+Desktop indexes mail, calendar, task, contact and journal 
+documents from Notes.  Discussion documents including those from 
+the discussion and team room templates can also be indexed by 
+selecting an option from the preferences.  Once indexed, this data
+will be returned in Google Desktop searches.  The corresponding
+document can be opened in Lotus Notes from the Google Desktop 
+results page.
+
+Install: The plug-in will install automatically during the Google 
+Desktop setup process if Lotus Notes is already installed.  Lotus 
+Notes must not be running in order for the install to occur.  The
+Class ID for this plug-in is {8F42BDFB-33E8-427B-AFDC-A04E046D3F07}.
+
+Preferences: Preferences and selection of databases to index are
+set in the 'Google Desktop for Notes' dialog reached through the 
+'Actions' menu.
+
+Reindexing: Selecting 'Reindex all databases' will index all the 
+documents in each database again.
+
+
+Notes Plug-in Known Issues
+---------------------------
+
+If the 'Google Desktop for Notes' item is not available from the 
+Lotus Notes Actions menu, then installation was not successful. 
+Installation consists of writing one file, notesgdsplugin.dll, to 
+the Notes application directory and a setting to the notes.ini 
+configuration file.  The most likely cause of an unsuccessful 
+installation is that the installer was not able to locate the 
+notes.ini file. Installation will complete if the user closes Notes
+and manually adds the following setting to this file on a new line:
+AddinMenus=notesgdsplugin.dll
+
+If the notesgdsplugin.dll file is not in the application directory
+(e.g., C:\Program Files\Lotus\Notes) after Google Desktop 
+installation, it is likely that Notes was not installed correctly. 
+
+Only local databases can be indexed.  If they can be determined, 
+the user's local mail file and address book will be included in the
+list automatically.  Mail archives and other databases must be 
+added with the 'Add' button.
+
+Some users may experience performance issues during the initial 
+indexing of a database.  The 'Perform the initial index of a 
+database only when I'm idle' option will limit the indexing process
+to times when the user is not using the machine. If this does not 
+alleviate the problem or the user would like to continually index 
+but just do so more slowly or quickly, the GoogleWaitTime notes.ini
+value can be set. Increasing the GoogleWaitTime value will slow 
+down the indexing process, and lowering the value will speed it up.
+A value of zero causes the fastest possible indexing.  Removing the
+ini parameter altogether returns it to the default (20).
+
+Crashes have been known to occur with certain types of history 
+bookmarks.  If the Notes client seems to crash randomly, try 
+disabling the 'Index note history' option.  If it crashes before,
+you can get to the preferences, add the following line to your 
+notes.ini file:
+GDSNoIndexHistory=1
diff --git a/tools/grit/grit/testdata/about.html b/tools/grit/grit/testdata/about.html
new file mode 100644
index 0000000000..8e5fad7b2b
--- /dev/null
+++ b/tools/grit/grit/testdata/about.html
@@ -0,0 +1,45 @@
+[HEADER]
+<table cellspacing=0 cellPadding=0 width="100%" border=0><tr bgcolor=#3399cc><td align=middle height=1><img height=1 width=1></td></tr></table>
+<table cellspacing=0 cellPadding=1 width="100%" bgcolor=#e8f4f7 border=0><tr><td height=20><font size=+1 color=#000000>&nbsp;<b>[TITLE]</b></font></td></tr></table>
+<br><center><span style="line-height:16pt"><font color=#335cec><B>Google Desktop Search: Search your own computer.</B></font></span></center><br>
+
+<table cellspacing=1 cellpadding=0 width=300 align=center border=0>
+<tr><td nowrap><font size=-1><img style="vertical-align:middle" height=16 src="outlook.gif" width=16>&nbsp;&nbsp;Outlook Email</font></td>
+<td nowrap>&nbsp;</td>
+<td nowrap><font size=-1><img style="vertical-align:middle" height=16 src="netscape.gif" width=16>&nbsp;&nbsp;Netscape Mail / Thunderbird</font></td></tr>
+
+<tr><td nowrap><font size=-1><img style="vertical-align:middle" height=16 src="oe.gif" width=16>&nbsp;&nbsp;Outlook Express</font></td>
+<td nowrap>&nbsp;</td>
+<td nowrap><font size=-1><img style="vertical-align:middle" height=16 src="ff.gif" width=16>&nbsp;&nbsp;Netscape / Firefox / Mozilla</font></td></tr>
+
+<tr><td nowrap><font size=-1><img style="vertical-align:middle" height=16 src="doc.gif" width=16>&nbsp;&nbsp;Word</font></td>
+<td nowrap>&nbsp;</td>
+<td nowrap><font size=-1><img style="vertical-align:middle" height=16 src="pdf.gif" width=16>&nbsp;&nbsp;PDF</font></td></tr>
+
+<tr><td nowrap><font size=-1><img style="vertical-align:middle" height=16 src="xls.gif" width=16>&nbsp;&nbsp;Excel</font></td>
+<td nowrap>&nbsp;</td>
+<td nowrap><font size=-1><img style="vertical-align:middle" height=16 src="mus.gif" width=16>&nbsp;&nbsp;Music</font></td></tr>
+
+<tr><td nowrap><font size=-1><img style="vertical-align:middle" height=16 src="ppt.gif" width=16>&nbsp;&nbsp;PowerPoint</font></td>
+<td nowrap>&nbsp;</td>
+<td nowrap><font size=-1><img style="vertical-align:middle" height=16 src="jpg.gif" width=16>&nbsp;&nbsp;Images</font></td></tr>
+
+<tr><td nowrap><font size=-1><img style="vertical-align:middle" height=16 src="ie.gif" width=16>&nbsp;&nbsp;Internet Explorer</font></td>
+<td nowrap>&nbsp;</td>
+<td nowrap><font size=-1><img style="vertical-align:middle" height=16 src="mov.gif" width=16>&nbsp;&nbsp;Video</font></td></tr>
+
+<tr><td nowrap><font size=-1><img style="vertical-align:middle" height=16 src="aim.gif" width=16>&nbsp;&nbsp;AOL Instant Messenger</font></td>
+<td nowrap>&nbsp;</td>
+<td nowrap><font size=-1><img style="vertical-align:middle" height=16 src="other.gif" width=16>&nbsp;&nbsp;Even more with <a href="http://desktop.google.com/plugins.html">these plug-ins</A></font></td></tr>
+
+<tr><td nowrap><font size=-1><img style="vertical-align:middle" height=16 src="txt.gif" width=16>&nbsp;&nbsp;Text and others</font></td></tr>
+</table>
+<center>
+<p><table cellpadding=1>
+<tr><td><a href="http://desktop.google.com/gettingstarted.html?hl=[LANG_CODE]"><B>Getting Started</B></A> - Learn more about using Google Desktop Search</td></tr>
+<tr><td><a href="http://desktop.google.com/help.html?hl=[LANG_CODE]"><B>Online Help</B></A> - Up-to-date answers to your questions</td></tr>
+<tr><td><a href="[$~PRIVACY~$]"><B>Privacy</B></A> - A few words about privacy and Google Desktop Search</td></tr>
+<tr><td><a href="http://desktop.google.com/uninstall.html?hl=[LANG_CODE]"><B>Uninstall</B></A> - How to uninstall Google Desktop Search</td></tr>
+<tr><td><a href="http://desktop.google.com/feedback.html?hl=[LANG_CODE]"><B>Submit Feedback</B></A> - Send us your comments and ideas</td></tr>
+</table><br><font size=-2>Google Desktop Search [$~BUILDNUMBER~$]</font><br><br>
+[FOOTER]
\ No newline at end of file
diff --git a/tools/grit/grit/testdata/android.xml b/tools/grit/grit/testdata/android.xml
new file mode 100644
index 0000000000..cc3b141f70
--- /dev/null
+++ b/tools/grit/grit/testdata/android.xml
@@ -0,0 +1,24 @@
+<!--
+  Copyright (c) 2012 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.
+-->
+
+<resources>
+  <!-- A string with placeholder. -->
+  <string xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2" name="placeholders">
+    Open <xliff:g id="FILENAME" example="internet.html">%s</xliff:g>?
+  </string>
+
+  <!-- A simple string. -->
+  <string name="simple">A simple string.</string>
+
+  <!-- A string with a comment. -->
+  <string name="comment">Contains a <!-- ignore this --> comment. </string>
+
+  <!-- A second simple string. -->
+  <string name="simple2"> Another simple string. </string>
+
+  <!-- A non-translatable string. -->
+  <string name="constant" translatable="false">Do not translate me.</string>
+</resources>
diff --git a/tools/grit/grit/testdata/bad_browser.html b/tools/grit/grit/testdata/bad_browser.html
new file mode 100644
index 0000000000..e8cf34664d
--- /dev/null
+++ b/tools/grit/grit/testdata/bad_browser.html
@@ -0,0 +1,16 @@
+<p><b>We're sorry, but we don't seem to be compatible.</b></p> 
+<p><font size="-1">Our software suggests that you're using a browser incompatible with Google Desktop Search. 
+	Google Desktop Search currently supports the following:</font></p> 
+<ul><font size="-1"> 
+	<li>Microsoft IE 5 and newer (<a href="http://www.microsoft.com/windows/ie/downloads/default.asp">Download</a>)</li>
+	<li>Mozilla (<a href="http://www.mozilla.org/products/mozilla1.x/">Download</a>)</li>
+	<li>Mozilla Firefox (<a href="http://www.mozilla.org/products/firefox/">Download</a>)</li>
+	<li>Netscape 7 and newer (<a href="http://channels.netscape.com/ns/browsers/download.jsp">Download</a>)</li>
+</font></ul> 
+
+<p><font size="-1">You may <a href="[REDIR]">click here</a> to use your 
+	unsupported browser, though you likely will encounter some areas that don't 
+	work as expected. You need to have Javascript enabled, regardless of the 
+	browser you use.</font>
+<p><font size="-1">We hope to expand this list in the near future and announce new 
+	browsers as they become available.
diff --git a/tools/grit/grit/testdata/browser.html b/tools/grit/grit/testdata/browser.html
new file mode 100644
index 0000000000..45d364d56f
--- /dev/null
+++ b/tools/grit/grit/testdata/browser.html
@@ -0,0 +1,42 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html><head><title>[$~TITLE~$]</title>
+<style>
+BODY { MARGIN-LEFT: 1em; MARGIN-RIGHT: 1em }
+BODY, TD, DIV, A {	FONT-FAMILY: arial,sans-serif}
+DIV, TD {	COLOR: #000}
+A:link {	COLOR: #00c}
+A:visited { COLOR: #551a8b}
+A:active { COLOR: #f00 }
+</style>
+</head>
+
+<body bgcolor="#ffffff" text="#000000" link="#0000cc" vlink="#800080" alink="#ff0000" topmargin=2>
+
+<table cellspacing=2 cellpadding=0 width="99%" border=0>
+<tr>
+	<td width="1%" rowspan=2>[$~IMAGE~$]
+	<td>&nbsp;</td>
+    <td rowspan=2>
+    <table cellspacing=0 cellpadding=0 width="100%" border=0>
+	<tr>
+		<td bgcolor=#3399cc><img height=1 width=1></td>
+	</tr>
+	</table>
+	<table cellspacing=0 cellpadding=0 width="100%" border=0 bgcolor=#efefef>
+	<tr>
+		<td nowrap bgcolor=#E8F4F7><font face=arial,sans-serif color=#000000 size=+1><b>&nbsp;[$~CHROME_TITLE~$]</b></font></td>
+	</tr>
+	</table>
+	</td>
+</tr>
+</table>
+
+<table cellpadding=3 width="94%" align="center" cellspacing=0 border=0> 
+<tr valign="middle"> 
+	<td valign="top">
+	[$~BODY~$]
+	</td>
+	</tr> 
+</table>
+[$~FOOTER~$]
+</body></html>
\ No newline at end of file
diff --git a/tools/grit/grit/testdata/buildinfo.grd b/tools/grit/grit/testdata/buildinfo.grd
new file mode 100644
index 0000000000..80458a8265
--- /dev/null
+++ b/tools/grit/grit/testdata/buildinfo.grd
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?> <!-- -*- XML -*- -->
+<grit
+    base_dir="."
+    source_lang_id="en"
+    tc_project="GoogleDesktopWindowsClient"
+    latest_public_release="0"
+    current_release="1"
+    enc_check="möl">
+  <outputs>
+    <output filename="resource.h" type="rc_header" />
+    <output filename="en_generated_resources.rc" type="rc_all" lang="en" />
+    <output filename="sv_generated_resources.rc" type="rc_all" lang="sv" />
+  </outputs>
+  <translations>
+    <file path="substitute.xmb" lang="sv" />
+  </translations>
+  <release seq="1" allow_pseudo="false">
+    <includes>
+      <include type="BITMAP" name="IDB_PR" file="pr.bmp" />
+      <if expr="lang == 'sv'">
+        <include type="BITMAP" name="IDB_PR2" file="pr2.bmp" />
+      </if>
+    </includes>
+    <structures>
+      <structure name="SIDEBAR_LOADING.HTML" encoding="utf-8" file="sidebar_loading.html" type="tr_html" generateid="false" expand_variables="false"/>
+      <structure name="IDS_PLACEHOLDER" file="transl.rc" type="dialog" >
+        <skeleton expr="lang == 'sv'" file="transl1.rc" variant_of_revision="1"/>
+      </structure>
+      <if expr="lang != 'sv'">
+        <structure name="WELCOME_TOAST.HTML" encoding="utf-8" file="welcome_toast.html" type="tr_html" generateid="false" expand_variables="true"/>
+      </if>
+    </structures>
+    <messages first_id="8192">
+      <message name="IDS_COPYRIGHT_GOOGLE_LONG" sub_variable="true" desc="Gadget copyright notice.  Needs to be updated every year.">
+        Copyright 2008 Google Inc. All Rights Reserved.
+      </message>
+      <message name="IDS_NEWS_PANEL_COPYRIGHT">
+        Google Desktop News gadget
+[IDS_COPYRIGHT_GOOGLE_LONG]
+View news that is personalized based on the articles you read.
+
+For example, if you read lots of sports news, you'll see more sports articles. If you read technology news less often, you'll see fewer of those articles.
+      </message>
+    </messages>
+  </release>
+</grit>
diff --git a/tools/grit/grit/testdata/cache_prefix.html b/tools/grit/grit/testdata/cache_prefix.html
new file mode 100644
index 0000000000..b1f91dd82b
--- /dev/null
+++ b/tools/grit/grit/testdata/cache_prefix.html
@@ -0,0 +1,24 @@
+<head>
+<meta http-equiv="cache-control" content="no-cache">
+<meta http-equiv="pragma" content="no-cache">
+<meta http-equiv="expires" content="-1">
+</head>
+<body onload="[ONLOAD]">
+<table width="100%" border=1><tr><td>
+<table cellspacing=0 cellpadding=10 width="100%" bgcolor=#ffffff border=1 color="#ffffff">
+<tr><td><font face="arial,sans-serif" color=black size=-1>This is one version of <a href="[$~URL~$]">
+<font color="blue">[URL-DISP]</font></a> from your personal <a href="http://desktop.google.com/webcache.html"><font color=blue>cache</font></a>.<br>
+The page may have changed since that time. Click here for the <a href="[$~URL~$]"><font color="blue">current page</font></a>.<br>
+Since this page is stored on your computer, publicly linking to this page will not work.[$~EXTRA~$]<br><br>
+<font size="-2"><i>Google may not be affiliated with the authors of this page nor responsible for its content. This page may be protected by copyright.</i></font>
+</td>
+</tr></table></td></tr></table>
+<style>
+.hl {	color:black; background-color:#ffff88}
+</style>		
+<script>
+[$~HIGHLIGHT_SCRIPT~$]
+window.onerror=new Function(';');
+</script>
+<hr id=gg_1>
+</body>
\ No newline at end of file
diff --git a/tools/grit/grit/testdata/cache_prefix_file.html b/tools/grit/grit/testdata/cache_prefix_file.html
new file mode 100644
index 0000000000..f3eb8e0f11
--- /dev/null
+++ b/tools/grit/grit/testdata/cache_prefix_file.html
@@ -0,0 +1,25 @@
+<head>
+<meta http-equiv="cache-control" content="no-cache">
+<meta http-equiv="pragma" content="no-cache">
+<meta http-equiv="expires" content="-1"></head>
+<body onload="[ONLOAD]">
+<table width="100%" border=1>
+<tr><td>
+<table cellspacing=0 cellpadding=10 width="100%" bgcolor=#ffffff border=1 color="#ffffff">
+<tr><td><font face=arial,sans-serif color=black size=-1>This is one version of <a href="[$~URL~$]"><font color=blue>[URL-DISP]</font></a> 
+from your personal <a href="http://desktop.google.com/filecache.html"><font color=blue>cache</font></a>.<br>
+The file may have changed since that time. Click here for the <a href="[$~URL~$]"><font color=blue>current file</font></a>.<br>
+Since this file is stored on your computer, publicly linking to it will not work.[$~EXTRA~$]<br><br>
+<font size="-2"><i>Google may not be affiliated with the authors of this page nor responsible for its content. This page may be protected by copyright.</i></font>
+</td></tr>
+</table>
+</td></tr></table>
+<style>
+.hl {	color:black; background-color:#ffff88}
+</style>		
+<script>
+[$~HIGHLIGHT_SCRIPT~$]
+window.onerror=new Function(';');
+</script>
+<hr id=gg_1>
+</body>
\ No newline at end of file
diff --git a/tools/grit/grit/testdata/chat_result.html b/tools/grit/grit/testdata/chat_result.html
new file mode 100644
index 0000000000..318078bc3d
--- /dev/null
+++ b/tools/grit/grit/testdata/chat_result.html
@@ -0,0 +1,24 @@
+[HEADER]
+[CHROME]
+<table border=0 cellpadding=2 cellspacing=2>
+<tr><td>[$~STARTCHAT~$]</td></tr>
+</table>
+<blockquote id=gg_1> 
+<table bgcolor=#f0f8ff width=80% cellpadding=5><tr><td>
+<img style="vertical-align:middle;" height=16 src="16x16_chat.gif" width=16> &nbsp; <b>[$~TITLE~$]</b> 
+<font size=-1><br><br>Participants: [USERNAME], [BUDDYNAME]<br>
+Date: [TIME]</font></td></tr></table>
+<br id=contents>
+<label>[CONTENTS]</label>
+</blockquote>
+<table border=0 cellpadding=2 cellspacing=2>
+<tr><td>[$~STARTCHAT~$]</td></tr>
+</table>
+<style>
+.hl {	color:black; background-color:#ffff88}
+</style>
+<script>
+[$~HIGHLIGHT_SCRIPT~$]
+[ONLOAD]
+</script>
+[FOOTER]
diff --git a/tools/grit/grit/testdata/chrome/app/generated_resources.grd b/tools/grit/grit/testdata/chrome/app/generated_resources.grd
new file mode 100644
index 0000000000..c2efb77fd8
--- /dev/null
+++ b/tools/grit/grit/testdata/chrome/app/generated_resources.grd
@@ -0,0 +1,199 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+This file contains definitions of resources that will be translated for each
+locale.  The variables is_win, is_macosx, is_linux, and is_posix are available
+for making strings OS specific.  Other platform defines such as use_titlecase
+are declared in build/common.gypi.
+-->
+
+<grit base_dir="." latest_public_release="0" current_release="1"
+      source_lang_id="en" enc_check="möl">
+  <outputs>
+    <output filename="grit/generated_resources.h" type="rc_header">
+      <emit emit_type='prepend'></emit>
+    </output>
+    <output filename="generated_resources_am.pak" type="data_package" lang="am" />
+    <output filename="generated_resources_ar.pak" type="data_package" lang="ar" />
+    <if expr="pp_ifdef('use_third_party_translations')">
+      <output filename="generated_resources_ast.pak" type="data_package" lang="ast" />
+    </if>
+    <output filename="generated_resources_bg.pak" type="data_package" lang="bg" />
+    <output filename="generated_resources_bn.pak" type="data_package" lang="bn" />
+    <if expr="pp_ifdef('use_third_party_translations')">
+      <output filename="generated_resources_bs.pak" type="data_package" lang="bs" />
+    </if>
+    <output filename="generated_resources_ca.pak" type="data_package" lang="ca" />
+    <if expr="pp_ifdef('use_third_party_translations')">
+      <output filename="generated_resources_ca@valencia.pak" type="data_package" lang="ca@valencia" />
+    </if>
+    <output filename="generated_resources_cs.pak" type="data_package" lang="cs" />
+    <output filename="generated_resources_da.pak" type="data_package" lang="da" />
+    <output filename="generated_resources_de.pak" type="data_package" lang="de" />
+    <output filename="generated_resources_el.pak" type="data_package" lang="el" />
+    <if expr="pp_ifdef('use_third_party_translations')">
+      <output filename="generated_resources_en-AU.pak" type="data_package" lang="en-AU" />
+    </if>
+    <output filename="generated_resources_en-GB.pak" type="data_package" lang="en-GB" />
+    <output filename="generated_resources_en-US.pak" type="data_package" lang="en" />
+    <if expr="pp_ifdef('use_third_party_translations')">
+      <output filename="generated_resources_eo.pak" type="data_package" lang="eo" />
+    </if>
+    <output filename="generated_resources_es.pak" type="data_package" lang="es" />
+    <output filename="generated_resources_es-419.pak" type="data_package" lang="es-419" />
+    <output filename="generated_resources_et.pak" type="data_package" lang="et" />
+    <if expr="pp_ifdef('use_third_party_translations')">
+      <output filename="generated_resources_eu.pak" type="data_package" lang="eu" />
+    </if>
+    <output filename="generated_resources_fa.pak" type="data_package" lang="fa" />
+    <output filename="generated_resources_fake-bidi.pak" type="data_package" lang="fake-bidi" />
+    <output filename="generated_resources_fi.pak" type="data_package" lang="fi" />
+    <output filename="generated_resources_fil.pak" type="data_package" lang="fil" />
+    <output filename="generated_resources_fr.pak" type="data_package" lang="fr" />
+    <if expr="pp_ifdef('use_third_party_translations')">
+      <output filename="generated_resources_gl.pak" type="data_package" lang="gl" />
+    </if>
+    <output filename="generated_resources_gu.pak" type="data_package" lang="gu" />
+    <output filename="generated_resources_he.pak" type="data_package" lang="he" />
+    <output filename="generated_resources_hi.pak" type="data_package" lang="hi" />
+    <output filename="generated_resources_hr.pak" type="data_package" lang="hr" />
+    <output filename="generated_resources_hu.pak" type="data_package" lang="hu" />
+    <if expr="pp_ifdef('use_third_party_translations')">
+      <output filename="generated_resources_hy.pak" type="data_package" lang="hy" />
+      <output filename="generated_resources_ia.pak" type="data_package" lang="ia" />
+    </if>
+    <output filename="generated_resources_id.pak" type="data_package" lang="id" />
+    <output filename="generated_resources_it.pak" type="data_package" lang="it" />
+    <output filename="generated_resources_ja.pak" type="data_package" lang="ja" />
+    <if expr="pp_ifdef('use_third_party_translations')">
+      <output filename="generated_resources_ka.pak" type="data_package" lang="ka" />
+    </if>
+    <output filename="generated_resources_kn.pak" type="data_package" lang="kn" />
+    <output filename="generated_resources_ko.pak" type="data_package" lang="ko" />
+    <if expr="pp_ifdef('use_third_party_translations')">
+      <output filename="generated_resources_ku.pak" type="data_package" lang="ku" />
+      <output filename="generated_resources_kw.pak" type="data_package" lang="kw" />
+    </if>
+    <output filename="generated_resources_lt.pak" type="data_package" lang="lt" />
+    <output filename="generated_resources_lv.pak" type="data_package" lang="lv" />
+    <output filename="generated_resources_ml.pak" type="data_package" lang="ml" />
+    <output filename="generated_resources_mr.pak" type="data_package" lang="mr" />
+    <if expr="pp_ifdef('use_third_party_translations')">
+      <output filename="generated_resources_ms.pak" type="data_package" lang="ms" />
+    </if>
+    <output filename="generated_resources_nl.pak" type="data_package" lang="nl" />
+    <!-- The translation console uses 'no' for Norwegian Bokmål. It should
+         be 'nb'. -->
+    <output filename="generated_resources_nb.pak" type="data_package" lang="no" />
+    <output filename="generated_resources_pl.pak" type="data_package" lang="pl" />
+    <output filename="generated_resources_pt-BR.pak" type="data_package" lang="pt-BR" />
+    <output filename="generated_resources_pt-PT.pak" type="data_package" lang="pt-PT" />
+    <output filename="generated_resources_ro.pak" type="data_package" lang="ro" />
+    <output filename="generated_resources_ru.pak" type="data_package" lang="ru" />
+    <output filename="generated_resources_sk.pak" type="data_package" lang="sk" />
+    <output filename="generated_resources_sl.pak" type="data_package" lang="sl" />
+    <output filename="generated_resources_sr.pak" type="data_package" lang="sr" />
+    <output filename="generated_resources_sv.pak" type="data_package" lang="sv" />
+    <output filename="generated_resources_sw.pak" type="data_package" lang="sw" />
+    <output filename="generated_resources_ta.pak" type="data_package" lang="ta" />
+    <output filename="generated_resources_te.pak" type="data_package" lang="te" />
+    <output filename="generated_resources_th.pak" type="data_package" lang="th" />
+    <output filename="generated_resources_tr.pak" type="data_package" lang="tr" />
+    <if expr="pp_ifdef('use_third_party_translations')">
+      <output filename="generated_resources_ug.pak" type="data_package" lang="ug" />
+    </if>
+    <output filename="generated_resources_uk.pak" type="data_package" lang="uk" />
+    <output filename="generated_resources_vi.pak" type="data_package" lang="vi" />
+    <output filename="generated_resources_zh-CN.pak" type="data_package" lang="zh-CN" />
+    <output filename="generated_resources_zh-TW.pak" type="data_package" lang="zh-TW" />
+  </outputs>
+  <translations>
+    <file path="resources/generated_resources_am.xtb" lang="am" />
+    <file path="resources/generated_resources_ar.xtb" lang="ar" />
+    <file path="../../third_party/launchpad_translations/generated_resources_ast.xtb" lang="ast" />
+    <file path="resources/generated_resources_bg.xtb" lang="bg" />
+    <file path="resources/generated_resources_bn.xtb" lang="bn" />
+    <file path="../../third_party/launchpad_translations/generated_resources_bs.xtb" lang="bs" />
+    <file path="resources/generated_resources_ca.xtb" lang="ca" />
+    <file path="../../third_party/launchpad_translations/generated_resources_ca-valencia.xtb" lang="ca@valencia" />
+    <file path="resources/generated_resources_cs.xtb" lang="cs" />
+    <file path="resources/generated_resources_da.xtb" lang="da" />
+    <file path="resources/generated_resources_de.xtb" lang="de" />
+    <file path="resources/generated_resources_el.xtb" lang="el" />
+    <file path="../../third_party/launchpad_translations/generated_resources_en-AU.xtb" lang="en-AU" />
+    <file path="resources/generated_resources_en-GB.xtb" lang="en-GB" />
+    <file path="../../third_party/launchpad_translations/generated_resources_eo.xtb" lang="eo" />
+    <file path="resources/generated_resources_es.xtb" lang="es" />
+    <file path="resources/generated_resources_es-419.xtb" lang="es-419" />
+    <file path="resources/generated_resources_et.xtb" lang="et" />
+    <file path="../../third_party/launchpad_translations/generated_resources_eu.xtb" lang="eu" />
+    <file path="resources/generated_resources_fa.xtb" lang="fa" />
+    <file path="resources/generated_resources_fi.xtb" lang="fi" />
+    <file path="resources/generated_resources_fil.xtb" lang="fil" />
+    <file path="resources/generated_resources_fr.xtb" lang="fr" />
+    <file path="../../third_party/launchpad_translations/generated_resources_gl.xtb" lang="gl" />
+    <file path="resources/generated_resources_gu.xtb" lang="gu" />
+    <file path="resources/generated_resources_hi.xtb" lang="hi" />
+    <file path="resources/generated_resources_hr.xtb" lang="hr" />
+    <file path="resources/generated_resources_hu.xtb" lang="hu" />
+    <file path="../../third_party/launchpad_translations/generated_resources_hy.xtb" lang="hy" />
+    <file path="../../third_party/launchpad_translations/generated_resources_ia.xtb" lang="ia" />
+    <file path="resources/generated_resources_id.xtb" lang="id" />
+    <file path="resources/generated_resources_it.xtb" lang="it" />
+    <!-- The translation console uses 'iw' for Hebrew, but we use 'he'. -->
+    <file path="resources/generated_resources_iw.xtb" lang="he" />
+    <file path="resources/generated_resources_ja.xtb" lang="ja" />
+    <file path="../../third_party/launchpad_translations/generated_resources_ka.xtb" lang="ka" />
+    <file path="resources/generated_resources_kn.xtb" lang="kn" />
+    <file path="resources/generated_resources_ko.xtb" lang="ko" />
+    <file path="../../third_party/launchpad_translations/generated_resources_ku.xtb" lang="ku" />
+    <file path="../../third_party/launchpad_translations/generated_resources_kw.xtb" lang="kw" />
+    <file path="resources/generated_resources_lt.xtb" lang="lt" />
+    <file path="resources/generated_resources_lv.xtb" lang="lv" />
+    <file path="resources/generated_resources_ml.xtb" lang="ml" />
+    <file path="resources/generated_resources_mr.xtb" lang="mr" />
+    <file path="../../third_party/launchpad_translations/generated_resources_ms.xtb" lang="ms" />
+    <file path="resources/generated_resources_nl.xtb" lang="nl" />
+    <file path="resources/generated_resources_no.xtb" lang="no" />
+    <file path="resources/generated_resources_pl.xtb" lang="pl" />
+    <file path="resources/generated_resources_pt-BR.xtb" lang="pt-BR" />
+    <file path="resources/generated_resources_pt-PT.xtb" lang="pt-PT" />
+    <file path="resources/generated_resources_ro.xtb" lang="ro" />
+    <file path="resources/generated_resources_ru.xtb" lang="ru" />
+    <file path="resources/generated_resources_sk.xtb" lang="sk" />
+    <file path="resources/generated_resources_sl.xtb" lang="sl" />
+    <file path="resources/generated_resources_sr.xtb" lang="sr" />
+    <file path="resources/generated_resources_sv.xtb" lang="sv" />
+    <file path="resources/generated_resources_sw.xtb" lang="sw" />
+    <file path="resources/generated_resources_ta.xtb" lang="ta" />
+    <file path="resources/generated_resources_te.xtb" lang="te" />
+    <file path="resources/generated_resources_th.xtb" lang="th" />
+    <file path="resources/generated_resources_tr.xtb" lang="tr" />
+    <file path="../../third_party/launchpad_translations/generated_resources_ug.xtb" lang="ug" />
+    <file path="resources/generated_resources_uk.xtb" lang="uk" />
+    <file path="resources/generated_resources_vi.xtb" lang="vi" />
+    <file path="resources/generated_resources_zh-CN.xtb" lang="zh-CN" />
+    <file path="resources/generated_resources_zh-TW.xtb" lang="zh-TW" />
+  </translations>
+  <release seq="1" allow_pseudo="false">
+    <messages fallback_to_english="true">
+      <!-- TODO add all of your "string table" messages here.  Remember to
+      change nontranslateable parts of the messages into placeholders (using the
+      <ph> element).  You can also use the 'grit add' tool to help you identify
+      nontranslateable parts and create placeholders for them. -->
+      <message name="IDS_BACKGROUND_APP_INSTALLED_BALLOON_TITLE" desc="The title of the balloon that is displayed when a background app is installed">
+        New background app installed
+      </message>
+      <message name="IDS_BACKGROUND_APP_INSTALLED_BALLOON_BODY" desc="The contents of the balloon that is displayed when a background app is installed">
+        <ph name="APP_NAME">$1<ex>Background App</ex></ph> will launch at system startup and continue to run in the background even once you've closed all other <ph name="PRODUCT_NAME">$2<ex>Google Chrome</ex></ph> windows.
+      </message>
+    </messages>
+    <structures fallback_to_english="true">
+      <!-- Make sure these stay in sync with the structures in generated_resources.grd. -->
+      <structure name="IDD_CHROME_FRAME_FIND_DIALOG" file="cf_resources.rc" type="dialog" >
+      </structure>
+      <structure name="IDD_CHROME_FRAME_READY_PROMPT" file="cf_resources.rc" type="dialog" >
+      </structure>
+    </structures>
+  </release>
+</grit>
diff --git a/tools/grit/grit/testdata/chrome_html.html b/tools/grit/grit/testdata/chrome_html.html
new file mode 100644
index 0000000000..7f7633c5cf
--- /dev/null
+++ b/tools/grit/grit/testdata/chrome_html.html
@@ -0,0 +1,6 @@
+<include src="included_sample.html">
+<style type="text/css">
+#image {
+  content: url('chrome://theme/IDR_SOME_FILE');
+}
+</style>
diff --git a/tools/grit/grit/testdata/default_100_percent/a.png b/tools/grit/grit/testdata/default_100_percent/a.png
new file mode 100644
index 0000000000000000000000000000000000000000..5d5089038ca71172e95db9e7aae1e1fa5cebd505
GIT binary patch
literal 159
zcmeAS@N?(olHy`uVBq!ia0vp^oFL4>0wld=oSO}#(mY)pLnNjq|2Y3)zGGzYPN&L+
zMSC}CcCfp=Dtxv4%6W%G#Q=|R|L;6pCCLUWO)Z<5eoL%TkDTw=s4X!^d(Qa<2khAN
zZPy!XToBAic1Ss}vcWiD27B3&`Zj^H6CO>7R1{ToQ;=ggdEYbV=IISvfHpFCy85}S
Ib4q9e0O9jEh5!Hn

literal 0
HcmV?d00001

diff --git a/tools/grit/grit/testdata/default_100_percent/b.png b/tools/grit/grit/testdata/default_100_percent/b.png
new file mode 100644
index 0000000000..6178079822
--- /dev/null
+++ b/tools/grit/grit/testdata/default_100_percent/b.png
@@ -0,0 +1 @@
+b
diff --git a/tools/grit/grit/testdata/del_footer.html b/tools/grit/grit/testdata/del_footer.html
new file mode 100644
index 0000000000..4e19950bfc
--- /dev/null
+++ b/tools/grit/grit/testdata/del_footer.html
@@ -0,0 +1,8 @@
+<table cellspacing=0 cellpadding=2 width="100%" border=0>
+<tr bgcolor=#EFEFEF><td><font size=-1>&nbsp;<b>Remove</b> checked results and <b>return to search</b>.</font></td>
+<td align=right><font size=-1><a onClick='checkall(1)' href="#">Check all</a> - <a onClick='checkall(0)' href="#">Uncheck all</a>&nbsp;&nbsp;</font></td>
+<td align=right width=1% nowrap><font size=-1>
+<input onclick=deleting() type=submit value="Remove checked results" name=submit2>
+</font></td></tr></table>
+<center><br><font size=-1>[$~BOTTOMLINE~$] - &copy;2005 Google </font></center>
+</body></html>
diff --git a/tools/grit/grit/testdata/del_header.html b/tools/grit/grit/testdata/del_header.html
new file mode 100644
index 0000000000..72bc6756eb
--- /dev/null
+++ b/tools/grit/grit/testdata/del_header.html
@@ -0,0 +1,60 @@
+<body bgcolor="#ffffff" topmargin="2" marginheight="2">
+<table cellSpacing="2" cellPadding="0" width="100%" border="0">
+<form action='[$~DELETE~$]' method="post" name="delform">
+<input name="redir" type="hidden" value="[REDIR]">
+<script>
+<!--
+function deleting() {
+f=document.getElementsByName("del");
+var num = 0; 
+if (f.length)
+ for(i=0;i<f.length; i++)
+  if(f[i].checked) num++;
+  if (num == 1) alert("One checked result has been removed");
+  else if (num > 1) alert(num + " checked results have been removed");
+  else alert("No results were checked, so no results have been removed");
+}
+function checkall(v) {
+ f=document.getElementsByName("del");
+ if (f.length) 
+  for(i=0;i<f.length; i++)
+   f[i].checked=v;
+}
+//-->
+</script>
+<tr>
+<td vAlign="top" width="1%"><A href='[$~HOMEPAGE~$]'> <img alt="Go to Google Desktop Search" width="150" height="55" src="/logo3.gif" border="0" vspace="12"></A></td>
+<td>&nbsp;</td>
+<td noWrap>
+ <table cellSpacing="0" cellPadding="0" width="100%" border="0">
+ <tr>
+ <td bgColor="#DD0000"><img height="1" alt="" width="1"></td>
+ </tr>
+ </table>
+ <table cellSpacing="0" cellPadding="0" width="100%" border="0">
+ <tr>
+ <td noWrap bgColor="#efefef"><font size="+1"><b>&nbsp;Remove Specific Items</b></font></td>
+ <td noWrap align="right" bgColor="#efefef"><font size="-1"><a href="http://desktop.google.com/remove.html">Help</a>&nbsp;&nbsp;</font></td>
+ </tr>
+ </table>
+</td>
+</tr>
+</table>
+<table cellSpacing="0" cellPadding="2" width="100%" border="0">
+<tr bgColor="#EFEFEF">
+<td><font size="-1">&nbsp;<B>Remove</B> checked results and <B>return to search</B>.</font></td>
+<td align="right"><font size="-1"><a onClick='checkall(1)' href="#">Check all</a> - <a onClick='checkall(0)' href="#">
+Uncheck all</a>&nbsp;&nbsp;</font></td>
+<td align="right" width="1%" nowrap><font size="-1"><input onclick="deleting()" type="submit" value="Remove checked results" name="submit2"></font></td>
+</tr>
+</table>
+<br>
+<table cellspacing="0" cellpadding="2" width="100%" border="0">
+<tr>
+<td colSpan="3" bgcolor="#FFFFFF" style="border:solid; border-width:1px; border-color:#DD0000"><font size="-1">&nbsp;<b>Remove 
+checked items from Google Desktop Search. Other copies of the same items will not be 
+affected.<br>
+&nbsp;If you view the item again, it will be added back to Google Desktop Search.</b></font></td>
+</tr>
+</table>
+<br>
\ No newline at end of file
diff --git a/tools/grit/grit/testdata/deleted.html b/tools/grit/grit/testdata/deleted.html
new file mode 100644
index 0000000000..5ae5f355fa
--- /dev/null
+++ b/tools/grit/grit/testdata/deleted.html
@@ -0,0 +1,21 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html><head><title>Database Deleted</title>
+<meta http-equiv="content-type" content="text/html; charset=utf-8">
+<meta http-equiv="cache-control" content="no-cache">
+<meta http-equiv="pragma" content="no-cache">
+<meta http-equiv="expires" content="-1">
+<style>
+BODY,TD,A,P {FONT-FAMILY: arial,sans-serif}
+.q {COLOR: #0000cc}
+</style>
+</head>
+<BODY text=#000000 vLink=#551a8b aLink=#ff0000 link=#0000cc bgColor=#ffffff onload=sf()>
+<center>
+<TABLE cellSpacing=0 cellPadding=0 border=0>
+<tr><td><a href="[$~HOMEPAGE~$]"><IMG border=0 height=110 alt="Google Desktop Search" src="hp_logo.gif" width=276></a>
+</td></tr></table><BR>
+<center>The database has been deleted. Click <a href="[$~HOMEPAGE~$]">here</a> to continue.</center>
+</td></tr>
+</table>
+<br><FONT size=-1>[$~BOTTOMLINE~$]</font></p>
+<p><FONT size=-2>&copy;2005 Google</font></p></center></body></html>
\ No newline at end of file
diff --git a/tools/grit/grit/testdata/depfile.grd b/tools/grit/grit/testdata/depfile.grd
new file mode 100644
index 0000000000..e2f7191218
--- /dev/null
+++ b/tools/grit/grit/testdata/depfile.grd
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?> <!-- -*- XML -*- -->
+<grit
+    base_dir="."
+    latest_public_release="0"
+    current_release="1">
+  <outputs>
+    <output filename="default_100_percent.pak" lang="en" type="data_package" context="default_100_percent" />
+    <output filename="special_100_percent.pak" lang="en" type="data_package" context="special_100_percent" />
+  </outputs>
+  <release seq="1">
+    <structures fallback_to_low_resolution="true">
+      <if expr="False">
+        <part file="grit_part.grdp" />
+      </if>
+      <structure type="chrome_scaled_image" name="IDR_A" file="a.png" />
+    </structures>
+  </release>
+</grit>
diff --git a/tools/grit/grit/testdata/details.html b/tools/grit/grit/testdata/details.html
new file mode 100644
index 0000000000..0ab0e2a90c
--- /dev/null
+++ b/tools/grit/grit/testdata/details.html
@@ -0,0 +1,10 @@
+[!]
+title	Improve Google Desktop Search by Sending Non-Personal Information
+template
+bottomline
+hp_image
+
+<p><strong>This documentation is not yet available</strong></p>
+<center><br>
+<font size=-1>[$~BOTTOMLINE~$] - &copy;2005 Google </font> 
+</center>
diff --git a/tools/grit/grit/testdata/duplicate-name-input.xml b/tools/grit/grit/testdata/duplicate-name-input.xml
new file mode 100644
index 0000000000..cc4d1d65c5
--- /dev/null
+++ b/tools/grit/grit/testdata/duplicate-name-input.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<grit base_dir="." latest_public_release="2" current_release="3" source_lang_id="en-US">
+  <release seq="3">
+    <messages>
+        <message name="IDS_GREETING" desc="Printed to greet the currently logged in user">
+          Hello <ph name="USERNAME">%s<ex>Joi</ex></ph>, how are you doing today?
+        </message>
+    </messages>
+    <structures>
+        <!-- Duplicate name here -->
+        <structure type="version" name="IDS_GREETING" file="rc_files/bla.rc" />
+    </structures>
+  </release>
+  <translations>
+    <file path="figs_nl_translations.xml" />
+    <file path="cjk_translations.xml" />
+  </translations>
+  <outputs>
+    <output filename="resource.h" type="rc_header" />
+    <output filename="resource_en.rc" type="rc_all" lang="en-US" />
+    <output filename="resource_fr.rc" type="rc_all" lang="fr-FR" />
+    <output filename="resource_it.rc" type="rc_translateable" lang="it-IT" />
+    <output filename="resource_zh_cn.rc" type="rc_translateable" lang="zh-CN" />
+    <output filename="nontranslateable.rc" type="rc_nontranslateable" />
+  </outputs>
+</grit>
diff --git a/tools/grit/grit/testdata/email_result.html b/tools/grit/grit/testdata/email_result.html
new file mode 100644
index 0000000000..8bb04b988c
--- /dev/null
+++ b/tools/grit/grit/testdata/email_result.html
@@ -0,0 +1,34 @@
+[HEADER]
+[CHROME]
+<table border=0 cellpadding=2 cellspacing=2 width='100%'>
+<tr><td><font size=-1>[CONV]
+<a href='[$~REPLY_URL~$]'>Reply</a> | <a href='[$~REPLYALL_URL~$]'>Reply&nbsp;to&nbsp;All</a>[$~FORWARD_URL~$] | <a href='mailto:'>Compose</a>[$~OUTLOOKVIEW~$]
+</font></td></tr>
+</table>
+<blockquote id=gg_1>
+<table bgcolor=#f0f8ff width=80% cellpadding=5><tr><td>
+<img style="vertical-align:middle;" height=16 src='/email.gif' width=16> &nbsp; <b>[SUBJECT]</b> 
+<p><font size=-1>[FROM-DISP]
+[TO-DISP]
+[CC-DISP]
+[BCC-DISP]
+[REPLYTO-DISP]
+[DATE-DISP]
+[VIEW-DISP]
+[$~ATTACH~$]
+</font></td></tr></table>
+<p class=g><span style="width:500;"><font size=-1><label>[MESSAGE]</label></span></p>
+</font> 
+</blockquote>
+<table border=0 cellpadding=2 cellspacing=2 width='100%'>
+<tr><td><font size=-1>[CONV]
+<a href='[$~REPLY_URL~$]'>Reply</a> | <a href='[$~REPLYALL_URL~$]'>Reply&nbsp;to&nbsp;All</a>[$~FORWARD_URL~$] | <a href='mailto:'>Compose</a>[$~OUTLOOKVIEW~$]
+</font></td></tr></table>
+<style>
+.hl {	color:black; background-color:#ffff88}
+</style>
+<script>
+[$~HIGHLIGHT_SCRIPT~$]
+[ONLOAD]
+</script>
+[FOOTER]
\ No newline at end of file
diff --git a/tools/grit/grit/testdata/email_thread.html b/tools/grit/grit/testdata/email_thread.html
new file mode 100644
index 0000000000..3c7279b841
--- /dev/null
+++ b/tools/grit/grit/testdata/email_thread.html
@@ -0,0 +1,10 @@
+[HEADER] 
+[CHROME]
+<blockquote [MAXWIDTH]>
+<b><img src=email.gif style="vertical-align:middle;" width=16 height=16> &nbsp; [SUBJECT]</b><br><br>
+<TABLE cellSpacing=0 cellPadding=3 border=0>
+[CONTENTS]
+</table>
+</blockquote>
+[NEXT_PREV]
+[FOOTER]
\ No newline at end of file
diff --git a/tools/grit/grit/testdata/error.html b/tools/grit/grit/testdata/error.html
new file mode 100644
index 0000000000..66875a234c
--- /dev/null
+++ b/tools/grit/grit/testdata/error.html
@@ -0,0 +1,8 @@
+[HEADER]
+[CHROME]
+<br>
+<blockquote>
+[ERROR]<br><br>
+If you think this is an error, please <a href="http://desktop.google.com/feedback.html?version=[VERSION]">contact us</a>.
+</blockquote>
+[FOOTER]
\ No newline at end of file
diff --git a/tools/grit/grit/testdata/explicit_web.html b/tools/grit/grit/testdata/explicit_web.html
new file mode 100644
index 0000000000..1424adc617
--- /dev/null
+++ b/tools/grit/grit/testdata/explicit_web.html
@@ -0,0 +1,11 @@
+[HEADER]
+<style>
+.image {BORDER: #0000cc 1px solid;}
+.imageh {BORDER: #0000cc 1px solid;}
+</style>
+[WEB_TOP_CHROME]
+[$~STATUS~$]
+[$~MESSAGE~$]
+[WEB_FILES]
+<br>[NEXT_PREV]
+[FOOTER]
\ No newline at end of file
diff --git a/tools/grit/grit/testdata/footer.html b/tools/grit/grit/testdata/footer.html
new file mode 100644
index 0000000000..3372d6afac
--- /dev/null
+++ b/tools/grit/grit/testdata/footer.html
@@ -0,0 +1,14 @@
+<center><br clear=all><br>
+<table cellspacing=0 cellpadding=0 width="100%" border=0><tr bgcolor=#3399CC><td align=middle height=1><img height=1 width=1></td></tr></table>
+<table cellspacing=0 cellpadding=0 width="100%" bgcolor=#e8f4f7 border=0>
+<tr bgcolor=#e8f4f7>
+<td><br>
+<table cellpadding=1 align=center border=0 cellspacing=0 bgcolor=#e8f4f7>
+<form action='[$~SEARCHURL~$]' method=get>
+<tr><td noWrap>[$~BOTTOM~$]</td></tr></form>
+</table><br>
+</td></tr></table>
+<table cellspacing=0 cellpadding=0 width="100%" border=0><tr bgcolor=#3399CC><td align=middle height=1><img height=1 width=1></td></tr></table><br>
+<font size=-1>[$~BOTTOMLINE~$] - &copy;2005 Google </font></center>
+[SCRIPT]
+</body></html>
diff --git a/tools/grit/grit/testdata/generated_resources_fr.xtb b/tools/grit/grit/testdata/generated_resources_fr.xtb
new file mode 100644
index 0000000000..373c40feea
--- /dev/null
+++ b/tools/grit/grit/testdata/generated_resources_fr.xtb
@@ -0,0 +1,3079 @@
+<?xml version="1.0" ?>
+<!DOCTYPE translationbundle>
+<translationbundle lang="fr">
+<translation id="1525924600121678168">Salut!</translation>
+<translation id="5335090254790956485">Salut <ph name="USERNAME"/></translation>
+<translation id="6779164083355903755">Supprime&amp;r</translation>
+<translation id="6879617193011158416">Activer la barre de favoris</translation>
+<translation id="8130276680150879341">Déconnexion du réseau privé</translation>
+<translation id="1058418043520174283"><ph name="INDEX"/> sur <ph name="COUNT"/></translation>
+<translation id="4480627574828695486">Déconnecter ce compte...</translation>
+<translation id="7040807039050164757">&amp;Vérifier l'orthographe dans ce champ</translation>
+<translation id="778579833039460630">Aucune donnée reçue.</translation>
+<translation id="1852799913675865625">Une erreur s'est produite lors de la tentative de lecture du fichier : <ph name="ERROR_TEXT"/>.</translation>
+<translation id="3828924085048779000">Le mot de passe multiterme est obligatoire.</translation>
+<translation id="8265562484034134517">Importer les données d'un autre navigateur...</translation>
+<translation id="2709516037105925701">Saisie automatique</translation>
+<translation id="4857138207355690859">API P2P</translation>
+<translation id="250599269244456932">Exécuter automatiquement (recommandé)</translation>
+<translation id="3581034179710640788">Le certificat de sécurité du site a expiré !</translation>
+<translation id="2825758591930162672">Clé publique de l'objet</translation>
+<translation id="8275038454117074363">Importer</translation>
+<translation id="8418445294933751433">Afficher dan&amp;s un onglet</translation>
+<translation id="6985276906761169321">ID :</translation>
+<translation id="859285277496340001">Le certificat n'indique aucun mécanisme permettant de vérifier s'il a été révoqué.</translation>
+<translation id="2010799328026760191">Touches de modification...</translation>
+<translation id="3300394989536077382">Signé par :</translation>
+<translation id="654233263479157500">Utiliser un service Web pour résoudre les erreurs de navigation</translation>
+<translation id="4940047036413029306">Guillemet</translation>
+<translation id="1526811905352917883">Une nouvelle tentative de connexion avec SSL 3.0 a dû être effectuée. Cette opération indique généralement que le serveur utilise un logiciel très ancien et qu'il est susceptible de présenter d'autres problèmes de sécurité.</translation>
+<translation id="1497897566809397301">Autoriser le stockage des données locales (recommandé)</translation>
+<translation id="3275778913554317645">Ouvrir dans une fenêtre</translation>
+<translation id="4553117311324416101">Google pense qu'un logiciel malveillant pourrait être installé sur votre ordinateur si vous continuez. Nous vous conseillons de ne pas continuer, même si vous avez déjà consulté ce site auparavant ou si vous avez confiance en celui-ci. Il se peut qu'il ait été piraté récemment. Réessayez demain ou utilisez un autre site.</translation>
+<translation id="509988127256758334">&amp;Rechercher :</translation>
+<translation id="1420684932347524586">Échec de génération de clé privée RSA aléatoire</translation>
+<translation id="2501173422421700905">Certificat en attente</translation>
+<translation id="2313634973119803790">Technologie réseau :</translation>
+<translation id="2382901536325590843">Le certificat du serveur ne figure pas dans le DNS.</translation>
+<translation id="2833791489321462313">Demander le mot de passe au retour de veille</translation>
+<translation id="3850258314292525915">Désactiver la synchronisation</translation>
+<translation id="2721561274224027017">Base de données indexée</translation>
+<translation id="8208216423136871611">Ne pas enregistrer</translation>
+<translation id="684587995079587263"><ph name="PRODUCT_NAME"/> synchronise vos données avec votre compte Google en toute sécurité. Synchronisez toutes vos données ou personnalisez les types de données synchronisées et les options de chiffrement.</translation>
+<translation id="4405141258442788789">Le délai imparti à l'opération est dépassé.</translation>
+<translation id="5048179823246820836">Nordique</translation>
+<translation id="1763046204212875858">Créer des raccourcis vers des applications</translation>
+<translation id="2105006017282194539">Pas encore chargé</translation>
+<translation id="524759338601046922">Confirmer le nouveau code PIN :</translation>
+<translation id="688547603556380205">L2TP/IPSec + Certificat utilisateur</translation>
+<translation id="777702478322588152">Préfecture</translation>
+<translation id="6562437808764959486">Extraction de l'image de récupération...</translation>
+<translation id="561349411957324076">Terminé</translation>
+<translation id="4764776831041365478">Il se peut que la page Web à l'adresse <ph name="URL"/> soit temporairement inaccessible ou qu'elle ait été déplacée de façon permanente à une autre adresse Web.</translation>
+<translation id="6156863943908443225">Cache des scripts</translation>
+<translation id="4610656722473172270">Barre d'outils Google</translation>
+<translation id="151501797353681931">Importés depuis Safari</translation>
+<translation id="6706684875496318067">Le plug-in <ph name="PLUGIN_NAME"/> n'est pas autorisé.</translation>
+<translation id="586567932979200359">Vous exécutez <ph name="PRODUCT_NAME"/> à partir de son image disque. Si vous l'installez sur votre ordinateur, vous pourrez l'utiliser sans image disque et bénéficierez de mises à jour automatiques.</translation>
+<translation id="3775432569830822555">Certificat du serveur SSL</translation>
+<translation id="1829192082282182671">Z&amp;oom arrière</translation>
+<translation id="6102827823267795198">Indique si la suggestion du moteur de recherche doit être entrée immédiatement via la saisie semi-automatique lorsque la fonctionnalité Recherche instantanée est activée.</translation>
+<translation id="1467071896935429871">Mise à jour du système : <ph name="PERCENT"/> % téléchargés</translation>
+<translation id="7881267037441701396">Les informations d'identification associées au partage de vos imprimantes via <ph name="CLOUD_PRINT_NAME"/> sont arrivées à expiration. Cliquez ici pour saisir à nouveau votre nom d'utilisateur et votre mot de passe.</translation>
+<translation id="816055135686411707">Erreur de définition du paramètre de confiance du certificat</translation>
+<translation id="4714531393479055912"><ph name="PRODUCT_NAME"/> peut maintenant synchroniser vos mots de passe.</translation>
+<translation id="5704565838965461712">Sélectionnez le certificat à présenter pour l'identification :</translation>
+<translation id="2025632980034333559"><ph name="APP_NAME"/> a planté. Cliquez sur cette info-bulle pour actualiser l'extension.</translation>
+<translation id="4059593000330943833">Compatibilité expérimentale avec des méthodes Wi-Fi Extensible Authentication Protocol supplémentaires, telles que EAP-TLS et LEAP.</translation>
+<translation id="6322279351188361895">Échec de lecture de la clé privée</translation>
+<translation id="3781072658385678636">Les plug-ins suivants ont été bloqués sur cette page :</translation>
+<translation id="4428782877951507641">Configuration de la synchronisation</translation>
+<translation id="3648460724479383440">Case d'option cochée</translation>
+<translation id="4654488276758583406">Très petite</translation>
+<translation id="6647228709620733774">URL de révocation de l'autorité de certification Netscape</translation>
+<translation id="546411240573627095">Style de pavé numérique</translation>
+<translation id="7663002797281767775">Active les feuilles de style CSS 3D et la composition graphique haute performance des pages Web via le processeur graphique.</translation>
+<translation id="2972581237482394796">&amp;Rétablir</translation>
+<translation id="5895138241574237353">Redémarrer</translation>
+<translation id="1858072074757584559">La connexion n'est pas compressée.</translation>
+<translation id="528468243742722775">Fin</translation>
+<translation id="1723824996674794290">&amp;Nouvelle fenêtre</translation>
+<translation id="1313405956111467313">Configuration automatique du proxy</translation>
+<translation id="1589055389569595240">Afficher l'orthographe et la grammaire</translation>
+<translation id="4364779374839574930">Aucune imprimante n'a été trouvée. Veuillez en installer une.</translation>
+<translation id="7017587484910029005">Saisissez les caractères visibles dans l'image ci-dessous.</translation>
+<translation id="9013589315497579992">Certificat d'authentification de client SSL incorrect</translation>
+<translation id="8595062045771121608">Le certificat du serveur ou un certificat AC intermédiaire présenté au navigateur a été signé avec un algorithme de signature faible tel que RSA-MD2. D'après des études récentes menées par des informaticiens, les algorithmes de signature seraient plus faibles qu'on ne le pensait jusqu'alors. Aujourd'hui, ils sont très rarement utilisés par les sites Web jugés dignes de confiance. Ce certificat a peut-être été contrefait. Nous vous déconseillons vivement de continuer.</translation>
+<translation id="8666632926482119393">Rechercher le précédent</translation>
+<translation id="7567293639574541773">I&amp;nspecter l'élément</translation>
+<translation id="8392896330146417149">État d'itinérance :</translation>
+<translation id="6813971406343552491">&amp;Non</translation>
+<translation id="36224234498066874">Effacer les données de navigation...</translation>
+<translation id="3384773155383850738">Nombre maximal de suggestions</translation>
+<translation id="8331498498435985864">L'accessibilité est désactivée.</translation>
+<translation id="8530339740589765688">Sélectionner par domaine</translation>
+<translation id="8677212948402625567">Tout réduire...</translation>
+<translation id="7600965453749440009">Ne jamais traduire les pages rédigées en <ph name="LANGUAGE"/> </translation>
+<translation id="3208703785962634733">Non confirmé</translation>
+<translation id="6523841952727744497">Avant de vous connecter, démarrez une session en tant qu'invité afin d'activer le réseau <ph name="NETWORK_ID"/>.</translation>
+<translation id="7450044767321666434">La gravure de l'image est terminée.</translation>
+<translation id="2653266418988778031">Si vous supprimez le certificat d'une autorité de certification, votre navigateur ne fera plus confiance aux certificats émis par cette autorité de certification.</translation>
+<translation id="298068999958468740">Synchronisez toutes les données de cet ordinateur ou sélectionnez celles que vous souhaitez synchroniser.</translation>
+<translation id="5341849548509163798"><ph name="NUMBER_MANY"/> hours ago</translation>
+<translation id="4422428420715047158">Domaine :</translation>
+<translation id="3602290021589620013">Aperçu</translation>
+<translation id="7516602544578411747">Associe chaque fenêtre du navigateur à un profil et ajoute une option de sélection des profils en haut à droite. Chaque profil possède ses propres favoris, extensions, applications, etc.</translation>
+<translation id="7082055294850503883">Ignorer le verrouillage des majuscules et saisir des minuscules par défaut</translation>
+<translation id="1800124151523561876">Aucune parole détectée</translation>
+<translation id="7814266509351532385">Changer de moteur de recherche par défaut</translation>
+<translation id="5376169624176189338">Cliquer pour revenir en arrière, maintenir pour voir l'historique</translation>
+<translation id="6310545596129886942"><ph name="NUMBER_FEW"/> secondes restantes</translation>
+<translation id="9181716872983600413">Unicode</translation>
+<translation id="1383861834909034572">Ouverture à la fin du téléchargement</translation>
+<translation id="5727728807527375859">Les extensions, les applications et les thèmes peuvent endommager votre ordinateur. Voulez-vous vraiment continuer ?</translation>
+<translation id="3857272004253733895">Schéma du pinyin double</translation>
+<translation id="1636842079139032947">Déconnecter ce compte...</translation>
+<translation id="6721972322305477112">&amp;Fichier</translation>
+<translation id="1076818208934827215">Microsoft Internet Explorer</translation>
+<translation id="9056810968620647706">Aucune correspondance trouvée</translation>
+<translation id="1901494098092085382">État de votre commentaire</translation>
+<translation id="2861301611394761800">Mise à jour terminée. Veuillez redémarrer le système.</translation>
+<translation id="2231238007119540260">Lorsque vous supprimez un certificat de serveur, vous rétablissez les contrôles de sécurité habituels du serveur et un certificat valide lui est demandé.</translation>
+<translation id="5463582782056205887">Essayez d'ajouter
+        <ph name="PRODUCT_NAME"/>
+        aux programmes autorisés dans les paramètres de votre pare-feu ou de votre antivirus. S'il
+        est déjà autorisé, tentez de le supprimer de la liste et de l'ajouter à nouveau à
+        la liste des programmes autorisés.</translation>
+<translation id="7624154074265342755">Réseaux sans fil</translation>
+<translation id="3315158641124845231">Masquer <ph name="PRODUCT_NAME"/></translation>
+<translation id="3496213124478423963">Zoom arrière</translation>
+<translation id="2296019197782308739">Méthode EAP :</translation>
+<translation id="42981349822642051">Développer</translation>
+<translation id="4013794286379809233">Veuillez vous connecter</translation>
+<translation id="7693221960936265065">de n'importe quand</translation>
+<translation id="1763138995382273070">Désactiver la validation des formulaires interactifs HTML5</translation>
+<translation id="4920887663447894854">Le suivi de votre position géographique sur cette page a été bloqué pour les sites suivants :</translation>
+<translation id="7690346658388844119">La gravure de l'image a été interrompue.</translation>
+<translation id="8133676275609324831">&amp;Afficher dans le dossier</translation>
+<translation id="645705751491738698">Continuer à bloquer JavaScript</translation>
+<translation id="4780321648949301421">Enregistrer la page sous...</translation>
+<translation id="9154072353677278078">Le serveur <ph name="DOMAIN"/> à l'adresse <ph name="REALM"/> requiert un nom d'utilisateur et un mot de passe.</translation>
+<translation id="2551191967044410069">Exceptions de géolocalisation</translation>
+<translation id="4092066334306401966">13px</translation>
+<translation id="8178665534778830238">Contenu :</translation>
+<translation id="153384433402665971">Le plug-in <ph name="PLUGIN_NAME"/> a été bloqué, car il n'est plus à jour.</translation>
+<translation id="2610260699262139870">Taille ré&amp;elle</translation>
+<translation id="4535734014498033861">Échec de la connexion au serveur proxy.</translation>
+<translation id="558170650521898289">Vérification de pilote matériel Microsoft Windows</translation>
+<translation id="98515147261107953">Paysage</translation>
+<translation id="8974161578568356045">Détecter automatiquement</translation>
+<translation id="1818606096021558659">Page</translation>
+<translation id="5388588172257446328">Nom d'utilisateur :</translation>
+<translation id="1657406563541664238">Nous aider à améliorer <ph name="PRODUCT_NAME"/> en envoyant automatiquement les statistiques d'utilisation et les rapports d'erreur à Google</translation>
+<translation id="7982789257301363584">Réseau</translation>
+<translation id="8528962588711550376">Connexion en cours</translation>
+<translation id="2336228925368920074">Ajouter tous les onglets aux favoris...</translation>
+<translation id="4985312428111449076">Onglets ou fenêtres</translation>
+<translation id="7481475534986701730">Sites récemment consultés</translation>
+<translation id="4260722247480053581">Ouvrir dans une fenêtre de navigation privée</translation>
+<translation id="8503758797520866434">Préférences de saisie automatique...</translation>
+<translation id="2757031529886297178">Compteur d'images par seconde</translation>
+<translation id="6657585470893396449">Mot de passe</translation>
+<translation id="7881483672146086348">Afficher le compte</translation>
+<translation id="1776883657531386793"><ph name="OID"/> : <ph name="INFO"/></translation>
+<translation id="1510030919967934016">Le suivi de votre position géographique a été bloqué pour cette page.</translation>
+<translation id="4640525840053037973">Connexion à l'aide de votre compte Google</translation>
+<translation id="5255315797444241226">Le mot de passe multiterme entré est incorrect.</translation>
+<translation id="6242054993434749861">télécopie : #<ph name="FAX"/></translation>
+<translation id="762917759028004464">Le navigateur par défaut est actuellement <ph name="BROWSER_NAME"/>.</translation>
+<translation id="9213479837033539041"><ph name="NUMBER_MANY"/> secondes restantes</translation>
+<translation id="300544934591011246">Mot de passe précédent</translation>
+<translation id="5078796286268621944">Code PIN incorrect</translation>
+<translation id="989988560359834682">Modifier l'adresse</translation>
+<translation id="8487678622945914333">Zoom avant</translation>
+<translation id="2972557485845626008">Micrologiciel</translation>
+<translation id="735327918767574393">Une erreur s'est produite lors de l'affichage de cette page Web. Pour continuer, actualisez cette page ou ouvrez-en une autre.</translation>
+<translation id="8028060951694135607">Récupération de clé Microsoft</translation>
+<translation id="9187657844611842955">recto verso</translation>
+<translation id="6391832066170725637">Fichier ou répertoire introuvable</translation>
+<translation id="4694445829210540512">Aucun forfait de données <ph name="NETWORK"/> actif</translation>
+<translation id="5494920125229734069">Tout sélectionner</translation>
+<translation id="2857834222104759979">Le fichier manifeste est incorrect.</translation>
+<translation id="7931071620596053769">Les pages suivantes ne répondent plus. Vous pouvez attendre qu'elles soient de nouveau accessibles ou les supprimer.</translation>
+<translation id="1209866192426315618"><ph name="NUMBER_DEFAULT"/> minutes restantes</translation>
+<translation id="7938958445268990899">Le certificat du serveur n'est pas encore valide.</translation>
+<translation id="4569998400745857585">Menu contenant des extensions masquées</translation>
+<translation id="4081383687659939437">Enregistrer les infos</translation>
+<translation id="5786805320574273267">Configuration de l'accès à distance à cet ordinateur.</translation>
+<translation id="1801827354178857021">Point</translation>
+<translation id="2179052183774520942">Ajouter un moteur de recherche</translation>
+<translation id="5498951625591520696">Impossible d'atteindre le serveur.</translation>
+<translation id="2956948609882871496">Importer mes favoris...</translation>
+<translation id="1621207256975573490">Enregistrer le &amp;cadre sous...</translation>
+<translation id="4681260323810445443">Vous n'êtes pas autorisé à accéder à la page Web <ph name="URL"/>. Votre connexion peut être requise.</translation>
+<translation id="2176444992480806665">Envoyer la capture d'écran du dernier onglet actif</translation>
+<translation id="1165039591588034296">Erreur</translation>
+<translation id="2064942105849061141">Utiliser le thème GTK+</translation>
+<translation id="2278562042389100163">Ouvrir une fenêtre du navigateur</translation>
+<translation id="5246282308050205996"><ph name="APP_NAME"/> a planté. Cliquez sur cette info-bulle pour redémarrer l'application.</translation>
+<translation id="9218430445555521422">Définir comme navigateur par défaut</translation>
+<translation id="5027550639139316293">Certificat de courrier électronique</translation>
+<translation id="938582441709398163">Clavier en superposition</translation>
+<translation id="427208986916971462">La connexion est compressée avec <ph name="COMPRESSION"/>.</translation>
+<translation id="4589279373639964403">Exporter mes favoris...</translation>
+<translation id="8876215549894133151">Format :</translation>
+<translation id="5234764350956374838">Ignorer</translation>
+<translation id="40027638859996362">Déplacer un mot</translation>
+<translation id="5463275305984126951">Index de <ph name="LOCATION"/></translation>
+<translation id="5154917547274118687">Mémoire</translation>
+<translation id="1493492096534259649">Impossible d'utiliser cette langue pour corriger l'orthographe.</translation>
+<translation id="6628463337424475685">Recherche <ph name="ENGINE"/></translation>
+<translation id="2502105862509471425">Ajouter une autre carte de paiement...</translation>
+<translation id="4037618776454394829">Envoyer la dernière capture d'écran enregistrée</translation>
+<translation id="8987670145726065238">Ce fichier contient du code malveillant. Voulez-vous vraiment continuer ?</translation>
+<translation id="182729337634291014">Erreur de synchronisation...</translation>
+<translation id="4465830120256509958">Clavier brésilien</translation>
+<translation id="2459861677908225199">Utiliser TLS 1.0</translation>
+<translation id="4792711294155034829">&amp;Signaler un problème...</translation>
+<translation id="5819484510464120153">Créer des raccourci&amp;s vers des applications...</translation>
+<translation id="6845180713465955339">Le certificat &quot;<ph name="CERTIFICATE_NAME"/>&quot; a été émis par :</translation>
+<translation id="7531238562312180404"><ph name="PRODUCT_NAME"/> ne contrôlant pas la façon dont les extensions gèrent vos données personnelles, toutes les extensions sont désactivées dans les fenêtres de navigation privée. Vous pouvez les réactiver individuellement dans le <ph name="BEGIN_LINK"/>gestionnaire des extensions<ph name="END_LINK"/>.</translation>
+<translation id="5667293444945855280">Logiciels malveillants</translation>
+<translation id="3435845180011337502">Mise en page ou mise en forme de la page</translation>
+<translation id="3838186299160040975">Acheter davantage...</translation>
+<translation id="6831043979455480757">Traduire</translation>
+<translation id="3587482841069643663">Tout</translation>
+<translation id="6698381487523150993">Créé :</translation>
+<translation id="4684748086689879921">Annuler l'importation</translation>
+<translation id="9130015405878219958">Le mode indiqué est incorrect.</translation>
+<translation id="6615807189585243369"><ph name="BURNT_AMOUNT"/> copié(s) sur <ph name="TOTAL_SIZE"/></translation>
+<translation id="8518425453349204360">L'accès à distance à cet ordinateur est activé pour <ph name="USER_EMAIL_ADDRESS"/>.</translation>
+<translation id="4950138595962845479">Options...</translation>
+<translation id="4653235815000740718">Un problème est survenu lors de la création du support de récupération du système d'exploitation. Le périphérique de stockage utilisé est introuvable.</translation>
+<translation id="5516565854418269276">Toujours &amp;afficher la barre de favoris</translation>
+<translation id="6426222199977479699">Erreur SSL</translation>
+<translation id="7104784605502674932">Confirmer les préférences de synchronisation</translation>
+<translation id="1788636309517085411">Utiliser les valeurs par défaut</translation>
+<translation id="1661867754829461514">Code secret manquant</translation>
+<translation id="7406714851119047430">L'accès à distance à cet ordinateur est désactivé.</translation>
+<translation id="8589311641140863898">API des extensions expérimentales</translation>
+<translation id="2804922931795102237">Inclure les informations système</translation>
+<translation id="869891660844655955">Date d'expiration</translation>
+<translation id="2178614541317717477">Autorité de certification compromise</translation>
+<translation id="4449935293120761385">À propos de la saisie automatique</translation>
+<translation id="4194570336751258953">Activer la fonction &quot;Taper pour cliquer&quot;</translation>
+<translation id="6066742401428748382">Accès à la page Web refusé</translation>
+<translation id="5111692334209731439">&amp;Gestionnaire de favoris</translation>
+<translation id="8295070100601117548">Erreur serveur</translation>
+<translation id="5661272705528507004">Cette carte SIM est désactivée et ne peut être utilisée. Veuillez demander à votre fournisseur de services de la remplacer.</translation>
+<translation id="443008484043213881">Outils</translation>
+<translation id="2529657954821696995">Clavier néerlandais</translation>
+<translation id="1128128132059598906">EAP-TTLS</translation>
+<translation id="6585234750898046415">Choisissez une image à associer à votre compte. Celle-ci s'affichera sur l'écran de connexion.</translation>
+<translation id="7957054228628133943">Configurer le blocage des fenêtres pop-up...</translation>
+<translation id="179767530217573436">des 4 dernières semaines</translation>
+<translation id="2279770628980885996">Une situation inattendue s'est produite tandis que le serveur tentait de traiter la demande.</translation>
+<translation id="8079135502601738761">Impossible d'afficher certaines parties de ce document PDF. Souhaitez-vous l'ouvrir dans Adobe Reader ?</translation>
+<translation id="9123413579398459698">Proxy FTP</translation>
+<translation id="3887875461425980041">Si vous utilisez la version PPAPI de Flash, exécutez-la dans chaque processus de moteur du rendu plutôt que dans un processus de plug-in dédié.</translation>
+<translation id="8534801226027872331">Cela signifie que le certificat présenté à votre navigateur contient des erreurs et qu'il ne peut pas être compris. Il est possible que les informations sur l'identité du certificat ou que d'autres informations du certificat relatives à la sécurité de la connexion soient incompréhensibles. Ne poursuivez pas.</translation>
+<translation id="3608527593787258723">Activer l'onglet 1</translation>
+<translation id="4497369307931735818">Communication à distance</translation>
+<translation id="3855676282923585394">Importer les favoris et les paramètres...</translation>
+<translation id="1116694919640316211">À propos</translation>
+<translation id="4422347585044846479">Modifier le favori de cette page</translation>
+<translation id="1684638090259711957">Ajouter un format d'exception</translation>
+<translation id="4925481733100738363">Configurer l'accès à distance...</translation>
+<translation id="1880905663253319515">Supprimer le certificat &quot;<ph name="CERTIFICATE_NAME"/>&quot; ?</translation>
+<translation id="8546306075665861288">Cache des images</translation>
+<translation id="5904093760909470684">Configuration du proxy</translation>
+<translation id="2874027208508018603">En l'absence de connexion Wi-Fi, Google Chrome utilise les données 3G.</translation>
+<translation id="4558734465070698159">Appuyez sur <ph name="HOTKEY_NAME"/> pour sélectionner le mode de saisie précédent.</translation>
+<translation id="3348643303702027858">La création du support de récupération du système d'exploitation a été annulée.</translation>
+<translation id="3391060940042023865">Le plug-in suivant est bloqué : <ph name="PLUGIN_NAME"/></translation>
+<translation id="4237016987259239829">Erreur de connexion réseau</translation>
+<translation id="9050666287014529139">Mot de passe multiterme</translation>
+<translation id="5197255632782567636">Internet</translation>
+<translation id="4755860829306298968">Configurer les paramètres de blocage des plug-ins...</translation>
+<translation id="8879284080359814990">Afficher dan&amp;s un onglet</translation>
+<translation id="2786847742169026523">Synchroniser vos mots de passe</translation>
+<translation id="41293960377217290">Le serveur proxy agit comme un intermédiaire entre votre ordinateur et les autres serveurs. Votre configuration système utilise actuellement un proxy, mais
+        <ph name="PRODUCT_NAME"/>
+        ne parvient pas à s'y connecter.</translation>
+<translation id="4520722934040288962">Sélectionner par type d'application</translation>
+<translation id="3873139305050062481">Procéder à l'i&amp;nspection de l'élément</translation>
+<translation id="7445762425076701745">Impossible de valider entièrement l'identité du serveur auquel vous êtes connecté. Le nom utilisé pour cette connexion n'est valide que sur votre réseau et aucune autorité de certification externe ne peut en vérifier la propriété. Certaines autorités de certification délivrent tout de même des certificats pour ces types de nom, par conséquent nous ne sommes pas en mesure de vérifier que vous êtes connecté au site voulu et non à un site malveillant.</translation>
+<translation id="1556537182262721003">Impossible de déplacer le répertoire d'extensions dans le profil.</translation>
+<translation id="5866557323934807206">Supprimer ces paramètres pour les prochaines visites</translation>
+<translation id="6506104645588011859">L'accessibilité est activée.</translation>
+<translation id="5355351445385646029">Appuyer sur la touche Espace pour sélectionner la suggestion</translation>
+<translation id="6978622699095559061">Vos favoris</translation>
+<translation id="6370820475163108109"><ph name="ORGANIZATION_NAME"/> (<ph name="DOMAIN_NAME"/>)</translation>
+<translation id="5453029940327926427">Fermer les onglets</translation>
+<translation id="406070391919917862">Applications en arrière-plan</translation>
+<translation id="8820817407110198400">Favoris</translation>
+<translation id="3214837514330816581">Supprimer les données synchronisées de Google Dashboard</translation>
+<translation id="2580170710466019930">Veuillez patienter pendant que <ph name="PRODUCT_NAME"/> installe les dernières mises à jour système.</translation>
+<translation id="7428061718435085649">Utilisez les touches Maj gauche et droite pour sélectionner les 2e et 3e propositions</translation>
+<translation id="1070066693520972135">WEP</translation>
+<translation id="206683469794463668">Mode Zhuyin complet. La sélection automatique de la suggestion et les options associées sont désactivées ou ignorées.</translation>
+<translation id="5191625995327478163">&amp;Paramètres linguistiques...</translation>
+<translation id="8833054222610756741">CRX-less Web Apps</translation>
+<translation id="4031729365043810780">Connexion au réseau</translation>
+<translation id="3332115613788466465">Reliure bord long</translation>
+<translation id="1985136186573666099"><ph name="PRODUCT_NAME"/> utilise les paramètres proxy du système pour se connecter au réseau.</translation>
+<translation id="6508261954199872201">Application : <ph name="APP_NAME"/></translation>
+<translation id="5585645215698205895">&amp;Descendre</translation>
+<translation id="8366757838691703947">? Toutes les données présentes sur le périphérique seront supprimées.</translation>
+<translation id="6596816719288285829">Adresse IP</translation>
+<translation id="7747704580171477003">Active le nouveau design de la page &quot;Nouvel onglet&quot; (en cours de développement).</translation>
+<translation id="4508265954913339219">Échec de l'activation</translation>
+<translation id="8656768832129462377">Ne pas vérifier</translation>
+<translation id="715487527529576698">Le chinois simplifié est le mode de saisie initial</translation>
+<translation id="1674989413181946727">Paramètres SSL sur tout l'ordinateur :</translation>
+<translation id="8703575177326907206">Votre connexion à <ph name="DOMAIN"/> n'est pas chiffrée.</translation>
+<translation id="8472623782143987204">matériel requis</translation>
+<translation id="4865571580044923428">Gérer les exceptions...</translation>
+<translation id="2526619973349913024">Rechercher des mises à jour</translation>
+<translation id="3874070094967379652">Utiliser un mot de passe multiterme pour chiffrer mes données de synchronisation</translation>
+<translation id="4864369630010738180">Connexion en cours...</translation>
+<translation id="6500116422101723010">Le serveur ne parvient pas à traiter la demande pour le moment. Ce code indique une situation temporaire. Le serveur sera de nouveau opérationnel ultérieurement.</translation>
+<translation id="1644574205037202324">Historique</translation>
+<translation id="1297175357211070620">Destination</translation>
+<translation id="6219983382864672018">Web audio</translation>
+<translation id="479280082949089240">Cookies placés par cette page</translation>
+<translation id="4198861010405014042">Accès partagé</translation>
+<translation id="6204930791202015665">Afficher...</translation>
+<translation id="5941343993301164315">Veuillez vous connecter à <ph name="TOKEN_NAME"/>.</translation>
+<translation id="4417229845571722044">Ajouter un nouvel e-mail</translation>
+<translation id="8049151370369915255">Personnaliser les polices...</translation>
+<translation id="2886862922374605295">Matériel :</translation>
+<translation id="4497097279402334319">Erreur de connexion au réseau.</translation>
+<translation id="5303618139271450299">Cette page Web est introuvable.</translation>
+<translation id="4256316378292851214">En&amp;registrer la vidéo sous...</translation>
+<translation id="3528171143076753409">Le certificat du serveur n'est pas approuvé.</translation>
+<translation id="6518014396551869914">Cop&amp;ier l'image</translation>
+<translation id="3236997602556743698">Sebeol-sik 390</translation>
+<translation id="542155483965056918"><ph name="NUMBER_ZERO"/> mins ago</translation>
+<translation id="289426338439836048">Autre réseau mobile...</translation>
+<translation id="3986287159189541211">Erreur HTTP <ph name="ERROR_NUMBER"/> (<ph name="ERROR_NAME"/>) : <ph name="ERROR_TEXT"/></translation>
+<translation id="3225319735946384299">Signature du code</translation>
+<translation id="3118319026408854581">Aide <ph name="PRODUCT_NAME"/></translation>
+<translation id="2422426094670600218">&lt;sans nom&gt;</translation>
+<translation id="2012766523151663935">Version du micrologiciel :</translation>
+<translation id="4120898696391891645">La page ne se charge pas</translation>
+<translation id="6060685159320643512">Attention, ces fonctionnalités expérimentales peuvent mordre.</translation>
+<translation id="5829990587040054282">Verrouiller l'écran ou éteindre</translation>
+<translation id="7800304661137206267">La connexion est chiffrée au moyen de <ph name="CIPHER"/>, avec <ph name="MAC"/> pour l'authentification des messages et <ph name="KX"/> pour la méthode d'échange de clés.</translation>
+<translation id="7706319470528945664">Clavier portugais</translation>
+<translation id="5584537427775243893">Importation</translation>
+<translation id="9128870381267983090">Connexion au réseau</translation>
+<translation id="4181841719683918333">Langues</translation>
+<translation id="6535131196824081346">Cette erreur peut se produire lors de la connexion à un serveur sécurisé (HTTPS).
+        Elle indique que le serveur tente d'établir une connexion sécurisée, mais
+        que celle-ci ne sera pas du tout sécurisée en raison d'une grave erreur de configuration.
+        <ph name="LINE_BREAK"/> Dans ce cas, une intervention
+        est requise sur le serveur.
+                <ph name="PRODUCT_NAME"/>
+        n'utilise pas de connexion non sécurisée pour protéger la confidentialité
+        de vos données.</translation>
+<translation id="5235889404533735074">La synchronisation de <ph name="PRODUCT_NAME"/> vous permet de partager vos données (favoris, préférences) sur vos ordinateurs en toute simplicité. Pour ce faire, <ph name="PRODUCT_NAME"/> enregistre vos données en ligne via Google lorsque vous vous connectez à votre compte.</translation>
+<translation id="6533668113756472185">Format ou mise en forme de la page</translation>
+<translation id="5640179856859982418">Clavier suisse</translation>
+<translation id="5910363049092958439">En&amp;registrer l'image sous...</translation>
+<translation id="1363055550067308502">Basculer en mode pleine chasse ou demi-chasse</translation>
+<translation id="3108967419958202225">Sélectionner...</translation>
+<translation id="6451650035642342749">Effacer les paramètres d'ouverture automatique</translation>
+<translation id="5948544841277865110">Ajouter un réseau privé</translation>
+<translation id="7121570032414343252"><ph name="NUMBER_TWO"/> secondes</translation>
+<translation id="1378451347523657898">Ne pas envoyer de capture d'écran</translation>
+<translation id="5098629044894065541">Hébreu</translation>
+<translation id="7751559664766943798">Toujours afficher la barre de favoris</translation>
+<translation id="5098647635849512368">Impossible de trouver le chemin d'accès absolu du répertoire à empaqueter.</translation>
+<translation id="780617032715125782">Créer un profil</translation>
+<translation id="933712198907837967">Diners Club</translation>
+<translation id="6380224340023442078">Paramètres de contenu...</translation>
+<translation id="950108145290971791">Activer la recherche instantanée pour accélérer la recherche et la navigation ?</translation>
+<translation id="144136026008224475">Plus d'extensions &gt;&gt;</translation>
+<translation id="5486326529110362464">La valeur d'entrée de la clé privée est obligatoire.</translation>
+<translation id="9039663905644212491">PEAP</translation>
+<translation id="62780591024586043">Fonctionnalités de localisation expérimentales</translation>
+<translation id="8584280235376696778">Ou&amp;vrir la vidéo dans un nouvel onglet</translation>
+<translation id="2845382757467349449">Toujours afficher la barre de favoris</translation>
+<translation id="2516384155283419848">Reliure</translation>
+<translation id="3053013834507634016">Utilisation de la clé du certificat</translation>
+<translation id="4487088045714738411">Clavier belge</translation>
+<translation id="7511635910912978956"><ph name="NUMBER_FEW"/> heures restantes</translation>
+<translation id="2152580633399033274">Afficher toutes les images (recommandé)</translation>
+<translation id="7894567402659809897">Cliquez sur
+          <ph name="BEGIN_BOLD"/>Démarrer<ph name="END_BOLD"/>,
+          puis sur
+          <ph name="BEGIN_BOLD"/>Exécuter<ph name="END_BOLD"/>.
+          Saisissez
+          et cliquez sur
+          <ph name="BEGIN_BOLD"/>OK<ph name="END_BOLD"/>.</translation>
+<translation id="2934952234745269935">Nom de volume</translation>
+<translation id="7960533875494434480">Reliure bord court</translation>
+<translation id="6431347207794742960"><ph name="PRODUCT_NAME"/> va configurer les mises à jour automatiques pour tous les utilisateurs de cet ordinateur.</translation>
+<translation id="4973698491777102067">Effacer les éléments datant :</translation>
+<translation id="6074963268421707432">Interdire à tous les sites d'afficher des notifications sur le Bureau</translation>
+<translation id="8508050303181238566">Appuyez sur <ph name="HOTKEY_NAME"/> pour passer d'un mode de saisie à l'autre.</translation>
+<translation id="6273404661268779365">Ajouter un nouveau fax</translation>
+<translation id="1995173078718234136">Recherche de contenu en cours...</translation>
+<translation id="4735819417216076266">Style d'entrée avec Espace</translation>
+<translation id="2977095037388048586">Vous avez tenté d'accéder à <ph name="DOMAIN"/>, mais, au lieu de cela, vous communiquez actuellement avec un serveur identifié comme <ph name="DOMAIN2"/>. Cela est peut-être dû à un défaut de configuration du serveur ou à quelque chose de plus grave. Un pirate informatique sur votre réseau cherche peut-être à vous faire visiter une version falsifiée de <ph name="DOMAIN3"/>, donc potentiellement préjudiciable. Nous vous déconseillons vivement de continuer.</translation>
+<translation id="220138918934036434">Masquer le bouton</translation>
+<translation id="5374359983950678924">Modifier l'image</translation>
+<translation id="5158548125608505876">Ne pas synchroniser mes mots de passe</translation>
+<translation id="2167276631610992935">JavaScript</translation>
+<translation id="6974306300279582256">Activer les notifications de <ph name="SITE"/></translation>
+<translation id="492914099844938733">Afficher les incompatibilités</translation>
+<translation id="5233638681132016545">Nouvel onglet</translation>
+<translation id="6567688344210276845">Impossible de charger l'icône &quot;<ph name="ICON"/>&quot; d'action de page.</translation>
+<translation id="5210365745912300556">Fermer l'onglet</translation>
+<translation id="8628085465172583869">Nom d'hôte du serveur :</translation>
+<translation id="498765271601821113">Ajouter une carte de paiement</translation>
+<translation id="7694379099184430148"><ph name="FILENAME"/> : type de fichier inconnu</translation>
+<translation id="1992397118740194946">Non défini</translation>
+<translation id="7966826846893205925">Gérer les paramètres de saisie automatique...</translation>
+<translation id="8556732995053816225">Respecter la &amp;casse</translation>
+<translation id="3314070176311241517">Autoriser tous les sites à exécuter JavaScript (recommandé)</translation>
+<translation id="2406911946387278693">Gérer vos périphériques depuis le cloud</translation>
+<translation id="7419631653042041064">Clavier catalan</translation>
+<translation id="5710740561465385694">Me demander lorsqu'un site essaie de stocker des données</translation>
+<translation id="3897092660631435901">Menu</translation>
+<translation id="7024867552176634416">Sélectionnez le périphérique de stockage amovible à utiliser.</translation>
+<translation id="8553075262323480129">La traduction a échoué, car nous n'avons pas pu déterminer la langue de la page.</translation>
+<translation id="5910680277043747137">Vous pouvez créer des profils supplémentaires pour autoriser plusieurs personnes à utiliser et personnaliser Google Chrome.</translation>
+<translation id="4381849418013903196">Deux-points</translation>
+<translation id="1103523840287552314">Toujours traduire en <ph name="LANGUAGE"/></translation>
+<translation id="2263497240924215535">(désactivée)</translation>
+<translation id="2159087636560291862">Cela signifie que le certificat n'a pas été vérifié par un tiers reconnu par votre ordinateur. N'importe qui peut émettre un certificat en se faisant passer pour un autre site Web. Ce certificat doit donc être vérifié par un tiers approuvé. Sans cette vérification, les informations sur l'identité du certificat sont sans intérêt. Par conséquent, il nous est impossible de vérifier que vous communiquez bien avec <ph name="DOMAIN"/> et non avec un pirate informatique ayant émis son propre certificat en prétendant être <ph name="DOMAIN2"/>. Nous vous déconseillons vivement de continuer.</translation>
+<translation id="58625595078799656"><ph name="PRODUCT_NAME"/> requiert que vous cryptiez vos données à l'aide de votre mot de passe Google ou de votre propre mot de passe multiterme.</translation>
+<translation id="8017335670460187064"><ph name="LABEL"/></translation>
+<translation id="6840184929775541289">N'est pas une autorité de certification</translation>
+<translation id="6099520380851856040">Date et heure : <ph name="CRASH_TIME"/></translation>
+<translation id="144518587530125858">Impossible de charger &quot;<ph name="IMAGE_PATH"/>&quot; pour le thème.</translation>
+<translation id="5355097969896547230">Rechercher à nouveau</translation>
+<translation id="7925285046818567682">En attente de <ph name="HOST_NAME"/>...</translation>
+<translation id="2553440850688409052">Masquer ce plug-in</translation>
+<translation id="3280237271814976245">Enregistrer &amp;sous...</translation>
+<translation id="8301162128839682420">Ajouter une langue :</translation>
+<translation id="7658239707568436148">Annuler</translation>
+<translation id="8695825812785969222">Ouvrir une &amp;adresse...</translation>
+<translation id="4538417792467843292">Supprimer le mot</translation>
+<translation id="8412392972487953978">Vous devez saisir deux fois le même mot de passe multiterme.</translation>
+<translation id="9121814364785106365">Ouvrir dans un onglet épinglé</translation>
+<translation id="6996264303975215450">Page Web, tout type de contenu</translation>
+<translation id="3435896845095436175">Activer</translation>
+<translation id="1891668193654680795">Considérer ce certificat comme fiable pour identifier les développeurs de logiciels.</translation>
+<translation id="5078638979202084724">Ajouter tous les onglets aux favoris</translation>
+<translation id="5585118885427931890">Impossible de créer le dossier de favoris.</translation>
+<translation id="2154710561487035718">Copier l'URL</translation>
+<translation id="8163672774605900272">Si vous pensez ne pas avoir à utiliser de serveur proxy, procédez comme suit :
+        <ph name="PLATFORM_TEXT"/></translation>
+<translation id="5510687173983454382">Définir les utilisateurs autorisés à se connecter à un périphérique et autoriser les sessions de navigation en tant qu'invité</translation>
+<translation id="3241680850019875542">Sélectionnez le répertoire racine de l'extension à empaqueter. Pour mettre à jour une extension, sélectionnez également le fichier de clé privée à réutiliser.</translation>
+<translation id="7500424997253660722">Pool restreint :</translation>
+<translation id="657402800789773160">&amp;Rafraîchir cette page</translation>
+<translation id="6163363155248589649">&amp;Normal</translation>
+<translation id="7972714317346275248">PKCS #1 SHA-384 avec chiffrement RSA</translation>
+<translation id="3020990233660977256">Numéro de série : <ph name="SERIAL_NUMBER"/></translation>
+<translation id="8426519927982004547">HTTPS/SSL</translation>
+<translation id="8216781342946147825">Toutes les données de votre ordinateur et des sites Web que vous visitez</translation>
+<translation id="5548207786079516019">Ceci est une installation secondaire de <ph name="PRODUCT_NAME"/> et ce dernier ne peut pas être défini comme navigateur par défaut.</translation>
+<translation id="3984413272403535372">Erreur lors de la signature de l'extension</translation>
+<translation id="8807083958935897582"><ph name="PRODUCT_NAME"/> permet d'effectuer des recherches sur Internet à l'aide du champ polyvalent. Sélectionnez le moteur de recherche à utiliser :</translation>
+<translation id="6629104427484407292">Sécurité : <ph name="SECURITY"/></translation>
+<translation id="9208886416788010685">Adobe Reader n'est pas à jour</translation>
+<translation id="3373604799988099680">Extensions ou applications</translation>
+<translation id="318408932946428277">Effacer les cookies et autres données de site et de plug-in lorsque je ferme le navigateur</translation>
+<translation id="314141447227043789">Téléchargement de l'image terminé.</translation>
+<translation id="8725178340343806893">Favoris</translation>
+<translation id="5177526793333269655">Afficher les vignettes</translation>
+<translation id="8926389886865778422">Ne plus afficher ce message</translation>
+<translation id="6985235333261347343">Agent de récupération de clé Microsoft</translation>
+<translation id="3605499851022050619">Page de diagnostic de navigation sécurisée</translation>
+<translation id="4417271111203525803">Adresse ligne 2</translation>
+<translation id="7617095560120859490">Décrivez-nous le problème recontré. (Champ obligatoire)</translation>
+<translation id="5618333180342767515">Cela peut prendre quelques minutes.</translation>
+<translation id="4307992518367153382">Options de base</translation>
+<translation id="8480417584335382321">Niveau de zoom par défaut :</translation>
+<translation id="3872166400289564527">Stockage externe</translation>
+<translation id="5912378097832178659">Modifi&amp;er les moteurs de recherche...</translation>
+<translation id="8272426682713568063">Cartes de paiement</translation>
+<translation id="3749289110408117711">Nom du fichier</translation>
+<translation id="3173397526570909331">Arrêter la synchronisation</translation>
+<translation id="5538092967727216836">Actualiser le cadre</translation>
+<translation id="4813345808229079766">Connexion</translation>
+<translation id="411666854932687641">Mémoire privée</translation>
+<translation id="119944043368869598">Tout effacer</translation>
+<translation id="3467848195100883852">Activer la correction orthographique automatique</translation>
+<translation id="1336254985736398701">Afficher les &amp;infos sur la page</translation>
+<translation id="7550830279652415241">favoris_<ph name="DATESTAMP"/>.html</translation>
+<translation id="6828153365543658583">Autoriser uniquement les utilisateurs suivants à se connecter :</translation>
+<translation id="1652965563555864525">&amp;Muet</translation>
+<translation id="4200983522494130825">Nouvel ongle&amp;t</translation>
+<translation id="7979036127916589816">Erreur de synchronisation</translation>
+<translation id="1029317248976101138">Zoom</translation>
+<translation id="5455790498993699893"><ph name="ACTIVE_MATCH"/> sur <ph name="TOTAL_MATCHCOUNT"/></translation>
+<translation id="8890069497175260255">Type de clavier</translation>
+<translation id="1202290638211552064">Délai d'expiration atteint au niveau de la passerelle ou du serveur proxy en attente d'une réponse d'un serveur en amont.</translation>
+<translation id="7765158879357617694">Déplacer</translation>
+<translation id="5731751937436428514">Mode de saisie du vietnamien (VIQR)</translation>
+<translation id="8412144371993786373">Ajouter la page actuelle aux favoris</translation>
+<translation id="7615851733760445951">&lt;aucun cookie sélectionné&gt;</translation>
+<translation id="469553822757430352">Le mot de passe de l'application est incorrect.</translation>
+<translation id="2493021387995458222">Sélectionner &quot;un mot à la fois&quot;</translation>
+<translation id="5279600392753459966">Tout bloquer</translation>
+<translation id="6846298663435243399">Chargement en cours…</translation>
+<translation id="7392915005464253525">&amp;Rouvrir la fenêtre fermée</translation>
+<translation id="1144684570366564048">Gérer les exceptions...</translation>
+<translation id="7400418766976504921">URL</translation>
+<translation id="1541725072327856736">Katakana demi-chasse</translation>
+<translation id="7456847797759667638">Ouvrir une adresse</translation>
+<translation id="1388866984373351434">Données de navigation</translation>
+<translation id="3754634516926225076">Code PIN incorrect. Veuillez réessayer.</translation>
+<translation id="7378627244592794276">Non</translation>
+<translation id="2800537048826676660">Utiliser cette langue pour corriger l'orthographe</translation>
+<translation id="68541483639528434">Fermer les autres onglets</translation>
+<translation id="941543339607623937">Clé privée non valide.</translation>
+<translation id="6499058468232888609">Une erreur réseau s'est produite pendant la communication avec le service de gestion des périphériques.</translation>
+<translation id="4433862206975946675">Importer les données d'un autre navigateur...</translation>
+<translation id="4022426551683927403">&amp;Ajouter au dictionnaire</translation>
+<translation id="2897878306272793870">Voulez-vous vraiment ouvrir <ph name="TAB_COUNT"/> onglets ?</translation>
+<translation id="312759608736432009">Fabricant du périphérique :</translation>
+<translation id="362276910939193118">Afficher l'historique complet</translation>
+<translation id="6079696972035130497">Illimité</translation>
+<translation id="4365411729367255048">Clavier Neo2 allemand</translation>
+<translation id="6348657800373377022">Liste déroulante</translation>
+<translation id="8064671687106936412">Clé :</translation>
+<translation id="2218515861914035131">Coller en texte brut</translation>
+<translation id="1725149567830788547">Afficher les &amp;commandes</translation>
+<translation id="3528033729920178817">Cette page suit votre position géographique.</translation>
+<translation id="5518584115117143805">Certificat de chiffrement de courrier électronique</translation>
+<translation id="9203398526606335860">&amp;Profilage activé</translation>
+<translation id="4307281933914537745">En savoir plus sur la récupération du système</translation>
+<translation id="2849936225196189499">Essentielle</translation>
+<translation id="9001035236599590379">Type MIME</translation>
+<translation id="5612754943696799373">Autoriser le téléchargement ?</translation>
+<translation id="6353618411602605519">Clavier croate</translation>
+<translation id="5515810278159179124">Interdire à tous les sites de suivre ma position géographique</translation>
+<translation id="5999606216064768721">Utiliser la barre de titre du système et les bordures de la fenêtre</translation>
+<translation id="904752364881701675">En bas à gauche</translation>
+<translation id="3398951731874728419">Informations sur l'erreur :</translation>
+<translation id="1464570622807304272">Essayez : saisissez &quot;orchidées&quot;, puis appuyez sur Entrée.</translation>
+<translation id="8026684114486203427">Pour utiliser Chrome Web Store, vous devez être connecté à un compte Google.</translation>
+<translation id="8417276187983054885">Configurer <ph name="CLOUD_PRINT_NAME"/></translation>
+<translation id="3056462238804545033">Petit problème... Nous n'avons pas réussi à vous authentifier. Veuillez vérifier vos identifiants de connexion puis réessayer.</translation>
+<translation id="5298420986276701358">Pour gérer à distance la configuration de ce périphérique <ph name="PRODUCT_NAME"/> depuis le cloud, connectez-vous avec votre compte Google Apps.</translation>
+<translation id="2678063897982469759">Réactiver</translation>
+<translation id="1779766957982586368">Fermer la fenêtre</translation>
+<translation id="4850886885716139402">Présentation</translation>
+<translation id="89217462949994770">Vous avez saisi un trop grand nombre de codes PIN incorrects. Veuillez contacter <ph name="CARRIER_ID"/> pour obtenir une nouvelle clé de déverrouillage du code PIN à 8 chiffres.</translation>
+<translation id="5920618722884262402">Bloquer le contenu inapproprié</translation>
+<translation id="5120247199412907247">Configuration avancée</translation>
+<translation id="5922220455727404691">Utiliser SSL 3.0</translation>
+<translation id="1368352873613152012">Règles de confidentialité liées à la navigation sécurisée</translation>
+<translation id="5105859138906591953">Vous devez être connecté à votre compte Google pour importer les favoris de la barre d'outils Google dans Google Chrome. Connectez-vous et relancez l'importation.</translation>
+<translation id="8899851313684471736">Ouvrir le lien dans une nouvelle &amp;fenêtre</translation>
+<translation id="4110342520124362335">Les cookies de <ph name="DOMAIN"/> ont été bloqués.</translation>
+<translation id="3303818374450886607">Copies</translation>
+<translation id="2019718679933488176">&amp;Ouvrir le fichier audio dans un nouvel onglet</translation>
+<translation id="4138267921960073861">Afficher les noms d'utilisateurs et leur photo sur la page de connexion</translation>
+<translation id="7465778193084373987">URL de révocation de certificat Netscape</translation>
+<translation id="5976690834266782200">Ajoute des options de regroupement des onglets dans le menu contextuel des onglets.</translation>
+<translation id="4755240240651974342">Clavier finnois</translation>
+<translation id="7049893973755373474">Vérifiez votre connexion Internet. Redémarrez votre routeur, votre modem 
+        ou tout autre périphérique réseau que vous utilisez.</translation>
+<translation id="7421925624202799674">&amp;Afficher le code source de la page</translation>
+<translation id="3940082421246752453">Le serveur ne prend pas en charge la version HTTP utilisée dans la demande.</translation>
+<translation id="661719348160586794">Vos mots de passe enregistrés s'afficheront ici.</translation>
+<translation id="6686490380836145850">Fermer les onglets sur la droite</translation>
+<translation id="5608669887400696928"><ph name="NUMBER_DEFAULT"/> heures</translation>
+<translation id="8844709414456935411"><ph name="PRODUCT_NAME"/>
+        indique qu'un produit ESET intercepte les connexions sécurisées.
+        En général, cela ne constitue pas un problème de sécurité car le 
+        logiciel ESET s'exécute souvent sur le même ordinateur. Toutefois, en raison
+        de certaines incompatibilités avec les connexions sécurisées 
+        <ph name="PRODUCT_NAME"/>,
+        vous devez configurer les produits ESET de manière à éviter ces 
+        interceptions. Cliquez sur le lien En savoir plus pour obtenir des instructions.</translation>
+<translation id="3936877246852975078">Les requêtes adressées au serveur ont été temporairement limitées.</translation>
+<translation id="2600306978737826651">Impossible de télécharger l'image. Gravure annulée.</translation>
+<translation id="609978099044725181">Activer/désactiver le mode Hanja</translation>
+<translation id="1829483195200467833">Effacer les paramètres d'ouverture automatique</translation>
+<translation id="2738771556149464852">Pas après le</translation>
+<translation id="5774515636230743468">Manifeste :</translation>
+<translation id="719464814642662924">Visa</translation>
+<translation id="7474889694310679759">Clavier anglais canadien</translation>
+<translation id="1817871734039893258">Récupération de fichier Microsoft</translation>
+<translation id="2423578206845792524">En&amp;registrer l'image sous...</translation>
+<translation id="6839929833149231406">Zone</translation>
+<translation id="9068931793451030927">Chemin :</translation>
+<translation id="283278805979278081">Prendre la photo</translation>
+<translation id="7320906967354320621">Inactif</translation>
+<translation id="1407050882688520094">Certains de vos certificats enregistrés identifient ces autorités de certification :</translation>
+<translation id="4287689875748136217">Impossible d'afficher la page Web, car le serveur n'a envoyé aucune donnée.</translation>
+<translation id="1634788685286903402">Considérer ce certificat comme fiable pour identifier les utilisateurs de messageries.</translation>
+<translation id="7052402604161570346">Ce type de fichier peut endommager votre ordinateur. Voulez-vous vraiment télécharger <ph name="FILE_NAME"/> ?</translation>
+<translation id="8642489171979176277">Importés depuis la barre d'outils Google</translation>
+<translation id="4142744419835627535">Recherche instantanée et saisie semi-automatique</translation>
+<translation id="4684427112815847243">Tout synchroniser</translation>
+<translation id="1125520545229165057">Dvorak (Hsu)</translation>
+<translation id="8940229512486821554">Exécuter la commande <ph name="EXTENSION_NAME"/> : <ph name="SEARCH_TERMS"/></translation>
+<translation id="2232876851878324699">Le fichier contenait un certificat, qui n'a pas été importé :</translation>
+<translation id="7787129790495067395">Vous utilisez actuellement un mot de passe multiterme. Si vous l'oubliez, vous pouvez réinitialiser la synchronisation afin de supprimer vos données des serveurs Google à l'aide de Google Dashboard.</translation>
+<translation id="2686759344028411998">Impossible de détecter les modules chargés.</translation>
+<translation id="572525680133754531">Cette fonctionnalité affiche une bordure autour des couches de rendu afin de déboguer et d'étudier leur composition.</translation>
+<translation id="2011110593081822050">Processus de traitement Web : <ph name="WORKER_NAME"/></translation>
+<translation id="3294437725009624529">Invité</translation>
+<translation id="350069200438440499">Nom du fichier :</translation>
+<translation id="9058204152876341570">Un élément est manquant.</translation>
+<translation id="8494979374722910010">Échec de la tentative de connexion au serveur.</translation>
+<translation id="7810202088502699111">Des fenêtres pop-up ont été bloquées sur cette page.</translation>
+<translation id="8190698733819146287">Personnaliser les langues et la saisie...</translation>
+<translation id="646727171725540434">Proxy HTTP</translation>
+<translation id="1006316751839332762">Mot de passe multiterme de chiffrement</translation>
+<translation id="8795916974678578410">Nouvelle fenêtre</translation>
+<translation id="2733275712367076659">Certains certificats provenant de ces organisations vous identifient :</translation>
+<translation id="4801512016965057443">Autoriser l'itinérance des données mobiles</translation>
+<translation id="2515586267016047495">Alt</translation>
+<translation id="2046040965693081040">Utiliser les pages actuelles</translation>
+<translation id="3798449238516105146">Version</translation>
+<translation id="5764483294734785780">En&amp;registrer le fichier audio sous...</translation>
+<translation id="5252456968953390977">Itinérance</translation>
+<translation id="8744641000906923997">Romaji</translation>
+<translation id="8507996248087185956"><ph name="NUMBER_DEFAULT"/> minutes</translation>
+<translation id="4845656988780854088">Synchroniser uniquement les paramètres et\ndonnées qui ont changé depuis la dernière connexion\n(requiert votre mot de passe précédent)</translation>
+<translation id="348620396154188443">Autoriser tous les sites à afficher des notifications sur le Bureau</translation>
+<translation id="8214489666383623925">Ouvrir le fichier...</translation>
+<translation id="5376120287135475614">Changer de fenêtre</translation>
+<translation id="5230160809118287008">Chèvres téléportées</translation>
+<translation id="1701567960725324452">Si vous arrêtez la synchronisation, les données stockées sur cet ordinateur et dans votre compte Google demeureront à ces deux emplacements. Toutefois, les nouvelles données ou les modifications apportées au contenu existant ne seront pas synchronisées.</translation>
+<translation id="7761701407923456692">Le certificat du serveur ne correspond pas à l'URL.</translation>
+<translation id="3885155851504623709">Commune</translation>
+<translation id="4910171858422458941">Impossible d'activer les plug-ins désactivés par une stratégie d'entreprise.</translation>
+<translation id="4495419450179050807">Ne pas afficher sur cette page</translation>
+<translation id="4745800796303246012">Méthodes EAP en Wi-Fi expérimentales</translation>
+<translation id="1225544122210684390">Disque dur</translation>
+<translation id="939736085109172342">Nouveau dossier</translation>
+<translation id="4933484234309072027">intégration sur <ph name="URL"/></translation>
+<translation id="5554720593229208774">Autorité de certification de messagerie</translation>
+<translation id="862750493060684461">Cache CSS</translation>
+<translation id="2832519330402637498">En haut à gauche</translation>
+<translation id="6749695674681934117">Saisissez le nom du nouveau dossier.</translation>
+<translation id="6204994989617056362">L'extension de renégociation SSL était introuvable lors de la négociation sécurisée. Avec certains sites, connus pour leur prise en charge de l'extension de renégociation, Google Chrome exige une négociation mieux sécurisée afin de prévenir certaines attaques. L'absence de cette extension suggère que votre connexion a été interceptée et manipulée au cours du transfert.</translation>
+<translation id="6679492495854441399">Petit problème... Une erreur de communication avec le réseau est survenue lors de la tentative d'inscription de ce périphérique. Veuillez vérifier votre connexion réseau et réessayer.</translation>
+<translation id="7789962463072032349">pause</translation>
+<translation id="121827551500866099">Afficher tous les téléchargements...</translation>
+<translation id="1562633988311880769">Connexion à <ph name="CLOUD_PRINT_NAME"/></translation>
+<translation id="5949910269212525572">Impossible de résoudre l'adresse DNS du serveur.</translation>
+<translation id="3115147772012638511">En attente de l'affichage du cache</translation>
+<translation id="257088987046510401">Thèmes</translation>
+<translation id="6771079623344431310">Impossible de se connecter au serveur proxy.</translation>
+<translation id="2200129049109201305">Ignorer la synchronisation des données chiffrées ?</translation>
+<translation id="1426410128494586442">Oui</translation>
+<translation id="6725970970008349185">Nombre de suggestions par page</translation>
+<translation id="6198252989419008588">Modifier le code PIN</translation>
+<translation id="5749483996735055937">Un problème est survenu lors de la copie de l'image de récupération sur le périphérique.</translation>
+<translation id="3520476450377425184"><ph name="NUMBER_MANY"/> jours restants</translation>
+<translation id="7643817847124207232">La connexion Internet a été interrompue.</translation>
+<translation id="932327136139879170">Début</translation>
+<translation id="4764675709794295630">« Précédent</translation>
+<translation id="2560794850818211873">C&amp;opier l'URL de la vidéo</translation>
+<translation id="6042708169578999844">Vos données sur <ph name="WEBSITE_1"/> et <ph name="WEBSITE_2"/></translation>
+<translation id="5302048478445481009">Langue</translation>
+<translation id="5553089923092577885">Mappages des stratégies de certificat</translation>
+<translation id="5600907569873192868"><ph name="NUMBER_MANY"/> minutes restantes</translation>
+<translation id="1519704592140256923">Sélectionner la position</translation>
+<translation id="1275018677838892971">Le site Web à l'adresse <ph name="HOST_NAME"/> contient des éléments provenant de sites signalés comme étant des sites de phishing. Ces derniers incitent les internautes à divulguer leurs informations personnelles en se faisant passer pour des institutions de confiance, telles que des banques.</translation>
+<translation id="702455272205692181"><ph name="EXTENSION_NAME"/></translation>
+<translation id="7170041865419449892">Hors de portée</translation>
+<translation id="908263542783690259">Effacer l'historique de navigation</translation>
+<translation id="7518003948725431193">Aucune page Web trouvée à l'adresse :<ph name="URL"/></translation>
+<translation id="745602119385594863">Nouveau moteur de recherche :</translation>
+<translation id="7484645889979462775">Jamais pour ce site</translation>
+<translation id="8666066831007952346"><ph name="NUMBER_TWO"/> jours restants</translation>
+<translation id="9086455579313502267">Impossible d'accéder au réseau.</translation>
+<translation id="5595485650161345191">Modifier l'adresse</translation>
+<translation id="2374144379568843525">&amp;Masquer le panneau de la vérification orthographique</translation>
+<translation id="2694026874607847549">1 cookie</translation>
+<translation id="4393664266930911253">Activer ces fonctionnalités...</translation>
+<translation id="6390842777729054533"><ph name="NUMBER_ZERO"/> secondes restantes</translation>
+<translation id="3909791450649380159">Cou&amp;per</translation>
+<translation id="2955913368246107853">Fermer la barre de recherche</translation>
+<translation id="5642508497713047">Signataire de la liste de révocation de certificats</translation>
+<translation id="813082847718468539">Afficher des informations à propos du site</translation>
+<translation id="3122464029669770682">UC</translation>
+<translation id="1684861821302948641">Fermer les pages</translation>
+<translation id="6092270396854197260">MSPY</translation>
+<translation id="6802031077390104172"><ph name="USAGE"/> (<ph name="OID"/>)</translation>
+<translation id="4052120076834320548">Très petite</translation>
+<translation id="6623138136890659562">Afficher les réseaux privés dans le menu Réseau pour activer la connexion à un VPN</translation>
+<translation id="8969837897925075737">Vérification de la mise à jour du système...</translation>
+<translation id="3393716657345709557">L'entrée demandée est introuvable dans le cache.</translation>
+<translation id="7241389281993241388">Connectez-vous à <ph name="TOKEN_NAME"/> pour importer le certificat client.</translation>
+<translation id="40334469106837974">Modifier la mise en page</translation>
+<translation id="4804818685124855865">Se déconnecter</translation>
+<translation id="2617919205928008385">Espace insuffisant.</translation>
+<translation id="210445503571712769">Préférences synchronisées</translation>
+<translation id="1608306110678187802">Imp&amp;rimer le cadre...</translation>
+<translation id="7427315641433634153">MSCHAP</translation>
+<translation id="6622980291894852883">Continuer à bloquer les images</translation>
+<translation id="5937837224523037661">Lorsqu'un site utilise des plug-ins :</translation>
+<translation id="4988792151665380515">Échec d'exportation de la clé publique</translation>
+<translation id="6333049849394141510">Choisir les éléments à synchroniser</translation>
+<translation id="446322110108864323">Paramètres de saisie du Pinyin</translation>
+<translation id="4948468046837535074">Ouvrir les pages suivantes :</translation>
+<translation id="5222676887888702881">Déconnexion</translation>
+<translation id="6978121630131642226">Moteurs de recherche</translation>
+<translation id="6839225236531462745">Erreur de suppression de certificat</translation>
+<translation id="6745994589677103306">Ne rien faire</translation>
+<translation id="855081842937141170">Épingler l'onglet</translation>
+<translation id="6263541650532042179">réinitialiser la synchronisation</translation>
+<translation id="6055392876709372977">PKCS #1 SHA-256 avec chiffrement RSA</translation>
+<translation id="7903984238293908205">Katakana</translation>
+<translation id="3781488789734864345">Choisir un réseau mobile</translation>
+<translation id="268053382412112343">&amp;Historique</translation>
+<translation id="2723893843198727027">Mode développeur :</translation>
+<translation id="1722567105086139392">Lien</translation>
+<translation id="2620436844016719705">Système</translation>
+<translation id="5362741141255528695">Sélectionnez le fichier de clé privée.</translation>
+<translation id="5292890015345653304">Insérez une carte SD ou une carte mémoire USB.</translation>
+<translation id="5583370583559395927">Temps restant : <ph name="TIME_REMAINING"/></translation>
+<translation id="8065982201906486420">Cliquez ici pour exécuter le plug-in <ph name="PLUGIN_NAME"/>.</translation>
+<translation id="6219717821796422795">Hanyu</translation>
+<translation id="3725367690636977613">pages</translation>
+<translation id="2688477613306174402">Configuration en cours</translation>
+<translation id="1195447618553298278">Erreur inconnue</translation>
+<translation id="3353284378027041011"><ph name="NUMBER_FEW"/> days ago</translation>
+<translation id="8811462119186190367">La langue utilisée pour Google Chrome est passée de &quot;<ph name="FROM_LOCALE"/>&quot; à &quot;<ph name="TO_LOCALE"/>&quot; après la synchronisation de vos paramètres.</translation>
+<translation id="1087119889335281750">&amp;Aucune suggestion orthographique</translation>
+<translation id="5228309736894624122">Erreur de protocole SSL</translation>
+<translation id="8216170236829567922">Mode de saisie du thaï (clavier Pattachote)</translation>
+<translation id="8464132254133862871">Ce compte utilisateur n'est pas compatible avec ce service.</translation>
+<translation id="6812349420832218321"><ph name="PRODUCT_NAME"/> ne peut pas être exécuté en tant que root.</translation>
+<translation id="5076340679995252485">C&amp;oller</translation>
+<translation id="2904348843321044456">Paramètres de contenu...</translation>
+<translation id="1055216403268280980">Dimensions de l'image</translation>
+<translation id="1784284518684746740">Sélectionner le fichier à enregistrer sous</translation>
+<translation id="7032947513385578725">Disque Flash</translation>
+<translation id="5518442882456325299">Moteur de recherche actuel :</translation>
+<translation id="14171126816530869">L'identité de <ph name="ORGANIZATION"/> situé à <ph name="LOCALITY"/> a été vérifiée par <ph name="ISSUER"/>.</translation>
+<translation id="6263082573641595914">Version de l'autorité de certification Microsoft</translation>
+<translation id="3105917916468784889">Enregistrer une capture d'écran</translation>
+<translation id="1741763547273950878">Page sur <ph name="SITE"/></translation>
+<translation id="1587275751631642843">Console &amp;JavaScript</translation>
+<translation id="8460696843433742627">Réponse reçue incorrecte lors de la tentative de chargement de <ph name="URL"/>.
+        Cela peut être dû à une opération de maintenance ou à une configuration incorrecte sur le serveur.</translation>
+<translation id="297870353673992530">Serveur DNS :</translation>
+<translation id="3222066309010235055">Pré-rendu : <ph name="PRERENDER_CONTENTS_NAME"/></translation>
+<translation id="6410063390789552572">Impossible d'accéder à la bibliothèque réseau.</translation>
+<translation id="6880587130513028875">Des images ont été bloquées sur cette page.</translation>
+<translation id="851263357009351303">Toujours autoriser <ph name="HOST"/> à afficher les images</translation>
+<translation id="3511307672085573050">Copier l'adr&amp;esse du lien</translation>
+<translation id="1134009406053225289">Ouvrir dans une fenêtre de navigation privée</translation>
+<translation id="6655190889273724601">Mode développeur</translation>
+<translation id="1071917609930274619">Chiffrement des données</translation>
+<translation id="3473105180351527598">Activer la protection contre le phishing et les logiciels malveillants</translation>
+<translation id="6151323131516309312">Appuyez sur <ph name="SEARCH_KEY"/> pour rechercher sur <ph name="SITE_NAME"/></translation>
+<translation id="3753317529742723206">Voulez-vous utiliser <ph name="HANDLER_TITLE"/> (<ph name="HANDLER_HOSTNAME"/>) au lieu de <ph name="REPLACED_HANDLER_TITLE"/> pour gérer les liens <ph name="PROTOCOL"/>:// à partir de maintenant ?</translation>
+<translation id="6216679966696797604">Démarrer une session en tant qu'invité</translation>
+<translation id="5456397824015721611">Nombre maximal de caractères chinois dans la mémoire tampon de pré-édition, notamment les entrées de symboles Zhuyin</translation>
+<translation id="2055443983279698110">Barre de menus GNOME expérimentale disponible</translation>
+<translation id="2342959293776168129">Effacer l'historique des téléchargements</translation>
+<translation id="2503522102815150840">Navigateur bloqué...</translation>
+<translation id="7201354769043018523">Parenthèse drte</translation>
+<translation id="425878420164891689">Calcul du temps de chargement</translation>
+<translation id="508794495705880051">Ajouter une carte de paiement...</translation>
+<translation id="1425975335069981043">Itinérance :</translation>
+<translation id="1272079795634619415">Arrêter</translation>
+<translation id="5442787703230926158">Erreur de synchronisation...</translation>
+<translation id="2462724976360937186">ID de clé de l'autorité de certification</translation>
+<translation id="6786747875388722282">Extensions</translation>
+<translation id="3944384147860595744">Imprimez où que vous soyez.</translation>
+<translation id="2570648609346224037">Un problème est survenu lors du téléchargement de l'image de récupération.</translation>
+<translation id="4306718255138772973">Cloud Print Proxy</translation>
+<translation id="9053965862400494292">Une erreur s'est produite lors de la configuration de la synchronisation.</translation>
+<translation id="8596540852772265699">Fichiers personnalisés</translation>
+<translation id="7017354871202642555">Impossible de définir le mode une fois la fenêtre créée.</translation>
+<translation id="3101709781009526431">Date et heure</translation>
+<translation id="69375245706918574">Personnaliser les préférences de synchronisation</translation>
+<translation id="833853299050699606">Aucune information disponible sur le forfait</translation>
+<translation id="1737968601308870607">Signaler un problème</translation>
+<translation id="4571852245489094179">Importer mes favoris et paramètres</translation>
+<translation id="99648783926443049">Sélectionnez le <ph name="BEGIN_BOLD"/>menu clé à molette &gt; Paramètres &gt; Options avancées &gt; Modifier les paramètres du proxy<ph name="END_BOLD"/> et vérifiez que vos paramètres sont définis sur &quot;sans proxy&quot; ou &quot;direct&quot;.</translation>
+<translation id="4421917670248123270">Fermer et annuler les téléchargements</translation>
+<translation id="5605623530403479164">Autres moteurs de recherche</translation>
+<translation id="8887243200615092733"><ph name="PRODUCT_NAME"/> peut maintenant synchroniser vos mots de passe. Pour protéger vos données, vous devez confirmer les informations relatives à votre compte.</translation>
+<translation id="4740663705480958372">Cette fonctionnalité active les API P2P Pepper et P2P JavaScript. L'API est en cours de développement et n'est pas encore opérationnelle.</translation>
+<translation id="5710435578057952990">L'identité de ce site Web n'a pas été vérifiée.</translation>
+<translation id="1421046588786494306">Sessions à l'étranger</translation>
+<translation id="1661245713600520330">Cette page répertorie tous les modules chargés dans le processus principal et les modules enregistrés de manière à être chargés ultérieurement.</translation>
+<translation id="5451646087589576080">Afficher les &amp;infos sur le cadre</translation>
+<translation id="3368922792935385530">Connecté</translation>
+<translation id="3498309188699715599">Paramètres d'entrée en Chewing</translation>
+<translation id="8486154204771389705">Conserver sur cette page</translation>
+<translation id="3866443872548686097">Votre support de récupération est prêt. Vous pouvez le retirer du système.</translation>
+<translation id="6824564591481349393">Copi&amp;er l'adresse e-mail</translation>
+<translation id="907148966137935206">Interdire à tous les sites d'afficher des fenêtres pop-up (recommandé)</translation>
+<translation id="5184063094292164363">Console &amp;JavaScript</translation>
+<translation id="333371639341676808">Empêcher cette page de générer des boîtes de dialogue supplémentaires</translation>
+<translation id="7632380866023782514">En haut à droite</translation>
+<translation id="4925520021222027859">Entrez le mot de passe associé à votre application :</translation>
+<translation id="3494768541638400973">Mode de saisie Google du japonais (pour clavier japonais)</translation>
+<translation id="5844183150118566785"><ph name="PRODUCT_NAME"/> est à jour (<ph name="VERSION"/>)</translation>
+<translation id="3118046075435288765">Le serveur a mis fin à la connexion de manière inattendue.</translation>
+<translation id="8041140688818013446">Il est possible que le serveur hébergeant la page Web soit surchargé ou ait rencontré une erreur. Pour éviter de générer
+        trop de trafic et d'aggraver la situation,
+        <ph name="PRODUCT_NAME"/> a temporairement
+        bloqué l'acceptation des requêtes adressées au serveur.
+        <ph name="LINE_BREAK"/>
+        Si vous pensez que ce comportement n'est pas souhaitable, (par exemple, dans le cas où vous déboguez votre propre site Web), vous pouvez
+        consulter la page <ph name="NET_INTERNALS_PAGE"/>,
+        sur laquelle vous pourrez trouver plus d'informations ou désactiver cette fonctionnalité.</translation>
+<translation id="1725068750138367834">Gestionnaire de &amp;fichiers</translation>
+<translation id="4254921211241441775">Arrêter la synchronisation du compte</translation>
+<translation id="7791543448312431591">Ajouter</translation>
+<translation id="8569764466147087991">Sélectionnez le fichier à ouvrir</translation>
+<translation id="5449451542704866098">Aucun forfait de données</translation>
+<translation id="307505906468538196">Créer un compte Google</translation>
+<translation id="2053553514270667976">Code postal</translation>
+<translation id="48838266408104654">&amp;Gestionnaire de tâches</translation>
+<translation id="4378154925671717803">Téléphone</translation>
+<translation id="3694027410380121301">Sélectionner l'onglet précédent</translation>
+<translation id="6178664161104547336">Sélectionner un certificat</translation>
+<translation id="1375321115329958930">Mots de passe enregistrés</translation>
+<translation id="3341703758641437857">Autoriser l'accès aux URL de fichier</translation>
+<translation id="5702898740348134351">Modifi&amp;er les moteurs de recherche...</translation>
+<translation id="734303607351427494">Gérer les moteurs de recherche...</translation>
+<translation id="8326478304147373412">PKCS #7, chaîne de certificats</translation>
+<translation id="3242765319725186192">Clé pré-partagée :</translation>
+<translation id="8089798106823170468">Contrôlez et partagez l'accès à vos imprimantes depuis n'importe quel compte Google.</translation>
+<translation id="5984992849064510607">Ajoute l'option &quot;Utiliser les onglets latéraux&quot; au menu contextuel de la barre d'onglets. Utilisez cette option pour déplacer les onglets du haut de l'écran (affichage par défaut) vers le côté. Particulièrement utile sur les grands écrans.</translation>
+<translation id="839736845446313156">S'inscrire</translation>
+<translation id="4668929960204016307">,</translation>
+<translation id="2409527877874991071">Saisissez un nouveau nom.</translation>
+<translation id="4240069395079660403"><ph name="PRODUCT_NAME"/> ne peut pas être affiché dans cette langue.</translation>
+<translation id="747114903913869239">Erreur : impossible de décoder l'extension.</translation>
+<translation id="5412637665001827670">Clavier bulgare</translation>
+<translation id="2113921862428609753">Accès aux informations de l'autorité</translation>
+<translation id="5227536357203429560">Ajouter un réseau privé...</translation>
+<translation id="732677191631732447">C&amp;opier l'URL du fichier audio</translation>
+<translation id="7224023051066864079">Masque de sous-réseau :</translation>
+<translation id="2401813394437822086">Impossible d'accéder à votre compte ?</translation>
+<translation id="2344262275956902282">Utiliser les touches - et = pour paginer une liste d'entrées</translation>
+<translation id="3609138628363401169">Le serveur ne prend pas en charge l'extension de renégociation TLS.</translation>
+<translation id="3369624026883419694">Résolution de l'hôte...</translation>
+<translation id="8870413625673593573">Récemment fermés</translation>
+<translation id="9145357542626308749">Le certificat de sécurité du site a été signé avec un algorithme de signature faible.</translation>
+<translation id="8502803898357295528">Votre mot de passe a été modifié</translation>
+<translation id="4064488613268730704">Gérer les paramètres de saisie automatique...</translation>
+<translation id="6830600606572693159">La page Web <ph name="URL"/> n'est pas disponible pour le moment. Cela peut être dû à une surcharge ou à une opération de maintenance.</translation>
+<translation id="4145797339181155891">Éjecter</translation>
+<translation id="7886793013438592140">Impossible de lancer le processus de service.</translation>
+<translation id="8417944620073548444"><ph name="MEGABYTES"/> Mo restants</translation>
+<translation id="7339898014177206373">Nouvelle fenêtre</translation>
+<translation id="3026202950002788510">Sélectionnez
+          <ph name="BEGIN_BOLD"/>
+          Applications &gt; Préférences système &gt; Réseau &gt; Avancé &gt; Proxys
+          <ph name="END_BOLD"/>
+          et désélectionnez les serveurs proxy sélectionnés.</translation>
+<translation id="7033648024564583278">Gravure en cours d'initialisation...</translation>
+<translation id="2246340272688122454">Téléchargement de l'image de récupération...</translation>
+<translation id="7770995925463083016">il y a <ph name="NUMBER_TWO"/> minutes</translation>
+<translation id="2816269189405906839">Mode de saisie du chinois (cangjie)</translation>
+<translation id="7087282848513945231">Comté</translation>
+<translation id="2149951639139208969">Ouvrir l'adresse dans un nouvel onglet</translation>
+<translation id="175196451752279553">&amp;Rouvrir l'onglet fermé</translation>
+<translation id="5992618901488170220">Impossible d'afficher la page Web, car votre ordinateur est passé en mode
+        veille ou hibernation. Dans ce cas, les connexions réseau sont
+        coupées et les requêtes réseau échouent. L'actualisation de la page
+        devrait permettre de résoudre ce problème.</translation>
+<translation id="2655386581175833247">Certificat utilisateur :</translation>
+<translation id="5039804452771397117">Autoriser</translation>
+<translation id="5435964418642993308">Appuyer sur Entrée pour revenir en arrière et sur la touche de menu contextuel pour afficher l'historique</translation>
+<translation id="81686154743329117">ZRM</translation>
+<translation id="7564146504836211400">Cookies et autres données</translation>
+<translation id="2266011376676382776">Page(s) ne répondant pas</translation>
+<translation id="2714313179822741882">Paramètres d'entrée hangûl</translation>
+<translation id="8658163650946386262">Configurer la synchronisation...</translation>
+<translation id="3100609564180505575">Modules (<ph name="TOTAL_COUNT"/>). Conflits connus : <ph name="BAD_COUNT"/>, conflits probables : <ph name="SUSPICIOUS_COUNT"/></translation>
+<translation id="3627671146180677314">Date de renouvellement du certificat Netscape</translation>
+<translation id="1319824869167805246">Ouvrir tous les favoris dans une nouvelle fenêtre</translation>
+<translation id="8652487083013326477">bouton radio concernant l'étendue de pages</translation>
+<translation id="5204967432542742771">Saisissez votre mot de passe</translation>
+<translation id="4388712255200933062"><ph name="CLOUD_PRINT_NAME"/> est conçu pour rendre l'impression plus intuitive, accessible et utile. <ph name="CLOUD_PRINT_NAME"/> vous permet de rendre vos imprimantes accessibles depuis n'importe quelle application Web ou mobile associée à <ph name="CLOUD_PRINT_NAME"/>.</translation>
+<translation id="2932611376188126394">Dictionnaire de kanji unique</translation>
+<translation id="5485754497697573575">Rétablir tous les onglets</translation>
+<translation id="3371861036502301517">Échec de l'installation de l'extension</translation>
+<translation id="644038709730536388">En savoir plus sur la manière de se protéger des logiciels malveillants en ligne</translation>
+<translation id="2155931291251286316">Toujours afficher les fenêtres pop-up de <ph name="HOST"/></translation>
+<translation id="3445830502289589282">Authentification phase 2 :</translation>
+<translation id="5650551054760837876">Aucun résultat de recherche trouvé</translation>
+<translation id="5494362494988149300">Ouvrir une fois le téléchargement &amp;terminé</translation>
+<translation id="2956763290572484660"><ph name="COOKIES"/> cookies</translation>
+<translation id="6989836856146457314">Mode de saisie du japonais (pour clavier américain)</translation>
+<translation id="9187787570099877815">Continuer à bloquer les plug-ins</translation>
+<translation id="8425492902634685834">Épingler sur la barre des tâches</translation>
+<translation id="825608351287166772">Les certificats ont une période de validité, comme tous les documents relatifs à votre identité (tel qu'un passeport). Le certificat présenté à votre navigateur n'est pas encore valide ! Lorsqu'un certificat est en dehors de sa période de validité, il n'est pas nécessaire d'assurer la maintenance de certaines informations relatives à son état (s'il a été révoqué ou s'il n'est plus approuvé). Par conséquent, il est impossible de vérifier que le certificat est fiable. Ne poursuivez pas.</translation>
+<translation id="741630086309232721">Fermer la session d'invité</translation>
+<translation id="7309459761865060639">Contrôlez vos tâches d'impression et l'état de connexion de vos imprimantes en ligne.</translation>
+<translation id="4803909571878637176">Désinstallation</translation>
+<translation id="5209518306177824490">Empreinte SHA-1</translation>
+<translation id="3300768886937313568">Modifier le code PIN de la carte SIM</translation>
+<translation id="7447657194129453603">État du réseau :</translation>
+<translation id="1553538517812678578">sans limite</translation>
+<translation id="7947315300197525319">(Choisir une autre capture d'écran)</translation>
+<translation id="3612070600336666959">Désactivation</translation>
+<translation id="3759461132968374835">Aucune erreur n'a été signalée récemment. Les erreurs n'apparaissent ici que lorsque l'envoi de rapports d'erreur est activé.</translation>
+<translation id="1516602185768225813">Rouvrir les dernières pages ouvertes</translation>
+<translation id="189210018541388520">Ouvrir en mode plein écran</translation>
+<translation id="8795668016723474529">Ajouter une carte de paiement</translation>
+<translation id="5860033963881614850">Désactivé</translation>
+<translation id="3956882961292411849">Chargement des informations sur votre forfait Internet mobile, veuillez patienter...</translation>
+<translation id="689050928053557380">Acheter un forfait de données...</translation>
+<translation id="4235618124995926194">Inclure cet e-mail :</translation>
+<translation id="4874539263382920044">Le titre doit comporter au moins un caractère.</translation>
+<translation id="798525203920325731">Espaces de noms réseau</translation>
+<translation id="263325223718984101"><ph name="PRODUCT_NAME"/> n'a pas pu terminer l'installation, mais va poursuivre son exécution à partir de son image disque.</translation>
+<translation id="7025190659207909717">Gestion des services Internet mobiles</translation>
+<translation id="8265096285667890932">Utiliser les onglets latéraux</translation>
+<translation id="4250680216510889253">Non</translation>
+<translation id="3949593566929137881">Saisir le code PIN de la carte SIM</translation>
+<translation id="6291953229176937411">&amp;Afficher dans le Finder</translation>
+<translation id="2476990193835943955">Maintenez la touche Ctrl, Alt ou Maj enfoncée&lt;br&gt;pour afficher le raccourci clavier qui lui est associé.</translation>
+<translation id="9187827965378254003">Vraiment désolé, aucun prototype n'est disponible pour le moment.</translation>
+<translation id="8933960630081805351">&amp;Afficher dans le Finder</translation>
+<translation id="3041612393474885105">Informations relatives au certificat</translation>
+<translation id="7378810950367401542">/</translation>
+<translation id="4611079913162790275">La synchronisation des mots de passe requiert votre attention.</translation>
+<translation id="6562758426028728553">Veuillez saisir l'ancien et le nouveau code PIN.</translation>
+<translation id="614161640521680948">Langue :</translation>
+<translation id="3665650519256633768">Résultats de recherche</translation>
+<translation id="3733127536501031542">Serveur SSL avec fonction d'optimisation</translation>
+<translation id="3614837889828516995">Enregistrer en PDF</translation>
+<translation id="5745056705311424885">Mémoire USB détectée</translation>
+<translation id="5895875028328858187">M'avertir lorsque le flux de données est faible ou presque inexistant</translation>
+<translation id="939598580284253335">Saisir le mot de passe multiterme</translation>
+<translation id="7917972308273378936">Clavier lituanien</translation>
+<translation id="8371806639176876412">Les éléments saisis dans le champ polyvalent peuvent être enregistrés.</translation>
+<translation id="4216499942524365685">Les informations de connexion à votre compte sont obsolètes. Cliquez ici pour saisir à nouveau votre mot de passe.</translation>
+<translation id="8899388739470541164">Vietnamien</translation>
+<translation id="4091434297613116013">feuilles de papier</translation>
+<translation id="7475671414023905704">URL de mot de passe perdu Netscape</translation>
+<translation id="3335947283844343239">Rouvrir l'onglet fermé</translation>
+<translation id="4089663545127310568">Effacer les mots de passe enregistrés</translation>
+<translation id="6500444002471948304">Créer un nouveau dossier...</translation>
+<translation id="2480626392695177423">Basculer en mode ponctuation pleine chasse ou demi-chasse</translation>
+<translation id="5830410401012830739">Gérer les paramètres de localisation...</translation>
+<translation id="8977410484919641907">Synchronisé...</translation>
+<translation id="2794293857160098038">Options de recherche par défaut</translation>
+<translation id="3947376313153737208">Aucune sélection</translation>
+<translation id="1346104802985271895">Mode de saisie du vietnamien (TELEX)</translation>
+<translation id="5935630983280450497"><ph name="NUMBER_ONE"/> minute restante</translation>
+<translation id="5889282057229379085">Le nombre maximal d'autorités de certification intermédiaires a été dépassé : <ph name="NUM_INTERMEDIATE_CA"/></translation>
+<translation id="3180365125572747493">Saisissez un mot de passe pour chiffrer ce fichier de certificat.</translation>
+<translation id="5496587651328244253">Organiser</translation>
+<translation id="4821086771593057290">Votre mot de passe a changé. Veuillez réessayer avec votre nouveau mot de passe.</translation>
+<translation id="7075513071073410194">PKCS #1 MD5 avec chiffrement RSA</translation>
+<translation id="4378727699507047138">Utiliser le thème classique</translation>
+<translation id="7124398136655728606">Échap efface toute la mémoire tampon de pré-édition</translation>
+<translation id="8293206222192510085">Ajouter aux favoris</translation>
+<translation id="2592884116796016067">Un incident est survenu sur une partie de cette page (HTML WebWorker). Elle risque de ne pas fonctionner correctement.</translation>
+<translation id="2529133382850673012">Clavier américain</translation>
+<translation id="4411578466613447185">Signataire de code</translation>
+<translation id="1354868058853714482">Adobe Reader n'est pas à jour et risque de ne plus être sécurisé.</translation>
+<translation id="6252594924928912846">Personnaliser les paramètres de synchronisation...</translation>
+<translation id="8425755597197517046">Co&amp;ller et rechercher</translation>
+<translation id="1093148655619282731">Détails du certificat sélectionné :</translation>
+<translation id="5568069709869097550">Impossible de se connecter</translation>
+<translation id="2743322561779022895">Activation :</translation>
+<translation id="4181898366589410653">Système de révocation introuvable dans le certificat du serveur</translation>
+<translation id="8705331520020532516">Numéro de série</translation>
+<translation id="1665770420914915777">Afficher la page &quot;Nouvel onglet&quot;</translation>
+<translation id="2629089419211541119">il y a <ph name="NUMBER_ONE"/> heure</translation>
+<translation id="1691063574428301566">Votre ordinateur redémarrera une fois la mise à jour effectuée.</translation>
+<translation id="131364520783682672">Verr. maj.</translation>
+<translation id="6259308910735500867">L'accès au répertoire de l'hôte de communication à distance a été refusé. Essayez avec un autre compte.</translation>
+<translation id="3415261598051655619">Accessible aux scripts :</translation>
+<translation id="2335122562899522968">Cette page place des cookies.</translation>
+<translation id="8461914792118322307">Proxy</translation>
+<translation id="4089521618207933045">Avec sous-menu</translation>
+<translation id="1936157145127842922">Afficher dans le dossier</translation>
+<translation id="6982279413068714821">il y a <ph name="NUMBER_DEFAULT"/> minutes</translation>
+<translation id="7977590112176369853">&lt;saisir une requête&gt;</translation>
+<translation id="3449839693241009168">Appuyez sur <ph name="SEARCH_KEY"/> pour envoyer des commandes à <ph name="EXTENSION_NAME"/>.</translation>
+<translation id="7443484992065838938">Prévisualiser le rapport</translation>
+<translation id="5714678912774000384">Activer le dernier onglet</translation>
+<translation id="3799598397265899467">Lorsque je quitte le navigateur</translation>
+<translation id="2125314715136825419">Continuer sans mettre à jour Adobe Reader (non recommandé)</translation>
+<translation id="1120026268649657149">Le champ de mot clé doit être vide ou comporter un mot unique</translation>
+<translation id="542318722822983047">Déplacer le curseur automatiquement au caractère suivant</translation>
+<translation id="5317780077021120954">Enregistrer</translation>
+<translation id="9027459031423301635">Ouvrir le lien dans un nouvel ongle&amp;t</translation>
+<translation id="2251809247798634662">Nouvelle fenêtre de navigation privée</translation>
+<translation id="358344266898797651">Celtique</translation>
+<translation id="3625870480639975468">Réinitialiser le zoom</translation>
+<translation id="5199729219167945352">Prototypes</translation>
+<translation id="5055518462594137986">Mémoriser mes choix pour tous les liens de ce type</translation>
+<translation id="246059062092993255">Les plug-ins de cette page ont été bloqués.</translation>
+<translation id="2870560284913253234">Site</translation>
+<translation id="6945221475159498467">Sélectionner</translation>
+<translation id="7724603315864178912">Couper</translation>
+<translation id="4164507027399414915">Restaurer toutes les miniatures supprimées</translation>
+<translation id="917051065831856788">Utiliser les onglets latéraux</translation>
+<translation id="1976150099241323601">Se connecter au dispositif de sécurité</translation>
+<translation id="6620110761915583480">Enregistrer le fichier</translation>
+<translation id="4988526792673242964">Pages</translation>
+<translation id="7543025879977230179">Options de <ph name="PRODUCT_NAME"/></translation>
+<translation id="2175607476662778685">Barre de lancement rapide</translation>
+<translation id="6434309073475700221">Annuler</translation>
+<translation id="1367951781824006909">Choisir un fichier</translation>
+<translation id="1425127764082410430">&amp;Rechercher <ph name="SEARCH_TERMS"/> avec <ph name="SEARCH_ENGINE"/></translation>
+<translation id="684265517037058883">(pas encore valide)</translation>
+<translation id="2027538664690697700">Mettre à jour le plug-in...</translation>
+<translation id="8205333955675906842">Police Sans-Serif</translation>
+<translation id="39964277676607559">Impossible de charger le JavaScript &quot;<ph name="RELATIVE_PATH"/>&quot; du script de contenu.</translation>
+<translation id="4378551569595875038">Connexion...</translation>
+<translation id="7029809446516969842">Mots de passe</translation>
+<translation id="8053278772142718589">Fichiers PKCS #12</translation>
+<translation id="3129020372442395066">Options de saisie automatique de <ph name="PRODUCT_NAME_SHORT"/></translation>
+<translation id="4114360727879906392">Fenêtre précédente</translation>
+<translation id="8238649969398088015">Astuce</translation>
+<translation id="5958418293370246440"><ph name="SAVED_FILES"/> / <ph name="TOTAL_FILES"/> fichiers</translation>
+<translation id="2350172092385603347">Localisation utilisée, mais les paramètres régionaux par défaut (default_locale) n'ont pas été indiqués dans le manifeste. </translation>
+<translation id="8221729492052686226">Si vous n'êtes pas à l'origine de cette requête, il s'agit probablement d'une attaque contre votre système. Si vous n'avez pas lancé cette requête de manière intentionnelle, cliquez sur Ne rien faire.</translation>
+<translation id="5894314466642127212">Votre commentaire a bien été envoyé.</translation>
+<translation id="894360074127026135">Fonction d'optimisation internationale Netscape </translation>
+<translation id="6025294537656405544">Taille de police minimale</translation>
+<translation id="1201402288615127009">Suivant</translation>
+<translation id="1335588927966684346">Utilitaire :</translation>
+<translation id="7857823885309308051">Cette opération peut prendre une minute...</translation>
+<translation id="662870454757950142">Le format du mot de passe est incorrect.</translation>
+<translation id="370665806235115550">Chargement...</translation>
+<translation id="1808792122276977615">Ajouter la page...</translation>
+<translation id="2076269580855484719">Masquer ce plug-in</translation>
+<translation id="254416073296957292">&amp;Paramètres linguistiques...</translation>
+<translation id="6652975592920847366">Créer un support de récupération du système d'exploitation</translation>
+<translation id="52912272896845572">Le fichier de clé privée est incorrect.</translation>
+<translation id="3232318083971127729">Valeur :</translation>
+<translation id="8807632654848257479">Stable</translation>
+<translation id="4209092469652827314">Grande</translation>
+<translation id="4222982218026733335">Certificat serveur invalide</translation>
+<translation id="152234381334907219">Jamais enregistrés</translation>
+<translation id="5600599436595580114">Cette page a été préchargée.</translation>
+<translation id="8926468725336609312">Google Chrome ne peut pas afficher l'aperçu avant impression lorsque la visionneuse de documents PDF intégrée est désactivée. Pour l'afficher, veuillez accéder à <ph name="BEGIN_LINK"/>chrome://plugins<ph name="END_LINK"/>, activer &quot;Chrome PDF Viewer&quot; et réessayer.</translation>
+<translation id="8494214181322051417">Nouveau !</translation>
+<translation id="7762841930144642410"><ph name="BEGIN_BOLD"/>Vous êtes passé en navigation privée<ph name="END_BOLD"/>. Les pages que vous consultez dans cette fenêtre n'apparaîtront ni dans l'historique de votre navigateur, ni dans l'historique des recherches, et ne laisseront aucune trace (comme les cookies) sur votre ordinateur une fois que vous aurez fermé la fenêtre de navigation privée. Tous les fichiers téléchargés et les favoris créés seront toutefois conservés.        <ph name="LINE_BREAK"/>        <ph name="BEGIN_BOLD"/>Passer en navigation privée n'a aucun effet sur les autres utilisateurs, serveurs ou logiciels. Méfiez-vous :<ph name="END_BOLD"/>        <ph name="BEGIN_LIST"/>          <ph name="BEGIN_LIST_ITEM"/>Des sites Web qui collectent ou partagent des informations vous concernant<ph name="END_LIST_ITEM"/>          <ph name="BEGIN_LIST_ITEM"/>Des fournisseurs d'accès Internet ou des employeurs qui conservent une trace des pages que vous visitez<ph name="END_LIST_ITEM"/>          <ph name="BEGIN_LIST_ITEM"/>Des programmes indésirables qui enregistrent vos frappes en échange d'émoticônes gratuites<ph name="END_LIST_ITEM"/>          <ph name="BEGIN_LIST_ITEM"/>Des personnes qui pourraient surveiller vos activités<ph name="END_LIST_ITEM"/>          <ph name="BEGIN_LIST_ITEM"/>Des personnes qui se tiennent derrière vous<ph name="END_LIST_ITEM"/>        <ph name="END_LIST"/>        <ph name="BEGIN_LINK"/>En savoir plus sur la navigation privée<ph name="END_LINK"/></translation>
+<translation id="2386255080630008482">Le certificat du serveur a été révoqué.</translation>
+<translation id="2135787500304447609">&amp;Reprendre</translation>
+<translation id="8309505303672555187">Sélectionnez un réseau :</translation>
+<translation id="6143635259298204954">Impossible d'extraire les fichiers de l'extension. Pour effectuer cette opération en toute sécurité, vous devez disposer d'un chemin d'accès à votre répertoire de profils ne contenant pas de lien symbolique. Aucun chemin de ce type n'existe pour votre profil.</translation>
+<translation id="1813414402673211292">Effacer les données de navigation</translation>
+<translation id="4062903950301992112">Si vous êtes conscient que la visite de ce site peut être préjudiciable à votre ordinateur, vous pouvez <ph name="PROCEED_LINK"/>.</translation>
+<translation id="32330993344203779">Votre périphérique est inscrit pour bénéficier de la gestion d'entreprise.</translation>
+<translation id="2356762928523809690">Serveur de mise à jour non disponible (erreur : <ph name="ERROR_NUMBER"/>)</translation>
+<translation id="219008588003277019">Module client natif : <ph name="NEXE_NAME"/></translation>
+<translation id="5436510242972373446">Rechercher sur <ph name="SITE_NAME"/> :</translation>
+<translation id="3800764353337460026">Style de symboles</translation>
+<translation id="6719684875142564568"><ph name="NUMBER_ZERO"/> hours</translation>
+<translation id="2096368010154057602">Département</translation>
+<translation id="1036561994998035917">Continuer à utiliser <ph name="ENGINE_NAME"/></translation>
+<translation id="8730621377337864115">OK</translation>
+<translation id="665757950158579497">Essayez de désactiver les prédictions d'actions du réseau en procédant comme suit :
+        Sélectionnez le
+        <ph name="BEGIN_BOLD"/>
+        menu clé à molette &gt;
+        <ph name="SETTINGS_TITLE"/>
+        &gt;
+        <ph name="ADVANCED_TITLE"/>
+        <ph name="END_BOLD"/>
+        et désélectionnez &quot;<ph name="NO_PREFETCH_DESCRIPTION"/>&quot;.
+        Si le problème n'est pas résolu, nous vous conseillons de sélectionner de nouveau
+        cette option pour améliorer les performances.</translation>
+<translation id="4932733599132424254">Date</translation>
+<translation id="6267166720438879315">Sélectionnez un certificat pour vous authentifier sur <ph name="HOST_NAME"/>.</translation>
+<translation id="2422927186524098759">Barre latérale</translation>
+<translation id="7839809549045544450">La clé publique éphémère Diffie-Hellman associée au serveur est peu sûre.</translation>
+<translation id="5515806255487262353">Rechercher dans Dictionnaire</translation>
+<translation id="350048665517711141">Sélectionnez un moteur de recherche</translation>
+<translation id="2790805296069989825">Clavier russe</translation>
+<translation id="5708171344853220004">Nom Microsoft principal</translation>
+<translation id="5464696796438641524">Clavier polonais</translation>
+<translation id="2080010875307505892">Clavier serbe</translation>
+<translation id="2953767478223974804"><ph name="NUMBER_ONE"/> minute</translation>
+<translation id="201192063813189384">Erreur lors de la lecture des données du cache.</translation>
+<translation id="7851768487828137624">Canary</translation>
+<translation id="6129938384427316298">Commentaire du certificat Netscape</translation>
+<translation id="8210608804940886430">Page suivante</translation>
+<translation id="9065596142905430007"><ph name="PRODUCT_NAME"/> est à jour.</translation>
+<translation id="1035650339541835006">Paramètres de saisie automatique...</translation>
+<translation id="6315493146179903667">Tout ramener au premier plan</translation>
+<translation id="1000498691615767391">Sélectionner le dossier à ouvrir</translation>
+<translation id="3593152357631900254">Activer le mode Pinyin fuzzy</translation>
+<translation id="5015344424288992913">Résolution du proxy...</translation>
+<translation id="8506299468868975633">Le téléchargement de l'image a été interrompu.</translation>
+<translation id="4724168406730866204">Eten 26</translation>
+<translation id="308268297242056490">URI</translation>
+<translation id="4479812471636796472">Clavier Dvorak américain</translation>
+<translation id="8673026256276578048">Rechercher sur le Web...</translation>
+<translation id="1437307674059038925">Si vous utilisez un serveur proxy, vérifiez les paramètres associés ou demandez à votre administrateur réseau
+         si ce serveur fonctionne.</translation>
+<translation id="149347756975725155">Impossible de charger l'icône de l'extension &quot;<ph name="ICON"/>&quot;.</translation>
+<translation id="3675321783533846350">Définir un proxy pour se connecter au réseau</translation>
+<translation id="5451285724299252438">zone de texte concernant l'étendue de pages</translation>
+<translation id="5669267381087807207">Activation</translation>
+<translation id="7434823369735508263">Clavier Dvorak britannique</translation>
+<translation id="1572103024875503863"><ph name="NUMBER_MANY"/> jours</translation>
+<translation id="2084978867795361905">MS-IME</translation>
+<translation id="7227669995306390694">Aucun forfait de données <ph name="NETWORK"/></translation>
+<translation id="3481915276125965083">Les fenêtres pop-up suivantes ont été bloquées sur cette page :</translation>
+<translation id="7163503212501929773"><ph name="NUMBER_MANY"/> heures restantes</translation>
+<translation id="7705276765467986571">Impossible de charger le modèle du favori.</translation>
+<translation id="1196338895211115272">Échec d'exportation de la clé privée</translation>
+<translation id="5586329397967040209">Utiliser comme page d'accueil</translation>
+<translation id="629730747756840877">Compte</translation>
+<translation id="8525306231823319788">Plein écran</translation>
+<translation id="9054208318010838">Autoriser tous les sites à suivre ma position géographique</translation>
+<translation id="3058212636943679650">Si la restauration du système d'exploitation de votre ordinateur s'avère nécessaire, une carte SD ou une clé USB de récupération vous sera demandée.</translation>
+<translation id="2815382244540487333">Les cookies suivants ont été bloqués :</translation>
+<translation id="8882395288517865445">Inclure les adresses de ma fiche de Carnet d’adresses</translation>
+<translation id="374530189620960299">Le certificat de sécurité du site n'est pas approuvé !</translation>
+<translation id="8852407435047342287">Votre liste d'applications, d'extensions et de thèmes installés</translation>
+<translation id="5647283451836752568">Exécuter tous les plug-ins de cette page</translation>
+<translation id="8642947597466641025">Augmente la taille du texte</translation>
+<translation id="5188181431048702787">Accepter et continuer »</translation>
+<translation id="1293556467332435079">Fichiers
+</translation>
+<translation id="2490270303663597841">Appliquer uniquement à cette session de navigation privée</translation>
+<translation id="1757915090001272240">Latin large</translation>
+<translation id="8496717697661868878">Exécuter ce plug-in</translation>
+<translation id="3450660100078934250">MasterCard</translation>
+<translation id="2916073183900451334">Sur le Web, Tab permet de sélectionner les liens, ainsi que les champs de formulaire.</translation>
+<translation id="7772127298218883077">À propos de <ph name="PRODUCT_NAME"/></translation>
+<translation id="2090876986345970080">Paramètres de sécurité du système</translation>
+<translation id="9219103736887031265">Images</translation>
+<translation id="5453632173748266363">Cyrillique</translation>
+<translation id="1008557486741366299">Pas maintenant</translation>
+<translation id="8415351664471761088">Attendre la fin du téléchargement</translation>
+<translation id="1545775234664667895">Thème &quot;<ph name="THEME_NAME"/>&quot; installé</translation>
+<translation id="5329858601952122676">&amp;Supprimer</translation>
+<translation id="6100736666660498114">Menu Démarrer</translation>
+<translation id="3994878504415702912">&amp;Zoom</translation>
+<translation id="9009369504041480176">Transfert en cours (<ph name="PROGRESS_PERCENT"/> %)...</translation>
+<translation id="8995603266996330174">Géré par <ph name="DOMAIN"/></translation>
+<translation id="5602600725402519729">&amp;Rafraîchir</translation>
+<translation id="172612876728038702">Configuration du module de plate-forme sécurisée (TPM) en cours. Veuillez patienter, cela peut prendre quelques minutes.</translation>
+<translation id="1362165759943288856">Vous avez acheté une quantité illimitée de données le <ph name="DATE"/>.</translation>
+<translation id="2078019350989722914">Confirmer avant de quitter (<ph name="KEY_EQUIVALENT"/>)</translation>
+<translation id="7965010376480416255">Mémoire partagée</translation>
+<translation id="6248988683584659830">Rech. dans les paramètres</translation>
+<translation id="8323232699731382745">mot de passe d'accès au réseau</translation>
+<translation id="6588399906604251380">Activer la vérification orthographique</translation>
+<translation id="7167621057293532233">Types de données</translation>
+<translation id="7053983685419859001">Bloquer</translation>
+<translation id="2485056306054380289">Certificat de l'autorité de certification du serveur :</translation>
+<translation id="6462109140674788769">Clavier grec</translation>
+<translation id="2727712005121231835">Taille réelle</translation>
+<translation id="8887733174653581061">Toujours en haut</translation>
+<translation id="5581211282705227543">Aucun plug-in installé.</translation>
+<translation id="610886263749567451">Alerte JavaScript</translation>
+<translation id="5488468185303821006">Autoriser en mode navigation privée</translation>
+<translation id="6556866813142980365">Rétablir</translation>
+<translation id="2107287771748948380"><ph name="OBFUSCATED_CC_NUMBER"/>, expire le : <ph name="CC_EXPIRATION_DATE"/></translation>
+<translation id="6584811624537923135">Confirmer la désinstallation</translation>
+<translation id="7429235532957570505">Impossible de désactiver les plug-ins ayant été activés par une stratégie d'entreprise.</translation>
+<translation id="7866522434127619318">Cette fonctionnalité active l'option &quot;Lire en un clic&quot; dans les paramètres de contenu du plug-in.</translation>
+<translation id="8860923508273563464">Attendre la fin des téléchargements</translation>
+<translation id="6406506848690869874">Synchronisation</translation>
+<translation id="5288678174502918605">&amp;Rouvrir l'onglet fermé</translation>
+<translation id="7238461040709361198">Votre mot de passe de compte Google a changé depuis votre dernière connexion à partir de cet ordinateur.</translation>
+<translation id="1956050014111002555">Le fichier contenait plusieurs certificats, aucun d'eux n'a été importé :</translation>
+<translation id="302620147503052030">Afficher le bouton</translation>
+<translation id="5512074755152723588">La saisie dans le champ polyvalent d'une URL déjà ouverte dans un autre onglet entraîne l'affichage de l'onglet en question, et non l'affichage de l'URL dans l'onglet actuel.</translation>
+<translation id="9157595877708044936">Configuration en cours...</translation>
+<translation id="4475552974751346499">Rechercher dans les téléchargements</translation>
+<translation id="3021256392995617989">Me demander lorsqu'un site tente de suivre ma position géographique (recommandé)</translation>
+<translation id="5185386675596372454">La nouvelle version de &quot;<ph name="EXTENSION_NAME"/>&quot; a été désactivée, car elle nécessite davantage d'autorisations.</translation>
+<translation id="4285669636069255873">Clavier phonétique russe</translation>
+<translation id="4148925816941278100">American Express</translation>
+<translation id="2320435940785160168">Ce serveur exige un certificat d'authentification et n'a pas accepté celui envoyé par le navigateur. 
+Votre certificat a peut-être expiré ou le serveur n'a pas approuvé l'émetteur. 
+Réessayez avec un autre certificat si vous en avez un. 
+Sinon, vous devrez en obtenir un nouveau d'un autre émetteur.</translation>
+<translation id="6295228342562451544">Lorsque vous vous connectez à un site Web sécurisé, le serveur hébergeant ce site présente à votre navigateur un &quot;certificat&quot; afin de vérifier l'identité du site. Ce certificat contient des informations d'identité, telles que l'adresse du site Web, laquelle est vérifiée par un tiers approuvé par votre ordinateur. En vérifiant que l'adresse du certificat correspond à l'adresse du site Web, il est possible de s'assurer que vous êtes connecté de façon sécurisée avec le site Web souhaité et non pas avec un tiers (tel qu'un pirate informatique sur votre réseau).</translation>
+<translation id="6342069812937806050">À l'instant</translation>
+<translation id="5605716740717446121">Votre carte SIM sera définitivement désactivée si vous ne saisissez pas correctement la clé de déverrouillage du code PIN. Nombre de tentatives restantes : <ph name="TRIES_COUNT"/></translation>
+<translation id="8836712291807476944"><ph name="SAVED_BYTES"/> / <ph name="TOTAL_BYTES"/> octets, Interrompu</translation>
+<translation id="5502500733115278303">Importés depuis Firefox</translation>
+<translation id="569109051430110155">Détection automatique</translation>
+<translation id="4408599188496843485">&amp;Aide</translation>
+<translation id="5399158067281117682">Les codes PIN sont différents !</translation>
+<translation id="8494234776635784157">Contenu Web</translation>
+<translation id="2681441671465314329">Vider le cache</translation>
+<translation id="3646789916214779970">Rétablir le thème par défaut</translation>
+<translation id="1592960452683145077">Le service de communication à distance a démarré correctement. Vous devriez maintenant pouvoir vous connecter à distance à cet ordinateur.</translation>
+<translation id="1679068421605151609">Outils de développement</translation>
+<translation id="6648524591329069940">Police Serif</translation>
+<translation id="6896758677409633944">Copier</translation>
+<translation id="5260508466980570042">Adresse e-mail ou mot de passe incorrect. Veuillez réessayer.</translation>
+<translation id="7887998671651498201">Le plug-in suivant ne répond pas : souhaitez-vous interrompre <ph name="PLUGIN_NAME"/> ?</translation>
+<translation id="173188813625889224">Sens</translation>
+<translation id="8088823334188264070"><ph name="NUMBER_MANY"/> secondes</translation>
+<translation id="1337036551624197047">Clavier tchèque</translation>
+<translation id="4212108296677106246">Voulez-vous que &quot;<ph name="CERTIFICATE_NAME"/>&quot; soit considérée comme une autorité de certification fiable ?</translation>
+<translation id="2861941300086904918">Gestionnaire de sécurité natif du client</translation>
+<translation id="6991443949605114807">&lt;p&gt;Lorsque vous exécutez <ph name="PRODUCT_NAME"/> dans un environnement de bureau pris en charge, les paramètres proxy du système sont utilisés. Toutefois, soit votre système n'est pas pris en charge, soit un problème est survenu lors du lancement de votre configuration système.&lt;/p&gt;
+
+        &lt;p&gt;Vous avez toujours la possibilité d'effectuer la configuration via la ligne de commande. Pour plus d'informations sur les indicateurs et les variables d'environnement, veuillez vous reporter à &lt;code&gt;man <ph name="PRODUCT_BINARY_NAME"/>&lt;/code&gt;.&lt;/p&gt;</translation>
+<translation id="9071590393348537582">La page Web à l'adresse <ph name="URL"/> a déclenché trop de redirections. Pour résoudre le problème, effacez les cookies de ce site ou autorisez les cookies tiers. Si le problème persiste, il peut être dû à une mauvaise configuration du serveur et n'être aucunement lié à votre ordinateur.</translation>
+<translation id="7205869271332034173">SSID :</translation>
+<translation id="7084579131203911145">Nom du forfait :</translation>
+<translation id="5815645614496570556">Adresse X.400</translation>
+<translation id="3551320343578183772">Fermer l'onglet</translation>
+<translation id="3345886924813989455">Impossible de trouver un navigateur pris en charge.</translation>
+<translation id="74354239584446316">Le compte associé à la boutique en ligne est le suivant : <ph name="EMAIL_ADDRESS"/>. L'utilisation d'un autre compte pour la synchronisation provoque des erreurs.</translation>
+<translation id="3712897371525859903">Enregistrer la p&amp;age sous...</translation>
+<translation id="7926251226597967072"><ph name="PRODUCT_NAME"/> importe actuellement les éléments suivants à partir de <ph name="IMPORT_BROWSER_NAME"/> :</translation>
+<translation id="2767649238005085901">Appuyez sur Entrée pour avancer et sur la touche de menu contextuel pour afficher l'historique</translation>
+<translation id="8580634710208701824">Actualiser le cadre</translation>
+<translation id="1018656279737460067">Annulé</translation>
+<translation id="7606992457248886637">Autorités</translation>
+<translation id="707392107419594760">Sélectionnez votre clavier :</translation>
+<translation id="2007404777272201486">Signaler un problème...</translation>
+<translation id="2390045462562521613">Ignorer ce réseau</translation>
+<translation id="3348038390189153836">Nouveau matériel détecté</translation>
+<translation id="1666788816626221136">Vous disposez de certificats qui n'appartiennent à aucune autre catégorie :</translation>
+<translation id="4821935166599369261">&amp;Profilage activé</translation>
+<translation id="1603914832182249871">(Navigation privée)</translation>
+<translation id="7910768399700579500">&amp;Nouveau dossier</translation>
+<translation id="7472639616520044048">Types MIME :</translation>
+<translation id="2307164895203900614">Afficher les pages en arrière-plan (<ph name="NUM_BACKGROUND_APPS"/>)</translation>
+<translation id="3192947282887913208">Fichiers audio</translation>
+<translation id="6295535972717341389">Plug-ins</translation>
+<translation id="8116190140324504026">Plus d'informations...</translation>
+<translation id="7469894403370665791">Se connecter automatiquement à ce réseau</translation>
+<translation id="4807098396393229769">Titulaire de la carte</translation>
+<translation id="4094130554533891764">Elle peut désormais accéder à :</translation>
+<translation id="4131410914670010031">Noir et blanc</translation>
+<translation id="3800503346337426623">Ignorer la connexion et naviguer en tant qu'invité</translation>
+<translation id="2615413226240911668">Toutefois, cette page inclut d'autres ressources qui ne sont pas sécurisées. Ces ressources peuvent être consultées par des tiers pendant leur transfert, et modifiées par un pirate informatique dans le but de changer l'aspect et le comportement de cette page.</translation>
+<translation id="5880867612172997051">Accès réseau interrompu</translation>
+<translation id="7842346819602959665">La dernière version de l'extension &quot;<ph name="EXTENSION_NAME"/>&quot; requiert d'autres permissions. Elle a donc été désactivée.</translation>
+<translation id="3776667127601582921">Dans ce cas, le certificat du serveur ou un certificat d'autorité intermédiaire présenté à votre navigateur n'est pas valide. Cela peut signifier que le certificat est incorrect, qu'il contient des champs non valides ou qu'il n'est pas compatible.</translation>
+<translation id="2412835451908901523">Veuillez saisir la clé de déverrouillage du code PIN à 8 chiffres fournie par <ph name="CARRIER_ID"/>.</translation>
+<translation id="6979448128170032817">Exceptions...</translation>
+<translation id="7584802760054545466">Connexion à <ph name="NETWORK_ID"/></translation>
+<translation id="208047771235602537">Voulez-vous vraiment quitter <ph name="PRODUCT_NAME"/> alors qu'un téléchargement est en cours ?</translation>
+<translation id="4060383410180771901">Le site Web ne parvient pas à gérer la demande associée à <ph name="URL"/>.</translation>
+<translation id="6710213216561001401">Précédent</translation>
+<translation id="1108600514891325577">&amp;Arrêter</translation>
+<translation id="6035087343161522833">Lorsque l'option permettant de bloquer l'enregistrement des cookies tiers est activée, la lecture de ces cookies est également bloquée.</translation>
+<translation id="8619892228487928601"><ph name="CERTIFICATE_NAME"/> : <ph name="ERROR"/></translation>
+<translation id="1567993339577891801">Console JavaScript</translation>
+<translation id="1548132948283577726">Les sites pour lesquels vos mots de passe ne seront jamais enregistrés s'afficheront ici.</translation>
+<translation id="583281660410589416">Inconnu</translation>
+<translation id="3774278775728862009">Mode de saisie du thaï (clavier TIS-820.2538)</translation>
+<translation id="9115675100829699941">&amp;Favoris</translation>
+<translation id="2485422356828889247">Désinstaller</translation>
+<translation id="2621889926470140926">Voulez-vous vraiment quitter <ph name="PRODUCT_NAME"/> alors que <ph name="DOWNLOAD_COUNT"/> téléchargements sont en cours ?</translation>
+<translation id="7279701417129455881">Configurer le blocage des cookies...</translation>
+<translation id="1166359541137214543">ABC</translation>
+<translation id="5412713837047574330">L'application hébergée par <ph name="HOST_NAME"/> est inaccessible, car vous êtes déconnecté du réseau. Cette page s'affichera dès que la connexion réseau sera rétablie. &lt;br&gt;</translation>
+<translation id="5528368756083817449">Gestionnaire de favoris</translation>
+<translation id="7275974018215686543"><ph name="NUMBER_MANY"/> secs ago</translation>
+<translation id="215753907730220065">Quitter le mode plein écran</translation>
+<translation id="7849264908733290972">Ouvrir l'&amp;image dans un nouvel onglet</translation>
+<translation id="1560991001553749272">Favori ajouté !</translation>
+<translation id="3966072572894326936">Choisir un autre dossier...</translation>
+<translation id="8766796754185931010">Kotoeri</translation>
+<translation id="7781829728241885113">Hier</translation>
+<translation id="2762402405578816341">Synchroniser automatiquement les éléments suivants :</translation>
+<translation id="1623661092385839831">Votre ordinateur intègre un périphérique de sécurité TPM (module de plate-forme sécurisée) qui permet de mettre en œuvre plusieurs fonctionnalités de sécurité critiques dans Google Chrome OS.</translation>
+<translation id="3359256513598016054">Contraintes des stratégies de certificat</translation>
+<translation id="4433914671537236274">Créer un support de récupération</translation>
+<translation id="4509345063551561634">Emplacement :</translation>
+<translation id="7596288230018319236">Toutes les pages que vous consultez apparaîtront ici à moins que vous ne les ouvriez dans une fenêtre en navigation privée. Vous pouvez utiliser le bouton Rechercher de cette page pour rechercher dans toutes les pages de votre historique.</translation>
+<translation id="7434509671034404296">Options pour les développeurs</translation>
+<translation id="6447842834002726250">Cookies</translation>
+<translation id="2609371827041010694">Toujours exécuter pour ce site</translation>
+<translation id="5170568018924773124">Afficher le dossier</translation>
+<translation id="883848425547221593">Autres favoris</translation>
+<translation id="6054173164583630569">Clavier français</translation>
+<translation id="4870177177395420201"><ph name="PRODUCT_NAME"/> ne parvient pas à déterminer ou à définir le navigateur par défaut.</translation>
+<translation id="8898786835233784856">Sélectionner l'onglet suivant</translation>
+<translation id="2674170444375937751">Voulez-vous vraiment supprimer ces pages de votre historique ?</translation>
+<translation id="9111102763498581341">Déverrouiller</translation>
+<translation id="289695669188700754">ID de clé : <ph name="KEY_ID"/></translation>
+<translation id="3067198360141518313">Exécuter ce plug-in</translation>
+<translation id="8767072502252310690">Utilisateurs</translation>
+<translation id="683526731807555621">Ajouter un moteur</translation>
+<translation id="6871644448911473373">Répondeur OCSP : <ph name="LOCATION"/></translation>
+<translation id="8281886186245836920">Ignorer</translation>
+<translation id="3867944738977021751">Champs de certificat</translation>
+<translation id="2114224913786726438">Modules (<ph name="TOTAL_COUNT"/>) : aucun conflit détecté.</translation>
+<translation id="7629827748548208700">Onglet : <ph name="TAB_NAME"/></translation>
+<translation id="388442998277590542">Impossible de charger la page d'options &quot;<ph name="OPTIONS_PAGE"/>&quot;.</translation>
+<translation id="8449008133205184768">Coller en adaptant le style</translation>
+<translation id="9114223350847410618">Veuillez ajouter une autre langue avant de supprimer celle-ci.</translation>
+<translation id="4408427661507229495">nom du réseau</translation>
+<translation id="8886960478266132308"><ph name="PRODUCT_NAME"/> synchronise de manière sécurisée vos données avec votre compte Google.</translation>
+<translation id="8028993641010258682">Taille</translation>
+<translation id="5031603669928715570">Activer...</translation>
+<translation id="1383876407941801731">Recherche</translation>
+<translation id="8398877366907290961">Poursuivre quand même</translation>
+<translation id="5063180925553000800">Nouveau code PIN :</translation>
+<translation id="2496540304887968742">La capacité du périphérique doit être d'au moins 4 Go.</translation>
+<translation id="6974053822202609517">De droite à gauche</translation>
+<translation id="2370882663124746154">Activer le mode Pinyin double</translation>
+<translation id="5463856536939868464">Menu contenant des favoris masqués</translation>
+<translation id="8286227656784970313">Utiliser le dictionnaire système</translation>
+<translation id="5431084084184068621">Vous avez choisi de chiffrer les données à l'aide de votre mot de passe Google. Vous pouvez modifier vos paramètres de synchronisation à tout moment, si vous changez d'avis.</translation>
+<translation id="1493263392339817010">Personnaliser les polices...</translation>
+<translation id="5352033265844765294">Enregistrement des informations de date</translation>
+<translation id="6449085810994685586">&amp;Vérifier l'orthographe du texte de ce champ</translation>
+<translation id="3621320549246006887">Ceci est un modèle expérimental qui permet aux enregistrements DNS (utilisant le protocole de sécurité DNSSEC) d'autoriser ou de refuser des certificats HTTPS. Ce message s'affiche lorsque vous activez des fonctionnalités expérimentales via des options de ligne de commande. Vous pouvez supprimer ces options de ligne de commande pour ignorer cette erreur.</translation>
+<translation id="50960180632766478"><ph name="NUMBER_FEW"/> minutes restantes</translation>
+<translation id="3174168572213147020">Île</translation>
+<translation id="748138892655239008">Contraintes de base du certificat</translation>
+<translation id="457386861538956877">Autres...</translation>
+<translation id="8063491445163840780">Activer l'onglet 4</translation>
+<translation id="5966654788342289517">Données personnelles</translation>
+<translation id="9137013805542155359">Afficher l'original</translation>
+<translation id="4792385443586519711">Nom de la société</translation>
+<translation id="6423731501149634044">Définir Adobe Reader comme visionneuse de documents PDF par défaut ?</translation>
+<translation id="8839907368860424444">Pour gérer les extensions installées, cliquez sur Extensions dans le menu Fenêtre.</translation>
+<translation id="2461687051570989462">Accédez à vos imprimantes depuis n'importe quel ordinateur ou smartphone. <ph name="BEGIN_LINK"/>En savoir plus<ph name="END_LINK"/></translation>
+<translation id="7194430665029924274">Me &amp;le rappeler plus tard</translation>
+<translation id="5790085346892983794">Opération réussie !</translation>
+<translation id="1901769927849168791">Carte SD détectée.</translation>
+<translation id="818454486170715660"><ph name="NAME"/> - Propriétaire</translation>
+<translation id="1358032944105037487">Clavier japonais</translation>
+<translation id="8201956630388867069">WPA</translation>
+<translation id="603890000178803545">janv.^févr.^mars^avr.^mai^juin^juil.^août^sept.^oct.^nov.^déc.</translation>
+<translation id="8302838426652833913">Sélectionnez
+          <ph name="BEGIN_BOLD"/>
+          Applications &gt; Préférences système &gt; Réseau &gt; Assistant
+          <ph name="END_BOLD"/>
+          pour tester votre connexion.</translation>
+<translation id="8664389313780386848">&amp;Afficher le code source de la page</translation>
+<translation id="8970407809569722516">Micrologiciel :</translation>
+<translation id="1180549724812639004">Créer un profil</translation>
+<translation id="57646104491463491">Date de modification</translation>
+<translation id="5992752872167177798">Sandbox seccomp</translation>
+<translation id="6362853299801475928">Signale&amp;r un problème...</translation>
+<translation id="3289566588497100676">Entrée de symboles simplifiée</translation>
+<translation id="6507969014813375884">Chinois simplifié</translation>
+<translation id="7314244761674113881">Hôte SOCKS</translation>
+<translation id="5285794783728826432">Considérer ce certificat comme fiable pour identifier les sites Web.</translation>
+<translation id="4224803122026931301">Exceptions de localisation</translation>
+<translation id="749452993132003881">Hiragana</translation>
+<translation id="8226742006292257240">Le mot de passe TPM ci-dessous, généré de façon aléatoire, a été attribué à votre ordinateur :</translation>
+<translation id="8487693399751278191">Importer mes favoris maintenant...</translation>
+<translation id="7985242821674907985"><ph name="PRODUCT_NAME"/></translation>
+<translation id="7484580869648358686">Avertissement : Un problème a été détecté sur cette page.</translation>
+<translation id="2074739700630368799">Avec Google Chrome OS for business, vous pouvez connecter votre périphérique à Google Apps, ce qui vous permet de le rechercher et de le contrôler depuis le panneau de configuration de Google Apps.</translation>
+<translation id="4474155171896946103">Ajouter tous les onglets aux favoris...</translation>
+<translation id="5895187275912066135">Émis le</translation>
+<translation id="1190844492833803334">Lorsque je ferme le navigateur</translation>
+<translation id="5646376287012673985">Localisation</translation>
+<translation id="1110155001042129815">Attendre</translation>
+<translation id="2607101320794533334">Infos sur la clé publique de l'objet</translation>
+<translation id="7071586181848220801">Plug-in inconnu</translation>
+<translation id="3354601307791487577">Connexion en mode invité</translation>
+<translation id="4419409365248380979">Toujours autoriser <ph name="HOST"/> à paramétrer les cookies</translation>
+<translation id="2956070106555335453">Résumé</translation>
+<translation id="917450738466192189">Le certificat du serveur n'est pas valide.</translation>
+<translation id="2649045351178520408">Chaîne de certificats codés Base 64 ASCII</translation>
+<translation id="7424526482660971538">Choisir mon propre mot de passe multiterme</translation>
+<translation id="380271916710942399">Certificat de serveur non répertorié</translation>
+<translation id="6459488832681039634">Rechercher la sélection</translation>
+<translation id="2392369802118427583">Activer</translation>
+<translation id="9040421302519041149">L'accès à ce réseau est protégé.</translation>
+<translation id="5659593005791499971">E-mail</translation>
+<translation id="8235325155053717782">Erreur <ph name="ERROR_NUMBER"/> (<ph name="ERROR_NAME"/>) : <ph name="ERROR_TEXT"/></translation>
+<translation id="6584878029876017575">Signature permanente Microsoft</translation>
+<translation id="562901740552630300">Sélectionnez
+          <ph name="BEGIN_BOLD"/>
+          Démarrer &gt; Panneau de configuration &gt; Réseau et Internet &gt; Centre Réseau et partage &gt; Résolution des problèmes (en bas) &gt; Connexions Internet.
+          <ph name="END_BOLD"/></translation>
+<translation id="8816996941061600321">Gestionnaire de &amp;fichiers</translation>
+<translation id="2773223079752808209">Service client</translation>
+<translation id="4585473702689066695">Impossible de se connecter au réseau &quot;<ph name="NAME"/>&quot;.</translation>
+<translation id="4647175434312795566">J'accepte ces termes</translation>
+<translation id="1084824384139382525">Copier l'adr&amp;esse du lien</translation>
+<translation id="1221462285898798023">Veuillez démarrer <ph name="PRODUCT_NAME"/> en tant qu'utilisateur normal. Pour l'exécuter en tant que root, vous devez indiquer un autre répertoire de données utilisateur pour stocker les informations du profil.</translation>
+<translation id="3220586366024592812">Le processus du connecteur <ph name="CLOUD_PRINT_NAME"/> est bloqué. Voulez-vous le redémarrer ?</translation>
+<translation id="5042992464904238023">Contenu Web</translation>
+<translation id="6254503684448816922">Clé compromise</translation>
+<translation id="1181037720776840403">Supprimer</translation>
+<translation id="4006726980536015530">Si vous fermez <ph name="PRODUCT_NAME"/> maintenant, ces téléchargements seront annulés.</translation>
+<translation id="4194415033234465088">Dachen 26</translation>
+<translation id="1664712100580477121">Voulez-vous vraiment graver l'image sur le périphérique suivant :</translation>
+<translation id="6639554308659482635">Mémoire SQLite</translation>
+<translation id="8141503649579618569"><ph name="DOWNLOAD_RECEIVED"/>/<ph name="DOWNLOAD_TOTAL"/>, <ph name="TIME_LEFT"/></translation>
+<translation id="7650701856438921772"><ph name="PRODUCT_NAME"/> est affiché dans cette langue.</translation>
+<translation id="740624631517654988">Fenêtre pop-up bloquée</translation>
+<translation id="3738924763801731196"><ph name="OID"/> :</translation>
+<translation id="6550769511678490130">Ouvrir tous les favoris</translation>
+<translation id="1847961471583915783">Effacer les cookies et autres données de site et de plug-in lorsque je ferme le navigateur</translation>
+<translation id="8870318296973696995">Page d'accueil</translation>
+<translation id="6659594942844771486">Onglet</translation>
+<translation id="6575134580692778371">Non configuré</translation>
+<translation id="4624768044135598934">Opération réussie !</translation>
+<translation id="6014776969142880350">Relancez <ph name="PRODUCT_NAME"/> pour terminer la mise à jour.</translation>
+<translation id="5582768900447355629">Chiffrer toutes mes données</translation>
+<translation id="6122365914076864562">Veuillez patienter pendant que nous configurons votre réseau pour mobile.</translation>
+<translation id="1974043046396539880">Points de distribution de listes de révocation des certificats</translation>
+<translation id="7049357003967926684">Association</translation>
+<translation id="8641392906089904981">Appuyez sur Maj+Alt pour changer la disposition du clavier.</translation>
+<translation id="3024374909719388945">Utiliser l'horloge au format 24 heures</translation>
+<translation id="1867780286110144690"><ph name="PRODUCT_NAME"/> est prêt à terminer l'installation.</translation>
+<translation id="5316814419223884568">Lancez votre recherche à partir d'ici</translation>
+<translation id="8142732521333266922">OK, synchroniser tout</translation>
+<translation id="965674096648379287">Afin d'être correctement affichée, cette page requiert des données que vous avez précédemment entrées. Vous pouvez de nouveau transmettre ces données, mais, en procédant ainsi, vous devrez répéter chaque action que cette page a effectuée auparavant. Cliquez sur Rafraîchir pour transmettre de nouveau ces données et pour afficher cette page.</translation>
+<translation id="43742617823094120">Cela signifie que le certificat présenté à votre navigateur a été révoqué par son émetteur. L'intégrité de ce certificat a certainement été compromise, et il ne doit donc pas être approuvé. Ne poursuivez pas.</translation>
+<translation id="9019654278847959325">Clavier slovaque</translation>
+<translation id="18139523105317219">Nom de partie EDI</translation>
+<translation id="6657193944556309583">Vous avez déjà chiffré des données avec un mot de passe multiterme. Saisissez-le ci-dessous.</translation>
+<translation id="3328801116991980348">Informations sur le site</translation>
+<translation id="1205605488412590044">Créer un raccourci vers l'application...</translation>
+<translation id="2065985942032347596">Authentification requise</translation>
+<translation id="2553340429761841190"><ph name="PRODUCT_NAME"/> n'est pas parvenu à se connecter à <ph name="NETWORK_ID"/>. Sélectionnez un autre réseau ou réessayez.</translation>
+<translation id="2086712242472027775">Votre compte n'est pas compatible avec <ph name="PRODUCT_NAME"/>. Contactez l'administrateur de votre domaine ou utilisez un compte Google standard pour vous connecter.</translation>
+<translation id="7222232353993864120">Adresse e-mail</translation>
+<translation id="2128531968068887769">Client natif</translation>
+<translation id="7175353351958621980">Chargé depuis :</translation>
+<translation id="4590074117005971373">Active les balises canvas hautes performances dans un contexte 2D, pour effectuer le rendu via le processeur graphique.</translation>
+<translation id="7186367841673660872">Cette page en<ph name="ORIGINAL_LANGUAGE"/>a été traduite en<ph name="LANGUAGE_LANGUAGE"/></translation>
+<translation id="8448695406146523553">Seule une personne en possession de votre mot de passe multiterme peut lire vos données chiffrées. Google ne reçoit ni n'enregistre votre mot de passe multiterme. Si vous oubliez votre mot de passe multiterme, vous devrez</translation>
+<translation id="6052976518993719690">Autorité de certification SSL</translation>
+<translation id="1636959874332483835"><ph name="HOST_NAME"/> contient un logiciel malveillant. Votre ordinateur pourrait être infecté par un virus si vous consultez ce site.</translation>
+<translation id="8050783156231782848">Aucune donnée disponible.</translation>
+<translation id="1175364870820465910">Im&amp;primer...</translation>
+<translation id="3866249974567520381">Description</translation>
+<translation id="2900139581179749587">Voix non reconnue.</translation>
+<translation id="953692523250483872">Aucun fichier sélectionné</translation>
+<translation id="2294358108254308676">Souhaitez-vous installer <ph name="PRODUCT_NAME"/> ?</translation>
+<translation id="6549689063733911810">Activité récente</translation>
+<translation id="1529968269513889022">de la dernière semaine</translation>
+<translation id="5542132724887566711">Profil</translation>
+<translation id="5196117515621749903">Actualiser sans utiliser le cache</translation>
+<translation id="5552632479093547648">Logiciels malveillants et sites de phishing détectés !</translation>
+<translation id="4310537301481716192">Onglet fermé !</translation>
+<translation id="4988273303304146523">il y a <ph name="NUMBER_DEFAULT"/> jours</translation>
+<translation id="8428213095426709021">Paramètres</translation>
+<translation id="1588343679702972132">Ce site exige que vous vous identifiiez avec un certificat :</translation>
+<translation id="7211994749225247711">Supprimer...</translation>
+<translation id="2819994928625218237">&amp;Aucune suggestion orthographique</translation>
+<translation id="1065449928621190041">Clavier franco-canadien</translation>
+<translation id="8327626790128680264">Clavier étendu américain</translation>
+<translation id="2950186680359523359">Le serveur a mis fin à la connexion sans envoyer de données.</translation>
+<translation id="9142623379911037913">Autoriser <ph name="SITE"/> à afficher des notifications sur le Bureau ?</translation>
+<translation id="4196320913210960460">Pour gérer les extensions installées, cliquez sur Extensions dans le menu Outils.</translation>
+<translation id="3449494395612243720">Erreur de synchronisation, veuillez vous connecter à nouveau.</translation>
+<translation id="9118804773997839291">La liste suivante fait état des éléments dangereux détectés sur la page. Cliquez sur le lien &quot;Diagnostic&quot; pour obtenir plus d'informations sur un élément particulier.</translation>
+<translation id="7139724024395191329">Émirat</translation>
+<translation id="1761265592227862828">Synchroniser tous les paramètres et toutes les données\n(peut prendre un certain temps)</translation>
+<translation id="7754704193130578113">Toujours demander où enregistrer les fichiers</translation>
+<translation id="204914487372604757">Créer un raccourci</translation>
+<translation id="2497284189126895209">Tous les fichiers</translation>
+<translation id="696036063053180184">Sebeol-sik No-shift</translation>
+<translation id="452785312504541111">Anglais (pleine chasse)</translation>
+<translation id="945332329539165145">2D avec canvas et accélération matérielle</translation>
+<translation id="5220797120063118010">Cette fonctionnalité autorise l'installation d'applications Google Chrome déployées à partir d'un manifeste situé sur une page Web, plutôt qu'avec un fichier crx contenant le manifeste et les icônes.</translation>
+<translation id="9148126808321036104">Nouvelle connexion</translation>
+<translation id="2282146716419988068">GPU</translation>
+<translation id="428771275901304970">Moins de 1 Mo disponible</translation>
+<translation id="1682548588986054654">Nouvelle fenêtre de navigation privée</translation>
+<translation id="6833901631330113163">Europe du Sud</translation>
+<translation id="8691262314411702087">Sélectionner les éléments à synchroniser</translation>
+<translation id="6065289257230303064">Attributs du répertoire de l'objet du certificat</translation>
+<translation id="2423017480076849397">Accédez à vos imprimantes et partagez-les en ligne via <ph name="CLOUD_PRINT_NAME"/>.</translation>
+<translation id="569520194956422927">&amp;Ajouter...</translation>
+<translation id="4018133169783460046">Afficher <ph name="PRODUCT_NAME"/> dans cette langue</translation>
+<translation id="5110450810124758964">il y a <ph name="NUMBER_ONE"/> jour</translation>
+<translation id="3264544094376351444">Police Sans-Serif</translation>
+<translation id="5586942249556966598">Ne rien faire</translation>
+<translation id="2820806154655529776"><ph name="NUMBER_ONE"/> seconde</translation>
+<translation id="1077946062898560804">Configurer les mises à jour automatiques pour tous les utilisateurs</translation>
+<translation id="3122496702278727796">Échec de la création du répertoire des données</translation>
+<translation id="4517036173149081027">Fermer et annuler le chargement</translation>
+<translation id="7150146631451105528"><ph name="DATE"/></translation>
+<translation id="3166547286524371413">Adresse :</translation>
+<translation id="4522570452068850558">Détails</translation>
+<translation id="59659456909144943">Notification : <ph name="NOTIFICATION_NAME"/></translation>
+<translation id="6731320427842222405">Cette opération peut prendre quelques minutes.</translation>
+<translation id="4806525999832945986">Géré par <ph name="DOMAIN"/> (<ph name="STATUS"/>)</translation>
+<translation id="7503191893372251637">Type de certificat Netscape</translation>
+<translation id="1502960562739459116">Impossible d'afficher certaines parties de ce document PDF. Souhaitez-vous installer Adobe Reader ?</translation>
+<translation id="4135450933899346655">Vos certificats</translation>
+<translation id="4731578803613910821">Vos données personnelles sur <ph name="WEBSITE_1"/>, <ph name="WEBSITE_2"/> et <ph name="WEBSITE_3"/></translation>
+<translation id="7716781361494605745">URL de stratégie de l'autorité de certification Netscape</translation>
+<translation id="2881966438216424900">Dernier accès :</translation>
+<translation id="7552203043556919163">Synchroniser les mots de passe</translation>
+<translation id="630065524203833229">&amp;Quitter</translation>
+<translation id="4647090755847581616">&amp;Fermer l'onglet</translation>
+<translation id="2649204054376361687"><ph name="CITY"/>, <ph name="COUNTRY"/></translation>
+<translation id="7886758531743562066">Le site Web à l'adresse <ph name="HOST_NAME"/> contient des éléments provenant de sites qui semblent héberger des logiciels malveillants. Ces derniers peuvent nuire à votre ordinateur ou agir à votre insu. Le simple fait de visiter un site hébergeant ce type de logiciels peut infecter votre ordinateur.</translation>
+<translation id="2064746092913005102">Total : <ph name="NUMBER_OF_PAGES"/> <ph name="PAGE_OR_PAGES_LABEL"/> <ph name="TWO_SIDED"/> <ph name="TIMES"/> <ph name="NUMBER_OF_COPIES"/> <ph name="COPIES_LABEL"/> <ph name="EQUAL_SIGN"/> <ph name="NUMBER_OF_SHEETS"/> <ph name="SHEETS_LABEL"/></translation>
+<translation id="7538227655922918841">Les cookies de plusieurs sites ont été autorisés pour la session uniquement.</translation>
+<translation id="2385700042425247848">Nom du service :</translation>
+<translation id="7751005832163144684">Imprimer une page de test</translation>
+<translation id="3638865692466101147">Aperçu avant impression - <ph name="PREVIEW_TAB_TITLE"/></translation>
+<translation id="1471300011765310414"><ph name="PRODUCT_NAME"/>
+        ne peut pas à afficher la page Web, car votre ordinateur n'est pas connecté à Internet.</translation>
+<translation id="5464632865477611176">Exécuter cette fois</translation>
+<translation id="4268025649754414643">Chiffrement de la clé</translation>
+<translation id="7925247922861151263">Échec de la vérification AAA</translation>
+<translation id="1168020859489941584">Ouverture dans <ph name="TIME_REMAINING"/>...</translation>
+<translation id="7814458197256864873">&amp;Copier</translation>
+<translation id="8186706823560132848">Logiciel</translation>
+<translation id="4692623383562244444">Moteurs de recherche</translation>
+<translation id="567760371929988174">&amp;Méthodes d'entrée</translation>
+<translation id="10614374240317010">Jamais enregistrés</translation>
+<translation id="5116300307302421503">Impossible d'analyser le fichier.</translation>
+<translation id="2745080116229976798">Subordination qualifiée Microsoft</translation>
+<translation id="2526590354069164005">Bureau</translation>
+<translation id="7983301409776629893">Toujours traduire en <ph name="TARGET_LANGUAGE"/> les pages en <ph name="ORIGINAL_LANGUAGE"/></translation>
+<translation id="4890284164788142455">Thaï</translation>
+<translation id="4312207540304900419">Activer l'onglet suivant</translation>
+<translation id="8456362689280298700"><ph name="HOUR"/>:<ph name="MINUTE"/> de chargement</translation>
+<translation id="7648048654005891115">Style de mappage du clavier</translation>
+<translation id="539295039523818097">Un problème lié à votre microphone s'est produit.</translation>
+<translation id="4033319557821527966"><ph name="CLOUD_PRINT_NAME"/> vous permet d'accéder aux imprimantes de cet ordinateur, où que vous soyez. Connectez-vous pour l'activer.</translation>
+<translation id="6970216967273061347">District</translation>
+<translation id="4479639480957787382">Ethernet</translation>
+<translation id="6312403991423642364">Erreur de réseau inconnue.</translation>
+<translation id="751377616343077236">Nom du certificat</translation>
+<translation id="7154108546743862496">Plus d'informations</translation>
+<translation id="8637688295594795546">Mise à jour du système disponible. Préparation du téléchargement…</translation>
+<translation id="5167270755190684957">Galerie des thèmes Google Chrome</translation>
+<translation id="8382913212082956454">Copi&amp;er l'adresse e-mail</translation>
+<translation id="7447930227192971403">Activer l'onglet 3</translation>
+<translation id="2903493209154104877">Adresses</translation>
+<translation id="2056143100006548702">Plug-in : <ph name="PLUGIN_NAME"/> (<ph name="PLUGIN_VERSION"/>)</translation>
+<translation id="3479552764303398839">Pas maintenant</translation>
+<translation id="6445051938772793705">Pays</translation>
+<translation id="3251759466064201842">&lt;Ne fait pas partie du certificat&gt;</translation>
+<translation id="4229495110203539533">il y a <ph name="NUMBER_ONE"/> seconde</translation>
+<translation id="6410257289063177456">Fichiers image</translation>
+<translation id="6419902127459849040">Europe centrale</translation>
+<translation id="6707389671160270963">Certificat client SSL</translation>
+<translation id="6083557600037991373">Pour accélérer l'affichage des pages Web,
+        <ph name="PRODUCT_NAME"/>
+        enregistre temporairement les fichiers téléchargés sur le disque. Si
+        <ph name="PRODUCT_NAME"/>
+        ne s'arrête pas correctement, ces fichiers peuvent être endommagés, ce qui
+        génère cette erreur. L'actualisation de la page devrait permettre de résoudre
+        ce problème ; celui-ci ne se reproduira vraisemblablement plus si l'arrêt s'effectue
+        correctement.
+        <ph name="LINE_BREAK"/>
+        Si le problème persiste, essayez de supprimer le contenu du cache. Cette
+        erreur peut aussi indiquer que le matériel est sur le point de tomber
+        en panne.</translation>
+<translation id="5298219193514155779">Thème créé par</translation>
+<translation id="7366909168761621528">Données de navigation</translation>
+<translation id="1047726139967079566">Ajouter cette page aux favoris</translation>
+<translation id="9020142588544155172">Le serveur a refusé la connexion.</translation>
+<translation id="6113225828180044308">Module (<ph name="MODULUS_NUM_BITS"/> bits) :\n<ph name="MODULUS_HEX_DUMP"/>\n\nExposant public (<ph name="PUBLIC_EXPONENT_NUM_BITS"/> bits) :\n<ph name="EXPONENT_HEX_DUMP"/></translation>
+<translation id="2544782972264605588"><ph name="NUMBER_DEFAULT"/> secondes restantes</translation>
+<translation id="8871696467337989339">Vous utilisez un indicateur de ligne de commande non pris en charge : <ph name="BAD_FLAG"/>. La stabilité et la sécurité en seront affectées.</translation>
+<translation id="4767443964295394154">Emplacement de téléchargement</translation>
+<translation id="5031870354684148875">À propos de Google Traduction</translation>
+<translation id="720658115504386855">Les lettres ne sont pas sensibles à la casse.</translation>
+<translation id="2454247629720664989">Mot clé</translation>
+<translation id="3950820424414687140">Connexion</translation>
+<translation id="4626106357471783850">Redémarrez <ph name="PRODUCT_NAME"/> pour appliquer la mise à jour.</translation>
+<translation id="1697068104427956555">Sélectionner un carré dans l'image</translation>
+<translation id="2840798130349147766">Bases de données Web</translation>
+<translation id="1628736721748648976">Codage</translation>
+<translation id="1198271701881992799">Mise en route</translation>
+<translation id="782590969421016895">Utiliser les pages actuelles</translation>
+<translation id="6521850982405273806">Signaler une erreur</translation>
+<translation id="736515969993332243">Recherche de réseaux en cours</translation>
+<translation id="8026334261755873520">Effacer les données de navigation</translation>
+<translation id="1769104665586091481">Ouvrir le lien dans une nouvelle &amp;fenêtre</translation>
+<translation id="8503813439785031346">Nom d'utilisateur</translation>
+<translation id="5319782540886810524">Clavier letton</translation>
+<translation id="8651585100578802546">Forcer l'actualisation de cette page</translation>
+<translation id="685714579710025096">Disposition du clavier :</translation>
+<translation id="1361655923249334273">Non utilisé</translation>
+<translation id="290555789621781773"><ph name="NUMBER_TWO"/> minutes</translation>
+<translation id="5434065355175441495">Chiffrement RSA PKCS #1</translation>
+<translation id="7073704676847768330">Ce n'est probablement pas le site que vous recherchez !</translation>
+<translation id="8477384620836102176">&amp;Général</translation>
+<translation id="1074663319790387896">Configurer la synchronisation</translation>
+<translation id="4302315780171881488">État de connexion :</translation>
+<translation id="3391392691301057522">Ancien code PIN :</translation>
+<translation id="1344519653668879001">Désactiver le contrôle des liens hypertexte</translation>
+<translation id="6463795194797719782">&amp;Modifier</translation>
+<translation id="4262113024799883061">Chinois</translation>
+<translation id="4775879719735953715">Navigateur par défaut</translation>
+<translation id="5575473780076478375">Extension en mode navigation privée :<ph name="EXTENSION_NAME"/></translation>
+<translation id="4188026131102273494">Mot clé :</translation>
+<translation id="2930644991850369934">Un problème est survenu lors du téléchargement de l'image de récupération. La connexion réseau a été perdue.</translation>
+<translation id="3461610253915486539">Votre administrateur a désactivé certaines préférences.</translation>
+<translation id="5750053751252005701">Forfait de données <ph name="NETWORK"/> épuisé</translation>
+<translation id="8858939932848080433">Veuillez indiquer à quel niveau vous rencontrez des problèmes avant d'envoyer vos commentaires.</translation>
+<translation id="1720318856472900922">Authentification du serveur WWW TLS</translation>
+<translation id="8550022383519221471">Le service de synchronisation n'est pas disponible pour votre domaine.</translation>
+<translation id="3355823806454867987">Modifier les paramètres du proxy...</translation>
+<translation id="4780374166989101364">Cette fonctionnalité active les API des extensions expérimentales. Notez que vous ne pouvez pas mettre en ligne des extensions qui font appel aux API expérimentales dans la galerie d'extensions.</translation>
+<translation id="7227780179130368205">Un logiciel malveillant a été détecté !</translation>
+<translation id="435243347905038008">Forfait de données <ph name="NETWORK"/> presque épuisé</translation>
+<translation id="2489428929217601177">des dernières 24 heures</translation>
+<translation id="7418490403869327287">Une fois activée, la recherche instantanée charge la plupart des pages Web dès que vous saisissez l'URL dans le champ polyvalent, avant même que vous n'appuyiez sur Entrée. Si votre moteur de recherche par défaut est compatible, toute lettre saisie dans ce champ offre de nouveaux résultats et les prédictions intégrées vous guident dans vos recherches.\n\nChaque touche utilisée fait l'objet d'une requête, par conséquent il se peut que les éléments saisies dans le champ polyvalent soient enregistrés par votre moteur de recherche par défaut.\n</translation>
+<translation id="5149131957118398098"><ph name="NUMBER_ZERO"/> hours left</translation>
+<translation id="2541913031883863396">poursuivre quand même</translation>
+<translation id="4278390842282768270">Autorisé</translation>
+<translation id="2074527029802029717">Retirer l'onglet</translation>
+<translation id="1533897085022183721">Moins de <ph name="MINUTES"/></translation>
+<translation id="7503821294401948377">Impossible de charger l'icône &quot;<ph name="ICON"/>&quot; d'action du navigateur.</translation>
+<translation id="5539694491979265537">Consulter Google Dashboard</translation>
+<translation id="3942946088478181888">Plus d'informations</translation>
+<translation id="3722396466546931176">Ajoutez des langues puis faites-les glisser pour les classer dans l'ordre souhaité.</translation>
+<translation id="7396845648024431313"><ph name="APP_NAME"/> sera lancé au démarrage du système et continuera de s'exécuter en arrière-plan, même toutes les fenêtres de <ph name="PRODUCT_NAME"/> sont fermées.</translation>
+<translation id="8539727552378197395">Non (HttpOnly)</translation>
+<translation id="4519351128520996510">Saisir votre mot de passe multiterme pour la synchronisation</translation>
+<translation id="2391419135980381625">Police standard</translation>
+<translation id="7893393459573308604"><ph name="ENGINE_NAME"/> (par défaut)</translation>
+<translation id="5392544185395226057">Cette fonctionnalité active la prise en charge du client natif.</translation>
+<translation id="5400640815024374115">La puce du module de plate-forme sécurisée (TPM) est désactivée ou inexistante.</translation>
+<translation id="2151576029659734873">L'index de l'onglet indiqué est incorrect.</translation>
+<translation id="5150254825601720210">Nom du serveur SSL du certificat Netscape</translation>
+<translation id="6771503742377376720">Est une autorité de certification</translation>
+<translation id="8814190375133053267">Wi-Fi</translation>
+<translation id="2040078585890208937">Connexion à <ph name="NAME"/></translation>
+<translation id="8410619858754994443">Confirmer le mot de passe :</translation>
+<translation id="2210840298541351314">Aperçu avant impression</translation>
+<translation id="3858678421048828670">Clavier italien</translation>
+<translation id="4938277090904056629">Impossible d'établir une connexion sécurisée à cause de l'antivirus ESET.</translation>
+<translation id="4521805507184738876">(expiré)</translation>
+<translation id="111844081046043029">Voulez-vous vraiment quitter cette page ?</translation>
+<translation id="1951615167417147110">Faire défiler d'une page vers le haut</translation>
+<translation id="4154664944169082762">Empreintes</translation>
+<translation id="3202578601642193415">Le plus récent</translation>
+<translation id="8112886015144590373"><ph name="NUMBER_FEW"/> heures</translation>
+<translation id="1398853756734560583">Agrandir</translation>
+<translation id="8988255471271407508">La page Web est introuvable dans le cache. Certaines ressources ne sont restituées fidèlement que si elles sont extraites du cache, notamment les pages générées à partir de données que vous avez envoyées. <ph name="LINE_BREAK"/> Cette erreur peut également être due à un cache endommagé lors d'une fermeture incorrecte. <ph name="LINE_BREAK"/> Si le problème persiste, essayez d'effacer le cache.</translation>
+<translation id="1195977189444203128">Le plug-in <ph name="PLUGIN_NAME"/> n'est plus à jour.</translation>
+<translation id="3878562341724547165">Vous avez changé de position. Souhaitez-vous utiliser <ph name="NEW_GOOGLE_URL"/> ?</translation>
+<translation id="1758018619400202187">EAP-TLS</translation>
+<translation id="6690744523875189208"><ph name="NUMBER_TWO"/> heures</translation>
+<translation id="8053390638574070785">Rafraîchir cette page</translation>
+<translation id="5507756662695126555">Non-répudiation</translation>
+<translation id="3678156199662914018">Extension : <ph name="EXTENSION_NAME"/></translation>
+<translation id="9194519262242876737">Active l'API Web audio.</translation>
+<translation id="3531250013160506608">Zone de saisie de mot de passe</translation>
+<translation id="8314066201485587418">Effacer les cookies et autres données de site lorsque je quitte le navigateur</translation>
+<translation id="4094105377635924481">Ajouter l'option de regroupement au menu contextuel des onglets</translation>
+<translation id="8655295600908251630">Version</translation>
+<translation id="8250690786522693009">Latin</translation>
+<translation id="2119721408814495896">Le connecteur <ph name="CLOUD_PRINT_NAME"/> requiert l'installation du pack Microsoft XML Paper Specification Essentials.</translation>
+<translation id="7624267205732106503">Effacer les cookies et autres données de site lorsque je ferme le navigateur</translation>
+<translation id="8401363965527883709">Case décochée</translation>
+<translation id="7771452384635174008">Mise en page</translation>
+<translation id="6188939051578398125">Saisir un nom ou une adresse</translation>
+<translation id="8443621894987748190">Choix de l'image du compte</translation>
+<translation id="10122177803156699">Me montrer</translation>
+<translation id="5260878308685146029"><ph name="NUMBER_TWO"/> minutes restantes</translation>
+<translation id="2192505247865591433">De :</translation>
+<translation id="238391805422906964">Ouvrir un rapport de phishing</translation>
+<translation id="5921544176073914576">Page de phishing</translation>
+<translation id="3727187387656390258">Inspecter le pop-up</translation>
+<translation id="569068482611873351">Importer...</translation>
+<translation id="6571070086367343653">Modifier la carte de paiement</translation>
+<translation id="1204242529756846967">Cette langue est utilisée pour corriger l'orthographe.</translation>
+<translation id="3981760180856053153">Le type d'enregistrement indiqué est incorrect.</translation>
+<translation id="8464591670878858520">Forfait de données <ph name="NETWORK"/> arrivé à expiration</translation>
+<translation id="4568660204877256194">Exporter mes favoris...</translation>
+<translation id="3116361045094675131">Clavier britannique</translation>
+<translation id="4577070033074325641">Importer des favoris...</translation>
+<translation id="1641504961675316934"><ph name="CLOUD_PRINT_NAME"/></translation>
+<translation id="1715941336038158809">Nom d'utilisateur ou mot de passe incorrect</translation>
+<translation id="1901303067676059328">&amp;Tout sélectionner</translation>
+<translation id="674375294223700098">Erreur inconnue liée au certificat du serveur.</translation>
+<translation id="7780428956635859355">Envoyer une capture d'écran enregistrée</translation>
+<translation id="2850961597638370327">Émis pour : <ph name="NAME"/></translation>
+<translation id="2168039046890040389">Page précédente</translation>
+<translation id="1767519210550978135">Hsu</translation>
+<translation id="2498539833203011245">Réduire</translation>
+<translation id="2893168226686371498">Navigateur par défaut</translation>
+<translation id="2435457462613246316">Afficher le mot de passe</translation>
+<translation id="7988355189918024273">Activer les fonctionnalités d'accessibilité</translation>
+<translation id="5438653034651341183">Inclure la capture d'écran actuelle :</translation>
+<translation id="1899708097738826574"><ph name="OPTIONS_TITLE"/> - <ph name="SUBPAGE_TITLE"/></translation>
+<translation id="1765313842989969521">(cette extension est gérée et ne peut être désinstallée ni désactivée)</translation>
+<translation id="6983783921975806247">OID enregistré</translation>
+<translation id="394984172568887996">Importés depuis IE</translation>
+<translation id="5311260548612583999">Fichier de clé privée (facultatif) :</translation>
+<translation id="2430043402233747791">Autoriser pour la session uniquement</translation>
+<translation id="7363290921156020669"><ph name="NUMBER_ZERO"/> mins</translation>
+<translation id="7568790562536448087">Mise à jour en cours</translation>
+<translation id="4856408283021169561">Aucun microphone trouvé.</translation>
+<translation id="8190193592390505034">Connexion à <ph name="PROVIDER_NAME"/></translation>
+<translation id="6144890426075165477"><ph name="PRODUCT_NAME"/> n'est pas votre navigateur par défaut.</translation>
+<translation id="823241703361685511">Forfait</translation>
+<translation id="4068506536726151626">Cette page contient des éléments des sites ci-dessous qui suivent votre position géographique :</translation>
+<translation id="4721475475128190282">Plusieurs profils</translation>
+<translation id="4220128509585149162">Plantages</translation>
+<translation id="8798099450830957504">Par défaut</translation>
+<translation id="9107059250669762581"><ph name="NUMBER_DEFAULT"/> jours</translation>
+<translation id="1640283014264083726">PKCS #1 MD4 avec chiffrement RSA</translation>
+<translation id="872451400847464257">Modifier le moteur de recherche</translation>
+<translation id="6463061331681402734"><ph name="NUMBER_MANY"/> minutes</translation>
+<translation id="2466804342846034717">Indiquez le mot de passe approprié ci-dessus, puis saisissez les caractères figurant dans l'image ci-dessous.</translation>
+<translation id="3881435075661337013">Expiration de <ph name="NETWORK"/> imminente</translation>
+<translation id="5681833099441553262">Activer l'onglet précédent</translation>
+<translation id="4792057643643237295">Désactiver l'accès à distance</translation>
+<translation id="1681614449735360921">Afficher les incompatibilités</translation>
+<translation id="19094784437781028">Carte de débit Solo</translation>
+<translation id="2657327428424666237"><ph name="BEGIN_LINK"/>Actualisez<ph name="END_LINK"/> cette page Web ultérieurement.</translation>
+<translation id="7347751611463936647">Pour utiliser cette extension, saisissez &quot;<ph name="EXTENSION_KEYWORD"/>&quot;, TAB, puis votre commande ou votre recherche.</translation>
+<translation id="659432221160402784"><ph name="PRODUCT_NAME"/> synchronisera les applications installées, afin que vous puissiez y accéder en vous connectant depuis tout navigateur <ph name="PRODUCT_NAME"/>.</translation>
+<translation id="892464165639979917">Langues et paramètres du correcteur orthographique...</translation>
+<translation id="5645845270586517071">Erreur de sécurité</translation>
+<translation id="2805756323405976993">Applications</translation>
+<translation id="3651020361689274926">La ressource demandée n'existe plus et aucune adresse de transfert n'est disponible. Il semble que cet état de fait soit permanent.</translation>
+<translation id="2989786307324390836">Certificat unique binaire codé DER</translation>
+<translation id="3827774300009121996">&amp;Plein écran</translation>
+<translation id="3771294271822695279">Fichiers vidéo</translation>
+<translation id="6704875430222476107"><ph name="PRODUCT_NAME"/> indique que
+        NetNanny intercepte les connexions sécurisées. En général, cela
+        ne constitue pas un problème de sécurité, car le logiciel NetNanny s'exécute souvent
+        sur le même ordinateur. Toutefois, en raison de certaines incompatibilités avec
+        les connexions sécurisées Google Chrome, vous devez configurer NetNanny 
+        de manière à éviter ces interceptions. Cliquez sur le lien En savoir plus pour obtenir des instructions.</translation>
+<translation id="3388026114049080752">Vos onglets et activités de navigation</translation>
+<translation id="7525067979554623046">Créer</translation>
+<translation id="4711094779914110278">Turc</translation>
+<translation id="1031460590482534116">Une erreur s'est produite lors de la tentative d'enregistrement du certificat client. Erreur <ph name="ERROR_NUMBER"/> (<ph name="ERROR_NAME"/>)</translation>
+<translation id="7136984461011502314">Bienvenue dans <ph name="PRODUCT_NAME"/></translation>
+<translation id="1594030484168838125">Sélectionner</translation>
+<translation id="204497730941176055">Nom du modèle de certificat Microsoft</translation>
+<translation id="6705264787989366486">Configuration de l'adresse IP pour <ph name="NAME"/></translation>
+<translation id="8970721300630048025">Immortalisez votre plus beau sourire et utilisez la photo comme image de compte.</translation>
+<translation id="4087089424473531098">Extension créée :
+
+<ph name="EXTENSION_FILE"/></translation>
+<translation id="16620462294541761">Mot de passe incorrect. Veuillez réessayer.</translation>
+<translation id="5017508259293544172">LEAP</translation>
+<translation id="1394630846966197578">Échec de la connexion aux serveurs de reconnaissance vocale.</translation>
+<translation id="2498765460639677199">Très grande</translation>
+<translation id="2378982052244864789">Sélectionner le répertoire de l'extension</translation>
+<translation id="7861215335140947162">&amp;Téléchargements</translation>
+<translation id="4778630024246633221">Gestionnaire des certificats</translation>
+<translation id="6705050455568279082"><ph name="URL"/> souhaite suivre votre position géographique</translation>
+<translation id="4708849949179781599">Quitter <ph name="PRODUCT_NAME"/></translation>
+<translation id="2505402373176859469"><ph name="RECEIVED_AMOUNT"/> sur <ph name="TOTAL_SIZE"/></translation>
+<translation id="6644512095122093795">Proposer d'enregistrer les mots de passe</translation>
+<translation id="4724450788351008910">Modification de l'affiliation</translation>
+<translation id="2249605167705922988">par exemple : 1-5, 8, 11-13</translation>
+<translation id="8691686986795184760">(Activé par une stratégie d'entreprise)</translation>
+<translation id="1911483096198679472">Qu'est-ce que c'est ?</translation>
+<translation id="1976323404609382849">Les cookies de plusieurs sites ont été bloqués.</translation>
+<translation id="2662952950313424742">Serveur DNS spécifié par l'utilisateur et utilisé par Google Chrome, à la place du paramètre système par défaut, pour les résolutions DNS.</translation>
+<translation id="4176463684765177261">Désactivé</translation>
+<translation id="2079545284768500474">Annuler</translation>
+<translation id="114140604515785785">Répertoire racine de l'extension :</translation>
+<translation id="4788968718241181184">Mode de saisie du vietnamien (TCVN6064)</translation>
+<translation id="1512064327686280138">Échec de l'activation</translation>
+<translation id="3254409185687681395">Ajouter cette page aux favoris</translation>
+<translation id="1384616079544830839">L'identité de ce site Web a été vérifiée par <ph name="ISSUER"/>.</translation>
+<translation id="8710160868773349942">Adresse e-mail : <ph name="EMAIL_ADDRESSES"/></translation>
+<translation id="4057991113334098539">Activation...</translation>
+<translation id="9073281213608662541">PAP</translation>
+<translation id="1800035677272595847">Sites de phishing</translation>
+<translation id="8448317557906454022"><ph name="NUMBER_ZERO"/> secs ago</translation>
+<translation id="402759845255257575">Interdire à tous les sites d'exécuter JavaScript</translation>
+<translation id="4610637590575890427">Vouliez-vous accéder à <ph name="SITE"/> ?</translation>
+<translation id="7723779034587221017">La connexion avec le service de configuration a été perdue. Veuillez réinitialiser votre périphérique ou contacter votre représentant de l'assistance technique.</translation>
+<translation id="3046388203776734202">Paramètres des fenêtres pop-up :</translation>
+<translation id="3437994698969764647">Tout exporter...</translation>
+<translation id="8349305172487531364">Barre de favoris</translation>
+<translation id="1898064240243672867">Stocké dans : <ph name="CERT_LOCATION"/></translation>
+<translation id="444134486829715816">Développer...</translation>
+<translation id="1401874662068168819">Gin Yieh</translation>
+<translation id="7208899522964477531">Rechercher <ph name="SEARCH_TERMS"/> sur <ph name="SITE_NAME"/></translation>
+<translation id="6255097610484507482">Modifier la carte de paiement</translation>
+<translation id="5584091888252706332">Au démarrage</translation>
+<translation id="8960795431111723921">Nous examinons actuellement le problème.</translation>
+<translation id="2482878487686419369">Notifications</translation>
+<translation id="8004582292198964060">Navigateur</translation>
+<translation id="695755122858488207">Case d'option décochée</translation>
+<translation id="6357135709975569075"><ph name="NUMBER_ZERO"/> days</translation>
+<translation id="8666678546361132282">Anglais</translation>
+<translation id="2224551243087462610">Modifier le nom du dossier</translation>
+<translation id="1358741672408003399">Grammaire et orthographe</translation>
+<translation id="4910673011243110136">Réseaux privés</translation>
+<translation id="2527167509808613699">Toutes sortes de connexions</translation>
+<translation id="9095710730982563314">Exceptions liées aux notifications</translation>
+<translation id="8072988827236813198">Épingler les onglets</translation>
+<translation id="1234466194727942574">Barre d'onglets</translation>
+<translation id="7974087985088771286">Activer l'onglet 6</translation>
+<translation id="4035758313003622889">Gestionnaire de &amp;tâches</translation>
+<translation id="6356936121715252359">Paramètres de stockage d'Adobe Flash Player...</translation>
+<translation id="5885996401168273077">Connexion au réseau</translation>
+<translation id="7313804056609272439">Mode de saisie du vietnamien (VNI)</translation>
+<translation id="1768211415369530011">L'application suivante va être lancée si vous acceptez cette requête :\n\n<ph name="APPLICATION"/></translation>
+<translation id="8793043992023823866">Importation...</translation>
+<translation id="8106211421800660735">N° de carte</translation>
+<translation id="2550839177807794974">Gérer les moteurs de recherche...</translation>
+<translation id="7031711645186424727">Utiliser un moniteur externe</translation>
+<translation id="6316768948917110108">Gravure de l'image en cours...</translation>
+<translation id="5089810972385038852">État</translation>
+<translation id="2872961005593481000">Éteindre</translation>
+<translation id="8986267729801483565">Enregistrer les fichiers dans le dossier :</translation>
+<translation id="4322394346347055525">Fermer les autres onglets</translation>
+<translation id="4411770745820968260">Répertoire de fichiers</translation>
+<translation id="881799181680267069">Masquer les autres</translation>
+<translation id="1812631533912615985">Annuler l'épinglage des onglets</translation>
+<translation id="6042308850641462728">Plus</translation>
+<translation id="8318945219881683434">Échec de la vérification de la révocation</translation>
+<translation id="1650709179466243265">Ajouter www. et .com, puis ouvrir la page</translation>
+<translation id="3524079319150349823">Pour inspecter un pop-up, cliquez avec le bouton droit sur la page ou sur l'icône d'action du navigateur, puis sélectionnez Inspecter le pop-up.</translation>
+<translation id="994289308992179865">&amp;Répéter</translation>
+<translation id="7793343764764530903"><ph name="CLOUD_PRINT_NAME"/> est à présent activé. <ph name="PRODUCT_NAME"/> a enregistré les imprimantes installées sur cette machine en les associant à &lt;b&gt;<ph name="EMAIL_ADDRESSES"/>&lt;/b&gt;. Vous pouvez désormais utiliser vos imprimantes depuis n'importe quelle application Web ou mobile associée à <ph name="CLOUD_PRINT_NAME"/>.</translation>
+<translation id="1703490097606704369">Le serveur de <ph name="HOST_NAME"/>
+        est introuvable, car la résolution DNS a échoué. DNS est le service Web qui 
+        traduit les noms de site Web en adresses Internet. Cette erreur est 
+        généralement due à l'absence de connexion Internet ou à une configuration 
+        incorrecte du réseau. Cela peut également venir d'un serveur DNS qui ne 
+        répond pas ou d'un pare-feu interdisant l'accès de 
+        <ph name="PRODUCT_NAME"/>
+        au réseau.</translation>
+<translation id="8887090188469175989">ZGPY</translation>
+<translation id="3302709122321372472">Impossible de charger le fichier css &quot;<ph name="RELATIVE_PATH"/>&quot; du script de contenu.</translation>
+<translation id="305803244554250778">Créer des raccourcis vers des applications aux emplacements suivants :</translation>
+<translation id="574392208103952083">Moyenne</translation>
+<translation id="3745810751851099214">Envoyé pour :</translation>
+<translation id="3937609171782005782">Aider Google à détecter les logiciels malveillants en envoyant des données supplémentaires concernant les sites pour lesquels cet avertissement s'affiche. Ces données seront gérées conformément aux règles définies sur la page <ph name="PRIVACY_PAGE_LINK"/>.</translation>
+<translation id="8877448029301136595">[répertoire parent]</translation>
+<translation id="7301360164412453905">Touches de sélection du clavier Hsu</translation>
+<translation id="8631271110654520730">Copie de l'image de récupération...</translation>
+<translation id="1963227389609234879">Tout supprimer</translation>
+<translation id="7779140087128114262">Seule une personne en possession de votre mot de passe multiterme peut lire vos données chiffrées. Google ne reçoit ni n'enregistre votre mot de passe multiterme. Si vous oubliez votre mot de passe multiterme, vous devrez réinitialiser la synchronisation.</translation>
+<translation id="8027581147000338959">Ouvrir dans une nouvelle fenêtre</translation>
+<translation id="8019305344918958688">Dommage... Aucune extension n'est installée. :-(</translation>
+<translation id="7466861475611330213">Style de ponctuation</translation>
+<translation id="2496180316473517155">Historique de navigation</translation>
+<translation id="602251597322198729">Ce site tente de télécharger plusieurs fichiers. Voulez-vous autoriser le chargement ?</translation>
+<translation id="5843685321177053287">Établissement de la liaison avec le service de gestion des périphériques en attente...</translation>
+<translation id="2052389551707911401"><ph name="NUMBER_MANY"/> heures</translation>
+<translation id="5411472733320185105">Ne pas utiliser les paramètres du proxy pour les hôtes et domaines suivants :</translation>
+<translation id="6691936601825168937">&amp;Avancer</translation>
+<translation id="6566142449942033617">Impossible de charger &quot;<ph name="PLUGIN_PATH"/>&quot; pour le plug-in.</translation>
+<translation id="7065534935986314333">À propos du système</translation>
+<translation id="45025857977132537">Utilisation de la clé du certificat : <ph name="USAGES"/></translation>
+<translation id="6454421252317455908">Mode de saisie du chinois (quick)</translation>
+<translation id="368789413795732264">Une erreur s'est produite lors de la tentative d'écriture du fichier : <ph name="ERROR_TEXT"/>.</translation>
+<translation id="1173894706177603556">Renommer</translation>
+<translation id="5670032673361607750">La synchronisation requiert votre attention.</translation>
+<translation id="2148716181193084225">Aujourd'hui</translation>
+<translation id="1002064594444093641">Imp&amp;rimer le cadre...</translation>
+<translation id="7234674978021619913">Le site <ph name="HOST_NAME"/> a déjà été informé qu'un logiciel malveillant a été détecté sur ses pages. Pour plus d'informations concernant les problèmes rencontrés sur <ph name="HOST_NAME2"/>, consultez notre <ph name="DIAGNOSTIC_PAGE"/> Google.</translation>
+<translation id="8202390211066742724">Adresse de serveur DNS spécifiée par l'utilisateur.</translation>
+<translation id="4608500690299898628">&amp;Rechercher...</translation>
+<translation id="3574305903863751447"><ph name="CITY"/>, <ph name="STATE"/> <ph name="COUNTRY"/></translation>
+<translation id="8724859055372736596">&amp;Afficher dans le dossier</translation>
+<translation id="4605399136610325267">Non connecté à Internet.</translation>
+<translation id="978407797571588532">Sélectionnez
+          <ph name="BEGIN_BOLD"/>
+          Démarrer &gt; Panneau de configuration &gt; Connexions réseau &gt; Assistant Nouvelle connexion
+          <ph name="END_BOLD"/>
+          pour tester votre connexion.</translation>
+<translation id="5554489410841842733">Cette icône s'affiche lorsque l'extension peut agir sur la page active.</translation>
+<translation id="579702532610384533">Reconnexion</translation>
+<translation id="4862642413395066333">Réponses OCSP de signature</translation>
+<translation id="5266113311903163739">Erreur d'importation de l'autorité de certification</translation>
+<translation id="9563164493805065">Gravure de l'image terminée.</translation>
+<translation id="4756388243121344051">&amp;Historique</translation>
+<translation id="3789841737615482174">Installer</translation>
+<translation id="4320697033624943677">Ajouter des utilisateurs</translation>
+<translation id="9153934054460603056">Enregistrer l'authentification et le mot de passe</translation>
+<translation id="1455548678241328678">Clavier norvégien</translation>
+<translation id="2520481907516975884">Basculer en mode chinois/anglais</translation>
+<translation id="8571890674111243710">Traduction de la page en <ph name="LANGUAGE"/>...</translation>
+<translation id="4789872672210757069">À propos de &amp;<ph name="PRODUCT_NAME"/></translation>
+<translation id="4056561919922437609"><ph name="TAB_COUNT"/> onglets</translation>
+<translation id="4373894838514502496">il y a <ph name="NUMBER_FEW"/> minutes</translation>
+<translation id="6358450015545214790">Qu'est-ce que c'est ?</translation>
+<translation id="6264365405983206840">Tout &amp;sélectionner</translation>
+<translation id="1017280919048282932">&amp;Ajouter au dictionnaire</translation>
+<translation id="8319414634934645341">Utilisation étendue de la clé</translation>
+<translation id="4563210852471260509">Le chinois est la langue de saisie initiale</translation>
+<translation id="6897140037006041989">Agent utilisateur</translation>
+<translation id="3413122095806433232">Émetteurs de l'autorité de certification : <ph name="LOCATION"/></translation>
+<translation id="4115153316875436289"><ph name="NUMBER_TWO"/> jours</translation>
+<translation id="701080569351381435">Code source</translation>
+<translation id="3286538390144397061">Redémarrer maintenant</translation>
+<translation id="163309982320328737">La largeur de caractères initiale est Complète</translation>
+<translation id="5107325588313356747">Pour masquer l'accès à ce programme, vous devez le désinstaller au moyen de \n<ph name="CONTROL_PANEL_APPLET_NAME"/> du Panneau de configuration.\n\nSouhaitez-vous exécuter <ph name="CONTROL_PANEL_APPLET_NAME"/> ?</translation>
+<translation id="4841055638263130507">Paramètres du microphone</translation>
+<translation id="6965648386495488594">Port</translation>
+<translation id="7631887513477658702">&amp;Toujours ouvrir les fichiers de ce type</translation>
+<translation id="8627795981664801467">Uniquement les connexions sécurisées</translation>
+<translation id="8680787084697685621">Les informations de connexion au compte sont obsolètes.</translation>
+<translation id="3228969707346345236">La traduction a échoué, car la page est déjà en <ph name="LANGUAGE"/>.</translation>
+<translation id="1873879463550486830">Sandbox SUID</translation>
+<translation id="2190355936436201913">(vide)</translation>
+<translation id="8515737884867295000">Échec de l'authentification basée sur le certificat</translation>
+<translation id="5868426874618963178">Envoyer le code source de la page actuelle</translation>
+<translation id="1269138312169077280">Votre administrateur a désactivé certains paramètres.</translation>
+<translation id="5818003990515275822">Coréen</translation>
+<translation id="4182252350869425879">Avertissement : Il s'agit peut-être d'un site de phishing !</translation>
+<translation id="5458214261780477893">Dvorak</translation>
+<translation id="5353719617589986386">Étendue de pages incorrecte</translation>
+<translation id="1164369517022005061"><ph name="NUMBER_DEFAULT"/> heures restantes</translation>
+<translation id="5943260032016910017">Exceptions liées aux cookies et aux données de site</translation>
+<translation id="2214283295778284209"><ph name="SITE"/> n'est pas accessible</translation>
+<translation id="8755376271068075440">P&amp;lus grand</translation>
+<translation id="8132793192354020517">Connecté à <ph name="NAME"/></translation>
+<translation id="8187473050234053012">Le certificat de sécurité du site a été révoqué !</translation>
+<translation id="7444983668544353857">Désactiver <ph name="NETWORKDEVICE"/></translation>
+<translation id="6003177993629630467"><ph name="PRODUCT_NAME"/> risque de ne pas rester à jour.</translation>
+<translation id="421577943854572179">intégré sur tout autre site</translation>
+<translation id="580886651983547002"><ph name="PRODUCT_NAME"/>
+        ne parvient pas à atteindre le site Web. Cela vient probablement d'un problème de réseau,
+        mais peut également être dû à un pare-feu ou à un serveur proxy mal configuré.</translation>
+<translation id="5445557969380904478">À propos de la reconnaissance vocale</translation>
+<translation id="3093473105505681231">Langues et paramètres du correcteur orthographique...</translation>
+<translation id="152482086482215392"><ph name="NUMBER_ONE"/> seconde restante</translation>
+<translation id="529172024324796256">Nom d'utilisateur :</translation>
+<translation id="3308116878371095290">Le stockage des cookies n'est pas autorisé pour cette page.</translation>
+<translation id="7521387064766892559">JavaScript</translation>
+<translation id="7219179957768738017">La connexion utilise <ph name="SSL_VERSION"/>.</translation>
+<translation id="7014174261166285193">Échec de l'installation</translation>
+<translation id="1970746430676306437">Afficher les &amp;infos sur la page</translation>
+<translation id="3199127022143353223">Serveurs</translation>
+<translation id="2805646850212350655">Système de fichiers de chiffrement Microsoft </translation>
+<translation id="8053959338015477773">Un plug-in supplémentaire est requis pour afficher certains éléments sur cette page.</translation>
+<translation id="3541661933757219855">Appuyez sur Ctrl+Alt+/ ou sur Échap pour masquer</translation>
+<translation id="8813873272012220470">Cette fonctionnalité effectue des vérifications en arrière-plan et vous avertit en cas d'incompatibilité logicielle (modules tiers bloquant le navigateur, par exemple).</translation>
+<translation id="5020734739305654865">Connexion avec</translation>
+<translation id="2679385451463308372">Imprimer depuis la boîte de dialogue système…</translation>
+<translation id="7414887922320653780"><ph name="NUMBER_ONE"/> heure restante</translation>
+<translation id="121632099317611328">Échec de l'initialisation de l'appareil photo</translation>
+<translation id="399179161741278232">Importés</translation>
+<translation id="3829932584934971895">Type de fournisseur :</translation>
+<translation id="462288279674432182">IP restreinte :</translation>
+<translation id="3927932062596804919">Refuser</translation>
+<translation id="3524915994314972210">Démarrage du téléchargement en cours...</translation>
+<translation id="6484929352454160200">Une nouvelle version de <ph name="PRODUCT_NAME"/> est disponible.</translation>
+<translation id="3187212781151025377">Clavier hébreu</translation>
+<translation id="351152300840026870">Police à largeur fixe</translation>
+<translation id="5827266244928330802">Safari</translation>
+<translation id="778881183694837592">Les champs obligatoires ne doivent pas rester vides.</translation>
+<translation id="2371076942591664043">Ouvrir une fois le téléchargement &amp;terminé</translation>
+<translation id="3920504717067627103">Stratégies de certificat</translation>
+<translation id="155865706765934889">Pavé tactile</translation>
+<translation id="7701040980221191251">Aucun</translation>
+<translation id="5917011688104426363">Activer la barre d'adresse en mode recherche</translation>
+<translation id="6910239454641394402">Exceptions pour JavaScript</translation>
+<translation id="2979639724566107830">Ouvrir dans une nouvelle fenêtre</translation>
+<translation id="3269101346657272573">Veuillez saisir le code PIN.</translation>
+<translation id="9204065299849069896">Options de saisie automatique...</translation>
+<translation id="2822854841007275488">Arabe</translation>
+<translation id="5857090052475505287">Nouveau dossier</translation>
+<translation id="7450732239874446337">E/S réseau interrompue</translation>
+<translation id="5178667623289523808">Rechercher le précédent</translation>
+<translation id="2815448242176260024">Ne jamais enregistrer les mots de passe</translation>
+<translation id="2989805286512600854">Ouvrir dans un nouvel onglet</translation>
+<translation id="8687485617085920635">Fenêtre suivante</translation>
+<translation id="4122118036811378575">&amp;Rechercher le suivant</translation>
+<translation id="6008256403891681546">JCB</translation>
+<translation id="2610780100389066815">Signature de liste d'approbation Microsoft</translation>
+<translation id="8289811203643526145">Gérer les certificats...</translation>
+<translation id="2788575669734834343">Sélectionnez le fichier de certificat.</translation>
+<translation id="8404409224170843728">Fabricant :</translation>
+<translation id="8267453826113867474">Bloquer le contenu inapproprié</translation>
+<translation id="7959074893852789871">Le fichier contenait plusieurs certificats, dont certains n'ont pas été importés :</translation>
+<translation id="1213999834285861200">Exceptions pour les images</translation>
+<translation id="2805707493867224476">Autoriser tous les sites à afficher des fenêtres pop-up</translation>
+<translation id="3561217442734750519">Vous devez indiquer un chemin valide comme valeur de clé privée.</translation>
+<translation id="2444609190341826949">Sans mot de passe multiterme, vos mots de passe et autres données chiffrées ne seront pas synchronisés sur cet ordinateur.</translation>
+<translation id="77221669950527621">Extensions ou applications</translation>
+<translation id="6650142020817594541">Ce site recommande Google Chrome Frame (déjà installé).</translation>
+<translation id="6503077044568424649">Les plus visités</translation>
+<translation id="4625904365165566833">Vous n'êtes pas autorisé à vous connecter. Consultez le propriétaire de cet ordinateur portable.</translation>
+<translation id="7450633916678972976">Remarque : Lorsque vous cliquez sur &quot;Envoyer&quot;, Google Chrome joint à votre
+        envoi un journal indiquant votre version de Google Chrome et celle du système
+        d'exploitation utilisé, ainsi que l'URL associée à votre rapport. Vous pouvez
+        également joindre une capture d'écran. Ces informations nous
+        permettent de diagnostiquer les problèmes et d'améliorer les performances de
+        Google Chrome. Les informations personnelles fournies sciemment dans vos 
+        commentaires ou involontairement dans le journal, l'URL ou la capture
+        d'écran sont protégées conformément à nos règles de
+        confidentialité. Si vous ne souhaitez pas indiquer d'URL et/ou de capture
+        d'écran, décochez les cases &quot;Inclure cette URL&quot; et/ou &quot;Inclure cette capture d'écran&quot;. Vous acceptez que Google utilise vos commentaires pour améliorer ses produits ou services.</translation>
+<translation id="465365366590259328">Vos modifications seront prises en compte au prochain démarrage de <ph name="PRODUCT_NAME"/>.</translation>
+<translation id="7168109975831002660">Taille de police minimale</translation>
+<translation id="7070804685954057874">Entrée directe</translation>
+<translation id="3265459715026181080">Fermer la fenêtre</translation>
+<translation id="6074871234879228294">Mode de saisie du japonais (pour clavier japonais)</translation>
+<translation id="7855296476260297092">Inscription réussie</translation>
+<translation id="907841381057066561">Échec de création du fichier zip temporaire lors de la création du pack</translation>
+<translation id="1294298200424241932">Modifier les paramètres de confiance :</translation>
+<translation id="1384617406392001144">Votre historique de navigation</translation>
+<translation id="3831099738707437457">&amp;Masquer le panneau de la vérification orthographique</translation>
+<translation id="1040471547130882189">Plug-in ne répondant pas</translation>
+<translation id="5473075389972733037">IBM</translation>
+<translation id="8307664665247532435">Les paramètres seront effacés lors de la prochaine actualisation.</translation>
+<translation id="790025292736025802"><ph name="URL"/> introuvable</translation>
+<translation id="895347679606913382">Démarrage...</translation>
+<translation id="3319048459796106952">Nouvelle fenêtre de nav&amp;igation privée</translation>
+<translation id="5832669303303483065">Ajouter une adresse postale...</translation>
+<translation id="3127919023693423797">Authentification en cours...</translation>
+<translation id="4195643157523330669">Ouvrir dans un nouvel onglet</translation>
+<translation id="8030169304546394654">Déconnecté</translation>
+<translation id="4010065515774514159">Action du navigateur</translation>
+<translation id="4286563808063000730">Le mot de passe multiterme saisi ne peut pas être utilisé, car vous avez déjà chiffré des données avec un mot de passe multiterme. Entrez ci-dessous le mot de passe multiterme actuellement défini pour la synchronisation.</translation>
+<translation id="1154228249304313899">Ouvrir cette page :</translation>
+<translation id="9074348188580488499">Voulez-vous vraiment supprimer tous les mots de passe ?</translation>
+<translation id="6635491740861629599">Sélectionner par domaine</translation>
+<translation id="3627588569887975815">Ouvrir le lien dans une fenêtre en navi&amp;gation privée</translation>
+<translation id="5851868085455377790">Émetteur</translation>
+<translation id="8223496248037436966">Options de saisie automatique</translation>
+<translation id="1470719357688513792">Les nouveaux paramètres des cookies seront appliqués quand vous aurez actualisé la page.</translation>
+<translation id="5578327870501192725">Votre connexion à <ph name="DOMAIN"/> est sécurisée par un chiffrement <ph name="BIT_COUNT"/> bits.</translation>
+<translation id="869884720829132584">Menu Applications</translation>
+<translation id="7764209408768029281">Outi&amp;ls</translation>
+<translation id="1139892513581762545">Onglets latéraux</translation>
+<translation id="7634357567062076565">Reprendre</translation>
+<translation id="4779083564647765204">Zoom</translation>
+<translation id="3282430104564575032">Inspecteur de DOM</translation>
+<translation id="1526560967942511387">Document sans titre</translation>
+<translation id="1291144580684226670">Police standard</translation>
+<translation id="3979748722126423326">Activer <ph name="NETWORKDEVICE"/></translation>
+<translation id="5538307496474303926">Opération en cours...</translation>
+<translation id="4367133129601245178">C&amp;opier l'URL de l'image</translation>
+<translation id="7542995811387359312">La saisie automatique des numéros de carte de paiement est désactivée, car la connexion utilisée par ce formulaire n'est pas sécurisée.</translation>
+<translation id="3494444535872870968">Enregistrer le &amp;cadre sous...</translation>
+<translation id="987264212798334818">Général</translation>
+<translation id="7005812687360380971">Défaillance</translation>
+<translation id="2356070529366658676">Demander</translation>
+<translation id="5731247495086897348">Coller l'URL et y a&amp;ccéder</translation>
+<translation id="8467548439852845758">Pour plus de sécurité, <ph name="PRODUCT_NAME"/> va chiffrer vos mots de passe.</translation>
+<translation id="2524947000814989347">Si vous avez oublié votre mot de passe multiterme, vous devrez arrêter la synchronisation via Google Dashboard.</translation>
+<translation id="8018154597338652331"><ph name="BURNT_AMOUNT"/> sur <ph name="TOTAL_SIZE"/></translation>
+<translation id="7635741716790924709">Adresse ligne 1</translation>
+<translation id="5135533361271311778">Impossible de créer le favori.</translation>
+<translation id="5271247532544265821">Basculer en mode chinois simplifié/traditionnel</translation>
+<translation id="2052610617971448509">Votre système Sandbox n'est pas correctement configuré.</translation>
+<translation id="7384913436093989340">Sélectionnez le <ph name="BEGIN_BOLD"/>menu clé à molette &gt; Préférences &gt; Options avancées &gt; Modifier les paramètres du proxy<ph name="END_BOLD"/> et vérifiez que vos paramètres sont définis sur &quot;sans proxy&quot; ou &quot;direct&quot;.</translation>
+<translation id="6417515091412812850">Impossible de vérifier si le certificat a été révoqué.</translation>
+<translation id="7282743297697561153">Stockage des données</translation>
+<translation id="3363332416643747536"><ph name="DOWNLOAD_RECEIVED"/>/<ph name="DOWNLOAD_TOTAL"/>, Interrompu</translation>
+<translation id="7347702518873971555">Acheter un forfait</translation>
+<translation id="5285267187067365830">Installer le plug-in...</translation>
+<translation id="5334844597069022743">Afficher le code source</translation>
+<translation id="1166212789817575481">Fermer les onglets sur la droite</translation>
+<translation id="6472893788822429178">Afficher le bouton &quot;Accueil&quot;</translation>
+<translation id="4270393598798225102">Version <ph name="NUMBER"/></translation>
+<translation id="534916491091036097">Parenthèse gche</translation>
+<translation id="4157869833395312646">Microsoft Server Gated Cryptography</translation>
+<translation id="8903921497873541725">Zoom avant</translation>
+<translation id="2195729137168608510">Protection du courrier électronique</translation>
+<translation id="1425734930786274278">Les cookies suivants ont été bloqués (tous les cookies tiers sont bloqués, sans exception) :</translation>
+<translation id="6805647936811177813">Connectez-vous à <ph name="TOKEN_NAME"/> pour importer le certificat client de <ph name="HOST_NAME"/></translation>
+<translation id="3437016096396740659">La batterie est chargée.</translation>
+<translation id="6916146760805488559">Créer un nouveau profil...</translation>
+<translation id="1199232041627643649">Maintenez la touche <ph name="KEY_EQUIVALENT"/> enfoncée pour quitter.</translation>
+<translation id="5428562714029661924">Masquer ce plug-in</translation>
+<translation id="7907591526440419938">Ouvrir le fichier</translation>
+<translation id="2568774940984945469">Conteneur de barres d'infos</translation>
+<translation id="8971063699422889582">Le certificat du serveur a expiré.</translation>
+<translation id="8281596639154340028">Utiliser <ph name="HANDLER_TITLE"/></translation>
+<translation id="7134098520442464001">Réduit la taille du texte</translation>
+<translation id="21133533946938348">Épingler l'onglet</translation>
+<translation id="1325040735987616223">Mise à jour du système</translation>
+<translation id="2864069933652346933"><ph name="NUMBER_ZERO"/> days left</translation>
+<translation id="9090669887503413452">Inclure les informations système</translation>
+<translation id="3084771660770137092">Google Chrome n'avait pas suffisamment de mémoire ou le processus de la page Web a été arrêté pour une autre raison. Pour continuer, actualisez la page ou ouvrez-en une autre.</translation>
+<translation id="1114901192629963971">Impossible de valider votre mot de passe sur le réseau actuel. Sélectionnez un autre réseau.</translation>
+<translation id="5179510805599951267">Cette page n'est pas rédigée en <ph name="ORIGINAL_LANGUAGE"/> ? Signaler l'erreur</translation>
+<translation id="6430814529589430811">Certificat unique codé Base 64 ASCII</translation>
+<translation id="5143712164865402236">Activer le mode plein écran</translation>
+<translation id="8434177709403049435">Codag&amp;e</translation>
+<translation id="4051923669149193910"><ph name="HANDLER_TITLE"/> est déjà utilisé pour gérer les liens <ph name="PROTOCOL"/>://.</translation>
+<translation id="2722201176532936492">Touches de sélection</translation>
+<translation id="385120052649200804">Clavier international américain</translation>
+<translation id="9012607008263791152">Je comprends que la visite de ce site peut être préjudiciable à mon ordinateur.</translation>
+<translation id="6640442327198413730">Ressource cache manquante.</translation>
+<translation id="1441458099223378239">Impossible d'accéder à mon compte</translation>
+<translation id="5793220536715630615">C&amp;opier l'URL de la vidéo</translation>
+<translation id="523397668577733901">Vous préférez <ph name="BEGIN_LINK"/>parcourir la galerie<ph name="END_LINK"/> ?</translation>
+<translation id="2922350208395188000">Impossible de vérifier le certificat du serveur.</translation>
+<translation id="3778740492972734840">Outils de &amp;développement</translation>
+<translation id="8335971947739877923">Exporter...</translation>
+<translation id="5680966941935662618">Paramètres de saisie automatique</translation>
+<translation id="38385141699319881">Téléchargement de l'image en cours...</translation>
+<translation id="6004539838376062211">&amp;Options du vérificateur d'orthographe</translation>
+<translation id="5350198318881239970">Impossible d'ouvrir votre profil correctement.\n\nIl est possible que certaines fonctionnalités ne soient pas disponibles. Vérifiez que ce profil existe et que vous disposez d'une autorisation d'accès à son contenu en lecture et en écriture.</translation>
+<translation id="4058793769387728514">Vérifier le document maintenant</translation>
+<translation id="1810107444790159527">Zone de liste</translation>
+<translation id="3338239663705455570">Clavier slovène</translation>
+<translation id="1859234291848436338">Sens de l'écriture</translation>
+<translation id="4567836003335927027">Vos données sur <ph name="WEBSITE_1"/></translation>
+<translation id="756445078718366910">Ouvrir une fenêtre du navigateur</translation>
+<translation id="4126154898592630571">Conversion de la date et de l'heure</translation>
+<translation id="5088534251099454936">PKCS #1 SHA-512 avec chiffrement RSA</translation>
+<translation id="6392373519963504642">Clavier coréen</translation>
+<translation id="7887334752153342268">Dupliquer</translation>
+<translation id="4980691186726139495">Ne pas conserver sur cette page</translation>
+<translation id="3081523290047420375">Désactiver <ph name="CLOUD_PRINT_NAME"/></translation>
+<translation id="9207194316435230304">ATOK</translation>
+<translation id="9026731007018893674">téléchargement</translation>
+<translation id="7646591409235458998">E-mail :</translation>
+<translation id="703748601351783580">Ouvrir tous les favoris dans une nouvelle &amp;fenêtre</translation>
+<translation id="6199775032047436064">Rafraîchir la page actuelle</translation>
+<translation id="6981982820502123353">Accessibilité</translation>
+<translation id="112343676265501403">Exceptions pour les plug-ins</translation>
+<translation id="770273299705142744">Remplissage automatique des formulaires</translation>
+<translation id="7210998213739223319">Nom d'utilisateur</translation>
+<translation id="4478664379124702289">Enregistrer le lie&amp;n sous...</translation>
+<translation id="8725066075913043281">Réessayer</translation>
+<translation id="8502249598105294518">Personnaliser et configurer <ph name="PRODUCT_NAME"/></translation>
+<translation id="7392089327262158658">Préférences de saisie automatique <ph name="PRODUCT_NAME_SHORT"/></translation>
+<translation id="4163521619127344201">Votre position géographique</translation>
+<translation id="3797008485206955964">Afficher les pages en arrière-plan (<ph name="NUM_BACKGROUND_APPS"/>)</translation>
+<translation id="8590375307970699841">Configurer les mises à jour automatiques</translation>
+<translation id="2797524280730715045">il y a <ph name="NUMBER_DEFAULT"/> heures</translation>
+<translation id="265390580714150011">Valeur du champ</translation>
+<translation id="9073247318500677671">Les dernières versions d'Unity et GNOME (ainsi que la prochaine version d'Ubuntu, Natty Narwhal) affichent une barre de menus de type OSX sur toute la largeur supérieure de l'écran.</translation>
+<translation id="3869917919960562512">Index erroné.</translation>
+<translation id="7031962166228839643">Préparation du module de plate-forme sécurisée (TPM) en cours. Veuillez patienter, l'opération peut prendre quelques minutes.</translation>
+<translation id="4250377793615429299">Nombre de copies incorrect</translation>
+<translation id="7180865173735832675">Personnaliser</translation>
+<translation id="5737306429639033676">Prédire les actions du réseau pour améliorer les performances de chargement des pages</translation>
+<translation id="8123426182923614874">Données restantes :</translation>
+<translation id="3707020109030358290">N'est pas une autorité de certification.</translation>
+<translation id="2115926821277323019">L'URL doit être valide.</translation>
+<translation id="8986494364107987395">Envoyer automatiquement les statistiques d'utilisation et les rapports d'erreur à Google</translation>
+<translation id="7070714457904110559">Cette fonctionnalité active la géolocalisation dans les extensions expérimentales. Cela implique l'utilisation des API de localisation du système d'exploitation (si disponibles) et l'envoi de données sur la configuration réseau locale au service de localisation de Google afin de déterminer une position précise.</translation>
+<translation id="6701535245008341853">Impossible de charger le profil.</translation>
+<translation id="527605982717517565">Toujours exécuter JavaScript sur <ph name="HOST"/></translation>
+<translation id="702373420751953740">Version PRL :</translation>
+<translation id="1307041843857566458">Confirmer la réactivation</translation>
+<translation id="8314308967132194952">Ajouter une adresse postale...</translation>
+<translation id="1221024147024329929">PKCS #1 MD2 avec chiffrement RSA</translation>
+<translation id="853265131227167869">Dim.^Lun.^Mar.^Mer.^Jeu.^Ven.^Sam.</translation>
+<translation id="3323447499041942178">Zone de saisie</translation>
+<translation id="580571955903695899">Trier par nom</translation>
+<translation id="5230516054153933099">Fenêtre</translation>
+<translation id="7554791636758816595">Nouvel onglet</translation>
+<translation id="5503844897713343920">Vous tentez d'accéder au site <ph name="DOMAIN"/>, mais le certificat présenté par le serveur a été révoqué par son émetteur. Cela signifie que les informations d'identification présentées par le serveur ne sont pas approuvées. Vous communiquez peut-être avec un pirate informatique. Nous vous déconseillons vivement de continuer.</translation>
+<translation id="6928853950228839340">Composition hors écran</translation>
+<translation id="1308727876662951186"><ph name="NUMBER_ZERO"/> mins left</translation>
+<translation id="7671576867600624">Technologie :</translation>
+<translation id="1103966635949043187">Accédez à la page d'accueil du site :</translation>
+<translation id="1951332921786364801">Configurer la communication à distance</translation>
+<translation id="1086613338090581534">L'émetteur d'un certificat n'ayant pas expiré est tenu d'assurer la maintenance de ce qui s'appelle &quot;une liste de révocation&quot;. Si un certificat est compromis, l'émetteur peut le révoquer en l'ajoutant à la liste de révocation. Ce certificat n'est alors plus approuvé par votre navigateur. Il n'est pas nécessaire d'assurer la maintenance de l'état &quot;révoqué&quot; des certificats expirés. Donc, bien qu'un certificat ait été qualifié de valide pour le site Web que vous visitez actuellement, il est impossible de déterminer s'il a été, depuis, compromis puis révoqué ou s'il est toujours valide. Par conséquent, il n'est pas possible de s'assurer si vous communiquez avec un site Web légitime ou si le certificat a été compromis et se trouve maintenant en la possession d'un pirate informatique avec lequel vous communiquez. Ne poursuivez pas.</translation>
+<translation id="2645575947416143543">Néanmoins, si vous travaillez dans une entreprise qui génère ses propres certificats, et que vous essayez de vous connecter au site Web interne de l'entreprise avec un certificat de ce type, vous pouvez résoudre ce problème en toute sécurité. Pour ce faire, importez le certificat racine de l'entreprise en tant que &quot;certificat racine&quot;. Par la suite, les certificats émis ou vérifiés par votre entreprise seront approuvés et vous ne verrez plus cette erreur lorsque vous tenterez de vous connecter à nouveau au site Web interne. Contactez le support informatique de votre entreprise pour savoir comment ajouter un nouveau certificat racine sur votre ordinateur.</translation>
+<translation id="376466258076168640">Définir <ph name="PRODUCT_NAME"/> en tant que navigateur par défaut</translation>
+<translation id="1056898198331236512">Avertissement</translation>
+<translation id="8630826211403662855">Préférences de recherche</translation>
+<translation id="8432745813735585631">Clavier Colemak américain</translation>
+<translation id="8151639108075998630">Activer la navigation en tant qu'invité</translation>
+<translation id="2608770217409477136">Utiliser les paramètres par défaut</translation>
+<translation id="3157931365184549694">Rétablir</translation>
+<translation id="7426243339717063209">Désinstaller &quot;<ph name="EXTENSION_NAME"/>&quot; ?</translation>
+<translation id="996250603853062861">Établissement de la connexion sécurisée...</translation>
+<translation id="6059232451013891645">Dossier :</translation>
+<translation id="4274292172790327596">Erreur non reconnue</translation>
+<translation id="760537465793895946">Consultez les conflits connus avec des modules tiers.</translation>
+<translation id="7042418530779813870">Co&amp;ller et rechercher</translation>
+<translation id="9110447413660189038">&amp;Remonter</translation>
+<translation id="375403751935624634">Échec de la traduction en raison d'une erreur de serveur</translation>
+<translation id="2101225219012730419">Version :</translation>
+<translation id="1570242578492689919">Polices et codage</translation>
+<translation id="3082374807674020857"><ph name="PAGE_TITLE"/> - <ph name="PAGE_URL"/></translation>
+<translation id="8050038245906040378">Signature du code commercial Microsoft</translation>
+<translation id="3031557471081358569">Sélectionnez les éléments à importer :</translation>
+<translation id="1368832886055348810">De gauche à droite</translation>
+<translation id="3031433885594348982">Votre connexion à <ph name="DOMAIN"/> est sécurisée par le biais d'un faible chiffrement.</translation>
+<translation id="4047345532928475040">sans objet</translation>
+<translation id="5604324414379907186">Toujours afficher la barre de favoris</translation>
+<translation id="3220630151624181591">Activer l'onglet 2</translation>
+<translation id="8898139864468905752">Aperçu des onglets</translation>
+<translation id="2799223571221894425">Redémarrer</translation>
+<translation id="5771816112378578655">Configuration en cours...</translation>
+<translation id="1197979282329025000">Une erreur s'est produite lors de la récupération des fonctions de l'imprimante <ph name="PRINTER_NAME"/>. Cette imprimante n'a pas pu être enregistrée dans <ph name="CLOUD_PRINT_NAME"/>.</translation>
+<translation id="8820901253980281117">Exceptions pour les fenêtres pop-up</translation>
+<translation id="1143142264369994168">Signataire du certificat </translation>
+<translation id="904949795138183864">La page Web <ph name="URL"/> n'existe plus.</translation>
+<translation id="3228279582454007836">Vous n'avez jamais visité ce site auparavant.</translation>
+<translation id="2159017110205600596">Personnaliser...</translation>
+<translation id="5449716055534515760">Fe&amp;rmer la fenêtre</translation>
+<translation id="2814489978934728345">Arrêter le chargement de cette page</translation>
+<translation id="2354001756790975382">Autres favoris</translation>
+<translation id="8561574028787046517"><ph name="PRODUCT_NAME"/> a été mis à jour.</translation>
+<translation id="5234325087306733083">Mode hors connexion</translation>
+<translation id="1779392088388639487">Erreur d'importation de fichier PKCS #12</translation>
+<translation id="166278006618318542">Algorithme de clé publique de l'objet</translation>
+<translation id="5759272020525228995">Le site Web a rencontré une erreur lors de l'extraction de <ph name="URL"/>.
+        Cela peut être dû à une opération de maintenance ou à une configuration incorrecte.</translation>
+<translation id="641480858134062906">Échec du chargement de la page <ph name="URL"/></translation>
+<translation id="3693415264595406141">Mot de passe :</translation>
+<translation id="74568296546932365">Conserver <ph name="PAGE_TITLE"/> en tant que moteur de recherche par défaut</translation>
+<translation id="8602184400052594090">Fichier manifeste absent ou illisible</translation>
+<translation id="2784949926578158345">La connexion a été réinitialisée.</translation>
+<translation id="6663792236418322902">Le mot de passe choisi vous sera demandé pour restaurer le fichier. Veillez à le conserver en lieu sûr.</translation>
+<translation id="4532822216683966758">La vérification de la provenance du certificat DNS est activée, ce qui peut entraîner l'envoi d'informations privées à Google.</translation>
+<translation id="6321196148033717308">À propos de la reconnaissance vocale</translation>
+<translation id="3412265149091626468">Aller à la sélection</translation>
+<translation id="8167737133281862792">Ajouter un certificat</translation>
+<translation id="2911372483530471524">Espaces de noms PID</translation>
+<translation id="6093374025603915876">Préférences de saisie automatique</translation>
+<translation id="8584134039559266300">Activer l'onglet 8</translation>
+<translation id="5189060859917252173">Le certificat &quot;<ph name="CERTIFICATE_NAME"/>&quot; représente une autorité de certification.</translation>
+<translation id="3785852283863272759">Envoyer par e-mail l'emplacement de la page</translation>
+<translation id="2255317897038918278">Enregistrement des informations de date Microsoft</translation>
+<translation id="3493881266323043047">Validité</translation>
+<translation id="5979421442488174909">&amp;Traduire en <ph name="LANGUAGE"/></translation>
+<translation id="7326526699920221209">Batterie : <ph name="PRECENTAGE"/> %</translation>
+<translation id="952992212772159698">Désactivé</translation>
+<translation id="8299269255470343364">Japonais</translation>
+<translation id="5187826826541650604"><ph name="KEY_NAME"/> (<ph name="DEVICE"/>)</translation>
+<translation id="6429639049555216915">L'application est actuellement inaccessible.</translation>
+<translation id="2144536955299248197">Lecteur du certificat : <ph name="CERTIFICATE_NAME"/></translation>
+<translation id="50030952220075532"><ph name="NUMBER_ONE"/> jour restant</translation>
+<translation id="2885378588091291677">Gestionnaire de tâches</translation>
+<translation id="5792852254658380406">Gérer les extensions...</translation>
+<translation id="2359808026110333948">Continuer</translation>
+<translation id="176759384517330673">Synchronisation avec <ph name="USER_EMAIL_ADDRESS"/> effectuée. Dernière synchronisation : <ph name="LAST_SYNC_TIME"/></translation>
+<translation id="1618661679583408047">Le certificat de sécurité du site n'est pas encore valide !</translation>
+<translation id="7039912931802252762">Ouverture de session par carte à puce Microsoft</translation>
+<translation id="6285074077487067719">Format</translation>
+<translation id="3065140616557457172">Tapez votre requête ou saisissez une URL pour commencer la navigation : c'est à vous de choisir.</translation>
+<translation id="5509693895992845810">Enregistrer &amp;sous...</translation>
+<translation id="5986279928654338866">Le serveur <ph name="DOMAIN"/> requiert un nom d'utilisateur et un mot de passe.</translation>
+<translation id="521467793286158632">Supprimer tous les mots de passe</translation>
+<translation id="2491120439723279231">Le certificat du serveur contient des erreurs.</translation>
+<translation id="4448844063988177157">Recherche de réseaux Wi-Fi...</translation>
+<translation id="5765780083710877561">Description :</translation>
+<translation id="338583716107319301">Séparateur</translation>
+<translation id="2079053412993822885">Si vous supprimez l'un de vos propres certificats, vous ne pouvez plus l'utiliser pour vous identifier.</translation>
+<translation id="7221869452894271364">Rafraîchir cette page</translation>
+<translation id="6791443592650989371">État d'activation :</translation>
+<translation id="4801257000660565496">Créer des raccourcis vers des applications</translation>
+<translation id="6503256918647795660">Clavier franco-suisse</translation>
+<translation id="6175314957787328458">GUID de domaine Microsoft</translation>
+<translation id="8179976553408161302">Entrer</translation>
+<translation id="8261506727792406068">Supprimer</translation>
+<translation id="4404805853119650018">Échec de l'enregistrement de cet ordinateur pour l'accès à distance.</translation>
+<translation id="345693547134384690">Ouvrir l'&amp;image dans un nouvel onglet</translation>
+<translation id="7422192691352527311">Préférences...</translation>
+<translation id="354211537509721945">L'administrateur a désactivé les mises à jour.</translation>
+<translation id="1375198122581997741">À propos de la version</translation>
+<translation id="7915471803647590281">Veuillez nous indiquer ce qu'il se passe avant d'envoyer votre rapport.</translation>
+<translation id="5725124651280963564">Connectez-vous à <ph name="TOKEN_NAME"/> afin de générer une clé pour <ph name="HOST_NAME"/>.</translation>
+<translation id="8418113698656761985">Clavier roumain</translation>
+<translation id="5976160379964388480">Autres</translation>
+<translation id="3665842570601375360">Sécurité :</translation>
+<translation id="1430915738399379752">Imprimer</translation>
+<translation id="7999087758969799248">Mode de saisie standard</translation>
+<translation id="2635276683026132559">Signature</translation>
+<translation id="4835836146030131423">Erreur lors de la connexion</translation>
+<translation id="7715454002193035316">Pour cette session uniquement</translation>
+<translation id="2475982808118771221">Une erreur s'est produite.</translation>
+<translation id="3324684065575061611">(Désactivé par une stratégie d'entreprise)</translation>
+<translation id="7385854874724088939">Erreur lors de la tentative d'impression. Vérifiez votre imprimante et réessayez.</translation>
+<translation id="770015031906360009">Grec</translation>
+<translation id="3834901049798243128">Ignorer les exceptions et bloquer l'enregistrement des cookies tiers</translation>
+<translation id="8116152017593700047">Cet outil vous permet de sélectionner une capture d'écran enregistrée. Aucune capture d'écran n'est disponible pour le moment. Appuyez simultanément sur Ctrl et sur la touche &quot;Mode Présentation&quot; pour enregistrer une capture d'écran. Vos trois dernières captures apparaissent ici.</translation>
+<translation id="3454157711543303649">Activation effectuée</translation>
+<translation id="884923133447025588">Aucun système de révocation trouvé</translation>
+<translation id="556042886152191864">Bouton</translation>
+<translation id="1352060938076340443">Interrompu</translation>
+<translation id="8571226144504132898">Dictionnaire de symboles</translation>
+<translation id="7229570126336867161">Technologie EvDo requise</translation>
+<translation id="7582844466922312471">Internet mobile</translation>
+<translation id="945522503751344254">Envoyer le commentaire</translation>
+<translation id="4539401194496451708">Associé au profil Chrome <ph name="USER_EMAIL_ADDRESS"/>. Dernière synchronisation : <ph name="LAST_SYNC_TIME"/></translation>
+<translation id="7369847606959702983">Carte de crédit (autre)</translation>
+<translation id="6867459744367338172">Langues et saisie</translation>
+<translation id="7671130400130574146">Utiliser la barre de titre et les bordures de fenêtre du système</translation>
+<translation id="9170848237812810038">Ann&amp;uler</translation>
+<translation id="284970761985428403"><ph name="ASCII_NAME"/> (<ph name="UNICODE_NAME"/>)</translation>
+<translation id="3903912596042358459">Le serveur a refusé d'exécuter la demande.</translation>
+<translation id="8135557862853121765"><ph name="NUM_KILOBYTES"/> Ko</translation>
+<translation id="4444364671565852729"><ph name="PRODUCT_NAME"/> a été mis à jour vers la version <ph name="VERSION"/>.</translation>
+<translation id="5819890516935349394">Navigateur de contenu</translation>
+<translation id="2731392572903530958">&amp;Rouvrir la fenêtre fermée</translation>
+<translation id="1254593899333212300">Se connecter directement à Internet</translation>
+<translation id="6107012941649240045">Émis pour</translation>
+<translation id="6483805311199035658">Ouverture de <ph name="FILE"/> en cours</translation>
+<translation id="3576278878016363465">Cibles disponibles pour l'image</translation>
+<translation id="895541991026785598">Signaler un problème</translation>
+<translation id="940425055435005472">Taille de police :</translation>
+<translation id="494286511941020793">Aide pour la configuration de proxy</translation>
+<translation id="2765217105034171413">Petite</translation>
+<translation id="1285266685456062655"><ph name="NUMBER_FEW"/> hours ago</translation>
+<translation id="9154176715500758432">Rester sur cette page</translation>
+<translation id="5875565123733157100">Type de bug :</translation>
+<translation id="6988771638657196063">Inclure cette URL :</translation>
+<translation id="5717920936024713315">Cookies et données de site...</translation>
+<translation id="3842552989725514455">Police Serif</translation>
+<translation id="1949795154112250744"><ph name="BEGIN_BOLD"/>Avertissement :<ph name="END_BOLD"/> <ph name="PRODUCT_NAME"/> ne peut pas empêcher les extensions d'enregistrer votre historique de navigation. Pour désactiver cette extension en mode navigation privée, désélectionnez-la.</translation>
+<translation id="4440967101351338638">ChromiumOs Image Burn</translation>
+<translation id="1813278315230285598">Services</translation>
+<translation id="6860097299815761905">Paramètres du proxy...</translation>
+<translation id="373572798843615002">1 onglet</translation>
+<translation id="4162393307849942816"><ph name="BEGIN_BOLD"/>Vous naviguez en tant qu'invité<ph name="END_BOLD"/>. Les pages que vous consultez dans cette fenêtre n'apparaîtront pas dans l'historique de votre navigateur ni dans votre historique des recherches. Les autres traces telles que les cookies seront supprimées de l'ordinateur à la fin de votre session. En revanche, les fichiers téléchargés et les favoris créés seront conservés.
+        <ph name="LINE_BREAK"/>
+        <ph name="BEGIN_LINK"/>En savoir plus<ph name="END_LINK"/> sur le mode invité</translation>
+<translation id="827924395145979961">Chargement des pages impossible</translation>
+<translation id="3092544800441494315">Inclure cette capture d'écran :</translation>
+<translation id="7714464543167945231">Certificat</translation>
+<translation id="3616741288025931835">&amp;Effacer les données de navigation...</translation>
+<translation id="3313622045786997898">Valeur de signature du certificat</translation>
+<translation id="8535005006684281994">URL de renouvellement du certificat Netscape</translation>
+<translation id="2440604414813129000">Afficher la s&amp;ource</translation>
+<translation id="816095449251911490"><ph name="SPEED"/> - <ph name="RECEIVED_AMOUNT"/>, <ph name="TIME_REMAINING"/></translation>
+<translation id="8200772114523450471">Reprendre</translation>
+<translation id="6358975074282722691"><ph name="NUMBER_TWO"/> secs ago</translation>
+<translation id="5423849171846380976">Activé</translation>
+<translation id="6748105842970712833">Carte SIM désactivée</translation>
+<translation id="7323391064335160098">Compatibilité avec VPN</translation>
+<translation id="3929673387302322681">Développement - Instable</translation>
+<translation id="4251486191409116828">Échec de création du raccourci vers l'application</translation>
+<translation id="5190835502935405962">Barre de favoris</translation>
+<translation id="7828272290962178636">Le serveur est en mesure de répondre à la demande.</translation>
+<translation id="7823073559911777904">Modifier les paramètres du proxy...</translation>
+<translation id="5438430601586617544">(non empaquetée)</translation>
+<translation id="6460601847208524483">Rechercher le suivant</translation>
+<translation id="8433186206711564395">Paramètres réseau</translation>
+<translation id="4856478137399998590">Votre service Internet mobile est activé et prêt à l'emploi.</translation>
+<translation id="1676388805288306495">Modifier la police et la langue par défaut des pages Web</translation>
+<translation id="8969761905474557563">Composition graphique avec accélération matérielle</translation>
+<translation id="3937640725563832867">Autre nom de l'émetteur du certificat</translation>
+<translation id="4701488924964507374"><ph name="SENTENCE1"/> <ph name="SENTENCE2"/></translation>
+<translation id="1163931534039071049">&amp;Afficher le code source du cadre</translation>
+<translation id="8770196827482281187">Mode de saisie du persan (clavier ISIRI 2901)</translation>
+<translation id="6423239382391657905">OpenVPN</translation>
+<translation id="7564847347806291057">Arrêter le processus</translation>
+<translation id="1607220950420093847">Votre compte a peut-être été supprimé ou désactivé. Veuillez vous déconnecter.</translation>
+<translation id="5613695965848159202">Authentification anonyme :</translation>
+<translation id="2233320200890047564">Bases de données indexées</translation>
+<translation id="7063412606254013905">En savoir plus sur les escroqueries par phishing</translation>
+<translation id="307767688111441685">Page à l'apparence anormale</translation>
+<translation id="9076523132036239772">Adresse e-mail ou mot de passe incorrect. Essayez tout d'abord de vous connecter à un réseau.</translation>
+<translation id="6965978654500191972">Périphérique</translation>
+<translation id="1242521815104806351">Informations sur la connexion</translation>
+<translation id="5295309862264981122">Confirmer la navigation</translation>
+<translation id="1492817554256909552">Nom du point d'accès :</translation>
+<translation id="5546865291508181392">Rechercher</translation>
+<translation id="1999115740519098545">Au démarrage</translation>
+<translation id="2983818520079887040">Paramètres...</translation>
+<translation id="1465619815762735808">Lire en un clic</translation>
+<translation id="6941937518557314510">Connectez-vous à <ph name="TOKEN_NAME"/> pour vous authentifier auprès de <ph name="HOST_NAME"/> avec votre certificat.</translation>
+<translation id="2783600004153937501">Votre administrateur informatique a désactivé certaines options.</translation>
+<translation id="2099686503067610784">Supprimer le certificat de serveur &quot;<ph name="CERTIFICATE_NAME"/>&quot;?</translation>
+<translation id="9027603907212475920">Configurer la synchronisation...</translation>
+<translation id="6873213799448839504">Valider automatiquement une chaîne</translation>
+<translation id="7238585580608191973">Empreinte SHA-256</translation>
+<translation id="2501278716633472235">Retour</translation>
+<translation id="131461803491198646">Réseau domestique, sans itinérance</translation>
+<translation id="7377249249140280793"><ph name="RELATIVE_DATE"/> - <ph name="FULL_DATE"/></translation>
+<translation id="5679279978772703611">Gérer les mots de passe enregistrés...</translation>
+<translation id="4551440281920791563">Sélectionnez
+          <ph name="BEGIN_BOLD"/>
+          Menu clé à molette &gt; Options &gt; Options avancées &gt; Modifier les paramètres du proxy &gt; Paramètres réseau
+          <ph name="END_BOLD"/>
+          et désélectionnez l'option &quot;Utiliser un serveur proxy pour votre réseau local&quot;.</translation>
+<translation id="1285320974508926690">Ne jamais traduire ce site</translation>
+<translation id="8954894007019320973">(suite)</translation>
+<translation id="3748412725338508953">Trop de redirections</translation>
+<translation id="5833726373896279253">Ces paramètres ne peuvent être modifiés que par le propriétaire :</translation>
+<translation id="6858960932090176617">Active la protection XSS Auditor de WebKit (protection contre le Cross-site Scripting), une fonctionnalité qui vous protège de certaines attaques de sites malveillants et offre une sécurité accrue, mais qui n'est pas compatible avec tous les sites Web.</translation>
+<translation id="6005282720244019462">Clavier latino-américain</translation>
+<translation id="8831104962952173133">Phishing détecté !</translation>
+<translation id="5141720258550370428">Voulez-vous utiliser <ph name="HANDLER_TITLE"/> (<ph name="HANDLER_HOSTNAME"/>) pour gérer les liens <ph name="PROTOCOL"/>:// à partir de maintenant ?</translation>
+<translation id="6751344591405861699"><ph name="WINDOW_TITLE"/> (Navigation privée)</translation>
+<translation id="6681668084120808868">Prendre une photo</translation>
+<translation id="780301667611848630">Non merci</translation>
+<translation id="2812989263793994277">Ne pas afficher les images</translation>
+<translation id="7190251665563814471">Toujours autoriser ces plug-ins sur <ph name="HOST"/></translation>
+<translation id="6845383723252244143">Sélectionner un dossier</translation>
+<translation id="8925458182817574960">&amp;Paramètres</translation>
+<translation id="6361850914223837199">Informations sur l'erreur :</translation>
+<translation id="8948393169621400698">Toujours autoriser les plug-ins sur <ph name="HOST"/></translation>
+<translation id="3865082058368813534">Effacer les données de saisie automatique enregistrées</translation>
+<translation id="8288345061925649502">Changer de moteur de recherche</translation>
+<translation id="5436492226391861498">En attente du tunnel proxy...</translation>
+<translation id="3803991353670408298">Veuillez ajouter un autre mode de saisie avant de supprimer celui-ci.</translation>
+<translation id="1095623615273566396"><ph name="NUMBER_FEW"/> secondes</translation>
+<translation id="7006788746334555276">Paramètres de contenu</translation>
+<translation id="3369521687965833290">Impossible d'extraire les fichiers de l'extension. Pour effectuer cette opération en toute sécurité, vous devez disposer d'un chemin d'accès à votre répertoire de profils commençant par une lettre de lecteur et ne contenant ni jonction, ni point de montage, ni lien symbolique. Aucun chemin de ce type n'existe pour votre profil.</translation>
+<translation id="337920581046691015"><ph name="PRODUCT_NAME"/> va être installé.</translation>
+<translation id="6282194474023008486">Code postal</translation>
+<translation id="7733107687644253241">En bas à droite</translation>
+<translation id="5139955368427980650">&amp;Ouvrir</translation>
+<translation id="8136149669168180907"><ph name="DOWNLOADED_AMOUNT"/> téléchargé(s) sur <ph name="TOTAL_SIZE"/></translation>
+<translation id="7375268158414503514">Commentaires d'ordre général/Autres</translation>
+<translation id="4643612240819915418">Ou&amp;vrir la vidéo dans un nouvel onglet</translation>
+<translation id="7997479212858899587">Identité :</translation>
+<translation id="8300849813060516376">Échec de l'opération OTASP</translation>
+<translation id="2213819743710253654">Action sur la page</translation>
+<translation id="1317130519471511503">Modifier des éléments...</translation>
+<translation id="6391538222494443604">Le répertoire d'extensions est obligatoire.</translation>
+<translation id="8051695050440594747"><ph name="MEGABYTES"/> Mo disponibles</translation>
+<translation id="7088615885725309056">Ancien</translation>
+<translation id="461656879692943278"><ph name="HOST_NAME"/> fournit du contenu provenant de <ph name="ELEMENTS_HOST_NAME"/>, un site connu pour distribuer des logiciels malveillants. Votre ordinateur pourrait être infecté par un virus si vous consultez ce site.</translation>
+<translation id="1387022316521171484">Ces fonctionnalités expérimentales sont susceptibles d'être modifiées, interrompues ou supprimées à tout moment. Nous ne fournissons aucune garantie quant aux effets de leur activation. Votre navigateur pourrait bien prendre feu. Trêve de plaisanterie, il est possible que votre navigateur supprime toutes vos données ou que votre sécurité et votre vie privée soient compromises de manière inattendue. Nous vous prions d'agir avec précaution.</translation>
+<translation id="2143778271340628265">Configuration manuelle du proxy</translation>
+<translation id="5294529402252479912">Mettre à jour Adobe Reader maintenant</translation>
+<translation id="5263972071113911534"><ph name="NUMBER_MANY"/> days ago</translation>
+<translation id="7461850476009326849">Désactiver les plug-ins individuels...</translation>
+<translation id="4097411759948332224">Envoyer une capture d'écran de la page en cours</translation>
+<translation id="2231990265377706070">Point d'exclamation</translation>
+<translation id="7199540622786492483"><ph name="PRODUCT_NAME"/> n'est plus à jour, car il n'a pas été relancé depuis quelque temps. La mise à jour disponible sera installée dès que vous le relancerez.</translation>
+<translation id="8652722422052983852">Petit problème... Tentons de le résoudre.</translation>
+<translation id="5970231080121144965">Cette fonctionnalité permet d'établir des correspondances entre les sous-chaînes et plusieurs fragments d'URL figurant dans l'historique.</translation>
+<translation id="4665674675433053715">Page &quot;Nouvel onglet&quot; expérimentale</translation>
+<translation id="3726527440140411893">Les cookies suivants étaient autorisés lorsque vous avez consulté cette page :</translation>
+<translation id="3320859581025497771">votre opérateur</translation>
+<translation id="8828781037212165374">Activer ces fonctionnalités...</translation>
+<translation id="8562413501751825163">Quitter Firefox avant l'importation</translation>
+<translation id="3435541101098866721">Ajouter un nouveau téléphone</translation>
+<translation id="2448046586580826824">Proxy HTTP sécurisé</translation>
+<translation id="4032534284272647190">Accès à <ph name="URL"/> refusé.</translation>
+<translation id="4928569512886388887">Finalisation de la mise à jour du système...</translation>
+<translation id="8258002508340330928">Voulez-vous continuer ?</translation>
+<translation id="4309420042698375243"><ph name="NUM_KILOBYTES"/> Ko (<ph name="NUM_KILOBYTES_LIVE"/> Ko effectifs)</translation>
+<translation id="5554573843028719904">Autre réseau Wi-Fi...</translation>
+<translation id="5034259512732355072">Choisir un autre répertoire...</translation>
+<translation id="8885905466771744233">L'extension indiquée est déjà associée à une clé privée. Utilisez cette clé ou supprimez-la.</translation>
+<translation id="7831504847856284956">Ajouter une adresse</translation>
+<translation id="7505152414826719222">Stockage local</translation>
+<translation id="2541423446708352368">Afficher tous les téléchargements</translation>
+<translation id="4381021079159453506">Navigateur de contenu</translation>
+<translation id="8109246889182548008">Magasin de certificats</translation>
+<translation id="5030338702439866405">Émis par</translation>
+<translation id="5280833172404792470">Quitter le mode plein écran (<ph name="ACCELERATOR"/>)</translation>
+<translation id="2728127805433021124">Le certificat du serveur a été signé avec un algorithme de signature faible.</translation>
+<translation id="2137808486242513288">Ajouter un utilisateur</translation>
+<translation id="6193618946302416945">Me proposer de traduire les pages qui sont écrites dans une langue que je ne sais pas lire</translation>
+<translation id="129553762522093515">Récemment fermés</translation>
+<translation id="4287167099933143704">Saisir la clé de déverrouillage du code PIN</translation>
+<translation id="8355915647418390920"><ph name="NUMBER_FEW"/> jours</translation>
+<translation id="3129140854689651517">Rechercher du texte</translation>
+<translation id="7221585318879598658">Sans-Serif</translation>
+<translation id="5558129378926964177">Zoom &amp;avant</translation>
+<translation id="6451458296329894277">Confirmer le nouvel envoi du formulaire</translation>
+<translation id="5116333507878097773"><ph name="NUMBER_ONE"/> heure</translation>
+<translation id="8028152732786498049">Cet élément doit être installé depuis <ph name="CHROME_WEB_STORE"/>.</translation>
+<translation id="9199258761842902152">Mise en veille ou reprise</translation>
+<translation id="1851266746056575977">Mettre à jour maintenant</translation>
+<translation id="7017219178341817193">Ajouter une page</translation>
+<translation id="1038168778161626396">Chiffrer seulement</translation>
+<translation id="2756651186786928409">Ne jamais intervertir les touches de modification</translation>
+<translation id="1217515703261622005">Conversion des numéros spéciaux</translation>
+<translation id="7179921470347911571">Relancer maintenant</translation>
+<translation id="3715099868207290855">Synchronisation avec <ph name="USER_EMAIL_ADDRESS"/> effectuée</translation>
+<translation id="2679312662830811292">il y a <ph name="NUMBER_ONE"/> minute</translation>
+<translation id="9065203028668620118">Édition</translation>
+<translation id="4718464510840275738">Préférences synchronisées</translation>
+<translation id="8788572795284305350"><ph name="NUMBER_ZERO"/> hours ago</translation>
+<translation id="1177863135347784049">Personnalisé</translation>
+<translation id="8236028464988198644">Rechercher à partir de la barre d'adresse</translation>
+<translation id="4881695831933465202">Ouvrir</translation>
+<translation id="5988520580879236902">Inspecter les vues actives :</translation>
+<translation id="3593965109698325041">Contraintes de nom du certificat</translation>
+<translation id="4358697938732213860">Ajouter une adresse</translation>
+<translation id="8396532978067103567">Mot de passe incorrect.</translation>
+<translation id="5981759340456370804">Statistiques avancées</translation>
+<translation id="8160015581537295331">Clavier espagnol</translation>
+<translation id="3505920073976671674">Sélectionnez votre réseau</translation>
+<translation id="6644971472240498405"><ph name="NUMBER_ONE"/> jour</translation>
+<translation id="1782924894173027610">Le serveur de synchronisation est occupé. Veuillez réessayer ultérieurement.</translation>
+<translation id="6512448926095770873">Quitter cette page</translation>
+<translation id="5457599981699367932">Naviguer en tant qu'invité</translation>
+<translation id="3169472444629675720">Discover</translation>
+<translation id="6294193300318171613">&amp;Toujours afficher la barre de favoris</translation>
+<translation id="4088820693488683766">Options de recherche</translation>
+<translation id="3414952576877147120">Taille :</translation>
+<translation id="9098468523912235228">il y a <ph name="NUMBER_DEFAULT"/> secondes</translation>
+<translation id="7009102566764819240">La liste suivante fait état des éléments dangereux détectés sur la page. Cliquez sur le lien &quot;Diagnostic&quot; pour obtenir plus d'informations sur une ressource particulière. Si une ressource a été signalée comme site de phishing alors que vous êtes certain de sa fiabilité, cliquez sur le lien &quot;Signaler une erreur&quot;.</translation>
+<translation id="4923417429809017348">Cette page rédigée dans une langue non identifiée a été traduite en <ph name="LANGUAGE_LANGUAGE"/>.</translation>
+<translation id="3631337165634322335">Les exceptions ci-dessous s'appliquent uniquement à la session de navigation privée actuelle.</translation>
+<translation id="676327646545845024">Ne plus afficher la boîte de dialogue pour les liens de ce type</translation>
+<translation id="494645311413743213"><ph name="NUMBER_TWO"/> secondes restantes</translation>
+<translation id="1485146213770915382">Insérez <ph name="SEARCH_TERMS_LITERAL"/> dans l'URL où les termes de recherche devraient apparaître.</translation>
+<translation id="4839303808932127586">En&amp;registrer la vidéo sous...</translation>
+<translation id="5626134646977739690">Nom :</translation>
+<translation id="5854409662653665676">Si vous rencontrez des problèmes fréquents avec ce module, vous pouvez tenter d'y remédier en suivant la procédure ci-après :</translation>
+<translation id="3681007416295224113">Informations relatives au certificat</translation>
+<translation id="3046084099139788433">Activer l'onglet 7</translation>
+<translation id="721197778055552897"><ph name="BEGIN_LINK"/>En savoir plus<ph name="END_LINK"/> sur ce problème.</translation>
+<translation id="1699395855685456105">Version du matériel :</translation>
+<translation id="212464871579942993">Le site Web à l'adresse <ph name="HOST_NAME"/> contient des éléments provenant de sites qui semblent héberger des logiciels malveillants. Ces derniers peuvent nuire à votre ordinateur ou agir à votre insu. Le simple fait de visiter un site hébergeant ce type de logiciels peut infecter votre ordinateur. Ce site héberge également des informations provenant de sites signalés comme étant des sites de phishing. Ces derniers incitent les internautes à divulguer des informations personnelles en se faisant passer pour des institutions de confiance, telles que des banques.</translation>
+<translation id="8156020606310233796">Afficher la liste</translation>
+<translation id="957120528631539888">Désactivez l'affichage des messages de confirmation et le blocage de l'envoi des formulaires.</translation>
+<translation id="146000042969587795">Ce cadre a été bloqué, car il contient des éléments non sécurisés.</translation>
+<translation id="8112223930265703044">Tout</translation>
+<translation id="3968739731834770921">Kana</translation>
+<translation id="3729920814805072072">Gérer les mots de passe enregistrés...</translation>
+<translation id="7387829944233909572">Boîte de dialogue &quot;Effacer les données de navigation&quot;</translation>
+<translation id="8023801379949507775">Mettre à jour les extensions maintenant</translation>
+<translation id="6549677549082720666">Nouvelle application en arrière-plan installée</translation>
+<translation id="1983108933174595844">Envoyer une capture d'écran de la page actuelle</translation>
+<translation id="3298789223962368867">L'URL indiquée est incorrecte.</translation>
+<translation id="2202898655984161076">Un problème est survenu lors de l'affichage de la liste des imprimantes. Certaines de vos imprimantes ne sont peut-être pas correctement enregistrées dans <ph name="CLOUD_PRINT_NAME"/>.</translation>
+<translation id="6154697846084421647">Actuellement connecté</translation>
+<translation id="8241707690549784388">La page que vous recherchez a utilisé des informations que vous avez envoyées. Si vous revenez sur cette page, chaque action précédemment effectuée sera répétée. Souhaitez-vous continuer ?</translation>
+<translation id="5359419173856026110">Cette fonctionnalité indique la vitesse d'affichage réelle d'une page, en images par seconde, lorsque l'accélération matérielle est active.</translation>
+<translation id="4104163789986725820">E&amp;xporter...</translation>
+<translation id="2113479184312716848">&amp;Ouvrir un fichier...</translation>
+<translation id="8412709057120877195">Configurer le contrôle d'accès pour vos périphériques</translation>
+<translation id="486595306984036763">Ouvrir un rapport de phishing</translation>
+<translation id="3140353188828248647">Activer la barre d'adresse</translation>
+<translation id="4860787810836767172"><ph name="NUMBER_FEW"/> secs ago</translation>
+<translation id="5565871407246142825">Cartes de paiement</translation>
+<translation id="2587203970400270934">Code opérateur :</translation>
+<translation id="3355936511340229503">Erreur de connexion</translation>
+<translation id="1824910108648426227">Vous avez la possibilité de désactiver ces services.</translation>
+<translation id="3092040396860056776">Essayer d'afficher la page malgré tout</translation>
+<translation id="4350711002179453268">Impossible d'établir une connexion sécurisée avec le serveur. Le serveur a peut-être rencontré un problème ou exige un certificat d'authentification du client dont vous ne disposez pas.</translation>
+<translation id="91731790394942114">Ajouter un nouveau nom</translation>
+<translation id="5963026469094486319">Obtenir d'autres thèmes</translation>
+<translation id="2441719842399509963">Rétablir les valeurs par défaut</translation>
+<translation id="1893137424981664888">Aucun Plug-in installé.</translation>
+<translation id="3718288130002896473">Action</translation>
+<translation id="2168725742002792683">Extensions de fichier</translation>
+<translation id="1753905327828125965">Les plus visités</translation>
+<translation id="8116972784401310538">&amp;Gestionnaire de favoris</translation>
+<translation id="1849632043866553433">Caches des applications</translation>
+<translation id="3591607774768458617">Cette langue est actuellement utilisée par <ph name="PRODUCT_NAME"/>.</translation>
+<translation id="621638399744152264"><ph name="VALUE"/> %</translation>
+<translation id="4927301649992043040">Empaqueter l'extension</translation>
+<translation id="8679658258416378906">Activer l'onglet 5</translation>
+<translation id="4763816722366148126">Sélectionner le mode de saisie précédent</translation>
+<translation id="6458308652667395253">Configurer le blocage de JavaScript...</translation>
+<translation id="8435334418765210033">Réseaux mémorisés</translation>
+<translation id="6516193643535292276">Impossible de se connecter à Internet.</translation>
+<translation id="5125751979347152379">URL incorrecte</translation>
+<translation id="2791364193466153585">Informations sur la sécurité</translation>
+<translation id="4673916386520338632">Impossible d'installer l'application, car elle est en conflit avec &quot;<ph name="APP_NAME"/>&quot;, qui est déjà installé.</translation>
+<translation id="2024918351532495204">Votre périphérique n'est pas connecté.</translation>
+<translation id="6040143037577758943">Fermer</translation>
+<translation id="5787146423283493983">Accord de la clé</translation>
+<translation id="1101671447232096497"><ph name="NUMBER_MANY"/> mins ago</translation>
+<translation id="4265682251887479829">Vous ne trouvez pas ce que vous recherchez ?</translation>
+<translation id="1804251416207250805">Désactivez l'envoi des pings de contrôle des liens hypertexte.</translation>
+<translation id="5116628073786783676">En&amp;registrer le fichier audio sous...</translation>
+<translation id="2557899542277210112">Accédez rapidement à vos favoris en les ajoutant à la barre de favoris.</translation>
+<translation id="2749881179542288782">Vérifier la grammaire et l'orthographe</translation>
+<translation id="5105855035535475848">Épingler les onglets</translation>
+<translation id="6892450194319317066">Sélectionner par type d'application</translation>
+<translation id="3549436232897695316">assembler</translation>
+<translation id="5414121716219514204"><ph name="ENGINE_HOST_NAME"/> souhaite devenir votre moteur de recherche.</translation>
+<translation id="2752805177271551234">Utiliser l'historique d'entrée</translation>
+<translation id="7268365133021434339">Fermer les onglets</translation>
+<translation id="4910619056351738551">Voici quelques suggestions :</translation>
+<translation id="9131598836763251128">Sélectionnez un ou plusieurs fichiers</translation>
+<translation id="5489059749897101717">Afficher le panneau de la &amp;vérification orthographique</translation>
+<translation id="3423858849633684918">Veuillez relancer <ph name="PRODUCT_NAME"/>.</translation>
+<translation id="1232569758102978740">Sans titre</translation>
+<translation id="1903219944620007795">Pour saisir du texte, sélectionnez une langue et consultez la liste des modes de saisie disponibles.</translation>
+<translation id="4362187533051781987">Ville</translation>
+<translation id="9149866541089851383">Modifier...</translation>
+<translation id="7608619752233383356">Réinitialiser la synchronisation</translation>
+<translation id="1065245965611933814">Inclure une capture d'écran enregistrée :</translation>
+<translation id="7876243839304621966">Tout supprimer</translation>
+<translation id="5663459693447872156">Passer automatiquement en demi-chasse</translation>
+<translation id="4593021220803146968">&amp;Accéder à <ph name="URL"/></translation>
+<translation id="1128987120443782698">La capacité de ce périphérique de stockage est de <ph name="DEVICE_CAPACITY"/>. Veuillez insérer une carte SD ou une clé USB d'au moins 4 Go.</translation>
+<translation id="869257642790614972">Rouvrir le dernier onglet fermé</translation>
+<translation id="3978267865113951599">(blocage)</translation>
+<translation id="8412145213513410671">Erreurs (<ph name="CRASH_COUNT"/>)</translation>
+<translation id="560602183358579978">Traitement de la sélection...</translation>
+<translation id="7649070708921625228">Aide</translation>
+<translation id="5994107996638824097">Désolé ! La visionneuse de documents PDF intégrée à Google Chrome, nécessaire à l'affichage de l'aperçu avant impression, n'est pas incluse dans Chromium.</translation>
+<translation id="976526967778596630">Impossible d'ouvrir <ph name="HOST_NAME"/>, car vous êtes déconnecté du réseau. Cette page s'affichera dès que la connexion réseau sera rétablie. &lt;br&gt;</translation>
+<translation id="1734072960870006811">Télécopie</translation>
+<translation id="3095995014811312755">version</translation>
+<translation id="7052500709156631672">La passerelle ou le serveur proxy a reçu une réponse incorrecte d'un serveur en amont.</translation>
+<translation id="281133045296806353">Nouvelle fenêtre ouverte dans la session du navigateur</translation>
+<translation id="7144878232160441200">Réessayer</translation>
+<translation id="2860002559146138960"><ph name="PRODUCT_NAME"/> peut maintenant synchroniser vos mots de passe. Vos données seront chiffrées avec le mot de passe de votre compte Google ou le mot de passe multiterme de votre choix.</translation>
+<translation id="3951872452847539732">Les paramètres réseau de votre proxy sont gérés par une extension.</translation>
+<translation id="6442697326824312960">Retirer l'onglet</translation>
+<translation id="6382612843547381371">Valable du <ph name="START_DATE_TIME"/> au <ph name="END_DATE_TIME"/></translation>
+<translation id="6869402422344886127">Case cochée</translation>
+<translation id="5637380810526272785">Mode de saisie</translation>
+<translation id="404928562651467259">AVERTISSEMENT</translation>
+<translation id="7172053773111046550">Clavier estonien</translation>
+<translation id="497490572025913070">Ajout de bordures aux couches de rendu composées</translation>
+<translation id="9002707937526687073">Imp&amp;rimer...</translation>
+<translation id="5953934840931207585">Paramètres de saisie automatique <ph name="PRODUCT_NAME_SHORT"/></translation>
+<translation id="5556459405103347317">Rafraîchir</translation>
+<translation id="8000020256436988724">Barre d'outils</translation>
+<translation id="8326395326942127023">Nom de la base de données :</translation>
+<translation id="7507930499305566459">Certificat du répondeur d'état</translation>
+<translation id="2689915906323125315">Utiliser le mot de passe de mon compte Google</translation>
+<translation id="6440205424473899061">Vos favoris sont maintenant synchronisés avec Google Documents ! 
+Pour fusionner et synchroniser vos favoris dans <ph name="PRODUCT_NAME"/> sur un autre ordinateur, procédez de la même manière que précédemment sur l'ordinateur voulu.</translation>
+<translation id="7727721885715384408">Renommer...</translation>
+<translation id="2604243255129603442"><ph name="NAME_OF_EXTENSION"/> a été désactivé. Si vous arrêtez la synchronisation des favoris, vous pouvez la réactiver sur la page des extensions, via le menu Outils.</translation>
+<translation id="2024621544377454980">Affichage des pages impossible</translation>
+<translation id="7136694880210472378">Utiliser par défaut</translation>
+<translation id="7681202901521675750">La carte SIM est verrouillée. Veuillez saisir votre code PIN. Nombre de tentatives restantes : <ph name="TRIES_COUNT"/></translation>
+<translation id="1731346223650886555">Point-virgule</translation>
+<translation id="158849752021629804">Réseau domestique requis</translation>
+<translation id="7339763383339757376">PKCS #7, certificat unique</translation>
+<translation id="7587108133605326224">Langues baltes</translation>
+<translation id="3991936620356087075">Vous avez saisi un trop grand nombre de clés de verrouillage du code PIN incorrectes. Votre carte SIM est définitivement désactivée.</translation>
+<translation id="936801553271523408">Données de diagnostic système</translation>
+<translation id="6389701355360299052">Page Web, contenu HTML uniquement</translation>
+<translation id="8067791725177197206">Continuer »</translation>
+<translation id="9009144784540995197">Gérez vos imprimantes.</translation>
+<translation id="1055006259534905434">(Choisir un problème dans la liste ci-dessous)</translation>
+<translation id="3021678814754966447">&amp;Afficher le code source du cadre</translation>
+<translation id="8601206103050338563">Authentification du client WWW TLS</translation>
+<translation id="1692799361700686467">Les cookies de plusieurs sites sont autorisés.</translation>
+<translation id="7074488040076962230">Impossible d'afficher la page de la barre latérale &quot;<ph name="SIDEBAR_PAGE"/>&quot;.</translation>
+<translation id="529232389703829405">Vous avez acheté <ph name="DATA_AMOUNT"/> de données le <ph name="DATE"/>.</translation>
+<translation id="5271549068863921519">Enregistrer le mot de passe</translation>
+<translation id="4345587454538109430">Configurer...</translation>
+<translation id="8148264977957212129">Mode de saisie du pinyin</translation>
+<translation id="5787378733537687553">Intervertir les touches Ctrl et Alt de gauche</translation>
+<translation id="7772032839648071052">Confirmer le mot de passe multiterme</translation>
+<translation id="6857811139397017780">Activer <ph name="NETWORKSERVICE"/></translation>
+<translation id="3251855518428926750">Ajouter...</translation>
+<translation id="4120075327926916474">Voulez-vous que Google Chrome enregistre ces informations de carte de paiement pour le remplissage de formulaires Web ?</translation>
+<translation id="6929555043669117778">Continuer à bloquer les fenêtres pop-up</translation>
+<translation id="5864471791310927901">Échec de la vérification DHCP</translation>
+<translation id="3508920295779105875">Choisir un autre dossier...</translation>
+<translation id="2503458975635466059">Le profil semble être utilisé par le processus <ph name="PROCESS_ID"/> sur l'hôte <ph name="HOST_NAME"/>. Si vous êtes certain qu'aucun autre processus n'utilise ce profil, supprimez le fichier <ph name="LOCK_FILE"/> et relancez <ph name="PRODUCT_NAME"/>.</translation>
+<translation id="2987775926667433828">Chinois traditionnel</translation>
+<translation id="6684737638449364721">Effacer les données de navigation...</translation>
+<translation id="3954582159466790312">Ré&amp;activer le son</translation>
+<translation id="1110772031432362678">Aucun réseau trouvé.</translation>
+<translation id="3936390757709632190">&amp;Ouvrir le fichier audio dans un nouvel onglet</translation>
+<translation id="7297622089831776169">&amp;Méthodes d'entrée</translation>
+<translation id="5731698828607291678">Onglets ou fenêtres</translation>
+<translation id="1152775729948968688">Toutefois, cette page inclut d'autres ressources qui ne sont pas sécurisées. Ces ressources peuvent être consultées par des tiers pendant leur transfert, et modifiées par un pirate informatique dans le but de changer le comportement de cette page.</translation>
+<translation id="604124094241169006">Automatique</translation>
+<translation id="862542460444371744">&amp;Extensions</translation>
+<translation id="8045462269890919536">Roumain</translation>
+<translation id="6320286250305104236">Paramètres du réseau...</translation>
+<translation id="2927657246008729253">Changer...</translation>
+<translation id="7978412674231730200">Clé privée</translation>
+<translation id="464745974361668466">Format :</translation>
+<translation id="5308380583665731573">Se connecter</translation>
+<translation id="9111395131601239814"><ph name="NETWORKDEVICE"/> : <ph name="STATUS"/></translation>
+<translation id="9049981332609050619">Vous avez tenté de contacter <ph name="DOMAIN"/>, mais le certificat présenté par le serveur est incorrect.</translation>
+<translation id="4414232939543644979">Nouvelle fenêtre de nav&amp;igation privée</translation>
+<translation id="1693754753824026215">La page à l'adresse <ph name="SITE"/> indique :</translation>
+<translation id="7148804936871729015">Le serveur associé à <ph name="URL"/> n'a pas répondu à temps. Cela peut être dû à une surcharge.</translation>
+<translation id="5950967683057767490">L2TP/IPSec + Clé pré-partagée</translation>
+<translation id="8108473539339615591">XSS Auditor</translation>
+<translation id="1902576642799138955">Durée de validité</translation>
+<translation id="4910021444507283344">WebGL</translation>
+<translation id="6692173217867674490">Mot de passe multiterme erroné</translation>
+<translation id="5550431144454300634">Corriger automatiquement la saisie</translation>
+<translation id="3308006649705061278">Unité d'organisation</translation>
+<translation id="8912362522468806198">Compte Google</translation>
+<translation id="4443536555189480885">&amp;Aide</translation>
+<translation id="340485819826776184">Utiliser un service de prédiction afin de compléter les recherches et les URL saisies dans la barre d'adresse</translation>
+<translation id="4074900173531346617">Certificat du signataire de courrier électronique</translation>
+<translation id="6165508094623778733">En savoir plus</translation>
+<translation id="9052208328806230490">Vous avez enregistré vos imprimantes sur <ph name="CLOUD_PRINT_NAME"/> via le compte <ph name="EMAIL"/>.</translation>
+<translation id="822618367988303761">il y a <ph name="NUMBER_TWO"/> jours</translation>
+<translation id="7928333295097642153"><ph name="HOUR"/>:<ph name="MINUTE"/> restantes</translation>
+<translation id="7568593326407688803">Cette page est en<ph name="ORIGINAL_LANGUAGE"/>Voulez-vous la traduire ?</translation>
+<translation id="563969276220951735">Saisie automatique des formulaires</translation>
+<translation id="6870130893560916279">Clavier ukrainien</translation>
+<translation id="8629974950076222828">Ouvrir tous les favoris dans une fenêtre de navigation privée</translation>
+<translation id="3126026824346185272">Ctrl</translation>
+<translation id="4745438305783437565"><ph name="NUMBER_FEW"/> minutes</translation>
+<translation id="2649911884196340328">Le certificat de sécurité du serveur contient des erreurs !</translation>
+<translation id="6666647326143344290">avec votre compte Google</translation>
+<translation id="3828029223314399057">Rechercher dans les favoris</translation>
+<translation id="4885705234041587624">MSCHAPv2</translation>
+<translation id="5614190747811328134">Avertissement utilisateur</translation>
+<translation id="8906421963862390172">&amp;Options du vérificateur d'orthographe</translation>
+<translation id="9046895021617826162">Échec de la connexion</translation>
+<translation id="1492188167929010410">Identifiant de l'erreur <ph name="CRASH_ID"/></translation>
+<translation id="1963692530539281474"><ph name="NUMBER_DEFAULT"/> jours restants</translation>
+<translation id="4470270245053809099">Émis par : <ph name="NAME"/></translation>
+<translation id="5365539031341696497">Mode de saisie du thaï (clavier Kesmanee)</translation>
+<translation id="2403091441537561402">Passerelle :</translation>
+<translation id="6337234675334993532">Chiffrement</translation>
+<translation id="668171684555832681">Autre...</translation>
+<translation id="1932098463447129402">Pas avant le</translation>
+<translation id="7845920762538502375"><ph name="PRODUCT_NAME"/> n'a pas pu synchroniser vos données, car la connexion avec le serveur de synchronisation n'a pas pu être établie. Nouvel essai...</translation>
+<translation id="2192664328428693215">Me demander lorsqu'un site souhaite afficher des notifications sur le Bureau (recommandé)</translation>
+<translation id="6708242697268981054">Source :</translation>
+<translation id="4786993863723020412">Erreur de lecture du cache</translation>
+<translation id="6630452975878488444">Raccourci de sélection</translation>
+<translation id="8709969075297564489">Vérifier la révocation du certificat serveur</translation>
+<translation id="8698171900303917290">Vous rencontrez des problèmes lors de l'installation ?</translation>
+<translation id="830868413617744215">Bêta</translation>
+<translation id="5925147183566400388">Pointeur de la déclaration CPS (Certification Practice Statement)</translation>
+<translation id="1497270430858433901">Le <ph name="DATE"/>, vous avez reçu <ph name="DATA_AMOUNT"/> à utiliser librement.</translation>
+<translation id="8150167929304790980">Nom complet</translation>
+<translation id="636850387210749493">Inscription d'entreprise</translation>
+<translation id="1947424002851288782">Clavier allemand</translation>
+<translation id="932508678520956232">Impossible de lancer l'impression.</translation>
+<translation id="4861833787540810454">&amp;Lire</translation>
+<translation id="2552545117464357659">Récent</translation>
+<translation id="7269802741830436641">Cette page Web présente une boucle de redirection.</translation>
+<translation id="4180788401304023883">Supprimer le certificat &quot;<ph name="CERTIFICATE_NAME"/>&quot; émis par l'autorité de certification ?</translation>
+<translation id="5869522115854928033">Mots de passe enregistrés</translation>
+<translation id="2089090684895656482">Moins</translation>
+<translation id="1709220265083931213">Options avancées</translation>
+<translation id="5748266869826978907">Vérifiez vos paramètres DNS. Contactez votre administrateur réseau si vous n'êtes pas sûr de vous.</translation>
+<translation id="4771973620359291008">Une erreur inconnue s'est produite.</translation>
+<translation id="5509914365760201064">Émetteur : <ph name="CERTIFICATE_AUTHORITY"/></translation>
+<translation id="7073385929680664879">Passer d'un mode de saisie à l'autre</translation>
+<translation id="6898699227549475383">Organisation (O)</translation>
+<translation id="4333854382783149454">PKCS #1 SHA-1 avec chiffrement RSA</translation>
+<translation id="762904068808419792">Entrez la requête de recherche ici.</translation>
+<translation id="8615618338313291042">Application en mode navigation privée : <ph name="APP_NAME"/></translation>
+<translation id="978146274692397928">La largeur de ponctuation initiale est Complète</translation>
+<translation id="8959027566438633317">Installer <ph name="EXTENSION_NAME"/> ?</translation>
+<translation id="8155798677707647270">Installation d'une nouvelle version...</translation>
+<translation id="6886871292305414135">Ouvrir le lien dans un nouvel ongle&amp;t</translation>
+<translation id="1639192739400715787">Pour accéder aux paramètres de sécurité, saisissez le code PIN de la carte SIM.</translation>
+<translation id="7961015016161918242">Jamais</translation>
+<translation id="3950924596163729246">Impossible d'accéder au réseau.</translation>
+<translation id="2835170189407361413">Effacer le formulaire</translation>
+<translation id="4631110328717267096">Échec de la mise à jour du système</translation>
+<translation id="3695919544155087829">Saisissez le mot de passe utilisé pour chiffrer ce fichier de certificat.</translation>
+<translation id="2230051135190148440">CHAP</translation>
+<translation id="6308937455967653460">Enregistrer le lie&amp;n sous...</translation>
+<translation id="5421136146218899937">Effacer les données de navigation...</translation>
+<translation id="5783059781478674569">Options de reconnaissance vocale</translation>
+<translation id="5441100684135434593">Réseau câblé</translation>
+<translation id="3285322247471302225">Nouvel ongle&amp;t</translation>
+<translation id="3943582379552582368">R&amp;etour</translation>
+<translation id="7607002721634913082">Téléchargement suspendu</translation>
+<translation id="480990236307250886">Ouvrir la page d'accueil</translation>
+<translation id="8286036467436129157">Connexion</translation>
+<translation id="5999940714422617743">L'installation de <ph name="EXTENSION_NAME"/> est terminée.</translation>
+<translation id="1122198203221319518">&amp;Outils</translation>
+<translation id="5757539081890243754">Page d'accueil</translation>
+<translation id="2760009672169282879">Clavier phonétique bulgare</translation>
+<translation id="6608140561353073361">Cookies et données de site...</translation>
+<translation id="8007030362289124303">Batterie faible</translation>
+<translation id="4513946894732546136">Commentaires</translation>
+<translation id="1135328998467923690">Package incorrect : &quot;<ph name="ERROR_CODE"/>&quot;.</translation>
+<translation id="5906719743126878045"><ph name="NUMBER_TWO"/> heures restantes</translation>
+<translation id="1753682364559456262">Configurer les paramètres de blocage des images...</translation>
+<translation id="6550675742724504774">Options</translation>
+<translation id="8959208747503200525"><ph name="NUMBER_TWO"/> hours ago</translation>
+<translation id="431076611119798497">&amp;Détails</translation>
+<translation id="737801893573836157">Masquer la barre de titre du système et utiliser les bordures</translation>
+<translation id="5352235189388345738">Elle peut accéder aux éléments suivants :</translation>
+<translation id="5040262127954254034">Confidentialité</translation>
+<translation id="7666868073052500132">Objets : <ph name="USAGES"/></translation>
+<translation id="6985345720668445131">Paramètres d'entrée du japonais</translation>
+<translation id="3258281577757096226">Sebeol-sik Final</translation>
+<translation id="6906268095242253962">Veuillez vous connecter à Internet pour continuer.</translation>
+<translation id="1908748899139377733">Afficher les &amp;infos sur le cadre</translation>
+<translation id="803771048473350947">Fichier</translation>
+<translation id="6206311232642889873">Cop&amp;ier l'image</translation>
+<translation id="5158983316805876233">Utiliser le même proxy pour tous les protocoles</translation>
+<translation id="7108338896283013870">Masquer</translation>
+<translation id="3366404380928138336">Requête de protocole externe</translation>
+<translation id="5300589172476337783">Afficher</translation>
+<translation id="3160041952246459240">Certains de vos certificats enregistrés identifient ces serveurs :</translation>
+<translation id="566920818739465183">Vous avez visité ce site pour la première fois le <ph name="VISIT_DATE"/>.</translation>
+<translation id="2961695502793809356">Cliquer pour avancer, maintenir pour voir l'historique</translation>
+<translation id="4092878864607680421">La dernière version de l'application &quot;<ph name="APP_NAME"/>&quot; requiert d'autres autorisations. Elle a donc été désactivée.</translation>
+<translation id="8421864404045570940"><ph name="NUMBER_DEFAULT"/> secondes</translation>
+<translation id="5828228029189342317">Vous avez choisi d'ouvrir automatiquement certains types de fichiers après leur téléchargement.</translation>
+<translation id="1416836038590872660">EAP-MD5</translation>
+<translation id="176587472219019965">&amp;Nouvelle fenêtre</translation>
+<translation id="2788135150614412178">+</translation>
+<translation id="4055738107007928968">Vous avez essayé d'accéder au site <ph name="DOMAIN"/>, mais le serveur a présenté un certificat signé avec un algorithme de signature faible. Il se peut que les informations d'identification fournies par le serveur aient été falsifiées. Le serveur n'est peut-être pas celui auquel vous souhaitez accéder (il peut s'agir d'une tentative de piratage). Nous nous déconseillons vivement de continuer.</translation>
+<translation id="5308689395849655368">L'envoi de rapports d'erreur est désactivé.</translation>
+<translation id="8372369524088641025">Clé WEP incorrecte</translation>
+<translation id="8689341121182997459">Date d'expiration :</translation>
+<translation id="899403249577094719">URL de base du certificat Netscape</translation>
+<translation id="2737363922397526254">Réduire...</translation>
+<translation id="4880827082731008257">Rechercher dans l'historique</translation>
+<translation id="8661290697478713397">Ouvrir le lien dans la fenêtre de navi&amp;gation privée</translation>
+<translation id="4197700912384709145"><ph name="NUMBER_ZERO"/> secondes</translation>
+<translation id="7454780465968211330">Historique avancé pour le champ polyvalent</translation>
+<translation id="2158448795143567596">Active l'utilisation de graphismes 3D dans les éléments canvas via l'API WebGL.</translation>
+<translation id="1702534956030472451">Occident</translation>
+<translation id="6636709850131805001">État non reconnu</translation>
+<translation id="6095984072944024315">−</translation>
+<translation id="9141716082071217089">Impossible de vérifier si le certificat du serveur a été révoqué.</translation>
+<translation id="4304224509867189079">Se connecter</translation>
+<translation id="5332624210073556029">Fuseau horaire :</translation>
+<translation id="4799797264838369263">Cette option est soumise à une stratégie d'entreprise. Contactez votre administrateur pour plus d'informations.</translation>
+<translation id="4492190037599258964">Résultats de recherche pour &quot;<ph name="SEARCH_STRING"/>&quot;</translation>
+<translation id="3573179567135747900">Revenir à &quot;<ph name="FROM_LOCALE"/>&quot; (redémarrage requis)</translation>
+<translation id="2238123906478057869"><ph name="PRODUCT_NAME"/> va exécuter les tâches suivantes :</translation>
+<translation id="4042471398575101546">Ajouter la page</translation>
+<translation id="8848709220963126773">Changement de mode via la touche Maj</translation>
+<translation id="4871865824885782245">Options de date et d'heure...</translation>
+<translation id="8828933418460119530">Nom DNS</translation>
+<translation id="988159990683914416">Build de développement</translation>
+<translation id="8026354464835030469"><ph name="BURNT_AMOUNT"/> sur ...</translation>
+<translation id="4114470632216071239">Verrouiller la carte SIM (code PIN obligatoire pour utiliser les données mobiles)</translation>
+<translation id="2183426022964444701">Sélectionnez le répertoire racine de l'extension.</translation>
+<translation id="2517143724531502372">Les cookies de <ph name="DOMAIN"/> sont autorisés uniquement pour cette session.</translation>
+<translation id="9018524897810991865">Confirmer les préférences de synchronisation</translation>
+<translation id="4719905780348837473">RSN</translation>
+<translation id="5212108862377457573">Ajuster la conversion en fonction de l'entrée précédente</translation>
+<translation id="5398353896536222911">Afficher le panneau de la &amp;vérification orthographique</translation>
+<translation id="5811533512835101223">(Revenir à la capture d'écran d'origine)</translation>
+<translation id="5131817835990480221">Mettre à jour &amp;<ph name="PRODUCT_NAME"/></translation>
+<translation id="939519157834106403">SSID</translation>
+<translation id="3705722231355495246">-</translation>
+<translation id="2635102990349508383">Les informations de connexion au compte n'ont pas encore été saisies.</translation>
+<translation id="6902055721023340732">URL de configuration automatique</translation>
+<translation id="4268574628540273656">URL :</translation>
+<translation id="7481312909269577407">Avancer</translation>
+<translation id="3759876923365568382"><ph name="NUMBER_FEW"/> jours restants</translation>
+<translation id="295228163843771014">Vous avez choisi de ne pas synchroniser les mots de passe. Vous pouvez à tout moment modifier vos paramètres de synchronisation, si vous changez d'avis.</translation>
+<translation id="5972826969634861500">Lancer <ph name="PRODUCT_NAME"/></translation>
+<translation id="7828702903116529889"><ph name="PRODUCT_NAME"/>
+        ne parvient pas à accéder au réseau.
+        <ph name="LINE_BREAK"/>
+        Il est possible que votre pare-feu ou votre antivirus considère
+        <ph name="PRODUCT_NAME"/>
+        comme un intrus dans votre ordinateur et qu'il bloque ses tentatives de connexion à Internet.</translation>
+<translation id="878069093594050299">Ce certificat a été vérifié pour les utilisations suivantes :</translation>
+<translation id="5852112051279473187">Petit problème ! Une erreur est survenue lors de l'inscription de ce périphérique. Veuillez réessayer ou contacter votre représentant de l'assistance technique.</translation>
+<translation id="1664314758578115406">Ajouter aux favoris</translation>
+<translation id="7088418943933034707">Gérer les certificats...</translation>
+<translation id="8482183012530311851">Analyse du périphérique...</translation>
+<translation id="3127589841327267804">PYJJ</translation>
+<translation id="8808478386290700967">Web Store</translation>
+<translation id="1732215134274276513">Annuler l'épinglage des onglets</translation>
+<translation id="4084682180776658562">Favori</translation>
+<translation id="8859057652521303089">Sélectionnez votre langue :</translation>
+<translation id="3030138564564344289">Réessayer le téléchargement</translation>
+<translation id="8525552230188318924">Configurer la synchronisation des mots de passe</translation>
+<translation id="4381091992796011497">Nom d'utilisateur :</translation>
+<translation id="5830720307094128296">Enregistrer la p&amp;age sous...</translation>
+<translation id="8114439576766120195">Vos données sur tous les sites Web</translation>
+<translation id="4668954208278016290">Un problème est survenu lors de l'extraction de l'image sur l'ordinateur.</translation>
+<translation id="5822838715583768518">Lancer l'application</translation>
+<translation id="3942974664341190312">Dubeol-sik</translation>
+<translation id="8477241577829954800">Remplacé</translation>
+<translation id="6735304988756581115">Afficher les cookies et autres données de site...</translation>
+<translation id="3048564749795856202">Si vous pensez avoir cerné les risques, vous pouvez <ph name="PROCEED_LINK"/>.</translation>
+<translation id="2433507940547922241">Apparence</translation>
+<translation id="839072384475670817">Créer des raccourci&amp;s vers des applications...</translation>
+<translation id="1478632774608054702">Exécuter le flash PPAPI dans le processus du moteur de rendu</translation>
+<translation id="6756161853376828318">Définir <ph name="PRODUCT_NAME"/> en tant que navigateur par défaut</translation>
+<translation id="9112614144067920641">Veuillez choisir un nouveau code PIN.</translation>
+<translation id="2061855250933714566"><ph name="ENCODING_CATEGORY"/> (<ph name="ENCODING_NAME"/>)</translation>
+<translation id="7138678301420049075">Autre</translation>
+<translation id="9147392381910171771">&amp;Options</translation>
+<translation id="1803557475693955505">Impossible de charger la page d'arrière-plan &quot;<ph name="BACKGROUND_PAGE"/>&quot;.</translation>
+<translation id="5818334088068591797">À quel niveau rencontrez-vous des problèmes ? (Champ obligatoire)</translation>
+<translation id="6264485186158353794">Retour à la sécurité</translation>
+<translation id="5130080518784460891">Eten</translation>
+<translation id="5847724078457510387">Ce site répertorie tous ses certificats valides dans le système DNS. Un certificat non répertorié a cependant été utilisé par le serveur.</translation>
+<translation id="1394853081832053657">Options de reconnaissance vocale</translation>
+<translation id="5037676449506322593">Tout sélectionner</translation>
+<translation id="2785530881066938471">Impossible de charger le fichier &quot;<ph name="RELATIVE_PATH"/>&quot; pour le script de contenu, car ce fichier n'est pas codé en UTF-8.</translation>
+<translation id="3807747707162121253">&amp;Annuler</translation>
+<translation id="3306897190788753224">Désactiver temporairement la personnalisation des conversions, les suggestions basées sur l'historique et le dictionnaire utilisateur</translation>
+<translation id="2574102660421949343">Les cookies de <ph name="DOMAIN"/> sont autorisés.</translation>
+<translation id="77999321721642562">Au fil du temps, la zone ci-dessous affichera les huit sites que vous avez le plus visités.</translation>
+<translation id="1503894213707460512">Le plug-in <ph name="PLUGIN_NAME"/> a besoin de votre autorisation pour s'exécuter.</translation>
+<translation id="471800408830181311">Échec de création de clé privée</translation>
+<translation id="1273291576878293349">Ouvrir tous les favoris dans une fenêtre de navigation privée</translation>
+<translation id="1639058970766796751">Placer dans la file d'attente</translation>
+<translation id="1177437665183591855">Erreur de certificat serveur inconnue</translation>
+<translation id="8467473010914675605">Mode de saisie du coréen</translation>
+<translation id="3819800052061700452">&amp;Plein écran</translation>
+<translation id="5419540894229653647"><ph name="ERROR_DESCRIPTION_TEXT"/>
+        <ph name="LINE_BREAK"/>
+        Vous pouvez essayer de diagnostiquer le problème en procédant comme suit :
+        <ph name="LINE_BREAK"/>
+        <ph name="PLATFORM_TEXT"/></translation>
+<translation id="3533943170037501541">Bienvenue sur votre page d'accueil !</translation>
+<translation id="2333340435262918287">Vos modifications seront prises en compte au prochain démarrage de <ph name="PRODUCT_NAME"/>.</translation>
+<translation id="5906065664303289925">Adresse du matériel :</translation>
+<translation id="3178000186192127858">Lecture seule</translation>
+<translation id="2187895286714876935">Erreur d'importation du certificat serveur</translation>
+<translation id="5460896875189097758">Données stockées localement</translation>
+<translation id="4618990963915449444">Tous les fichiers de <ph name="DEVICE_NAME"/> vont être effacés.</translation>
+<translation id="614998064310228828">Modèle du périphérique :</translation>
+<translation id="1581962803218266616">Afficher dans le Finder</translation>
+<translation id="6096326118418049043">Nom X.500</translation>
+<translation id="6086259540486894113">Vous devez sélectionner au moins un type de données à synchroniser.</translation>
+<translation id="923467487918828349">Tout afficher</translation>
+<translation id="5101042277149003567">Ouvrir tous les favoris</translation>
+<translation id="4298972503445160211">Clavier danois</translation>
+<translation id="6621440228032089700">Cette fonctionnalité permet de réaliser un rendu hors écran de la texture, au lieu d'un affichage direct.</translation>
+<translation id="3488065109653206955">Partiellement activé</translation>
+<translation id="1481244281142949601">Votre système Sandbox est correctement configuré.</translation>
+<translation id="4849517651082200438">Ne pas installer</translation>
+<translation id="8602882075393902833">Activer la recherche instantanée pour accélérer la recherche et la navigation</translation>
+<translation id="6349678711452810642">Utiliser par défaut</translation>
+<translation id="6263284346895336537">Non essentielle</translation>
+<translation id="6409731863280057959">Fenêtres pop-up</translation>
+<translation id="3459774175445953971">Dernière modification :</translation>
+<translation id="73289266812733869">Désélectionné</translation>
+<translation id="3435738964857648380">Sécurité</translation>
+<translation id="9112987648460918699">Rechercher...</translation>
+<translation id="2231233239095101917">Le script de la page utilisait trop de mémoire. Rafraîchissez la page pour réactiver le script.</translation>
+<translation id="870805141700401153">Signature du code individuel Microsoft</translation>
+<translation id="5119173345047096771">Mozilla Firefox</translation>
+<translation id="9020278534503090146">Page Web inaccessible</translation>
+<translation id="4768698601728450387">Recadrer l'image</translation>
+<translation id="6245028464673554252">Si vous fermez <ph name="PRODUCT_NAME"/> maintenant, le téléchargement sera annulé.</translation>
+<translation id="3943857333388298514">Coller</translation>
+<translation id="385051799172605136">Retour</translation>
+<translation id="1742300158964248589">Impossible de graver l'image.</translation>
+<translation id="2670965183549957348">Mode de saisie du Chewing</translation>
+<translation id="5095208057601539847">Province</translation>
+<translation id="4085298594534903246">JavaScript a été bloqué sur cette page.</translation>
+<translation id="5630492933376732170">Remarque : Lorsque vous cliquez sur &quot;Envoyer&quot;, Google Chrome OS
+        joint à votre envoi un journal des événements système de
+         votre périphérique. Ces informations nous permettent de diagnostiquer les
+         problèmes, de comprendre comment vous interagissez avec votre
+         périphérique et d'améliorer les performances de ce dernier. Les
+         informations personnelles fournies sciemment dans vos commentaires ou 
+         involontairement dans les journaux système et la capture d'écran sont
+         protégées conformément à nos <ph name="BEGIN_LINK"/>Règles de confidentialité<ph name="END_LINK"/>.
+        Si vous ne souhaitez pas envoyer de journaux système, décochez la case
+        &quot;Inclure les informations système&quot;.</translation>
+<translation id="4341977339441987045">Interdire à tous les sites de stocker des données</translation>
+<translation id="806812017500012252">Trier par nom</translation>
+<translation id="3781751432212184938">Afficher un aperçu des onglets...</translation>
+<translation id="2960316970329790041">Annuler l'importation</translation>
+<translation id="3835522725882634757">Ce serveur envoie des données que <ph name="PRODUCT_NAME"/> ne comprend pas. Veuillez <ph name="BEGIN_LINK"/>signaler un bug<ph name="END_LINK"/> et inclure la <ph name="BEGIN2_LINK"/>liste des raw<ph name="END2_LINK"/>.</translation>
+<translation id="5361734574074701223">Calcul de la durée restante</translation>
+<translation id="6937152069980083337">Mode de saisie Google du japonais (pour clavier américain)</translation>
+<translation id="1731911755844941020">Envoi de la requête...</translation>
+<translation id="8371695176452482769">Parlez maintenant</translation>
+<translation id="2988488679308982380">Impossible d'installer le package : &quot;<ph name="ERROR_CODE"/>&quot;</translation>
+<translation id="2904079386864173492">Modèle :</translation>
+<translation id="3447644283769633681">Bloquer tous les cookies tiers</translation>
+<translation id="8917047707340793412">Remplacer par <ph name="ENGINE_NAME"/></translation>
+<translation id="6129953537138746214">Espace</translation>
+<translation id="3704331259350077894">Arrêt du fonctionnement</translation>
+<translation id="5801568494490449797">Préférences</translation>
+<translation id="1038842779957582377">Nom inconnu</translation>
+<translation id="5327248766486351172">Nom</translation>
+<translation id="5553784454066145694">Choisir un nouveau code PIN</translation>
+<translation id="8989148748219918422"><ph name="ORGANIZATION"/> [<ph name="COUNTRY"/>]</translation>
+<translation id="4664482161435122549">Erreur d'exportation de fichier PKCS #12</translation>
+<translation id="2445081178310039857">Le répertoire racine de l'extension doit être indiqué.</translation>
+<translation id="8251578425305135684">Miniature supprimée</translation>
+<translation id="6163522313638838258">Tout développer...</translation>
+<translation id="3037605927509011580">Aie aie aie</translation>
+<translation id="5803531701633845775">Choisir les expressions en arrière-plan, sans déplacer le pointeur</translation>
+<translation id="1918141783557917887">Plu&amp;s petit</translation>
+<translation id="6996550240668667907">Afficher le clavier en superposition</translation>
+<translation id="4065006016613364460">C&amp;opier l'URL de l'image</translation>
+<translation id="6965382102122355670">OK</translation>
+<translation id="8000066093800657092">Aucun réseau détecté</translation>
+<translation id="4481249487722541506">Charger l'extension non empaquetée...</translation>
+<translation id="8180239481735238521">page</translation>
+<translation id="8321738493186308836">Active l'interface utilisateur et le code de support pour le processus du service de communication à distance, de même que le plug-in client. Avertissement : ce service n'est actuellement disponible que pour les tests de développeurs. Si vous ne faites pas partie de l'équipe de développement et ne figurez pas sur la liste blanche, aucun élément de l'interface utilisateur activée ne fonctionnera.</translation>
+<translation id="2963783323012015985">Clavier turc</translation>
+<translation id="2149973817440762519">Modifier le favori</translation>
+<translation id="5431318178759467895">Couleur</translation>
+<translation id="7064842770504520784">Personnaliser les paramètres de synchronisation...</translation>
+<translation id="2784407158394623927">Activation de votre service Internet mobile</translation>
+<translation id="3679848754951088761"><ph name="SOURCE_ORIGIN"/></translation>
+<translation id="6920989436227028121">Ouvrir dans un onglet standard</translation>
+<translation id="4057041477816018958"><ph name="SPEED"/> - <ph name="RECEIVED_AMOUNT"/></translation>
+<translation id="2050339315714019657">Portrait</translation>
+<translation id="6978839998405419496"><ph name="NUMBER_ZERO"/> days ago</translation>
+<translation id="6139139147415955203">Active un service en arrière-plan qui connecte le service <ph name="CLOUD_PRINT_NAME"/> aux éventuelles imprimantes installées sur cet ordinateur. Une fois ce labo activé, vous pouvez lancer <ph name="CLOUD_PRINT_NAME"/> en vous connectant à votre compte Google via Options/Préférences dans la section Options avancées.</translation>
+<translation id="5112577000029535889">Outils de &amp;développement</translation>
+<translation id="2301382460326681002">Le répertoire racine de l'extension est incorrect.</translation>
+<translation id="7839192898639727867">ID de clé de l'objet du certificat</translation>
+<translation id="4759238208242260848">Téléchargements</translation>
+<translation id="2879560882721503072">Le stockage du certificat client généré par <ph name="ISSUER"/> a réussi.</translation>
+<translation id="1275718070701477396">Sélectionnée</translation>
+<translation id="1178581264944972037">Suspendre</translation>
+<translation id="6492313032770352219">Taille sur le disque :</translation>
+<translation id="5233231016133573565">ID du processus</translation>
+<translation id="5941711191222866238">Réduire</translation>
+<translation id="4121428309786185360">Expire le</translation>
+<translation id="2049137146490122801">Votre administrateur a désactivé l'accès aux fichiers locaux sur votre ordinateur.</translation>
+<translation id="1146498888431277930">Erreur de connexion SSL</translation>
+<translation id="8041089156583427627">Envoyer</translation>
+<translation id="6394627529324717982">Virgule</translation>
+<translation id="253434972992662860">&amp;Pause</translation>
+<translation id="335985608243443814">Parcourir...</translation>
+<translation id="7802488492289385605">Mode de saisie Google du japonais (pour clavier Dvorak américain)</translation>
+<translation id="7452120598248906474">Police à largeur fixe</translation>
+<translation id="3129687551880844787">Stockage de session</translation>
+<translation id="7427348830195639090">Page en arrière-plan : <ph name="BACKGROUND_PAGE_URL"/></translation>
+<translation id="5898154795085152510">Le serveur a renvoyé un certificat client incorrect. Erreur <ph name="ERROR_NUMBER"/> (<ph name="ERROR_NAME"/>)</translation>
+<translation id="2704184184447774363">Signature de document Microsoft</translation>
+<translation id="5677928146339483299">Bloqué</translation>
+<translation id="1474842329983231719">Gérer les paramètres d'impression...</translation>
+<translation id="2455981314101692989">Cette page Web a désactivé la saisie automatique dans ce formulaire.</translation>
+<translation id="1646136617204068573">Clavier hongrois</translation>
+<translation id="5988840637546770870">Les versions en développement permettent de tester de nouvelles idées, mais elles peuvent s'avérer très instables. Nous vous prions d'agir avec précaution.</translation>
+<translation id="3569713929051927529">Ajouter un dossier...</translation>
+<translation id="4032664149172368180">Mode de saisie du japonais (pour clavier Dvorak américain)</translation>
+<translation id="3748706263662799310">Signaler un bug</translation>
+<translation id="7167486101654761064">&amp;Toujours ouvrir les fichiers de ce type</translation>
+<translation id="4283623729247862189">Disque optique</translation>
+<translation id="5826507051599432481">Nom commun</translation>
+<translation id="8914326144705007149">Très grande</translation>
+<translation id="4215444178533108414">Modification terminée</translation>
+<translation id="5154702632169343078">Objet</translation>
+<translation id="2273562597641264981">Opérateur :</translation>
+<translation id="122082903575839559">Algorithme de signature du certificat</translation>
+<translation id="2181257377760181418">Cette fonctionnalité permet d'afficher un onglet d'aperçu avant de lancer une impression.</translation>
+<translation id="7240120331469437312">Autre nom de l'objet du certificat</translation>
+<translation id="6900113680982781280">Activer la saisie automatique pour remplir les formulaires Web d'un simple clic</translation>
+<translation id="1131850611586448366">Le site Web à l'adresse <ph name="HOST_NAME"/> a été signalé comme étant un site de phishing. Ces sites tentent d'amener les internautes à divulguer leurs informations personnelles en se faisant passer pour des institutions de confiance, telles que des banques.</translation>
+<translation id="5413218268059792983">Rechercher directement sur <ph name="SEARCH_ENGINE"/></translation>
+<translation id="1161575384898972166">Connectez-vous à <ph name="TOKEN_NAME"/> pour exporter le certificat client.</translation>
+<translation id="1718559768876751602">Créer un compte Google maintenant</translation>
+<translation id="1884319566525838835">État Sandbox</translation>
+<translation id="2770465223704140727">Retirer de la liste</translation>
+<translation id="3590587280253938212">rapide</translation>
+<translation id="6053401458108962351">&amp;Effacer les données de navigation…</translation>
+<translation id="2339641773402824483">Vérification des mises à jour...</translation>
+<translation id="9111742992492686570">Télécharger les mises à jour de sécurité essentielles</translation>
+<translation id="8636666366616799973">Package incorrect. Détails : &quot;<ph name="ERROR_MESSAGE"/>&quot;.</translation>
+<translation id="2045969484888636535">Continuer à bloquer les cookies</translation>
+<translation id="7353601530677266744">Ligne de commande</translation>
+<translation id="2766006623206032690">Coller l'URL et y a&amp;ccéder</translation>
+<translation id="4394049700291259645">Désactiver</translation>
+<translation id="969892804517981540">Build officiel</translation>
+<translation id="445923051607553918">Se connecter à un réseau Wi-Fi</translation>
+<translation id="100242374795662595">Périphérique inconnu</translation>
+<translation id="9087725134750123268">Supprimer les cookies et autres données de site</translation>
+<translation id="5050255233730056751">URL saisies</translation>
+<translation id="3349155901412833452">Utiliser les touches , et . pour paginer une liste d'entrées</translation>
+<translation id="6872947427305732831">Vider la mémoire</translation>
+<translation id="2742870351467570537">Supprimer les éléments sélectionnés</translation>
+<translation id="7561196759112975576">Toujours</translation>
+<translation id="2116673936380190819">de moins d'une heure</translation>
+<translation id="5765491088802881382">Aucun réseau n'est disponible.</translation>
+<translation id="1971538228422220140">Supprimer les cookies et autres données de site et de plug-in</translation>
+<translation id="883487340845134897">Intervertir les touches Rechercher et Ctrl gauche</translation>
+<translation id="5692957461404855190">Faites glisser trois doigts sur la surface de votre trackpad pour afficher un aperçu de tous vos onglets. Cliquez sur une vignette pour la sélectionner. Idéal en mode plein écran.</translation>
+<translation id="1375215959205954975">Nouveau ! Configurer la synchronisation des mots de passe</translation>
+<translation id="5183088099396036950">Échec de la tentative de connexion au serveur</translation>
+<translation id="4469842253116033348">Désactiver les notifications de <ph name="SITE"/></translation>
+<translation id="7999229196265990314">Les fichiers suivants ont été créés :
+
+Extension : <ph name="EXTENSION_FILE"/>
+Fichier de clé : <ph name="KEY_FILE"/>
+
+Conservez votre fichier de clé en lieu sûr. Vous en aurez besoin lors de la création de nouvelles versions de l'extension.</translation>
+<translation id="1846078536247420691">&amp;Oui</translation>
+<translation id="3036649622769666520">Ouvrir les fichiers</translation>
+<translation id="2966459079597787514">Clavier suédois</translation>
+<translation id="7685049629764448582">Mémoire JavaScript </translation>
+<translation id="6398765197997659313">Quitter le mode plein écran</translation>
+<translation id="6059652578941944813">Hiérarchie des certificats</translation>
+<translation id="4886690096315032939">Afficher l'onglet existant si l'URL associée est demandée dans un autre</translation>
+<translation id="5729712731028706266">&amp;Afficher</translation>
+<translation id="774576312655125744">Vos données personnelles sur <ph name="WEBSITE_1"/>, <ph name="WEBSITE_2"/> et sur <ph name="NUMBER_OF_OTHER_WEBSITES"/> autres sites Web</translation>
+<translation id="6359806961507272919">SMS de <ph name="PHONE_NUMBER"/></translation>
+<translation id="4508765956121923607">Afficher la s&amp;ource</translation>
+<translation id="5975083100439434680">Zoom arrière</translation>
+<translation id="8080048886850452639">C&amp;opier l'URL du fichier audio</translation>
+<translation id="2817109084437064140">Importer et associer au périphérique...</translation>
+<translation id="3331321258768829690">(<ph name="UTCOFFSET"/>) <ph name="LONGTZNAME"/> (<ph name="EXEMPLARCITY"/>)</translation>
+<translation id="619398760000422129">Plug-ins (par ex. Adobe Flash Player, QuickTime, etc.)</translation>
+<translation id="5849869942539715694">Empaqueter l'extension...</translation>
+<translation id="7339785458027436441">Vérifier l'orthographe lors de la frappe</translation>
+<translation id="8308427013383895095">Échec de la traduction en raison d'un problème de connexion réseau</translation>
+<translation id="1801298019027379214">Code PIN incorrect. Veuillez réessayer. Nombre de tentatives restantes : <ph name="TRIES_COUNT"/></translation>
+<translation id="1384721974622518101">Vous pouvez effectuer une recherche directement à partir du champ ci-dessus.</translation>
+<translation id="992543612453727859">Ajouter les expressions au premier plan</translation>
+<translation id="3857773447683694438">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</translation>
+<translation id="1244147615850840081">Opérateur</translation>
+<translation id="8203365863660628138">Confirmer l'installation</translation>
+<translation id="406259880812417922">(Mot clé : <ph name="KEYWORD"/>)</translation>
+<translation id="309628958563171656">Sensibilité :</translation>
+</translationbundle>
diff --git a/tools/grit/grit/testdata/generated_resources_iw.xtb b/tools/grit/grit/testdata/generated_resources_iw.xtb
new file mode 100644
index 0000000000..86b55334c0
--- /dev/null
+++ b/tools/grit/grit/testdata/generated_resources_iw.xtb
@@ -0,0 +1,4 @@
+<?xml version="1.0" ?>
+<!DOCTYPE translationbundle>
+<translationbundle lang="iw">
+</translationbundle>
diff --git a/tools/grit/grit/testdata/generated_resources_no.xtb b/tools/grit/grit/testdata/generated_resources_no.xtb
new file mode 100644
index 0000000000..913638ba4e
--- /dev/null
+++ b/tools/grit/grit/testdata/generated_resources_no.xtb
@@ -0,0 +1,4 @@
+<?xml version="1.0" ?>
+<!DOCTYPE translationbundle>
+<translationbundle lang="no">
+</translationbundle>
diff --git a/tools/grit/grit/testdata/grit_part.grdp b/tools/grit/grit/testdata/grit_part.grdp
new file mode 100644
index 0000000000..c8e9d92692
--- /dev/null
+++ b/tools/grit/grit/testdata/grit_part.grdp
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<grit-part>
+  <!-- Important for test purposes that this file not exist. -->
+  <structure type="chrome_scaled_image" name="IDR_DOES_NOT_EXIST" file="does-not-exist.png" />
+</grit-part>
diff --git a/tools/grit/grit/testdata/header.html b/tools/grit/grit/testdata/header.html
new file mode 100644
index 0000000000..8e9d10ec50
--- /dev/null
+++ b/tools/grit/grit/testdata/header.html
@@ -0,0 +1,39 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html><head><title>[$~TITLE~$]</title>
+<meta http-equiv="cache-control" content="no-cache">
+<meta http-equiv="content-type" content="text/html; charset=utf-8">
+<meta http-equiv="pragma" content="no-cache">
+<meta http-equiv="expires" content="-1">
+[EXTRA_META]
+<style>
+BODY,TD,DIV,.P,A {	FONT-FAMILY: arial,sans-serif}
+DIV,TD { COLOR: #000}
+.f { COLOR: #6f6f6f}
+.fl:link { COLOR: #6f6f6f}
+A:link, .w, A.w:link, .w A:link { COLOR: #00c}
+A:visited {	COLOR: #551a8b}
+.fl:visited { COLOR: #551a8b}
+A:active, .fl:active  {	COLOR: #f00}
+.h { COLOR: #3399CC}
+.i { COLOR: #a90a08}
+.i:link { COLOR: #a90a08}
+.a, .a:link, .a:visited { COLOR: #008000}
+DIV.n {	MARGIN-TOP: 1ex}
+.n A { FONT-SIZE: 10pt; COLOR: #000}
+.n .i {	FONT-WEIGHT: bold; FONT-SIZE: 10pt}
+.q A:visited { COLOR: #00c}
+.q A:link {	COLOR: #00c}
+.q A:active { COLOR: #00c}
+.q { COLOR: #00c}
+.b { FONT-WEIGHT: bold; FONT-SIZE: 12pt; COLOR: #00c}
+.ch { CURSOR: hand}
+.e { MARGIN-TOP: 0.75em; MARGIN-BOTTOM: 0.75em}
+.g { MARGIN-TOP: 1em; MARGIN-BOTTOM: 1em}
+.f { MARGIN-TOP: 0.5em; MARGIN-BOTTOM: 0.25em}
+.s { HEIGHT: 10px }
+.c:active {	COLOR: #ff0000}
+.c:visited { COLOR: #551a8b}
+.c:link { COLOR: #7777cc}
+.c { COLOR: #7777cc }
+</style>
+</head>
\ No newline at end of file
diff --git a/tools/grit/grit/testdata/homepage.html b/tools/grit/grit/testdata/homepage.html
new file mode 100644
index 0000000000..cce4f2cf35
--- /dev/null
+++ b/tools/grit/grit/testdata/homepage.html
@@ -0,0 +1,37 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html><head><title>Google Desktop Search</title>
+<meta http-equiv="content-type" content="text/html; charset=utf-8">
+<meta http-equiv="cache-control" content="no-cache">
+<meta http-equiv="pragma" content="no-cache">
+<meta http-equiv="expires" content="-1">
+<style>
+BODY,TD,A,P {FONT-FAMILY: arial,sans-serif}
+.q   {COLOR: #0000cc}
+</style>
+<script>
+<!--
+function sf(){document.f.q.focus();}
+// -->
+</script>
+</head>
+<BODY text=#000000 vLink=#551a8b aLink=#ff0000 link=#0000cc bgColor=#ffffff onload=sf()>
+<center>
+<TABLE cellSpacing=0 cellPadding=0 border=0>
+<tr><td><a href="[$~HOMEPAGE~$]"><IMG border=0 height=110 alt="Google Desktop Search" src="hp_logo.gif" width=276></a></td></tr></table><BR>
+<FORM name=f method=GET action='[$~SEARCHURL~$]'>
+<TABLE cellSpacing=0 cellPadding=4 border=0>
+<tr>
+<TD class=q noWrap><FONT size=-1>
+[$~LINKS~$]
+</font></td>
+</tr></table>
+<table cellspacing=0 cellpadding=0>
+<tr vAlign=top>
+<td width=25%>&nbsp;</td>
+<td align=center><input maxlength=256 size=62 name=q value="[DISP_QUERY]"><br><input type=submit value="Search Desktop" name=btnG><INPUT type=submit value="Search the Web" name="redir" accesskey=w></td>
+<td align=left valign=top nowrap width=25%><font size=-2>&nbsp;&nbsp;<A href="[$~PREFERENCES~$]">Desktop&nbsp;Preferences</a></font></td>
+</tr></table></FORM>	
+<p><FONT color=#224499><B>Search your own computer.</B></font></p>
+<span style='width:29em'>[$~MESSAGE~$]</span><br>
+<br><FONT size=-1>[$~SETHOMEPAGE~$][$~BOTTOMLINE~$]</font></p>
+<p><FONT size=-2>&copy;2005 Google - Searching [NUM_ITEMS] items</font></p></center></body></html>
\ No newline at end of file
diff --git a/tools/grit/grit/testdata/hover.html b/tools/grit/grit/testdata/hover.html
new file mode 100644
index 0000000000..b8f9ce0200
--- /dev/null
+++ b/tools/grit/grit/testdata/hover.html
@@ -0,0 +1,177 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html><head>
+<meta http-equiv="content-type" content="text/html; charset=utf-8">
+<meta http-equiv="cache-control" content="no-cache">
+<meta http-equiv="pragma" content="no-cache">
+<meta http-equiv="expires" content="-1">
+<style>
+BODY { FONT-SIZE: 8pt; FONT-FAMILY: verdana,arial,san-serif }
+P { FONT-SIZE: 8pt; FONT-FAMILY: verdana,arial,san-serif }
+TD { FONT-SIZE: 8pt; FONT-FAMILY: verdana,arial,san-serif }
+A { FONT-SIZE: 8pt; FONT-FAMILY: verdana,arial,san-serif }
+DIV { FONT-SIZE: 8pt; TEXT-DECORATION: none }
+A:hover { COLOR: #ffffff }
+.border { BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px }
+</style>
+
+<!-- menu experiment start -->
+
+<style>
+<!--
+.menu1 {
+cursor:default;
+position:absolute;
+left: 10;
+top: 0;
+text-align: left;
+font-family: Arial, Helvetica, sans-serif;
+font-size: 8pt;
+background-color: menu;
+visibility: hidden;
+padding-top: 2px;
+padding-bottom: 2px;
+border: 1 solid;
+border-color: #888888;
+z-index: 100;
+}
+.menuitems {
+padding-left: 5px;
+padding-right: 5px;
+}
+-->
+</style>
+<SCRIPT LANGUAGE="JavaScript1.2">
+<!--
+var menustyle = "menu1";
+
+function showmenu() {
+  // var rightedge = document.body.clientWidth-event.clientX;
+  // var bottomedge = document.body.clientHeight-event.clientY;
+  // if (rightedge < rcmenu.offsetWidth)
+  //  rcmenu.style.left = document.body.scrollLeft + event.clientX - rcmenu.offsetWidth;
+  // else
+  //  rcmenu.style.left = document.body.scrollLeft + event.clientX;
+  // if (bottomedge < rcmenu.offsetHeight)
+  //   rcmenu.style.top = document.body.scrollTop + event.clientY - rcmenu.offsetHeight;
+  // else
+  //  rcmenu.style.top = document.body.scrollTop + event.clientY;
+
+  rcmenu.style.visibility = "visible";
+  // rcmenu.style.zindex = 0;
+  // document.all('rcmenu').style.zindex = 20;
+  document.onkeydown=ck;
+  return false;
+}
+
+function hidemenu() {
+  rcmenu.style.visibility = "hidden";
+}
+
+function ck(e){
+	evt=document.all?window.event:e;
+	k=document.all?window.event.keyCode:e.keyCode;
+	
+	if(k==27 /*<Esc>*/) {
+      hidemenu();
+	}
+}
+
+function menumouseover() {
+  if (event.srcElement.className == "menuitems") {
+    event.srcElement.style.backgroundColor = "highlight";
+    event.srcElement.style.color = "white";
+  }
+}
+
+function menumouseout() {
+  if (event.srcElement.className == "menuitems") {
+    event.srcElement.style.backgroundColor = "";
+    event.srcElement.style.color = "black";
+    window.status = "";
+  }
+}
+
+function menuselect() {
+  if (event.srcElement.className == "menuitems") {
+  if (event.srcElement.getAttribute("target") != null)
+    window.open(event.srcElement.url, event.srcElement.getAttribute("target"));
+  else if (event.srcElement.url.length)
+    window.location = event.srcElement.url;
+  }
+}
+// -->
+</script>
+
+<!-- menu experiment end -->
+
+</head>
+<BODY bottomMargin=0 bgColor=#3300cc leftMargin=0 topMargin=0 rightMargin=0 marginwidth="0" marginheight="0" border=0 style="border-width:0;" scroll=no>
+
+<!-- <br> -->
+
+<!-- menu experiment start -->
+
+<div id="rcmenu" class="skin0" onMouseover="menumouseover()" onMouseout="menumouseout()" onClick="menuselect();">
+<span class="menuitems" url="[$~SETDISP1~$]">Sidebar</span>
+<span class="menuitems" url="[$~SETDISP4~$]">Minibar</span>
+<span class="menuitems" url="[$~HIDE2~$]">Close</span>
+</div>
+
+<script language="JavaScript1.2">
+if (document.all && window.print) {
+  rcmenu.className = menustyle;
+  document.oncontextmenu = showmenu;
+  document.body.onclick = hidemenu;
+}
+</script>
+
+<!-- menu experiment end -->
+
+<script>
+function hide() {
+    return 1;
+	// return confirm("Are you sure you want to hide the minibar?\nYou can show it again in Google Desktop Search Preferences. ");
+}
+function clear() {
+	document.getElementById('q').value='';
+}
+</script>
+
+<TABLE cellSpacing=0 cellPadding=0 bgColor=#3300cc border=0><TBODY>
+<tr><TD vAlign=top>
+
+<form method=get action="[$~SEARCHURL~$]" [$~SEARCH_TARGET~$] name=f1 ID="f1" onsubmit="window.setTimeout('clear()', 500)">
+<input type=hidden name=src value=3>
+<input type=hidden name=redir value='' ID="redir">
+
+<TABLE cellSpacing=0 cellPadding=0 bgColor=#3300cc border=0><TBODY>
+
+<tr>
+<!-- border-top: #414a4f 0px solid; -->
+<!-- z-index:2; z-order:2; -->
+<TD vAlign=top>&nbsp;<INPUT name=q style="position:relative; height=19px;" class=border size=12>&nbsp;</td>
+
+<TD TABINDEX="2" onkeydown='if(event.keyCode!=16&&event.keyCode!=9)onclick()' onclick="f1.submit();q.value=''" class=ch onmouseover="this.bgColor='6666FF'" style="BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #6666cc 1px solid; BORDER-LEFT: #6666cc 1px solid; BORDER-BOTTOM: #000000 1px solid" onmouseout="this.bgColor='#000099'" vAlign=center align=middle bgColor=#000099><IMG src="logo.gif" align=middle></td>
+
+<TD width=2><IMG height=1 width=1></td>
+
+<TD TABINDEX="3" onkeydown='if(event.keyCode!=16&&event.keyCode!=9)onclick()' onclick="redir.value='google'; f1.submit(); redir.value='';q.value=''" class=ch onmouseover="this.bgColor='6666FF'" style="BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #6666cc 1px solid; BORDER-LEFT: #6666cc 1px solid; BORDER-BOTTOM: #000000 1px solid" onmouseout="this.bgColor='#000099'" vAlign=center align=middle bgColor=#000099><IMG src="gfavicon.ico" align=middle></td></tr>
+</TBODY></table>
+</td>
+
+<TD width=5><IMG height=1 width=1></td>
+
+<TD vAlign=top> 
+
+<TABLE cellSpacing=0 cellPadding=1 bgColor=#000099><TBODY>
+<tr><TD TABINDEX="4" onkeydown='if(event.keyCode!=16&&event.keyCode!=9)onclick()' valign=top onclick="location.href='[$~SETDISP1~$]';" class=ch onmouseover="this.bgColor='6666FF'" style="BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #6666cc 1px solid; BORDER-LEFT: #6666cc 1px solid; BORDER-BOTTOM: #000000 1px solid" onmouseout="this.bgColor='#000099'" vAlign=top noWrap bgColor=#000099><IMG src="down.gif"></td></tr></TBODY></table>
+
+</td>
+
+<TD width=1><IMG height=1 width=1></td>
+
+<TD vAlign=top><TABLE cellSpacing=0 cellPadding=1><TBODY>
+<tr><TD TABINDEX="5" onkeydown='if(event.keyCode!=16&&event.keyCode!=9)onclick()' valign=top onclick="if (hide())location.href='[$~HIDE2~$]';" class=ch onmouseover="this.bgColor='6666FF'" style="BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #6666cc 1px solid; BORDER-LEFT: #6666cc 1px solid; BORDER-BOTTOM: #000000 1px solid" onmouseout="this.bgColor='#000099'" vAlign=top noWrap bgColor=#000099><IMG src="close.gif"></td></tr></TBODY></table></td></tr></TBODY></table>
+
+</form>
+</body></html>
diff --git a/tools/grit/grit/testdata/include_test.html b/tools/grit/grit/testdata/include_test.html
new file mode 100644
index 0000000000..e08f2e2e8a
--- /dev/null
+++ b/tools/grit/grit/testdata/include_test.html
@@ -0,0 +1,31 @@
+<include src="included_sample.html">
+<if expr="True">
+should be kept
+</if>
+in the middle...
+<if expr="False">
+should be removed
+</if>
+
+<if expr="False">
+should be removed
+  <if expr="True">
+    should be removed because outer expr is False
+  </if>
+should be removed
+</if>
+
+<if expr="True">
+  <if expr="True">
+    <if expr="True">
+      nested true should be kept
+    </if>
+    <if expr="False">
+      should be removed
+    </if>
+  </if>
+  <if expr="True">
+    silbing true should be kept
+  </if>
+</if>
+at the end...
diff --git a/tools/grit/grit/testdata/included_sample.html b/tools/grit/grit/testdata/included_sample.html
new file mode 100644
index 0000000000..7150ffcbea
--- /dev/null
+++ b/tools/grit/grit/testdata/included_sample.html
@@ -0,0 +1 @@
+Hello Include!
diff --git a/tools/grit/grit/testdata/indexing_speed.html b/tools/grit/grit/testdata/indexing_speed.html
new file mode 100644
index 0000000000..db1787b0e2
--- /dev/null
+++ b/tools/grit/grit/testdata/indexing_speed.html
@@ -0,0 +1,58 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html><head><title>Google Desktop Search Index Speed</title>
+<meta http-equiv=content-type content="text/html; charset=utf-8">
+<style>
+BODY {
+	MARGIN-LEFT: 3em; MARGIN-RIGHT: 3em; FONT-FAMILY: arial,sans-serif
+}
+</style>
+</head>
+<BODY text=#000000 vLink=#551a8b aLink=#ff0000 link=#0000cc bgColor=#ffffff>
+<TABLE cellSpacing=2 cellPadding=0 width="100%" border=0>
+  <tr>
+    <TD vAlign=top width="1%"><A href="[$~HOMEPAGE~$]">
+		<IMG alt="Go to Google Desktop Search" src="/logo3.gif" border=0></A></td>
+    <td>&nbsp;</td>
+    <TD noWrap>
+      <TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
+        <tr>
+          <TD bgColor=#3399CC><IMG height=1 alt="" width=1></td>
+		</tr>
+	  </table>
+      <TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
+        <tr>
+          <TD noWrap bgColor=#efefef><B>&nbsp;Index Speed</B></td>
+            <TD noWrap align=right bgColor=#efefef><FONT size=-1><A href="/customize.html">Index Speed 
+              Help</A> | <A href="[$~ABOUT~$]"> About Google Desktop Search</A></font></td>
+          </tr></table></td></tr></table>
+<FONT size=-1>
+<p>
+To make your emails, files, and previously viewed web pages searchable, Google Desktop Search
+needs to index them. This indexing process is currently occuring in the background
+and your computer performance is minimally impacted.
+<p>
+You have the option of speeding up this process.
+<p><B><FONT color=#FF0000>Warning:</font></B> Speeding up indexing will cause your computer
+to become unusable for many minutes, depending on how many items need to be indexed. FAST INDEXING IS NOT
+RECOMMENDED.
+<BR>&nbsp;<BR>
+<FORM action="[$~SETINDEXSPEED~$]" method=GET>
+<input name=url value="[PREVPAGE]" type=hidden>
+<input type=radio name=FAST value="0" [FAST0-CHECKED] id=f0><label for=f0>Use background indexing (recommended)</label><br>
+<input type=radio name=FAST value="1" [FAST1-CHECKED] id=f1><label for=f1>Use fast indexing</label><br><br>
+<input type=submit value="Set Indexing Speed">
+</FORM>
+<BR>
+
+<p>&nbsp;<BR>
+<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
+<TR bgColor=#3399CC>
+	<TD align=middle height=1><IMG height=1 alt="" width=1></td></tr>
+</table>
+
+<TABLE cellSpacing=0 cellPadding=0 width="100%" align=center bgColor=#efefef border=0>
+<tr>
+	<TD align=middle height=20><FONT size=-1><A href="[$~HOMEPAGE~$]">Google Desktop Search&nbsp;Home</A> - <a href="[$~STATUS~$]">Status</a> - <A href="[$~ABOUT~$]">About Google Desktop Search</A> - [$~BUILDNUMBER~$] - &copy;2005 Google </font> </td></tr>
+</table><BR>
+</body>
+</html>
\ No newline at end of file
diff --git a/tools/grit/grit/testdata/install_prefs.html b/tools/grit/grit/testdata/install_prefs.html
new file mode 100644
index 0000000000..eca0b56de5
--- /dev/null
+++ b/tools/grit/grit/testdata/install_prefs.html
@@ -0,0 +1,92 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html><head><title>Google Desktop Search: Initial Preferences</title>
+<meta http-equiv="cache-control" content="no-cache">
+<meta http-equiv="content-type" content="text/html; charset=utf-8">
+<meta http-equiv="pragma" content="no-cache">
+<meta http-equiv="expires" content="-1">
+<style>
+BODY { FONT-FAMILY: arial,sans-serif }
+.c:active { COLOR: #FF0000 }
+.c:visited { COLOR: #7777CC }
+.c:link { COLOR: #7777CC }
+</style>
+<script>
+<!--
+override = 1;
+function ee() {if (override==1) {(new Image()).src="[COMPLETING]";}}
+// -->
+</script>
+</head><body leftmargin=30 rightmargin=30 onresize="stw()" onunload="ee()">
+<form onsubmit='override=0;return true;' action='[STEP2]' name=f method=post>
+<img src="logo3.gif" border=0>
+<div id=c1 style="width:600px">
+<br><font color=#00218a><b>To continue, please set these initial preferences:</b></font><br><br>
+<table border=0 id=t1 width=100%>
+<tr>
+ <td valign=top><input name=AIM id=chat type=checkbox checked></td>
+ <td>&nbsp;</td><td><label for=chat><font size=-1><B>Enable search over Instant Messenger chats</b><br>
+ <font size=-1>Google Desktop Search will store your chats and make them searchable.
+</font></label></td></tr>
+<tr height=1><td height=10px></td></tr>
+<tr>
+ <td valign=top><input name=HTTPS id=https type=checkbox checked></td>
+ <td>&nbsp;</td><td><label for=https><font size=-1><b>Enable search over secure web pages (HTTPS)</b>
+ <br><font size=-1>Google Desktop Search will store secure web pages that you view and make them 
+ searchable.</font></label> </td></tr>
+<tr height=1px><td height=10px></td></tr>
+
+<tr>
+ <td valign=top><input name=SEARCHBOX id=SEARCHBOX type=checkbox checked
+ onclick="handleSBClick(this)"></td>
+ <td>&nbsp;</td><td><label for=searchbox><font size=-1><b>Display search box</b></label>
+ <br><table border=0 cellpadding=0><tr><td valign=top>
+
+<input type="radio" name="SBDISPLAY" id="DISPLAYDB" [DB-CHECKED] value="DISPLAYDB"></td><td>
+<label for=DISPLAYDB><font size=-1>Deskbar - A search box in your taskbar</font></label></td></tr>
+<tr><td></td></tr>
+<tr><td></td><td><img src="deskbar.gif" alt="Deskbar" width="268" height="34"></td></tr>
+<tr><td height=2></td></tr>
+<tr><td valign=top>
+
+<input type="radio" name="SBDISPLAY" id="DISPLAYMB" [MB-CHECKED] VALUE="DISPLAYMB"></td><td>
+<label for=DISPLAYMB><font size=-1>Floating Deskbar - A search box that you can put anywhere on your desktop</font></label></td></tr>
+<tr><td></td></tr>
+<tr><td></td><td><img src="minibar.gif" width="137" height="27"></td></tr>
+<tr><td height=2></td></tr>
+
+</table>
+</td></tr>
+
+<tr>
+ <td valign=top><input name=SENDDATA id=usage type=checkbox checked></td>
+ <td>&nbsp;</td><td><label for=usage><font size=-1><b>Help us improve Google Desktop Search by sending usage data and crash reports</b></label>
+</font></td></tr>
+<tr height=8px><td colspan=3 height=8px></td></tr>
+<tr><td colspan=3><font size=-1>You can change these and other preferences at any time.</font></td></tr>
+</table></div>
+<p><input type=submit value="Set Preferences and Continue" id=s><br>
+</form>
+</center>
+[SCRIPT]
+<script>
+<!--
+function handleSBClick(checkbox) {
+  document.getElementById("DISPLAYDB").disabled = !checkbox.checked;
+  document.getElementById("DISPLAYMB").disabled = !checkbox.checked;
+}
+function stw() {
+if (document.all && document.body.clientWidth < 600) {
+ var w = document.body.clientWidth-35;
+ if (w < 10) { w = 10; }
+ w = w + 'px';
+ document.getElementById('c1').style.width=w;
+ return false;
+}
+document.getElementById('c1').style.width='600px';
+}
+stw();
+document.f.s.focus();
+// -->
+</script>
+<img SRC="http://www.google.com" WIDTH="0" HEIGHT="0" ALIGN="right"></img>
+</body></html>
\ No newline at end of file
diff --git a/tools/grit/grit/testdata/install_prefs2.html b/tools/grit/grit/testdata/install_prefs2.html
new file mode 100644
index 0000000000..18380397c2
--- /dev/null
+++ b/tools/grit/grit/testdata/install_prefs2.html
@@ -0,0 +1,52 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html><head><title>Indexing has Started</title>
+<meta http-equiv="cache-control" content="no-cache">
+<meta http-equiv="content-type" content="text/html; charset=utf-8">
+<meta http-equiv="pragma" content="no-cache">
+<meta http-equiv="expires" content="-1">
+<style>
+BODY { FONT-FAMILY: arial,sans-serif }
+}
+</style>
+<script>
+<!--
+override = 1;
+function ee() {if (override==1) {(new Image()).src="[COMPLETING]";}}
+// -->
+</script>
+</head><body leftmargin=30 rightmargin=30 onresize="stw()" onunload="ee()">
+<form onsubmit='override=0;return true;' action="[STEP3]" name=f>
+<img src="/logo3.gif" border=0><br><br>
+<div id=c1 style="width:575px">
+<table border=0 id=t1 width=100%><tr><td>
+<font color=#00218a><b>One-time indexing has started.</b></font><br><br>
+<font size=-1>An index is being prepared on your computer to allow you
+to search your information as fast as you can search the web.<br><br>
+<li>This is a one-time process that may take several hours.
+<li>You may continue to use your computer as usual and it is safe to shut down your computer.
+<li>Indexing will be performed only when your computer is idle.
+</ul>
+</font>
+<p><input type=submit value="Go to the Desktop Search homepage" name=s><br>
+</center>
+</td></tr></table>
+</form>
+</div>
+<script>
+<!--
+function stw() {
+if (document.all && document.body.clientWidth < 575) {
+ var w = document.body.clientWidth-35;
+ if (w < 10) { w = 10; }
+ w = w + 'px';
+ document.getElementById('c1').style.width=w;
+ return false;
+}    
+document.getElementById('c1').style.width='575px';
+}
+stw();
+// -->
+document.f.s.focus();
+</script>
+[SCRIPT]
+</body></html>
\ No newline at end of file
diff --git a/tools/grit/grit/testdata/klonk-alternate-skeleton.rc b/tools/grit/grit/testdata/klonk-alternate-skeleton.rc
new file mode 100644
index 0000000000000000000000000000000000000000..5f2c82a55469ddaab246c095826ad9e6743c0015
GIT binary patch
literal 1088
zcmbW0Pfr3t48`AhKZV)z#sGrI5!gjnU?DC>IT2z!82=r_L=!)}zjnmk5b$6oGo9&7
z+t=4lu9UG-Ujxl_t%b{59ih$9PSBn!lW7`iGrKMm&Q10vTRK5!yRJHlRN`fcWril@
zv|?uHM))d_NBa7`nW9TQ&PZ3tsax6ojav@U&9TYdHduz6k{G4GFTfpX_hk&`!z0F`
z!gJ>6WBh&UO&i_oS+VOvUfcD9JR=y&;3OxP2%KT$#JB9W=UtgQpDT@>(E^#^A;oG%
z4omjIK7rLXcRgmyS+%u_Gl2`MhOxMB{GGM&5o6cXF<vdhEe5Mu-+3OQZF~Ht$8Yl5
z&=^M*j(xG~y3(sxz{#AtW^kPoyR!dZ9)}Sd$_6;Qjx#V<A+O@5j%7~Al)9jj*71v4
z<zn{ZUuJA?73tB}iB6fJ)6H}8)1l|&XFq3N%P!P%;Wv{#b&7SVweIxDUCbEh>E~=G
z`!#F5=z%_bq95y7+aIx?IdcSN`A)xX^vZjCS7lnS#=iZ)E7W%eX8!kr-#RDO36^!o
Qqn&wY8qX0d7T}2V4SbP+*8l(j

literal 0
HcmV?d00001

diff --git a/tools/grit/grit/testdata/klonk.ico b/tools/grit/grit/testdata/klonk.ico
new file mode 100644
index 0000000000000000000000000000000000000000..d371b214dc366249870efccc5da278d023aa91f1
GIT binary patch
literal 766
zcmeH_F%H5o5CqSFL>Ve71Sxq1;TtsMEB*!Fv6LbmDQFSUL1mXjO7OC0gpl|G?B1ML
zXS=a1V(2`di0U>FnQ~o{oUDnF5j(}bxAgSuhE8lMu~rkI8Ju%mb%Im^Xd<+ZwEgwd
zFTg+WQOj5lfvO*4mbEA^bCj9KHh65vjx^zvsKW{eA8|Ah`w&r;%!`QgmEiG3hXCcC
L+@V2V6oA7MJIRBx

literal 0
HcmV?d00001

diff --git a/tools/grit/grit/testdata/klonk.rc b/tools/grit/grit/testdata/klonk.rc
new file mode 100644
index 0000000000000000000000000000000000000000..35652c4e6dd7cf7b7f62f637e191acf66f487235
GIT binary patch
literal 9824
zcmeI2+j1L48poSUd<zdSObP?FE=Nu{E-aL6%Z`X;t1MXwwb^nxw&R#MQm|was(2h8
z0*VVRxZyQ;25z?&e*drad1j>1!LS!j6*Z-q>7MTIeClrf{=b{yW=KLKoQA`29(tkA
z?@<`g*P*W;F2X@LqqP?P!IgxQa2&e)&gmcUJfiQMr{-PocF21|OVCckGsY~31#sNt
zeuJJaU(OhLWaHAYxy#{kNExfq8uQ5J2xc`jLo2kyURV$HuoL#fZm7|_&ii)Q3SZFE
z;@$|W^lb4S@e23#yIdxsED4)%Ix5vi$fg&b@^yerB!M>k-sfJ2-!(XtBx>~E;y0>;
zywqpO@eUBz4c2yv49m3k+_Z88eb3Rg>+A-4?GCk8rmyLEuD7;k@iyBQuQz|u4r}P|
z1pk!hKgO!w#>STMq~-8ViH-G#etL?RCgF{OzaBBS8aA-k=%+1wau1JP!(#WbwJk2e
z{FW=3II|6mUA$wTS=-Ei$KrzUMVn6ea?kwXHeRp*%qrtH8Cm5n-|(IYVUu<pe(r=N
zzO@*)I&s84Ull`c5XBVjPVmJ8W*uVn!oE+xdXM3B1?=zfi}cBtkC36HBDof6y#96&
zDNK-*c<mwsaiN$Tt;G8iy#LgqQ-aMX7AOxWcPO4D;cMihSg+XijJE^e#f+h-em)#K
zU}i#pm$ov9MjtR<GnAE-XHJcd#M&7}G3rSx$}4^5MSA<RMTcOD8qE;QGcM((Z-!r=
z@>HA@wRN;~7h6y+xyz_&R~;+XxM^eZ-_q~|%%b86_{3Asa-8FBk+Z7c-kJgN>UjHR
zv*J6C_vNv`hUxGkXMvL0T0vKhVQf$p6QjfeUR}fgl_wW2W!gk%O?<jZPZ}19O{d7^
z*finVDx2ru9D3dIaKoU~fb#-41E46PT;&oc4LDIw7tD-Ohf;>IO<b0BC*h%aN($z?
zm)50Lg3jeb@}4KgpHn7``|w@I(iDZ;#6d+vaXpT`D6f;D{i-%|`usUfYCfinmyGTN
zIW7V>a`tbcYLDwE{AY?>BR88vkIj3pcp9ftwy~b;A8i-;T|_p=$nY5yWU!`jTE^ib
ze*F+mE-Vf$<AuvpIC5FVr`t!>>e;=5g*fg0^w_NUeElxZA2EAWiGRui^1Zl<=<)P1
zF&Y;=yo$%KVIA>VGwa=@)kgQbrt31jq~WuvvL2VO`$<s`-l~FW4S%T*JzWty@3kqC
zpB4rFU-(`|ov-8B%D+84yQpbJq|Cy#a=VYFm5(Lg9joHhbBjy*SqUH5^H#VWD)#mP
zmDd8gX|wiIT+{3pP+PpWiFV4=ZF*H_#xD)})(!p!_EWXI5x?KFnQQblnWI&vvb<)-
zFIrzJTT2IfU>zNqGSmHCaU;Y2q0yQ$JF7mTwL~ub{sOMb^Vh8GFZ(K1F-x>#wroJR
z&tF1@??TN-{BD^Hb<bj)tU9hU-SUgid^Mw80(r42u2^L$1ARm5q2(uK*A(fk5cewP
z9Zr$-B@Y%=OVA@~R*aezo@z;A8C69Z##=4Z+%_6(qSKmXx%;{Kv$<M>gJ;mLeTx&a
ztSZO1p-!t5NvMLINn_JEi1N%h$mrKfeZ%Sxtv*(<o;FujMW(#py@aoK$>Sq%E`|5`
zMQa!2rJ*fu!l%|$%^a7pE^XVFE$AM-((pNcct~BK8YqR1Sd~Aqmi*&@D)rQ&bN`YW
zMPvC%+;<TLnyH+o+P!PzGEPTvj<#1#Q&p3I;<v-i%S09-uHQ3$KQw!lbu5_YDT~KE
zq3F><0?G_uSf2bldXz_x`Rp$tXUa07m0#5g^O>n*TJE4PW#|}5_jztxOjO*+fAM}<
zk=Lii5sD#879SKTSIp++>5AlgXumxIv246U-XKqCe;}^ATDIP+P{%8`Yynw2Uilpc
z$xha}X;{ahB+#YVajq(xJ|2|kCBqoURxZc-PC<V34wS`l@7lObCdzS5sL5l@zQ+BG
z;+Tl3tUl7t#}1OyYFBw_V3AMzKfW@m<J*t$@OdlXBE$+_TOoq!`H*`aipPX9y8N3z
zJLpP#o#HyZq-`Au=XaT7{)rj2n4zkrdkJOKOvhNvbdE_@DQ#r;l~PX2VN1f=r#R=S
z`e>WGR&NeH+c%h>-Yw>z7_{+>=5WWql;yg~F}<jhong+@E{wQv`%$Z$n`LNxVSLVu
zqX`bJ2rtN9gE2WJxg8d*6Uugv=9gd**I(1S$3)lvXuIe$9VB*sDZi`wUr{S<ASs*o
zEyw#FTC@PgtLUAvrjGSZrVFRipYc2<9~H+>V-&+XR>jna$uG|ylUKW<KRZ>)Rw*m^
z_oOjp@vHny>%lMrW)jt@&DG$}J`tOC!twxncz`|R{U9wplS^%1SD7h)zLPS$9KxSJ
z^(luqF00#DmestFZxDq%2fL5@KE>#H<EVwdOuH`m{4TpYASY`FCbM&`$abwl+vH7a
za;>I|)#R(g69An@YFD|(_t^K?Y(=LYvGR$s)LKbvaYc(JPp$Xb2G?a>eC9KE-cEhZ
zHSZ3+_C$Rze-w`BSsn7ZgI%TJO=9FfdDBy)V;pqaYpnOHjNdZ)cZhIWOV;71NPE_b
z5ZwYd@EV=tI))^?mN>3>KBO~=3-s|NvQu_bO!m`Xy&s`1RS8A9bec9lO`@(ym$)sX
zMVVq?wjta)kvTJp%Bk>bSh}4@HcmwuW}T<$ta~!gT03ja*d|hI1w9*Uk>}TwPvL12
z=Q{J$UgQ8RXmu+(2GDd)J#{>6mrEh;W{57|8=6JgB)U>?#`vQXEaBEZgsP}6H0c~I
zlTn_wQLB~3>U1IQ2y}Rh=cM|##66Rnd!p7F(K=LbM6B`LtO3?OS3Ko>03~gD6g5tu
zOSRooa>4*SqvO;gSO;d)IuFc4e&rSY3#4arR~e}tmqXie5w!0rzg2#y{KWm2%CD85
zD?e8LTlv1?UR>st9pKlDtGM^mfuA&df=7MIT`QQ#k8mnxoriygx5#|&^UZ&6F?Nx!
z2jMH^+zTJm>H?vU#6L!6XLz9~{RHheL_xo4SVUcx*(c|e8ZfVRzJC37^PM7DoUXW9
zRu0v_b;|ztF`73W!u5N4HWX!l^<O!vStkE0N0PgK{5wU`>ZH1;i+3m{&0Ya4gg*c`
C>9bG(

literal 0
HcmV?d00001

diff --git a/tools/grit/grit/testdata/ko_oem_enable_bug.html b/tools/grit/grit/testdata/ko_oem_enable_bug.html
new file mode 100644
index 0000000000..f2c199cc15
--- /dev/null
+++ b/tools/grit/grit/testdata/ko_oem_enable_bug.html
@@ -0,0 +1 @@
+<IMG style="VERTICAL-ALIGN: middle" height=16 alt=아웃룩 src="/email.gif" width=16>
\ No newline at end of file
diff --git a/tools/grit/grit/testdata/ko_oem_non_admin_bug.html b/tools/grit/grit/testdata/ko_oem_non_admin_bug.html
new file mode 100644
index 0000000000..b9e8a1f288
--- /dev/null
+++ b/tools/grit/grit/testdata/ko_oem_non_admin_bug.html
@@ -0,0 +1 @@
+<INPUT id=s type=submit value="&nbsp;&nbsp;확인&nbsp;&nbsp;">
\ No newline at end of file
diff --git a/tools/grit/grit/testdata/mini.html b/tools/grit/grit/testdata/mini.html
new file mode 100644
index 0000000000..8ac0a231a0
--- /dev/null
+++ b/tools/grit/grit/testdata/mini.html
@@ -0,0 +1,36 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html><head>
+<meta http-equiv=content-type content="text/html; charset=windows-1252">
+<meta http-equiv="cache-control" content="no-cache">
+<meta http-equiv="pragma" content="no-cache">
+<meta http-equiv="expires" content="-1">
+<style>
+BODY { FONT-SIZE: 8pt; FONT-FAMILY: verdana,arial,san-serif }
+P { FONT-SIZE: 8pt; FONT-FAMILY: verdana,arial,san-serif }
+TD { FONT-SIZE: 8pt; FONT-FAMILY: verdana,arial,san-serif }
+A { FONT-SIZE: 8pt; FONT-FAMILY: verdana,arial,san-serif }
+DIV { FONT-SIZE: 8pt; TEXT-DECORATION: none }
+A:hover { COLOR: #ffffff }
+.border { BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px }
+</style>
+</head>
+
+<BODY bottomMargin=0 bgColor=#3300cc leftMargin=0 topMargin=0 rightMargin=0 marginwidth="0" marginheight="0">
+
+<TABLE cellSpacing=0 cellPadding=0 bgColor=#3300cc border=0><TBODY>
+<tr><TD vAlign=top>
+
+<TABLE cellSpacing=0 cellPadding=0 bgColor=#3300cc border=0><TBODY>
+
+<tr>
+<TD vAlign=top>&nbsp;<INPUT style="position:relative; height=17px;" class=border size=10>&nbsp;</td>
+
+<TD class=ch onmouseover="this.bgColor='6666FF'" style="BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #6666cc 1px solid; BORDER-LEFT: #6666cc 1px solid; BORDER-BOTTOM: #000000 1px solid" onmouseout="this.bgColor='#000099'" vAlign=center align=middle bgColor=#000099><img height=1 width=1><IMG src="logo.gif" align=middle><img height=1 width=1></td>
+
+</TBODY></table>
+</td>
+
+<TD width=2><IMG height=1 width=1></td>
+
+<TD vAlign=top><TABLE cellSpacing=0 cellPadding=1><TBODY>
+<tr><TD class=ch onmouseover="this.bgColor='6666FF'" style="BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #6666cc 1px solid; BORDER-LEFT: #6666cc 1px solid; BORDER-BOTTOM: #000000 1px solid" onmouseout="this.bgColor='#000099'" vAlign=top noWrap bgColor=#000099><IMG src="mini_close.gif"></td></tr></TBODY></table></td></tr></TBODY></table></body></html>
diff --git a/tools/grit/grit/testdata/oem_enable.html b/tools/grit/grit/testdata/oem_enable.html
new file mode 100644
index 0000000000..db6b85eca6
--- /dev/null
+++ b/tools/grit/grit/testdata/oem_enable.html
@@ -0,0 +1,106 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html><head><title>Google Desktop Search Download</title>
+<meta http-equiv=content-type content="text/html; charset=utf-8">
+<style>BODY {
+	FONT-FAMILY: arial,sans-serif
+}
+TD {
+	FONT-FAMILY: arial,sans-serif
+}
+DIV {
+	FONT-FAMILY: arial,sans-serif
+}
+.p {
+	FONT-FAMILY: arial,sans-serif
+}
+A {
+	FONT-FAMILY: arial,sans-serif
+}
+DIV {
+	COLOR: #000
+}
+TD {
+	COLOR: #000
+}
+A:link {
+	COLOR: #00c
+}
+A:visited {
+	COLOR: #551a8b
+}
+</style>
+
+<meta content="mshtml 6.00.2800.1476" name=generator></head>
+<body>
+<center>
+<TABLE cellSpacing=0 cellPadding=0 border=0>
+  <TBODY>
+  <TR vAlign=center>
+    <td>
+      <DIV align=center><IMG height=55 alt="Google Desktop Search" 
+      src="/logo3.gif" width=150 border=0 search="" 
+      desktop=""></DIV></td>
+    <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
+    <td><FONT size=+1><B>Search your own 
+computer.</B></font></td></tr></TBODY></table><BR>
+<TABLE cellSpacing=0 cellPadding=0 width=630 border=0>
+  <TBODY>
+  <tr>
+    <TD vAlign=top width="53%"><FONT size=-1>
+      <LI>Find your email, files, web history and chats instantly <NOBR>
+      <LI>View web pages you've seen, even when you're not online</NOBR> 
+      <LI>Search as easily as you do on Google 
+      <p><B>Google Desktop Search finds:</B></p></font>
+      <TABLE cellSpacing=1 cellPadding=0 width=325 border=0 valign="center">
+        <TBODY>
+        <TR vAlign=center>
+          <TD colSpan=3><FONT size=-1><IMG style="VERTICAL-ALIGN: middle" 
+            height=16 alt=Outlook src="/email.gif" 
+            width=16>&nbsp;&nbsp;Email from Outlook, Outlook Express, &amp; 
+            Thunderbird</font></td></tr>
+        <tr>
+          <TD noWrap colSpan=3><FONT size=-1><IMG 
+            style="VERTICAL-ALIGN: middle" height=16 alt="Internet Explorer" 
+            src="/html.gif" width=16>&nbsp;&nbsp;Web history 
+            from IE/Firefox/Mozilla/Netscape</font></td></tr>
+        <tr>
+          <TD noWrap colSpan=3><FONT size=-1><IMG 
+            style="VERTICAL-ALIGN: middle" height=16 alt=Text 
+            src="/file.gif" width=16>&nbsp;&nbsp;Files in Word, 
+            Excel, Powerpoint, PDF, &amp; media formats</font></td></tr>
+        <tr>
+          <TD vAlign=top colSpan=3><FONT size=-1><IMG 
+            style="VERTICAL-ALIGN: middle" height=16 alt="AOL IM" 
+            src="/aim.gif" width=16>&nbsp;&nbsp;Chats from AOL 
+            Instant Messenger</font></td></tr>
+        <tr>
+          <TD noWrap><FONT size=-1>&nbsp;</font></td></tr></TBODY></table><FONT 
+      size=-1>&nbsp;</font><FONT size=-1><A 
+      href="http://desktop.google.com/about.html">About Desktop 
+      Search</A>&nbsp;&nbsp; <A 
+      href="http://desktop.google.com/screenshots.html">Screenshots</A>&nbsp;&nbsp; 
+      <A href="http://desktop.google.com/support">Help</A>&nbsp;&nbsp; <A 
+      href="http://desktop.google.com/feedback.html">Contact 
+      Us</A><BR></font></LI></td>
+    <td>&nbsp;&nbsp;&nbsp;</td>
+    <TD vAlign=top width="53%">
+      <TABLE cellPadding=2 width="100%" align=center>
+        <TBODY>
+        <tr>
+          <TD 
+          style="BORDER-RIGHT: rgb(204,204,204) 1px solid; BORDER-TOP: rgb(204,204,204) 1px solid; BORDER-LEFT: rgb(204,204,204) 1px solid; BORDER-BOTTOM: rgb(204,204,204) 1px solid" 
+          width="100%" bgColor=#e7eff7 blah2="#fff8dd" blah="#e7eaf7"><BR>
+            <center><FONT size=-1>By using, you agree to our <A 
+            href="http://desktop.google.com/eula.html"><BR>Terms &amp; 
+            Conditions</A> and <A 
+            href="http://desktop.google.com/privacypolicy.html">Privacy 
+            Policy</A></font></center>
+            <p></p>
+            <FORM action='[STEP2]'>
+            <P align=center><INPUT style="PADDING-RIGHT: 3px; PADDING-LEFT: 3px; FONT-WEIGHT: bold; FONT-SIZE: 17px; PADDING-BOTTOM: 4px; PADDING-TOP: 4px" type=submit value="Agree and Start Using" name=Submit> 
+            </p></FORM><FONT size=-2>* Automatically starts when you turn on 
+            your computer</font> </td></tr></TBODY></table>
+      <p></p></td></tr></TBODY></table></center>
+<p></p>
+<center><FONT color=#666666 size=-2>©2005 Google</font> 
+<p></p></center></body></html>
diff --git a/tools/grit/grit/testdata/oem_non_admin.html b/tools/grit/grit/testdata/oem_non_admin.html
new file mode 100644
index 0000000000..8b7ca13e21
--- /dev/null
+++ b/tools/grit/grit/testdata/oem_non_admin.html
@@ -0,0 +1,39 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html><head><title>Google Desktop Search Preferences</title>
+<meta http-equiv=cache-control content=no-cache>
+<meta http-equiv=content-type content="text/html; charset=utf-8">
+<meta http-equiv=pragma content=no-cache>
+<meta http-equiv=expires content=-1>
+<style>BODY {
+	FONT-FAMILY: arial,sans-serif
+}
+.c:active {
+	COLOR: #ff0000
+}
+.c:visited {
+	COLOR: #7777cc
+}
+.c:link {
+	COLOR: #7777cc
+}
+</style>
+
+<script>
+<!--
+override = 1;
+function ee() {if (override==1) {(new Image()).src="/doneinstallprefs&s=3286011577";}}
+// -->
+</script>
+
+<meta content="mshtml 6.00.2800.1476" name=generator></head>
+<BODY onresize=stw() leftMargin=30 rightMargin=30 onunload=ee()>
+<FORM name=f onsubmit=javascript:window.close();><IMG 
+src="/logo3.gif" border=0> 
+<DIV id=c1 style="WIDTH: 600px">
+<p><BR><FONT color=#00218a><B>We're sorry, but you need administrator access to 
+enable Desktop Search.</B></font></p><FONT size=-1>
+<p>To install or run Google Desktop Search you need administrator access on this 
+computer. Please try installing again once you have administrator 
+access.</p></font></DIV>
+<p><INPUT id=s type=submit value=&nbsp;&nbsp;OK&nbsp;&nbsp;> <BR></p>
+<center></center></FORM></body></html>
diff --git a/tools/grit/grit/testdata/onebox.html b/tools/grit/grit/testdata/onebox.html
new file mode 100644
index 0000000000..c24ff043a5
--- /dev/null
+++ b/tools/grit/grit/testdata/onebox.html
@@ -0,0 +1,21 @@
+<html><head><title>Google Desktop Search Results</title>
+<style><!--
+body,td,div,.p,a{font-family:arial,sans-serif }
+body{ background-color: transparent }
+div,td{color:#000}
+.f,.fl:link{color:#6f6f6f}
+a:link,.w,a.w:link,.w a:link{color:#00c}
+a:visited,.fl:visited{color:#551a8b}
+a:active,.fl:active{color:#f00}
+.t a:link,.t a:active,.t a:visited,.t{color:#000}
+//-->
+</style>
+</head>
+<body>
+<table cellspacing=0 cellpadding=1 border=0 ID="Google Desktop Search">
+<tr><td colspan=2><nobr><a href="http://[WEBSERVER][$~QUERY~$]" target=_parent>[NUMRESULTS] [RESULT-STRING] stored on your computer</a><font size=-1>&nbsp;-&nbsp;<a href="[HIDENOW]" style="color:#7777cc;" target=_parent>Hide</a>&nbsp;-&nbsp;<a href="http://desktop.google.com/integration.html" style="color:#7777cc;" target=_parent>About</a></font></nobr></td></tr>
+<tr><td valign=top width=40><img height=27 style="margin-top:2px;" src="http://[WEBSERVER]/onebox.gif"></td>
+<td valign=top width="99%"><font size=-1>[RESULTS]</font></td></tr>
+</table>
+</body>
+</html>
diff --git a/tools/grit/grit/testdata/oneclick.html b/tools/grit/grit/testdata/oneclick.html
new file mode 100644
index 0000000000..32dc6459dd
--- /dev/null
+++ b/tools/grit/grit/testdata/oneclick.html
@@ -0,0 +1,34 @@
+[HEADER]
+
+
+<TABLE cellSpacing=4 cellPadding=0 width="100%" border=0>
+<tr>
+	<TD vAlign=top align=left width=50%>
+	[EMAIL_TOP_CHROME]
+
+	<p class=f>
+	<TABLE cellSpacing=6 cellPadding=0 width="100%" border=0>
+		[EMAIL]
+	</table>
+	</td>
+
+
+	<TD width=1 align=middle bgColor=#cfcfcf><IMG height=1 width=1></td>
+    <TD width=50% vAlign=top align=left>
+	[FREQ_TOP_CHROME]
+	<p class=f>
+	<TABLE cellSpacing=6 cellPadding=0 width="100%" border=0 ID="Table1">
+		[$~FREQ~$]
+	</table>
+	<p class=g>
+	[RECENT_TOP_CHROME]
+	<TABLE cellSpacing=6 cellPadding=0 width="100%" border=0 ID="Table2">
+		[$~RECENT~$]
+	</table>
+	</td>
+	</tr>
+</table>
+<center><BR>
+
+
+[FOOTER]
diff --git a/tools/grit/grit/testdata/password.html b/tools/grit/grit/testdata/password.html
new file mode 100644
index 0000000000..16007a1ac0
--- /dev/null
+++ b/tools/grit/grit/testdata/password.html
@@ -0,0 +1,37 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html><head><title>Password Required</title>
+<meta http-equiv="content-type" content="text/html; charset=utf-8">
+<meta http-equiv="cache-control" content="no-cache">
+<meta http-equiv="pragma" content="no-cache">
+<meta http-equiv="expires" content="-1">
+<style>
+BODY,TD,A,P {FONT-FAMILY: arial,sans-serif}
+.q {COLOR: #0000cc}
+</style>
+<script>
+<!--
+function sf(){document.f.q.focus();}
+// -->
+</script>
+</head>
+<body text=#000000 vLink=#551a8b aLink=#ff0000 link=#0000cc bgColor=#ffffff onload=sf()>
+<center>
+<table cellSpacing=0 cellPadding=0 border=0>
+<tr><td><a href="[$~HOMEPAGE~$]"><IMG border=0 height=110 alt="Google Desktop Search" src="hp_logo.gif" width=276></a></td></tr></table><BR>
+<form name=f method=GET action='/password'>
+<table cellSpacing=0 cellPadding=4 border=0>
+<tr><td class=q noWrap><font size=-1>
+ <table cellSpacing=0 cellPadding=0>
+ <tr vAlign=top>
+ <td align=middle>Password required:&nbsp;&nbsp;<input maxLength=80 size=30 type=password name=pw value="">
+ <script>
+ document.f.q.focus();
+ </script>
+ &nbsp;<input type=submit value="Submit" name=submit>
+ </td></tr>
+ </table>
+ </form>
+</td></tr>
+</table>
+<br><font size=-1>[$~BOTTOMLINE~$]</font></p>
+<p><font size=-2>&copy;2005 Google</font></p></center></body></html>
\ No newline at end of file
diff --git a/tools/grit/grit/testdata/preferences.html b/tools/grit/grit/testdata/preferences.html
new file mode 100644
index 0000000000..b37412436b
--- /dev/null
+++ b/tools/grit/grit/testdata/preferences.html
@@ -0,0 +1,234 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html><head><title>Google Desktop Search Preferences</title>
+<meta http-equiv=content-type content="text/html; charset=utf-8">
+<style>
+body {
+  margin-left: 2em; margin-right: 2em;
+  font-family: arial,sans-serif;
+  color:#000; background-color:#fff;
+}
+a:active { color:#f00 }
+a:visited { color:#551a8b }
+a:link { color:#00c }
+a.c:active { color: #ff0000 }
+a.c:visited { color: #7777cc }
+a.c:link { color: #7777cc }
+.b { font-weight: bold }
+.shaded-header { background-color: #e8f4f7; border-top: 1px solid #39c;
+margin: 0px; padding: 0px }
+.shaded-subheader { background-color: #e8f4f7; margin: 12px 0px 0px 0px;
+ padding: 0px }
+.plain-subheader { background-color: #fff; margin: 12px 0px 0px 0px;
+ padding: 0px }
+.header-element { margin: 0px; padding: 2px}
+.expand { width: 98% }
+.s { font-size: smaller }
+.prefgroup { border: 2px solid #e8f4f7; width: 100% }
+.phead { font-weight: bold; font-size: smaller; vertical-align: top;
+text-transform: capitalize; border-bottom: 2px solid #e8f4f7; margin: 0px;
+padding: 8px}
+.pbody { border-bottom: 2px solid #e8f4f7; margin: 0px;
+padding: 8px}
+.pref-last { border-bottom: 0px }
+.example { color: gray; font-family: monospace; }
+</style>
+<script>
+<!--
+function validate() {}
+function fnOnClickAll() {for (var i = 0; i < document.langform.lr.length; i++) {
+document.langform.lr[i].checked = false;}}
+function fnOnClickSome() {
+var count = 0;for (var i = 0; i < document.langform.lr.length; i++) {
+if (document.langform.lr[i].checked) {count++;}}
+document.langform.lang[0].checked = (count <= 0);
+document.langform.lang[1].checked = (count > 0);}
+// -->
+</script>
+</head>
+<body onload="checkOffice()">
+<form name=prefs action="[$~SETPREFS~$]" method=post><input name=url
+value="[PREVPAGE]" type=hidden>
+<table cellspacing=2 cellpadding=0 width="100%" border=0>
+<tr>
+<td valign=top width="1%"><a href="[$~HOMEPAGE~$]">
+<img alt="Go to Google Desktop Search" src="logo3.gif" border=0></a></td>
+<td>&nbsp;</td>
+<td nowrap>
+
+<table class="shaded-header"><tr>
+<td class="header-element b expand">Preferences</td>
+<td class="header-element s">
+<a href="http://desktop.google.com/preferences.html">Preferences&nbsp;Help</a>
+</td>
+</tr></table>
+
+</tr></table>
+
+<table class="shaded-subheader"><tr>
+<td class="header-element expand s">
+<span class="b">Save</span> your preferences when finished.</td>
+<td class="header-element"><input type=submit value="Save Preferences"
+name=submit2></td>
+</tr></table>
+
+[STATUS-MESSAGE]
+<table class="plain-subheader"><tr>
+<td class="header-element expand"><span class="b">Preferences</span><span
+class="s"> (changes apply to Google Desktop Search application)</span></td>
+</tr></table>
+
+<table class="prefgroup" cellpadding=0 cellspacing=0>
+
+<!-- -->
+<tr>
+<td class="phead">Search types</td>
+<td class="pbody"><div class="s">Index the following items so that you can
+search for them:<br />&nbsp;</div>
+<div>
+ <table border=0>
+ <tr>
+  <td width=150 nowrap valign=top><span class="s">
+  <input type=checkbox [CHECK-EMAIL] name=EMAIL id=h3><label for=h3>
+  Email</label><br>
+  <input type=checkbox [CHECK-AIM] name=AIM id=h5><label for=h5> Chats 
+  (AOL/MSN IM)</label><br>
+  <input type=checkbox onclick='if(!this.checked){h12.checked=0;h12.disabled=1;}
+   else {h12.disabled=0;}' [CHECK-WEB] name=WEB id=h11><label for=h11> Web
+   history</label>
+  
+  </span></td>
+  <td width=120 nowrap valign=top><span class="s">
+  <script>
+<!--
+function checkOffice() { var w = document.getElementById("h7");
+var e = document.getElementById("h8"); var o = document.getElementById("h10");
+if (!(w.checked || e.checked)) { o.checked=0;o.disabled=1;} else {o.disabled=0;} }
+// -->
+  </script>
+  <input type=checkbox [CHECK-DOC] name=DOC id=h7 onclick='checkOffice()'>
+  <label for=h7> Word</label><br>
+  <input type=checkbox [CHECK-XLS] name=XLS id=h8 onclick='checkOffice()'>
+  <label for=h8> Excel</label><br>
+  <input type=checkbox [CHECK-PPT] name=PPT id=h9>
+  <label for=h9> PowerPoint</label><br>
+  </span></td><td nowrap valign=top><span class="s">
+  <input type=checkbox [CHECK-PDF] name=PDF id=hpdf>
+  <label for=hpdf> PDF</label><br>
+  <input type=checkbox [CHECK-TXT] name=TXT id=h6>
+  <label for=h6> Text, media, and other files</label><br>
+ </tr>
+ <tr><td nowrap valign=top colspan=3><span class="s"><br />
+ <input type=checkbox [CHECK-SECUREOFFICE] name=SECUREOFFICE id=h10>
+  <label for=h10> Password-protected Office documents (Word, Excel)</label><br />
+  <input type=checkbox [DISABLED-HTTPS] [CHECK-HTTPS] name=HTTPS id=h12><label
+  for=h12> Secure pages (HTTPS) in web history</label></span></td></tr>
+</table>
+</div></td></tr>
+</div>
+</td>
+</tr>
+
+<!-- -->
+<tr>
+<td class="phead">Plug-ins</td>
+<td class="pbody"><div class="s"
+style="display:[ADDIN-DISPLAYSTYLE]">Index these additional items:<p>
+[ADDIN-DO]
+[ADDIN-OPTIONS]</div><div class="s">
+To install plug-ins to index other items, visit the
+<a href="http://desktop.google.com/plugins.html">Plug-ins Download page</a>.</div>
+</tr>
+
+<!-- -->
+<tr>
+<td class="phead">Don't search these items</td>
+<td class="pbody"><div class="s">
+<label for=FORBIDDEN>Do not search web sites with the following URLs or files
+with the following paths. Put each entry on a separate line. Examples:</label><br>
+<span class="example">c:\Documents and Settings\username\Private Stuff</span><br>
+<span class="example">http://www.domain.com/</span><br>
+<div>&nbsp;</div>
+<div><TEXTAREA rows=3 cols=65 name=FORBIDDEN id=FORBIDDEN>[FORBIDDEN]
+</TEXTAREA></div>
+</tr>
+
+<!-- -->
+<tr>
+<td class="phead pref">Search Box Display</td>
+<td class="pbody pref" valign=top>
+
+<table border=0 cellpadding=0><tr><td valign=top>
+
+<input type="radio" name="SBDISPLAY" id="DISPLAYDB" [CHECK-DISPLAYDB] value="DISPLAYDB"></td><td>
+<label for=DISPLAYDB><font size=-1>Deskbar - A search box in your taskbar</font></label></td></tr>
+<tr><td></td></tr>
+<tr><td></td><td><img src="deskbar.gif" alt="Deskbar" width="268" height="34"></td></tr>
+<tr><td height=2></td></tr>
+<tr><td valign=top>
+
+<input type="radio" name="SBDISPLAY" id="DISPLAYMB" [CHECK-DISPLAYMB] VALUE="DISPLAYMB"></td><td>
+<label for=DISPLAYMB><font size=-1>Floating Deskbar - A search box you can put anywhere on your desktop</font></label></td></tr>
+<tr><td></td></tr>
+<tr><td></td><td><img src="minibar.gif" width="137" height="27"></td></tr>
+<tr><td height=2></td></tr>
+<tr><td valign=top>
+
+<input type=radio name="SBDISPLAY" id="DISPLAYNONE" [CHECK-DISPLAYNONE] VALUE="DISPLAYNONE"></td><td valign=top>
+<label for=DISPLAYNONE><font size=-1> None</font></label>
+</td></tr>
+</table>
+
+</td></tr>
+
+<!-- -->
+<tr>
+<td class="phead pref">Number of Results</td>
+<td class="pbody pref"><label for=num><span class="s">
+Display <select name=num id="num">
+<option [CHECK-NUM-10]>10
+<option [CHECK-NUM-20]>20
+<option [CHECK-NUM-30]>30
+<option [CHECK-NUM-50]>50
+<option [CHECK-NUM-100]>100</select>
+ results per page</span></label>
+</td>
+</tr>
+
+<!-- -->
+<tr>
+<td class="phead">Google integration</td>
+<td class="pbody">
+<table border=0 cellpadding=0>
+<tr><td><input type=CHECKBOX name=ONEBOX [CHECK-ONEBOX] id=onebox></td>
+<td><label for=onebox>
+ <span class="s">Show Desktop Search results on Google Web Search result pages.
+ </span></label></td></tr>
+ <tr><td></td><td>
+ <span class="s">Your personal results are private from Google.</span>
+ </td></tr></table>
+</td>
+</tr>
+
+<!-- -->
+<tr>
+<td class="phead pref-last">Help us improve</td>
+<td class="pbody pref-last">
+<input type=CHECKBOX name=SENDDATA id="SENDDATA" [CHECK-SENDDATA]><label for=
+SENDDATA> <span class="s">Send non-personal usage data and crash reports to
+Google to help improve Desktop Search.</span></label>
+</td>
+</tr>
+
+</table>
+
+<table class="shaded-subheader"><tr>
+<td class="header-element expand s"><span class="b">Save</span> your preferences
+when finished.</td>
+<td class="header-element"><input type=submit value="Save Preferences"
+name=submit2></td>
+</tr></table>
+
+<p><div align=center>[$~BOTTOMLINE~$]</div>
+<br><center><span class="s">&copy;2005 Google</span></center>
+</form></body></html>
\ No newline at end of file
diff --git a/tools/grit/grit/testdata/preprocess_test.html b/tools/grit/grit/testdata/preprocess_test.html
new file mode 100644
index 0000000000..13ece9a9f6
--- /dev/null
+++ b/tools/grit/grit/testdata/preprocess_test.html
@@ -0,0 +1,7 @@
+<if expr="True">
+should be kept
+</if>
+in the middle...
+<if expr="False">
+should be removed
+</if>
diff --git a/tools/grit/grit/testdata/privacy.html b/tools/grit/grit/testdata/privacy.html
new file mode 100644
index 0000000000..1d45f4a539
--- /dev/null
+++ b/tools/grit/grit/testdata/privacy.html
@@ -0,0 +1,35 @@
+[!]
+title	Privacy and Google Desktop Search
+template
+privacy_bottomline
+hp_image
+
+<TABLE CELLSPACING=0 CELLPADDING=5 WIDTH="98%" BORDER=0>
+<TR VALIGN=TOP>
+<td>
+<h4>Privacy and Google Desktop Search</h4>
+
+<p><FONT SIZE=-1>Google is committed to making search on your desktop as easy
+as searching the web.  We recognize that privacy is an important issue,
+so we designed and built Google Desktop Search with respect for your privacy.
+<p>
+So that you can easily search your computer, the Google Desktop Search application indexes
+and stores versions of your files and other computer activity, 
+such as email, chats, and web history.  These versions may also be mixed 
+with your Web search results to produce 
+results pages for you that integrate relevant content from your computer and 
+information from the Web. 
+<p>
+Your computer's content is not made accessible to Google or anyone else without your explicit permission. 
+
+<p>You can read the 
+<A HREF='http://desktop.google.com/privacypolicy.html?hl=[LANG_CODE]'>Privacy Policy</A>
+and <A HREF='http://desktop.google.com/privacyfaq.html?hl=[LANG_CODE]'>Privacy FAQ</A> online.
+</font>
+</td></tr></table>
+
+<center><br>
+<TABLE CELLSPACING=0 CELLPADDING=0 WIDTH="100%" BORDER=0>
+<TR BGCOLOR=#3399CC><TD ALIGN=MIDDLE HEIGHT=1><IMG HEIGHT=1 ALT="" WIDTH=1></td></tr></table>
+<FONT SIZE=-1>[$~PRIVACY_BOTTOMLINE~$] - &copy;2005 Google </font>
+</center>
\ No newline at end of file
diff --git a/tools/grit/grit/testdata/quit_apps.html b/tools/grit/grit/testdata/quit_apps.html
new file mode 100644
index 0000000000..a501b0e2bf
--- /dev/null
+++ b/tools/grit/grit/testdata/quit_apps.html
@@ -0,0 +1,49 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html><head><title>Google Desktop Search Preferences</title>
+<meta http-equiv=cache-control content=no-cache>
+<meta http-equiv=content-type content="text/html; charset=utf-8">
+<meta http-equiv=pragma content=no-cache>
+<meta http-equiv=expires content=-1>
+<style>BODY {
+	FONT-FAMILY: arial,sans-serif
+}
+.c:active {
+	COLOR: #ff0000
+}
+.c:visited {
+	COLOR: #7777cc
+}
+.c:link {
+	COLOR: #7777cc
+}
+</style>
+
+<script>
+<!--
+// -->
+</script>
+
+<meta content="mshtml 6.00.2800.1476" name=generator></head>
+<BODY onresize=stw() leftMargin=30 rightMargin=30>
+<FORM name=f action='[NEXTSTEP]' method=post><IMG src="/logo3.gif" 
+border=0> 
+<DIV id=c1 style="WIDTH: 600px">
+<p><BR><FONT color=#00218a><B>To start using Google Desktop Search, we may need to close the following programs if they are running:</B></font></p>
+<FONT size=-1><p>You can start these programs once Google Desktop Search is running.</p></font>
+
+<LI><FONT size=-1>AOL Instant Messenger</font> 
+<LI><FONT size=-1>Firefox</font> 
+<LI><FONT size=-1>Internet Explorer</font> 
+<LI><FONT size=-1>Microsoft Excel</font> 
+<LI><FONT size=-1>Microsoft Outlook </font>
+<LI><FONT size=-1>Microsoft Word </font>
+<LI><FONT size=-1>Mozilla</font> 
+<LI><FONT size=-1>Mozilla Thunderbird</font> 
+<LI><FONT size=-1>Netscape</font>
+<LI><FONT size=-1>Opera</font>
+<LI><FONT size=-1>Other web browsers</font>
+<FONT size=-1>
+<p>This will take only a few seconds to complete. </p></font></LI></DIV>
+<p><INPUT id=s type=submit name="quit" value="&nbsp;&nbsp;OK.&nbsp;&nbsp;Close&nbsp;these&nbsp;applications&nbsp;&nbsp;">
+   <INPUT id=s type=submit name="redir" value="&nbsp;&nbsp;Cancel.&nbsp;I'll&nbsp;run&nbsp;this&nbsp;later&nbsp;&nbsp;"><BR></p>
+<center></center></FORM></body></html>
diff --git a/tools/grit/grit/testdata/recrawl.html b/tools/grit/grit/testdata/recrawl.html
new file mode 100644
index 0000000000..0401e7c2b0
--- /dev/null
+++ b/tools/grit/grit/testdata/recrawl.html
@@ -0,0 +1,30 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html><head><title>Refresh index</title>
+<meta http-equiv="content-type" content="text/html; charset=utf-8">
+<meta http-equiv="cache-control" content="no-cache">
+<meta http-equiv="pragma" content="no-cache">
+<meta http-equiv="expires" content="-1">
+<style> 
+BODY,TD,A,P {FONT-FAMILY: arial,sans-serif}
+.q {COLOR: #0000cc}
+</style>
+</head>
+<body text="#000000" vLink="#551a8b" aLink="#ff0000" link="#0000cc" bgColor="#ffffff">
+<center>
+<table cellSpacing="0" cellPadding="0" border="0">
+<tr>
+<td><a href="[$~HOMEPAGE~$]"><img border="0" height="110" alt="Google Desktop Search" src="hp_logo.gif" width="276"></a>
+</td>
+</tr>
+</table>
+<br>
+<center>Google Desktop Search is now recrawling your drive to index new files.</center>
+<center>Note that new files are indexed automatically, and this step is generally not needed.</center>
+<center>Click <a href="[$~HOMEPAGE~$]">here</a> to continue.</center>
+</td></tr></table>
+<br>
+<font size="-1">[$~BOTTOMLINE~$]</font>
+<p><font size="-2">&copy;2005 Google</font></p>
+</center>
+</body>
+</html>
\ No newline at end of file
diff --git a/tools/grit/grit/testdata/resource_ids b/tools/grit/grit/testdata/resource_ids
new file mode 100644
index 0000000000..d5d440d57f
--- /dev/null
+++ b/tools/grit/grit/testdata/resource_ids
@@ -0,0 +1,13 @@
+{
+  "SRCDIR": ".",
+  "test.grd": {
+    "messages": [100, 10000],
+  },
+  "substitute_no_ids.grd": {
+    "messages": [10000, 20000],
+  },
+  "<(FOO)/file.grd": {
+  },
+  "<(SHARED_INTERMEDIATE_DIR)/devtools/devtools.grd": {
+  },
+}
diff --git a/tools/grit/grit/testdata/script.html b/tools/grit/grit/testdata/script.html
new file mode 100644
index 0000000000..f177d9c30e
--- /dev/null
+++ b/tools/grit/grit/testdata/script.html
@@ -0,0 +1,38 @@
+<script>
+function run(n,cut){
+	var out = "", str = "abcdefghijklmnopqrstuvwxyz 1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ,./:;'\"()*!?-_@[]{}#%`+=|\\>";
+	n.innerHTML = 'aa';
+
+	var base = n.scrollWidth;
+	for(var i=0;i<str.length;i++) {
+		n.innerHTML = 'a'+str.charAt(i)+'a';
+		out += str.charAt(i) + (n.scrollWidth-base) +";";
+
+		if(cut && !i && (n.scrollWidth-base == cut)) {
+			return '\x02'+"0;";
+		}
+	}
+	// extra cases for literals
+	n.innerHTML = 'a&lt;a';
+	out += '<' + (n.scrollWidth-base) +";";
+	n.innerHTML = 'a&amp;a';
+	out += '&' + (n.scrollWidth-base) +";";
+	
+	var base_height = n.scrollHeight;
+	n.innerHTML += '<br>a';
+	out += '\x01' + (n.scrollHeight-base_height) +";";
+	
+	return out;
+}
+
+function TEST_WIDTH() {
+	var n = document.getElementById('test');
+	var out = run(n[$~CUT~$]);
+	if (out.length>4){	
+		n.style.fontWeight='bold';
+		out += run(n);
+	}
+	n.outerHTML = "";
+	(new Image()).src="[$~SETWIDTH~$]?src=[COMPONENT]&data="+escape(out).replace(/\+/g,"%2B");
+}
+</script>
diff --git a/tools/grit/grit/testdata/searchbox.html b/tools/grit/grit/testdata/searchbox.html
new file mode 100644
index 0000000000..9eccba99a5
--- /dev/null
+++ b/tools/grit/grit/testdata/searchbox.html
@@ -0,0 +1,22 @@
+<body bgcolor=#ffffff topmargin=2 marginheight=2>
+<table border=0 cellpadding=0 cellspacing=0 width=1%>
+<tr>
+<td valign=top><a href='[$~HOMEPAGE~$]'><img width=150 height=55 src="/logo3.gif" alt="Go to Google Desktop Search" border=0 vspace=12></a></td>
+<td>&nbsp;&nbsp;</td>
+<td valign=top>
+<table cellpadding=0 cellspacing=0 border=0><tr><td colspan=2 height=14 valign=bottom>
+<table border=0 cellpadding=4 cellspacing=0>
+<tr><td class=q><font size=-1>
+[$~LINKS~$]
+</tr>
+</table>
+</td>
+</tr>
+<tr><td nowrap><form name=gs method=GET action='[$~SEARCHURL~$]'><input type=text name=q size=41 maxlength=2048 value="[DISP_QUERY]"><input type=hidden name=ie value="UTF-8">
+<font size=-1>[$~FLAGS~$]<input type=submit name="btnG" value="Search Desktop"><span id=hf></span></font></td>
+<td><font size=-2>&nbsp;&nbsp;<a href='[$~PREFERENCES~$]'>Desktop&nbsp;Preferences</a><br>&nbsp;&nbsp;<a [DELETE_EXTRA] href=[DELETE_PAGE]><nobr>[DELETE_NAME]</nobr></a></font></td>
+</tr></table>
+<table cellpadding=0 cellspacing=0 border=0>
+<tr><td><font size=-1>&nbsp;</font></td></tr>
+</table>
+</td></tr></form></table>
\ No newline at end of file
diff --git a/tools/grit/grit/testdata/sidebar_h.html b/tools/grit/grit/testdata/sidebar_h.html
new file mode 100644
index 0000000000..e103e8f8db
--- /dev/null
+++ b/tools/grit/grit/testdata/sidebar_h.html
@@ -0,0 +1,82 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html><head>
+<meta http-equiv="content-type" content="text/html; charset=utf-8">
+<meta http-equiv="cache-control" content="no-cache">
+<meta http-equiv="pragma" content="no-cache">
+<meta http-equiv="expires" content="-1">
+<style>
+BODY,TD,DIV,A,.p { FONT-FAMILY: arial,sans-serif; SCROLL: no}
+DIV,TD {COLOR: #000}
+.f, .fl:link {COLOR: #6f6f6f}
+A:link {	COLOR: #00c}
+A:visited {	COLOR: #551a8b}
+A:active {	COLOR: #f00}
+.fl:active {	COLOR: #f00}
+.h {	COLOR: #3399CC}
+.a, .a:link {COLOR: #008000}
+.b {	FONT-WEIGHT: bold; FONT-SIZE: 12pt; COLOR: #00c}
+.g {	MARGIN-TOP: .5em; MARGIN-BOTTOM: .5em}
+.f {	MARGIN-TOP: 0.5em; MARGIN-BOTTOM: 0.25em}
+.c:active, .c:visited, .c:link {	COLOR: #6f6f6f}
+.ch {CURSOR: hand}
+</style>
+</head>
+<BODY onload="TEST_WIDTH();" bottomMargin=0 leftMargin=2 topMargin=0 rightMargin=2 marginwidth=0 marginheight=0 SCROLL=NO bgcolor=#E0E0E0 style="border-style:solid; border-width:0;"  oncontextmenu="return false;">
+
+<script>
+function hide() {
+	return 1;
+	// return confirm("Are you sure you want to hide the sidebar?\nYou can show it again in Google Desktop Search Preferences. ");
+}
+</script>
+
+
+<TABLE border=0 cellPadding=0 cellSpacing=0 width="100%"><tr>
+<TD WIDTH="19%" VALIGN=TOP>
+
+<form method=get action="[$~SEARCHURL~$]">
+<input type=hidden name=src value=4>
+
+  <table cellspacing=0 cellpadding=0 width='1%'> 
+    <tr><td nowrap align=center valign=middle><nobr><img width=16 height=16 src=logo.gif>&nbsp;<b><i><font color=#6F6F6F>Google Desktop Search</font></i></b><IMG id=ctl src="[CONTROL_IMAGE]" border=0 usemap="#control"></nobr></td></tr>
+    <tr><td nowrap align=center valign=middle><nobr><input TABINDEX="1" style="font-size:10px; width:'100%';" name="q" id="q"></nobr></td></tr>
+    <tr><td nowrap align=center valign=middle><nobr><input TABINDEX="2" style="font-size:10px" type=submit value="Local search" name=btnG> <input TABINDEX="3" style="font-size:9px" type=submit value="Web search" name=redir></nobr></td></tr>
+<MAP name="control">
+<area TABINDEX="4" onkeydown='if(event.keyCode==13)location.href="movesidebar?side=1"' title="Move sidebar to Top" shape="rect" coords="9,0,22,8" href="/movesidebar?side=1" onmouseover="ctl.src='control1.gif'" onmouseout="ctl.src='[CONTROL_IMAGE]'">
+<area TABINDEX="5" onkeydown='if(event.keyCode==13)location.href="movesidebar?side=3"' title="Move sidebar to Bottom" shape="rect" coords="9,9,22,17" href="/movesidebar?side=3" onmouseover="ctl.src='control3.gif'" onmouseout="ctl.src='[CONTROL_IMAGE]'">
+<area TABINDEX="6" onkeydown='if(event.keyCode==13)location.href="movesidebar?side=0"' title="Move sidebar to Left" shape="rect" coords="0,2,8,15" href="/movesidebar?side=0" onmouseover="ctl.src='control0.gif'" onmouseout="ctl.src='[CONTROL_IMAGE]'">
+<area TABINDEX="7" onkeydown='if(event.keyCode==13)location.href="movesidebar?side=2"' title="Move sidebar to Right" shape="rect" coords="23,2,31,15" href="/movesidebar?side=2" onmouseover="ctl.src='control2.gif'" onmouseout="ctl.src='[CONTROL_IMAGE]'">
+</MAP>
+  </table>
+</form>
+
+</td>
+<TD WIDTH="27%" VALIGN=TOP>
+
+[HEADER_SECTION1]
+[CONTENT_INBOX]
+
+</td>
+<TD WIDTH="27%" VALIGN=top>
+
+[HEADER_SECTION2]
+[CONTENT_HIST]
+
+</td>
+<TD WIDTH="27%" VALIGN=top>
+
+[CONTENT_NEWS]
+[CONTENT_OTHER]
+
+</td>
+<TD WIDTH="1%" VALIGN=top>
+
+<a TABINDEX="8" onkeydown='if(event.keyCode!=16&&event.keyCode!=9)onclick()' onclick='return hide()' href='[$~HIDE1~$]' class=ch><img width=12 height=11 style='vertical-align:top;' src=/hide.gif valign=top border=0></a>
+
+</td>
+</tr></table>
+
+<font size=-1><span style="visibility:hidden" id='test'>t</span></font>
+
+[SCRIPT]
+</body></html>
diff --git a/tools/grit/grit/testdata/sidebar_v.html b/tools/grit/grit/testdata/sidebar_v.html
new file mode 100644
index 0000000000..e040d8ec59
--- /dev/null
+++ b/tools/grit/grit/testdata/sidebar_v.html
@@ -0,0 +1,267 @@
+<html><head>
+<title>Google Desktop Search Sidebar</title>
+<meta http-equiv="content-type" content="text/html; charset=utf-8">
+<meta http-equiv="cache-control" content="no-cache">
+<meta http-equiv="pragma" content="no-cache">
+<meta http-equiv="expires" content="-1">
+<style>
+BODY,TD,P,A {FONT-FAMILY: verdana,arial,sans-serif;font-size:8pt; color:#fff} 
+a:link, a:visited, a:hover, b, q b { color: #ffffff}
+a:active  { color: #ff0000}
+a:link,a:active,a:visited,div { text-decoration: none;font-size:8pt } 
+.g{margin-top: 1em;}
+.gg{margin-top: .4em;}
+.norepeat { background-repeat: no-repeat }
+.indent{margin-top: 0px; margin-bottom: 0px;margin-left:3px;}
+.c:link, .c:visited, .c:active { color: #959595;font-size:8pt } 
+.ch{cursor:pointer;cursor:hand}
+.gap{margin-top: 10px; margin-bottom: 10px;}
+.off {display:none}
+.on  {display:on}
+.but { border-top: 1px solid #73787E;border-bottom: 1px solid #000000;border-right: 1px solid #000000;border-left: 1px solid #73787E;margin-top: 0px; margin-bottom: 0px; cursor:pointer;cursor:hand}
+</style>
+<script>
+
+function toggle(i) {
+	var v = document.getElementById(i);
+	var vi = document.getElementById(i+'icon');
+	var c = (v['className'] == 'on');
+	if (c) {
+		v['className'] = 'off';
+		vi.src='up.gif';
+	}
+	else {
+		v['className'] = 'on';
+		vi.src='down.gif';
+	}
+	(new Image()).src="[$~TOGGLE~$]?setting="+i+"&mode="+v['className']+"&rnd="+Math.random();
+	
+	if (!c && (v['oclass'] == 'off')) {
+		location.href = location.href;
+	}
+	
+	return true;
+}
+function hide() {
+	// return confirm("Are you sure you want to hide the sidebar?\nYou can show it again in Google Desktop Search Preferences.");
+	return 1;
+}
+</script>
+
+<!-- menu experiment start -->
+
+<style>
+<!--
+.menu1 {
+cursor:default;
+position:absolute;
+text-align: left;
+font-family: Arial, Helvetica, sans-serif;
+font-size: 8pt;
+font-color: #000000;
+color: #000000;
+background-color: menu;
+visibility: hidden;
+padding-top: 2px;
+padding-bottom: 2px;
+border: 1 solid;
+border-color: #888888;
+z-index: 100;
+}
+.menuitems {
+padding-left: 5px;
+padding-right: 5px;
+}
+-->
+</style>
+<SCRIPT LANGUAGE="JavaScript1.2">
+<!--
+var menustyle = "menu1";
+
+function showmenu() {
+  var rightedge = document.body.clientWidth-event.clientX;
+  var bottomedge = document.body.clientHeight-event.clientY;
+  // if (rightedge < rcmenu.offsetWidth)
+  //  rcmenu.style.left = document.body.scrollLeft + event.clientX - rcmenu.offsetWidth;
+  // else
+  //   rcmenu.style.left = document.body.scrollLeft + event.clientX;
+
+  // if (rcmenu.style.left < 0) rcmenu.style.left = 0;
+  rcmenu.style.left = 0;
+
+  if (bottomedge < rcmenu.offsetHeight)
+     rcmenu.style.top = document.body.scrollTop + event.clientY - rcmenu.offsetHeight;
+  else
+     rcmenu.style.top = document.body.scrollTop + event.clientY;
+
+  if (rcmenu.style.top < 0) rcmenu.style.top = 0;
+
+  rcmenu.style.visibility = "visible";
+  // rcmenu.style.zindex = 0;
+  // document.all('rcmenu').style.zindex = 20;
+  document.onkeydown=ck;
+  return false;
+}
+
+function hidemenu() {
+  rcmenu.style.visibility = "hidden";
+}
+
+function ck(e){
+	evt=document.all?window.event:e;
+	k=document.all?window.event.keyCode:e.keyCode;
+	
+	if(k==27 /*<Esc>*/) {
+      hidemenu();
+	}
+}
+
+function menumouseover() {
+  if (event.srcElement.className == "menuitems") {
+    event.srcElement.style.backgroundColor = "highlight";
+    event.srcElement.style.color = "white";
+  }
+}
+
+function menumouseout() {
+  if (event.srcElement.className == "menuitems") {
+    event.srcElement.style.backgroundColor = "";
+    event.srcElement.style.color = "black";
+    window.status = "";
+  }
+}
+
+function menuselect() {
+  if (event.srcElement.className == "menuitems") {
+  if (event.srcElement.getAttribute("target") != null)
+    window.open(event.srcElement.url, event.srcElement.getAttribute("target"));
+  else if (event.srcElement.url.length)
+    window.location = event.srcElement.url;
+  }
+}
+// -->
+</script>
+
+<!-- menu experiment end -->
+
+</head>
+
+<body onload="TEST_WIDTH();" bottommargin=0 leftmargin=0 marginheight=0 marginwidth=0 rightmargin=0 topmargin=0 style="background-color:'#384146'; background-repeat: repeat-y; border-style:solid; border-width:0;"  background="greyback.jpg" scroll=NO oncontextmenu="return false;">
+
+<!-- menu experiment start -->
+
+<div id="rcmenu" class="skin0" onMouseover="menumouseover()" onMouseout="menumouseout()" onClick="menuselect();">
+<div class="menuitems" url="[$~SETDISP4~$]">Switch to minibar</div>
+<div class="menuitems" url="[$~SETDISP2~$]">Switch to hoverbar</div>
+<div class="menuitems" url="[$~HIDE1~$]">Close sidebar</div>
+<div class="menuitems" url="">No change</div>
+</div>
+
+<script language="JavaScript1.2">
+if (document.all && window.print) {
+  rcmenu.className = menustyle;
+  document.oncontextmenu = showmenu;
+  document.body.onclick = hidemenu;
+}
+</script>
+
+<!-- menu experiment end -->
+
+<div id="oneliner" style="visibility:hidden; position:absolute; left:0px; top:0px;"></div>
+<script>
+var h = document.getElementById("oneliner").offsetHeight*2;
+document.write("<style type='text/css'>.truncme { overflow:hidden;height: " +h+"px; }</style>");
+</script>
+
+<table cellpadding=0 cellspacing=0 border=0 width='100%'>
+<form method=get action="[$~SEARCHURL~$]" id=f1>
+<input type=hidden name=src value=5>
+<input type=hidden name=redir value=''>
+<tr>
+	<td width='1%'><IMG id=ctl src="[CONTROL_IMAGE]" border=0 usemap="#control"></td>
+	<td width='97%'><input TABINDEX="1" NAME="q" style="width:'100%'; FONT-FAMILY: verdana,arial,sans-serif;font-size:8pt"></td>
+	<td width='1%'><table cellpadding=2 cellspacing=0><tr><td> </td><td TABINDEX="8" onkeydown='if(event.keyCode!=16&&event.keyCode!=9)onclick()' onmouseover="this.bgColor='4C535B'" onmouseout="this.bgColor='#414A4F'" class=but bgcolor=414A4F valign=top onclick="location.href='[$~SETDISP2~$]';"><img src="mini_mini.gif"></td></tr></table></td>
+        <td width='1%'><table cellpadding=2 cellspacing=0><tr><td TABINDEX="9" onkeydown='if(event.keyCode!=16&&event.keyCode!=9)onclick()' onmouseover="this.bgColor='4C535B'" onmouseout="this.bgColor='#414A4F'" class=but bgcolor=414A4F valign=top onclick="if (hide())location.href='[$~HIDE1~$]';"><img src="mini_close.gif"></td></tr></table></td>
+</tr>
+<MAP name="control">
+<area TABINDEX="4" onkeydown='if(event.keyCode==13)location.href="movesidebar?side=1"' title="Move sidebar to Top" shape="rect" coords="9,0,22,8" href="/movesidebar?side=1" onmouseover="ctl.src='control1.gif'" onmouseout="ctl.src='[CONTROL_IMAGE]'">
+<area TABINDEX="5" onkeydown='if(event.keyCode==13)location.href="movesidebar?side=3"' title="Move sidebar to Bottom" shape="rect" coords="9,9,22,17" href="/movesidebar?side=3" onmouseover="ctl.src='control3.gif'" onmouseout="ctl.src='[CONTROL_IMAGE]'">
+<area TABINDEX="6" onkeydown='if(event.keyCode==13)location.href="movesidebar?side=0"' title="Move sidebar to Left" shape="rect" coords="0,2,8,15" href="/movesidebar?side=0" onmouseover="ctl.src='control0.gif'" onmouseout="ctl.src='[CONTROL_IMAGE]'">
+<area TABINDEX="7" onkeydown='if(event.keyCode==13)location.href="movesidebar?side=2"' title="Move sidebar to Right" shape="rect" coords="23,2,31,15" href="/movesidebar?side=2" onmouseover="ctl.src='control2.gif'" onmouseout="ctl.src='[CONTROL_IMAGE]'">
+</MAP>
+</table>
+
+<center>
+<table cellpadding=2 cellspacing=3>
+<tr>
+	<td TABINDEX="2" onkeydown='if(event.keyCode!=16&&event.keyCode!=9)onclick()' onclick="f1.submit()" onmouseover="this.bgColor='4C535B'" onmouseout="this.bgColor='#414A4F'" class=ch nowrap bgcolor=414A4F valign=top style="border-top: 1px solid #73787E;border-bottom: 1px solid #252C30;border-right: 1px solid #252C30;border-left: 1px solid #73787E;"><img src="logo.gif" align="texttop"> <font color=ffffff>Google Desktop Search&nbsp;</td>
+	<td TABINDEX="3" onkeydown='if(event.keyCode!=16&&event.keyCode!=9)onclick()' onclick="redir.value='google'; f1.submit(); redir.value='';" onmouseover="this.bgColor='4C535B'" onmouseout="this.bgColor='#414A4F'" class=ch bgcolor=414A4F nowrap valign=top style="border-top: 1px solid #73787E;border-bottom: 1px solid #252C30;border-right: 1px solid #252C30;border-left: 1px solid #73787E;">&nbsp;<font color=ffffff>Web&nbsp;</td>
+</tr>
+</form>
+</table>
+</center>
+
+<p class=gg>
+<table width=100% cellpadding=0 cellspacing=0><tr><td bgcolor=4E555C><img width=1 height=1></td></tr></table>
+<table class=ch cellpadding=0 cellspacing=0 style="background-color:'#424B50'; background-repeat: repeat-y;" background="section.jpg" width=100% height=18><tr onDblClick='return toggle("news");' onclick='return toggle("news");' onmouseover="this.bgColor='#465055'" onmouseout="this.bgColor=''"><td width=16 align=right><img id=newsicon src="[$~NEWS_MODE~$]" border=0></td><td valign=middle>&nbsp;<font color=ffffff>News</td></tr></table>
+<table width=100% cellpadding=0 cellspacing=0><tr><td bgcolor=313B40><img width=1 height=1></td></tr></table>
+
+<span id="news" class=[$~NEWS_CLASS~$] oclass=[$~NEWS_CLASS~$]>
+[CONTENT_NEWS]
+<p class=g>
+</span>
+
+<table width=100% cellpadding=0 cellspacing=0><tr><td bgcolor=4E555C><img width=1 height=1></td></tr></table>
+<table class=ch cellpadding=0 cellspacing=0 style="background-color:'#424B50'; background-repeat: repeat-y;" background="section.jpg" width=100% height=18><tr onDblClick='return toggle("inbox");' onclick='return toggle("inbox");' onmouseover="this.bgColor='#465055'" onmouseout="this.bgColor=''"><td width=16 align=right><img id=inboxicon src="[$~INBOX_MODE~$]" border=0></td><td valign=middle>&nbsp;<font color=ffffff>Email</td></tr></table>
+<table width=100% cellpadding=0 cellspacing=0><tr><td bgcolor=313B40><img width=1 height=1></td></tr></table>
+
+<span id=inbox class=[$~INBOX_CLASS~$] oclass=[$~INBOX_CLASS~$]>
+[CONTENT_INBOX]
+<p class=g>
+</span>
+
+<table width=100% cellpadding=0 cellspacing=0><tr><td bgcolor=4E555C><img width=1 height=1></td></tr></table>
+<table class=ch cellpadding=0 cellspacing=0 style="background-color:'#424B50'; background-repeat: repeat-y;" background="section.jpg" width=100% height=18><tr onDblClick='return toggle("hist");' onclick='return toggle("hist");' onmouseover="this.bgColor='#465055'" onmouseout="this.bgColor=''"><td width=16 align=right><img id=histicon src="[$~HIST_MODE~$]" border=0></td><td valign=middle>&nbsp;<font color=ffffff>Related History</td></tr></table>
+<table width=100% cellpadding=0 cellspacing=0><tr><td bgcolor=313B40><img width=1 height=1></td></tr></table>
+
+<span id="hist" class=[$~HIST_CLASS~$] oclass=[$~HIST_CLASS~$]>
+[CONTENT_HIST]
+<p class=g>
+</span>
+
+    
+<table width=100% cellpadding=0 cellspacing=0><tr><td bgcolor=4E555C><img width=1 height=1></td></tr></table>
+<table class=ch cellpadding=0 cellspacing=0 style="background-color:'#424B50'; background-repeat: repeat-y;" background="section.jpg" width=100% height=18><tr onDblClick='return toggle("recent");' onclick='return toggle("recent");' onmouseover="this.bgColor='#465055'" onmouseout="this.bgColor=''"><td width=16 align=right><img id=recenticon src="[$~RECENT_MODE~$]" border=0></td><td valign=middle>&nbsp;<font color=ffffff>Recent</td></tr></table>
+<table width=100% cellpadding=0 cellspacing=0><tr><td bgcolor=313B40><img width=1 height=1></td></tr></table>
+
+<span id="recent" class=[$~RECENT_CLASS~$] oclass=[$~RECENT_CLASS~$]>
+[CONTENT_RECENT]
+<p class=g>
+</span>
+
+
+<table width=100% cellpadding=0 cellspacing=0><tr><td bgcolor=4E555C><img width=1 height=1></td></tr></table>
+<table class=ch cellpadding=0 cellspacing=0 style="background-color:'#424B50'; background-repeat: repeat-y;" background="section.jpg" width=100% height=18><tr onDblClick='return toggle("popular");' onclick='return toggle("popular");' onmouseover="this.bgColor='#465055'" onmouseout="this.bgColor=''"><td width=16 align=right><img id=popularicon src="[$~POPULAR_MODE~$]" border=0></td><td valign=middle>&nbsp;<font color=ffffff>Frequently Visited</td></tr></table>
+<table width=100% cellpadding=0 cellspacing=0><tr><td bgcolor=313B40><img width=1 height=1></td></tr></table>
+
+<span id="popular" class=[$~POPULAR_CLASS~$] oclass=[$~POPULAR_CLASS~$]>
+[CONTENT_POPULAR]
+<p class=g>
+</span>
+
+
+<table width=100% cellpadding=0 cellspacing=0><tr><td bgcolor=4E555C><img width=1 height=1></td></tr></table>
+<table class=ch cellpadding=0 cellspacing=0 style="background-color:'#424B50'; background-repeat: repeat-y;" background="section.jpg" width=100% height=18><tr onDblClick='return toggle("quib_debug");' onclick='return toggle("quib_debug");' onmouseover="this.bgColor='#465055'" onmouseout="this.bgColor=''"><td width=16 align=right><img id=quib_debugicon src="[$~QUIB_DEBUG_MODE~$]" border=0></td><td valign=middle>&nbsp;<font color=ffffff>Implicit Query Debug</td></tr></table>
+<table width=100% cellpadding=0 cellspacing=0><tr><td bgcolor=313B40><img width=1 height=1></td></tr></table>
+
+<span id="quib_debug" class=[$~QUIB_DEBUG_CLASS~$] oclass=[$~QUIB_DEBUG_CLASS~$]>
+[CONTENT_QUIB_DEBUG]
+</span>
+
+<span style="visibility:hidden" id='test'>t</span>
+
+[CONTENT_OTHER]
+
+[SCRIPT]
+</body>
+</html>
diff --git a/tools/grit/grit/testdata/simple-input.xml b/tools/grit/grit/testdata/simple-input.xml
new file mode 100644
index 0000000000..92827fa4b5
--- /dev/null
+++ b/tools/grit/grit/testdata/simple-input.xml
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<grit base_dir="." latest_public_release="2" current_release="3" source_lang_id="en-US">
+  <release seq="2">
+    <messages>
+      <message name="IDS_OLD_MESSAGE" translateable="true">Hello earthlings!</message>
+    </messages>
+  </release>
+  <release seq="3">
+    <includes>
+        <include name="ID_EDIT_BOX_ICON" type="icon" translateable="false" file="images/edit_box.ico" />
+        <include name="ID_LOGO" type="gif" translateable="true" file="images/logo.gif"/>
+    </includes>
+    <messages>
+        <message name="IDS_BTN_GO" desc="Button text" meaning="verb">Go!</message>
+        <message name="IDS_GREETING" desc="Printed to greet the currently logged in user">
+          Hello <ph name="USERNAME">%s<ex>Joi</ex></ph>, how are you doing today?
+        </message>
+    </messages>
+    <structures>
+        <structure type="menu" name="IDM_FOO" file="rc_files/menus.rc" />
+        <structure type="dialog" name="IDD_BLAT" file="rc_files/dialogs.rc" />
+        <structure type="tr_html" name="IDR_HTML_TEMPLATE" file="templates/homepage.html" />
+        <structure type="dialog" name="IDD_NARROW_DIALOG" file="rc_files/dialogs.rc">
+          <skeleton expr="lang == 'fr-FR'" variant_of_revision="3">
+            <![CDATA[IDD_DIALOG1 DIALOGEX 0, 0, 186, 90
+STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | 
+    WS_SYSMENU
+CAPTION "TRANSLATEABLEPLACEHOLDER1"
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+    DEFPUSHBUTTON   "TRANSLATEABLEPLACEHOLDER2",IDOK,129,7,50,14
+    PUSHBUTTON      "TRANSLATEABLEPLACEHOLDER3",IDCANCEL,129,24,50,14
+    LTEXT           "TRANSLATEABLEPLACEHOLDER4",IDC_STATIC,23,31,40,8
+END]]>
+          </skeleton>
+        </structure>
+        <structure type="version" name="VS_VERSION_INFO" file="rc_files/version.rc"/>
+    </structures>
+  </release>
+  <translations>
+    <file path="figs_nl_translations.xml" />
+    <file path="cjk_translations.xml" />
+  </translations>
+  <outputs>
+    <output filename="resource.h" type="rc_header" />
+    <output filename="resource_en.rc" type="rc_all" lang="en-US" />
+    <output filename="resource_fr.rc" type="rc_all" lang="fr-FR" />
+    <output filename="resource_it.rc" type="rc_translateable" lang="it-IT" />
+    <output filename="resource_zh_cn.rc" type="rc_translateable" lang="zh-CN" />
+    <output filename="nontranslateable.rc" type="rc_nontranslateable" />
+  </outputs>
+</grit>
diff --git a/tools/grit/grit/testdata/simple.html b/tools/grit/grit/testdata/simple.html
new file mode 100644
index 0000000000..4392d23e98
--- /dev/null
+++ b/tools/grit/grit/testdata/simple.html
@@ -0,0 +1,3 @@
+<p>
+  Hello!
+</p>
\ No newline at end of file
diff --git a/tools/grit/grit/testdata/source.rc b/tools/grit/grit/testdata/source.rc
new file mode 100644
index 0000000000..fbc72284e9
--- /dev/null
+++ b/tools/grit/grit/testdata/source.rc
@@ -0,0 +1,57 @@
+IDC_KLONKMENU MENU
+BEGIN
+    POPUP "&File"
+    BEGIN
+        MENUITEM "E&xit",                       IDM_EXIT
+        MENUITEM "This be ""Klonk"" me like",   ID_FILE_THISBE
+        POPUP "gonk"
+        BEGIN
+            MENUITEM "Klonk && is [good]",           ID_GONK_KLONKIS
+        END
+    END
+    POPUP "&Help"
+    BEGIN
+        MENUITEM "&About ...",                  IDM_ABOUT
+    END
+END
+
+IDD_ABOUTBOX DIALOGEX 22, 17, 230, 75
+STYLE DS_SETFONT | DS_MODALFRAME | WS_CAPTION | WS_SYSMENU
+CAPTION "About"
+FONT 8, "System", 0, 0, 0x0
+BEGIN
+    ICON            IDI_KLONK,IDC_MYICON,14,9,20,20
+    LTEXT           "klonk Version ""yibbee"" 1.0",IDC_STATIC,49,10,119,8,
+                    SS_NOPREFIX
+    LTEXT           "Copyright (C) 2005",IDC_STATIC,49,20,119,8
+    DEFPUSHBUTTON   "OK",IDOK,195,6,30,11,WS_GROUP
+    CONTROL         "Jack ""Black"" Daniels",IDC_RADIO1,"Button",
+                    BS_AUTORADIOBUTTON,46,51,84,10
+END
+
+IDD_DIFFERENT_LENGTH_IN_TRANSL DIALOGEX 22, 17, 230, 75
+STYLE DS_SETFONT | DS_MODALFRAME | WS_CAPTION | WS_SYSMENU
+CAPTION "Bingobobbi"
+FONT 8, "System", 0, 0, 0x0
+BEGIN
+    LTEXT           "Howdie dodie!",IDC_STATIC,49,10,119,8,SS_NOPREFIX
+    LTEXT           "Yo froodie!",IDC_STATIC,49,20,119,8
+END
+
+STRINGTABLE
+BEGIN
+  IDS_SIMPLE "One"
+  IDS_PLACEHOLDER "%s birds"
+  IDS_PLACEHOLDERS "%d of %d"
+  IDS_REORDERED_PLACEHOLDERS "$1 of $2"
+  // Won't be in translations list because it has changed
+  IDS_CHANGED "This was the old version"
+  IDS_TWIN_1 "Hello"
+  IDS_TWIN_2 "Hello"
+  IDS_NOT_TRANSLATEABLE ":"
+  IDS_LONGER_TRANSLATED "Removed document $1"
+  // Won't appear in the list of translations because it's not in the .grd file
+  IDS_NO_LONGER_USED "Not used"
+  IDS_DIFFERENT_TWIN_1 "Howdie"
+  IDS_DIFFERENT_TWIN_2 "Howdie"
+END
diff --git a/tools/grit/grit/testdata/special_100_percent/a.png b/tools/grit/grit/testdata/special_100_percent/a.png
new file mode 100644
index 0000000000000000000000000000000000000000..5d5089038ca71172e95db9e7aae1e1fa5cebd505
GIT binary patch
literal 159
zcmeAS@N?(olHy`uVBq!ia0vp^oFL4>0wld=oSO}#(mY)pLnNjq|2Y3)zGGzYPN&L+
zMSC}CcCfp=Dtxv4%6W%G#Q=|R|L;6pCCLUWO)Z<5eoL%TkDTw=s4X!^d(Qa<2khAN
zZPy!XToBAic1Ss}vcWiD27B3&`Zj^H6CO>7R1{ToQ;=ggdEYbV=IISvfHpFCy85}S
Ib4q9e0O9jEh5!Hn

literal 0
HcmV?d00001

diff --git a/tools/grit/grit/testdata/status.html b/tools/grit/grit/testdata/status.html
new file mode 100644
index 0000000000..6b997b9369
--- /dev/null
+++ b/tools/grit/grit/testdata/status.html
@@ -0,0 +1,44 @@
+[HEADER]
+<table cellspacing=0 cellPadding=0 width="100%" border=0>
+<tr bgcolor=#3399cc><td align=middle height=1><img height=1 width=1></td></tr>
+</table>
+<table cellspacing=0 cellPadding=1 width="100%" bgcolor=#e8f4f7 border=0>
+<tr><td height=20><font size=+1 color=#000000>&nbsp;<b>Desktop Search Status</b></font></td></tr>
+</table>   
+<br>
+<center>
+[$~MESSAGE~$]
+<table cellspacing=0 cellPadding=6 width=500 border=0>
+<tr>
+ <td>&nbsp;</td>
+ <td align=right nowrap><i><font size=-1>Number of items</font></i></td>
+ <td align=right nowrap><i><font size=-1>Time of newest item</font></i></td>
+</tr>
+<tr> 
+ <td width=1% nowrap><img style="vertical-align:middle" width=16 height=16 src=favicon.ico>&nbsp; Total searchable items</td>
+ <td align=right><b>[TOTAL_COUNT]</b></td>
+ <td align=right><b>[TOTAL_TIME]</b></td>
+</tr>
+<tr> 
+ <td><font size=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<img style="vertical-align:middle" src=email.gif width=16 height=16>&nbsp; Emails</font></td>
+ <td align=right><font size=-1>[EMAIL_COUNT]</font></td>
+ <td align=right><font size=-1>[EMAIL_TIME]</font></td>
+</tr>
+<tr> 
+ <td><font size=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<img style="vertical-align:middle" src="16x16_chat.gif" width=16 height=16>&nbsp; Chats</font></td>
+ <td align=right><font size=-1>[IM_COUNT]</font></td>
+ <td align=right><font size=-1>[IM_TIME]</font></td>
+</tr>
+<tr> 
+ <td><font size=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<img style="vertical-align:middle" src=html.gif width=16 height=16>&nbsp; Web history</font></td>
+ <td align=right><font size=-1>[WEB_COUNT]</font></td>
+ <td align=right><font size=-1>[WEB_TIME]</font></td>
+</tr>
+<tr> 
+ <td><font size=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<img style="vertical-align:middle" src=file.gif width=16 height=16>&nbsp; Files</font></td>
+ <td align=right><font size=-1>[FILE_COUNT]</font></td>
+ <td align=right><font size=-1>[FILE_TIME]</font></td>
+</tr>
+</table>
+</center>
+[FOOTER]
\ No newline at end of file
diff --git a/tools/grit/grit/testdata/structure_variables.html b/tools/grit/grit/testdata/structure_variables.html
new file mode 100644
index 0000000000..2a15de8072
--- /dev/null
+++ b/tools/grit/grit/testdata/structure_variables.html
@@ -0,0 +1,4 @@
+<h1>[GREETING]!</h1>
+Some cool things are [THINGS].
+Did you know that [EQUATION]?
+<include src="[filename].html">
diff --git a/tools/grit/grit/testdata/substitute.grd b/tools/grit/grit/testdata/substitute.grd
new file mode 100644
index 0000000000..95dcc56e1d
--- /dev/null
+++ b/tools/grit/grit/testdata/substitute.grd
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?> <!-- -*- XML -*- -->
+<grit
+    base_dir="."
+    source_lang_id="en"
+    tc_project="GoogleDesktopWindowsClient"
+    latest_public_release="0"
+    current_release="1"
+    enc_check="möl">
+  <outputs>
+    <output filename="resource.h" type="rc_header" />
+    <output filename="en_generated_resources.rc" type="rc_all" lang="en" />
+    <output filename="sv_generated_resources.rc" type="rc_all" lang="sv" />
+  </outputs>
+  <translations>
+    <file path="substitute.xmb" lang="sv" />
+  </translations>
+  <release seq="1" allow_pseudo="false">
+    <messages first_id="8192">
+      <message name="IDS_COPYRIGHT_GOOGLE_LONG" sub_variable="true" desc="Gadget copyright notice.  Needs to be updated every year.">
+        Copyright 2008 Google Inc. All Rights Reserved.
+      </message>
+      <message name="IDS_NEWS_PANEL_COPYRIGHT">
+        Google Desktop News gadget
+[IDS_COPYRIGHT_GOOGLE_LONG]
+View news that is personalized based on the articles you read.
+
+For example, if you read lots of sports news, you'll see more sports articles. If you read technology news less often, you'll see fewer of those articles.
+      </message>
+    </messages>
+  </release>
+</grit>
diff --git a/tools/grit/grit/testdata/substitute.xmb b/tools/grit/grit/testdata/substitute.xmb
new file mode 100644
index 0000000000..e592069c8b
--- /dev/null
+++ b/tools/grit/grit/testdata/substitute.xmb
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE translationbundle SYSTEM "/home/build/nonconf/google3/i18n/translationbundle.dtd">
+<translationbundle lang="sv">
+<translation id="7239109800378180620">© 2008 Google Inc. Med ensamrätt.</translation>
+<translation id="6212022020330010625">Google Desktop News gadget
+<ph name="IDS_COPYRIGHT_GOOGLE_LONG_1"/>
+Se nyheter som är anpassade till dig, baserat på de artiklar du läser.
+
+Om du t.ex. läser massor av sportnyheter kommer du att se fler sportartiklar. Om du inte läser tekniknyheter lika ofta ser du färre av dessa artiklar.</translation>
+</translationbundle>
diff --git a/tools/grit/grit/testdata/substitute_no_ids.grd b/tools/grit/grit/testdata/substitute_no_ids.grd
new file mode 100644
index 0000000000..d569d1cacd
--- /dev/null
+++ b/tools/grit/grit/testdata/substitute_no_ids.grd
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?> <!-- -*- XML -*- -->
+<grit
+    base_dir="."
+    source_lang_id="en"
+    tc_project="GoogleDesktopWindowsClient"
+    latest_public_release="0"
+    current_release="1"
+    enc_check="möl">
+  <outputs>
+    <output filename="resource.h" type="rc_header" />
+    <output filename="en_generated_resources.rc" type="rc_all" lang="en" />
+    <output filename="sv_generated_resources.rc" type="rc_all" lang="sv" />
+  </outputs>
+  <translations>
+    <file path="substitute.xmb" lang="sv" />
+  </translations>
+  <release seq="1" allow_pseudo="false">
+    <messages>
+      <message name="IDS_COPYRIGHT_GOOGLE_LONG" sub_variable="true" desc="Gadget copyright notice.  Needs to be updated every year.">
+        Copyright 2008 Google Inc. All Rights Reserved.
+      </message>
+      <message name="IDS_NEWS_PANEL_COPYRIGHT">
+        Google Desktop News gadget
+[IDS_COPYRIGHT_GOOGLE_LONG]
+View news that is personalized based on the articles you read.
+
+For example, if you read lots of sports news, you'll see more sports articles. If you read technology news less often, you'll see fewer of those articles.
+      </message>
+    </messages>
+  </release>
+</grit>
diff --git a/tools/grit/grit/testdata/substitute_tmpl.grd b/tools/grit/grit/testdata/substitute_tmpl.grd
new file mode 100644
index 0000000000..be7b601707
--- /dev/null
+++ b/tools/grit/grit/testdata/substitute_tmpl.grd
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?> <!-- -*- XML -*- -->
+<grit
+    base_dir="."
+    source_lang_id="en"
+    tc_project="GoogleDesktopWindowsClient"
+    latest_public_release="0"
+    current_release="1"
+    enc_check="möl">
+  <outputs>
+    <output filename="resource.h" type="rc_header" />
+    <output filename="en_${name}_resources.rc" type="rc_all" lang="en" />
+    <output filename="sv_${name}_resources.rc" type="rc_all" lang="sv" />
+  </outputs>
+  <translations>
+    <file path="substitute.xmb" lang="sv" />
+  </translations>
+  <release seq="1" allow_pseudo="false">
+    <messages first_id="8192">
+      <message name="IDS_COPYRIGHT_GOOGLE_LONG" sub_variable="true" desc="Gadget copyright notice.  Needs to be updated every year.">
+        Copyright 2008 Google Inc. All Rights Reserved.
+      </message>
+      <message name="IDS_NEWS_PANEL_COPYRIGHT">
+        Google Desktop News gadget
+[IDS_COPYRIGHT_GOOGLE_LONG]
+View news that is personalized based on the articles you read.
+
+For example, if you read lots of sports news, you'll see more sports articles. If you read technology news less often, you'll see fewer of those articles.
+      </message>
+    </messages>
+  </release>
+</grit>
diff --git a/tools/grit/grit/testdata/test_css.css b/tools/grit/grit/testdata/test_css.css
new file mode 100644
index 0000000000..55d5dd1770
--- /dev/null
+++ b/tools/grit/grit/testdata/test_css.css
@@ -0,0 +1 @@
+This is a test!
diff --git a/tools/grit/grit/testdata/test_html.html b/tools/grit/grit/testdata/test_html.html
new file mode 100644
index 0000000000..55d5dd1770
--- /dev/null
+++ b/tools/grit/grit/testdata/test_html.html
@@ -0,0 +1 @@
+This is a test!
diff --git a/tools/grit/grit/testdata/test_js.js b/tools/grit/grit/testdata/test_js.js
new file mode 100644
index 0000000000..55d5dd1770
--- /dev/null
+++ b/tools/grit/grit/testdata/test_js.js
@@ -0,0 +1 @@
+This is a test!
diff --git a/tools/grit/grit/testdata/test_svg.svg b/tools/grit/grit/testdata/test_svg.svg
new file mode 100644
index 0000000000..55d5dd1770
--- /dev/null
+++ b/tools/grit/grit/testdata/test_svg.svg
@@ -0,0 +1 @@
+This is a test!
diff --git a/tools/grit/grit/testdata/test_text.txt b/tools/grit/grit/testdata/test_text.txt
new file mode 100644
index 0000000000..55d5dd1770
--- /dev/null
+++ b/tools/grit/grit/testdata/test_text.txt
@@ -0,0 +1 @@
+This is a test!
diff --git a/tools/grit/grit/testdata/time_related.html b/tools/grit/grit/testdata/time_related.html
new file mode 100644
index 0000000000..ee64b1665e
--- /dev/null
+++ b/tools/grit/grit/testdata/time_related.html
@@ -0,0 +1,11 @@
+[HEADER]
+[CHROME]
+[NAV_PRE_POST]
+[$~MESSAGE~$]<br>
+<table border=0 cellpadding=2 cellspacing=0 width='100%'> 
+[CONTENTS]
+</table><br>
+
+[NAV_PRE_POST]
+[FOOTER]
+
diff --git a/tools/grit/grit/testdata/toolbar_about.html b/tools/grit/grit/testdata/toolbar_about.html
new file mode 100644
index 0000000000..bb4b0eb355
--- /dev/null
+++ b/tools/grit/grit/testdata/toolbar_about.html
@@ -0,0 +1,138 @@
+<html id=dlgAbout STYLE="width: 25.8em; height: 17em" [GRITDIR]>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=utf-8">
+<title>About Google Toolbar</title>
+<style>
+.button {
+ width: 7em;
+ height: 2.2em;
+ color: buttontext;
+ font-family: MS Sans Serif;
+ font-size:8pt;
+ cursor: hand;
+}
+</style>
+
+<script> <!--
+  function HandleError(message, url, line) {
+    var L_Dialog_ErrorMessage = "An error has occured in this dialog.";
+    var L_ErrorNumber_Text = "Error: ";
+    var str = L_Dialog_ErrorMessage + "\n\n"
+     + L_ErrorNumber_Text + line + "\n"
+     + message;
+    alert (str);
+    window.close();
+    return true;
+  }
+  
+  function OnKeyPress(nCode) {
+    if (nCode == 27) {
+     window.close();
+     return;
+    }
+  }
+  
+  function OnLoad() {
+    if ((null != window.dialogArguments) && (window.dialogArguments.indexOf("&") == -1) && (window.dialogArguments.indexOf("<") == -1)) {
+     version.innerHTML = window.dialogArguments;
+    } else {
+     version.innerText = "Version: Unknown";
+    }
+  }
+
+  window.onerror = HandleError;
+  // -->
+</script>
+
+</head>
+
+
+<body bgcolor="#FFFFFF" onload="OnLoad()" onkeydown="OnKeyPress(event.keyCode)" onkeypress="OnKeyPress(event.keyCode)" scroll=no>
+
+<table border=0>
+
+  <tr height=5>
+    <td width=5></td>
+    <td></td>
+    <td></td>
+    <td></td>
+    <td width=5></td>
+  </tr>
+
+  <tr>
+    <td></td>
+    <td colspan=3>      
+
+
+<table border="0" cellpadding="0" cellspacing="0" valign="top">
+  <tr> 
+    <td valign="top" height="47" width="155"> 
+      <div align="center"><img src="title_toolbar.gif" width="275" height="59" alt="Google Toolbar"></div>
+    </td>
+    <td valign="middle" height="47" width="713"> 
+      <hr size=1 color=25479D></td></tr>
+</table>
+
+
+    </td>
+    <!-- 
+    <TD colspan=2>
+      <span style="COLOR: black; FONT: 18pt Tahoma, MS Shell Dlg"><b>
+       Google Toolbar&trade;</b>
+      </span>
+    </TD>
+     -->
+    <td valign="middle"> 
+    </td>
+  </tr>
+
+  <tr>
+    <td></td>
+    <td align=center><img src="googly.gif"></td>
+    <td colspan=2 align=left>
+     <span style="WIDTH: 25em; height:6em COLOR: black; FONT: 8pt Tahoma, MS Shell Dlg">
+       <span id=version></span><br>
+     </span>
+    </td>
+    <td></td>
+  </tr>
+
+  <tr height=50>
+    <td></td>
+    <td></td>
+    <td colspan=2 align=left>
+     <span style="WIDTH: 25em; height:6em COLOR: black; FONT: 8pt Tahoma, MS Shell Dlg">
+      <!--$/translate-->
+      <i>De parvis grandis acervus erit</i>
+      <!--$translate-->
+     </span>
+    </td>
+    <td></td>
+  </tr>
+
+  <tr height=40>
+    <td></td>
+    <td></td>
+    <td></td>
+    <td></td>
+    <td></td>
+  </tr>
+
+  <tr>
+    <td></td>
+    <td width=80></td>
+    <td>
+      <!--$/translate-->
+      <span style="WIDTH: 20em; COLOR: black; FONT: 8pt Tahoma, MS Shell Dlg" id="copyright">&copy; 2006 Google</span>
+      <!--$translate-->
+    </td>
+    <td id=ok-button align=right><button tabindex=1 type=submit align=right id="okButton" class=button onClick="window.close();" >OK</button>
+    </td>
+    <td></td>
+  </tr>
+
+</table>
+</span>
+
+</body>
+</html>
diff --git a/tools/grit/grit/testdata/tools/grit/resource_ids b/tools/grit/grit/testdata/tools/grit/resource_ids
new file mode 100644
index 0000000000..8a2b608df1
--- /dev/null
+++ b/tools/grit/grit/testdata/tools/grit/resource_ids
@@ -0,0 +1,176 @@
+# Copyright (c) 2011 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.
+#
+# This file is used to assign starting resource ids for resources and strings
+# used by Chromium.  This is done to ensure that resource ids are unique
+# across all the grd files.  If you are adding a new grd file, please add
+# a new entry to this file.
+#
+# The first entry in the file, SRCDIR, is special: It is a relative path from
+# this file to the base of your checkout.
+#
+# http://msdn.microsoft.com/en-us/library/t2zechd4(VS.71).aspx says that the
+# range for IDR_ is 1 to 28,671 and the range for IDS_ is 1 to 32,767 and
+# common convention starts practical use of IDs at 100 or 101.
+{
+  "SRCDIR": "../..",
+
+  "chrome/browser/browser_resources.grd": {
+    "includes": [500],
+  },
+  "chrome/browser/resources/component_extension_resources.grd": {
+    "includes": [1000],
+  },
+  "chrome/browser/resources/net_internals_resources.grd": {
+    "includes": [1500],
+  },
+  "chrome/browser/resources/shared_resources.grd": {
+    "includes": [2000],
+  },
+  "chrome/common/common_resources.grd": {
+    "includes": [2500],
+  },
+  "chrome/default_plugin/default_plugin_resources.grd": {
+    "includes": [3000],
+  },
+  "chrome/renderer/renderer_resources.grd": {
+    "includes": [3500],
+  },
+  "net/base/net_resources.grd": {
+    "includes": [4000],
+  },
+  "webkit/glue/webkit_resources.grd": {
+    "includes": [4500],
+  },
+  "webkit/tools/test_shell/test_shell_resources.grd": {
+    "includes": [5000],
+  },
+  "ui/resources/ui_resources.grd": {
+    "includes": [5500],
+  },
+  "chrome/app/theme/theme_resources.grd": {
+    "includes": [6000],
+  },
+  "chrome_frame/resources/chrome_frame_resources.grd": {
+    "includes": [6500],
+  },
+  # WebKit.grd can be in two different places depending on whether we are
+  # in a chromium checkout or a webkit-only checkout.
+  "third_party/WebKit/Source/WebKit/chromium/WebKit.grd": {
+    "includes": [7000],
+  },
+  "WebKit.grd": {
+    "includes": [7000],
+  },
+
+  "ui/base/strings/app_locale_settings.grd": {
+    "META": {"join": 2},
+    "messages": [7500],
+  },
+  "chrome/app/resources/locale_settings.grd": {
+    "includes": [8000],
+    "messages": [8500],
+  },
+  # These each start with the same resource id because we only use one
+  # file for each build (cros, linux, mac, or win).
+  "chrome/app/resources/locale_settings_cros.grd": {
+    "messages": [9000],
+  },
+  "chrome/app/resources/locale_settings_linux.grd": {
+    "messages": [9000],
+  },
+  "chrome/app/resources/locale_settings_mac.grd": {
+    "messages": [9000],
+  },
+  "chrome/app/resources/locale_settings_win.grd": {
+    "messages": [9000],
+  },
+
+  "ui/base/strings/ui_strings.grd": {
+    "META": {"join": 4},
+    "messages": [9500],
+  },
+  # Chromium strings and Google Chrome strings must start at the same id.
+  # We only use one file depending on whether we're building Chromium or
+  # Google Chrome.
+  "chrome/app/chromium_strings.grd": {
+    "messages": [10000],
+  },
+  "chrome/app/google_chrome_strings.grd": {
+    "messages": [10000],
+  },
+  # Leave lots of space for generated_resources since it has most of our
+  # strings.
+  "chrome/app/generated_resources.grd": {
+    "META": {"join": 2},
+    "structures": [10500],
+    "messages": [11000],
+  },
+  # The chrome frame dialogs are also in generated_resources.grd so they
+  # get included by the translation console.  We make sure that the ids
+  # for structures here are the same as for generated_resources.grd.
+  "chrome_frame/resources/chrome_frame_dialogs.grd": {
+    "structures": [10500],
+    "includes": [10750],
+  },
+  "webkit/glue/inspector_strings.grd": {
+    "messages": [16000],
+  },
+  "webkit/glue/webkit_strings.grd": {
+    "messages": [16500],
+  },
+
+  "chrome_frame/resources/chrome_frame_resources.grd": {
+    "includes": [17500],
+    "structures": [18000],
+  },
+
+  "ui/gfx/gfx_resources.grd": {
+    "includes": [18500],
+  },
+
+  "chrome/app/policy/policy_templates.grd": {
+    "structures": [19000],
+    "messages": [19010],
+  },
+
+  "chrome/browser/autofill/autofill_resources.grd": {
+    "messages": [19500],
+  },
+  "chrome/browser/resources/sync_internals_resources.grd": {
+    "includes": [20000],
+  },
+  # This file is generated during the build.
+  "<(SHARED_INTERMEDIATE_DIR)/devtools/devtools_resources.grd": {
+    "includes": [20500],
+  },
+  # All standard and large theme resources should have the same IDs.
+  "chrome/app/theme/theme_resources_standard.grd": {
+    "includes": [21000],
+  },
+  "chrome/app/theme/theme_resources_large.grd": {
+    "includes": [21000],
+  },
+  # This file is generated during the build.
+  "chrome/browser/debugger/frontend/devtools_frontend_resources.grd": {
+    "META": {"join": 2},
+    "includes": [21500],
+  },
+  "cloud_print/virtual_driver/win/install/virtual_driver_setup_resources.grd": {
+    "messages": [22500],
+  },
+  "chrome/browser/resources/quota_internals_resources.grd": {
+    "includes": [23000],
+  },
+  "chrome/browser/resources/workers_resources.grd": {
+    "includes": [23500],
+  },
+  # All standard and large theme resources should have the same IDs.
+  "ui/resources/ui_resources_standard.grd": {
+    "includes": [24000],
+  },
+  "ui/resources/ui_resources_large.grd": {
+    "includes": [24000],
+  },
+}
diff --git a/tools/grit/grit/testdata/transl.rc b/tools/grit/grit/testdata/transl.rc
new file mode 100644
index 0000000000..2f2595db3f
--- /dev/null
+++ b/tools/grit/grit/testdata/transl.rc
@@ -0,0 +1,56 @@
+IDC_KLONKMENU MENU
+BEGIN
+    POPUP "&Skra"
+    BEGIN
+        MENUITEM "&Haetta",                       IDM_EXIT
+        MENUITEM "Thetta er ""Klonk"" sem eg fyla",   ID_FILE_THISBE
+        POPUP "gonkurinn"
+        BEGIN
+            MENUITEM "Klonk && er [good]",           ID_GONK_KLONKIS
+        END
+    END
+    POPUP "&Hjalp"
+    BEGIN
+        MENUITEM "&Um...",                  IDM_ABOUT
+    END
+END
+
+IDD_ABOUTBOX DIALOGEX 22, 17, 230, 75
+STYLE DS_SETFONT | DS_MODALFRAME | WS_CAPTION | WS_SYSMENU
+CAPTION "Um Klonk"
+FONT 8, "System", 0, 0, 0x0
+BEGIN
+    ICON            IDI_KLONK,IDC_MYICON,14,9,20,20
+    LTEXT           "klonk utgafa ""jibbi"" 1.0",IDC_STATIC,49,10,119,8,
+                    SS_NOPREFIX
+    LTEXT           "Hofundarrettur (C) 2005",IDC_STATIC,49,20,119,8
+    DEFPUSHBUTTON   "I lagi",IDOK,195,6,30,11,WS_GROUP
+    CONTROL         "Jack ""Black"" Daniels",IDC_RADIO1,"Button",
+                    BS_AUTORADIOBUTTON,46,51,84,10
+END
+
+IDD_DIFFERENT_LENGTH_IN_TRANSL DIALOGEX 22, 17, 230, 75
+STYLE DS_SETFONT | DS_MODALFRAME | WS_CAPTION | WS_SYSMENU
+CAPTION "Bingobobbi"
+FONT 8, "System", 0, 0, 0x0
+BEGIN
+    LTEXT           "Howdie dodie!",IDC_STATIC,49,10,119,8,SS_NOPREFIX
+END
+
+STRINGTABLE
+BEGIN
+  IDS_SIMPLE "Ein"
+  IDS_PLACEHOLDER "%s Vogeln"
+  IDS_PLACEHOLDERS "%d von %d"
+  // Shouldn't be part of translations list because the translation is
+  // reordered so placeholder fixup fails
+  IDS_REORDERED_PLACEHOLDERS "$2 auf $1"
+  IDS_CHANGED "Dass war die alte Version"
+  IDS_TWIN_1 "Hallo"
+  IDS_TWIN_2 "Hallo"
+  IDS_NOT_TRANSLATEABLE ":"
+  IDS_LONGER_TRANSLATED "Dokument $1 ist entfernt worden"
+  IDS_NO_LONGER_USED "Nicht verwendet"
+  IDS_DIFFERENT_TWIN_1 "Howdie"
+  IDS_DIFFERENT_TWIN_2 "Hallo sagt man"
+END
diff --git a/tools/grit/grit/testdata/versions.html b/tools/grit/grit/testdata/versions.html
new file mode 100644
index 0000000000..d1f40d8d72
--- /dev/null
+++ b/tools/grit/grit/testdata/versions.html
@@ -0,0 +1,7 @@
+[HEADER]
+ 
+[TOP_CHROME]
+[CONTENTS]		
+
+[NEXT_PREV]
+[FOOTER]
diff --git a/tools/grit/grit/testdata/whitelist.txt b/tools/grit/grit/testdata/whitelist.txt
new file mode 100644
index 0000000000..5b3aca40b5
--- /dev/null
+++ b/tools/grit/grit/testdata/whitelist.txt
@@ -0,0 +1,4 @@
+IDS_MESSAGE_WHITELISTED
+IDR_STRUCTURE_WHITELISTED
+IDR_STRUCTURE_IN_TRUE_IF_WHITELISTED
+IDR_INCLUDE_WHITELISTED
diff --git a/tools/grit/grit/testdata/whitelist_resources.grd b/tools/grit/grit/testdata/whitelist_resources.grd
new file mode 100644
index 0000000000..9925688ff5
--- /dev/null
+++ b/tools/grit/grit/testdata/whitelist_resources.grd
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<grit latest_public_release="0"
+      current_release="1"
+      output_all_resource_defines="false">
+  <outputs>
+    <output filename="whitelist_test_resources.h" type="rc_header">
+      <emit emit_type='prepend'></emit>
+    </output>
+    <output filename="whitelist_test_resources_map.cc"
+            type="resource_file_map_source" />
+    <output filename="whitelist_test_resources_map.h"
+            type="resource_map_header" />
+    <output filename="whitelist_test_resources.pak" type="data_package" />
+  </outputs>
+  <translations>
+    <file path="substitute.xmb" lang="sv" />
+  </translations>
+    <release seq="1">
+    <structures>
+      <structure name="IDR_STRUCTURE_WHITELISTED" file="browser.html"
+                 type="chrome_html" >
+      </structure>
+      <structure name="IDR_STRUCTURE_NOT_WHITELISTED" file="deleted.html"
+                 type="chrome_html" >
+      </structure>
+      <if expr="True">
+        <structure name="IDR_STRUCTURE_IN_TRUE_IF_WHITELISTED"
+                   file="details.html"
+                   type="chrome_html" >
+        </structure>
+        <structure name="IDR_STRUCTURE_IN_TRUE_IF_NOT_WHITELISTED"
+                   file="error.html"
+                   type="chrome_html" >
+        </structure>
+      </if>
+      <if expr="False">
+        <structure name="IDR_STRUCTURE_IN_FALSE_IF_WHITELISTED"
+                   file="status.html"
+                   type="chrome_html" >
+        </structure>
+        <structure name="IDR_STRUCTURE_IN_FALSE_IF_NOT_WHITELISTED"
+                   file="simple.html"
+                   type="chrome_html" >
+        </structure>
+      </if>
+    </structures>
+    <includes>
+      <include name="IDR_INCLUDE_WHITELISTED" file="klonk.ico"
+               type="BINDATA" />
+      <include name="IDR_INCLUDE_NOT_WHITELISTED" file="klonk.rc"
+               type="BINDATA" />
+    </includes>
+  </release>
+</grit>
diff --git a/tools/grit/grit/testdata/whitelist_strings.grd b/tools/grit/grit/testdata/whitelist_strings.grd
new file mode 100644
index 0000000000..df80f5fd32
--- /dev/null
+++ b/tools/grit/grit/testdata/whitelist_strings.grd
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<grit latest_public_release="0"
+      current_release="1"
+      output_all_resource_defines="false">
+  <outputs >
+    <output filename="whitelist_test_resources.h" type="rc_header">
+      <emit emit_type='prepend'></emit>
+    </output>
+    <output filename="en_whitelist_test_strings.rc" type="rc_all" lang="en" />
+  </outputs>
+  <release seq="1">
+    <messages>
+      <message name="IDS_MESSAGE_WHITELISTED"
+               desc="A message in the whiltelist file.">
+        Whitelisted.
+      </message>
+      <message name="IDS_MESSAGE_NOT_WHITELISTED"
+               desc="A message that isn't in the whiltelist file.">
+        Not whitelisted.
+      </message>
+    </messages>
+  </release>
+</grit>
diff --git a/tools/grit/grit/tool/__init__.py b/tools/grit/grit/tool/__init__.py
new file mode 100644
index 0000000000..cc455b36e7
--- /dev/null
+++ b/tools/grit/grit/tool/__init__.py
@@ -0,0 +1,8 @@
+# Copyright (c) 2012 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.
+
+'''Package grit.tool
+'''
+
+pass
diff --git a/tools/grit/grit/tool/android2grd.py b/tools/grit/grit/tool/android2grd.py
new file mode 100644
index 0000000000..005297bafe
--- /dev/null
+++ b/tools/grit/grit/tool/android2grd.py
@@ -0,0 +1,484 @@
+# Copyright (c) 2012 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.
+
+"""The 'grit android2grd' tool."""
+
+from __future__ import print_function
+
+import getopt
+import os.path
+import sys
+from xml.dom import Node
+import xml.dom.minidom
+
+import six
+from six import StringIO
+
+import grit.node.empty
+from grit.node import node_io
+from grit.node import message
+
+from grit.tool import interface
+
+from grit import grd_reader
+from grit import lazy_re
+from grit import tclib
+
+
+# The name of a string in strings.xml
+_STRING_NAME = lazy_re.compile(r'[a-z0-9_]+\Z')
+
+# A string's character limit in strings.xml
+_CHAR_LIMIT = lazy_re.compile(r'\[CHAR-LIMIT=(\d+)\]')
+
+# Finds String.Format() style format specifiers such as "%-5.2f".
+_FORMAT_SPECIFIER = lazy_re.compile(
+  r'%'
+  r'([1-9][0-9]*\$|<)?'            # argument_index
+  r'([-#+ 0,(]*)'                  # flags
+  r'([0-9]+)?'                     # width
+  r'(\.[0-9]+)?'                   # precision
+  r'([bBhHsScCdoxXeEfgGaAtT%n])')  # conversion
+
+
+class Android2Grd(interface.Tool):
+  """Tool for converting Android string.xml files into chrome Grd files.
+
+Usage: grit [global options] android2grd [OPTIONS] STRINGS_XML
+
+The Android2Grd tool will convert an Android strings.xml file (whose path is
+specified by STRINGS_XML) and create a chrome style grd file containing the
+relevant information.
+
+Because grd documents are much richer than strings.xml documents we supplement
+the information required by grds using OPTIONS with sensible defaults.
+
+OPTIONS may be any of the following:
+
+    --name       FILENAME    Specify the base FILENAME. This should be without
+                             any file type suffix. By default
+                             "chrome_android_strings" will be used.
+
+    --languages  LANGUAGES   Comma separated list of ISO language codes (e.g.
+                             en-US, en-GB, ru, zh-CN). These codes will be used
+                             to determine the names of resource and translations
+                             files that will be declared by the output grd file.
+
+    --grd-dir    GRD_DIR     Specify where the resultant grd file
+                             (FILENAME.grd) should be output. By default this
+                             will be the present working directory.
+
+    --header-dir HEADER_DIR  Specify the location of the directory where grit
+                             generated C++ headers (whose name will be
+                             FILENAME.h) will be placed. Use an empty string to
+                             disable rc generation. Default: empty.
+
+    --rc-dir     RC_DIR      Specify the directory where resource files will
+                             be located relative to grit build's output
+                             directory. Use an empty string to disable rc
+                             generation. Default: empty.
+
+    --xml-dir    XML_DIR     Specify where to place localized strings.xml files
+                             relative to grit build's output directory. For each
+                             language xx a values-xx/strings.xml file will be
+                             generated. Use an empty string to disable
+                             strings.xml generation. Default: '.'.
+
+    --xtb-dir    XTB_DIR     Specify where the xtb files containing translations
+                             will be located relative to the grd file. Default:
+                             '.'.
+"""
+
+  _NAME_FLAG = 'name'
+  _LANGUAGES_FLAG = 'languages'
+  _GRD_DIR_FLAG = 'grd-dir'
+  _RC_DIR_FLAG = 'rc-dir'
+  _HEADER_DIR_FLAG = 'header-dir'
+  _XTB_DIR_FLAG = 'xtb-dir'
+  _XML_DIR_FLAG = 'xml-dir'
+
+  def __init__(self):
+    self.name = 'chrome_android_strings'
+    self.languages = []
+    self.grd_dir = '.'
+    self.rc_dir = None
+    self.xtb_dir = '.'
+    self.xml_res_dir = '.'
+    self.header_dir = None
+
+  def ShortDescription(self):
+    """Returns a short description of the Android2Grd tool.
+
+    Overridden from grit.interface.Tool
+
+    Returns:
+      A string containing a short description of the android2grd tool.
+    """
+    return 'Converts Android string.xml files into Chrome grd files.'
+
+  def ParseOptions(self, args):
+    """Set this objects and return all non-option arguments."""
+    flags = [
+        Android2Grd._NAME_FLAG,
+        Android2Grd._LANGUAGES_FLAG,
+        Android2Grd._GRD_DIR_FLAG,
+        Android2Grd._RC_DIR_FLAG,
+        Android2Grd._HEADER_DIR_FLAG,
+        Android2Grd._XTB_DIR_FLAG,
+        Android2Grd._XML_DIR_FLAG, ]
+    (opts, args) = getopt.getopt(
+        args, None, ['%s=' % o for o in flags] + ['help'])
+
+    for key, val in opts:
+      # Get rid of the preceding hypens.
+      k = key[2:]
+      if k == Android2Grd._NAME_FLAG:
+        self.name = val
+      elif k == Android2Grd._LANGUAGES_FLAG:
+        self.languages = val.split(',')
+      elif k == Android2Grd._GRD_DIR_FLAG:
+        self.grd_dir = val
+      elif k == Android2Grd._RC_DIR_FLAG:
+        self.rc_dir = val
+      elif k == Android2Grd._HEADER_DIR_FLAG:
+        self.header_dir = val
+      elif k == Android2Grd._XTB_DIR_FLAG:
+        self.xtb_dir = val
+      elif k == Android2Grd._XML_DIR_FLAG:
+        self.xml_res_dir = val
+      elif k == 'help':
+        self.ShowUsage()
+        sys.exit(0)
+    return args
+
+  def Run(self, opts, args):
+    """Runs the Android2Grd tool.
+
+    Inherited from grit.interface.Tool.
+
+    Args:
+      opts: List of string arguments that should be parsed.
+      args: String containing the path of the strings.xml file to be converted.
+    """
+    args = self.ParseOptions(args)
+    if len(args) != 1:
+      print('Tool requires one argument, the path to the Android '
+            'strings.xml resource file to be converted.')
+      return 2
+    self.SetOptions(opts)
+
+    android_path = args[0]
+
+    # Read and parse the Android strings.xml file.
+    with open(android_path) as android_file:
+      android_dom = xml.dom.minidom.parse(android_file)
+
+    # Do the hard work -- convert the Android dom to grd file contents.
+    grd_dom = self.AndroidDomToGrdDom(android_dom)
+    grd_string = six.text_type(grd_dom)
+
+    # Write the grd string to a file in grd_dir.
+    grd_filename = self.name + '.grd'
+    grd_path = os.path.join(self.grd_dir, grd_filename)
+    with open(grd_path, 'w') as grd_file:
+      grd_file.write(grd_string)
+
+  def AndroidDomToGrdDom(self, android_dom):
+    """Converts a strings.xml DOM into a DOM representing the contents of
+    a grd file.
+
+    Args:
+      android_dom: A xml.dom.Document containing the contents of the Android
+          string.xml document.
+    Returns:
+      The DOM for the grd xml document produced by converting the Android DOM.
+    """
+
+    # Start with a basic skeleton for the .grd file.
+    root = grd_reader.Parse(StringIO(
+      '''<?xml version="1.0" encoding="UTF-8"?>
+         <grit base_dir="." latest_public_release="0"
+             current_release="1" source_lang_id="en">
+           <outputs />
+           <translations />
+           <release allow_pseudo="false" seq="1">
+             <messages fallback_to_english="true" />
+           </release>
+         </grit>'''), dir='.')
+    outputs = root.children[0]
+    translations = root.children[1]
+    messages = root.children[2].children[0]
+    assert (isinstance(messages, grit.node.empty.MessagesNode) and
+            isinstance(translations, grit.node.empty.TranslationsNode) and
+            isinstance(outputs, grit.node.empty.OutputsNode))
+
+    if self.header_dir:
+      cpp_header = self.__CreateCppHeaderOutputNode(outputs, self.header_dir)
+    for lang in self.languages:
+      # Create an output element for each language.
+      if self.rc_dir:
+        self.__CreateRcOutputNode(outputs, lang, self.rc_dir)
+      if self.xml_res_dir:
+        self.__CreateAndroidXmlOutputNode(outputs, lang, self.xml_res_dir)
+      if lang != 'en':
+        self.__CreateFileNode(translations, lang)
+    # Convert all the strings.xml strings into grd messages.
+    self.__CreateMessageNodes(messages, android_dom.documentElement)
+
+    return root
+
+  def __CreateMessageNodes(self, messages, resources):
+    """Creates the <message> elements and adds them as children of <messages>.
+
+    Args:
+      messages: the <messages> element in the strings.xml dom.
+      resources: the <resources> element in the grd dom.
+    """
+    # <string> elements contain the definition of the resource.
+    # The description of a <string> element is contained within the comment
+    # node element immediately preceeding the string element in question.
+    description = ''
+    for child in resources.childNodes:
+      if child.nodeType == Node.COMMENT_NODE:
+        # Remove leading/trailing whitespace; collapse consecutive whitespaces.
+        description = ' '.join(child.data.split())
+      elif child.nodeType == Node.ELEMENT_NODE:
+        if child.tagName != 'string':
+          print('Warning: ignoring unknown tag <%s>' % child.tagName)
+        else:
+          translatable = self.IsTranslatable(child)
+          raw_name = child.getAttribute('name')
+          if not _STRING_NAME.match(raw_name):
+            print('Error: illegal string name: %s' % raw_name)
+          grd_name = 'IDS_' + raw_name.upper()
+          # Transform the <string> node contents into a tclib.Message, taking
+          # care to handle whitespace transformations and escaped characters,
+          # and coverting <xliff:g> placeholders into <ph> placeholders.
+          msg = self.CreateTclibMessage(child)
+          msg_node = self.__CreateMessageNode(messages, grd_name, description,
+              msg, translatable)
+          messages.AddChild(msg_node)
+          # Reset the description once a message has been parsed.
+          description = ''
+
+  def CreateTclibMessage(self, android_string):
+    """Transforms a <string/> element from strings.xml into a tclib.Message.
+
+    Interprets whitespace, quotes, and escaped characters in the android_string
+    according to Android's formatting and styling rules for strings.  Also
+    converts <xliff:g> placeholders into <ph> placeholders, e.g.:
+
+      <xliff:g id="website" example="google.com">%s</xliff:g>
+        becomes
+      <ph name="website"><ex>google.com</ex>%s</ph>
+
+    Returns:
+      The tclib.Message.
+    """
+    msg = tclib.Message()
+    current_text = ''  # Accumulated text that hasn't yet been added to msg.
+    nodes = android_string.childNodes
+
+    for i, node in enumerate(nodes):
+      # Handle text nodes.
+      if node.nodeType in (Node.TEXT_NODE, Node.CDATA_SECTION_NODE):
+        current_text += node.data
+
+      # Handle <xliff:g> and other tags.
+      elif node.nodeType == Node.ELEMENT_NODE:
+        if node.tagName == 'xliff:g':
+          assert node.hasAttribute('id'), 'missing id: ' + node.data()
+          placeholder_id = node.getAttribute('id')
+          placeholder_text = self.__FormatPlaceholderText(node)
+          placeholder_example = node.getAttribute('example')
+          if not placeholder_example:
+            print('Info: placeholder does not contain an example: %s' %
+                  node.toxml())
+            placeholder_example = placeholder_id.upper()
+          msg.AppendPlaceholder(tclib.Placeholder(placeholder_id,
+              placeholder_text, placeholder_example))
+        else:
+          print('Warning: removing tag <%s> which must be inside a '
+                'placeholder: %s' % (node.tagName, node.toxml()))
+          msg.AppendText(self.__FormatPlaceholderText(node))
+
+      # Handle other nodes.
+      elif node.nodeType != Node.COMMENT_NODE:
+        assert False, 'Unknown node type: %s' % node.nodeType
+
+      is_last_node = (i == len(nodes) - 1)
+      if (current_text and
+          (is_last_node or nodes[i + 1].nodeType == Node.ELEMENT_NODE)):
+        # For messages containing just text and comments (no xml tags) Android
+        # strips leading and trailing whitespace.  We mimic that behavior.
+        if not msg.GetContent() and is_last_node:
+          current_text = current_text.strip()
+        msg.AppendText(self.__FormatAndroidString(current_text))
+        current_text = ''
+
+    return msg
+
+  def __FormatAndroidString(self, android_string, inside_placeholder=False):
+    r"""Returns android_string formatted for a .grd file.
+
+      * Collapses consecutive whitespaces, except when inside double-quotes.
+      * Replaces \\, \n, \t, \", \' with \, newline, tab, ", '.
+    """
+    backslash_map = {'\\' : '\\', 'n' : '\n', 't' : '\t', '"' : '"', "'" : "'"}
+    is_quoted_section = False  # True when we're inside double quotes.
+    is_backslash_sequence = False  # True after seeing an unescaped backslash.
+    prev_char = ''
+    output = []
+    for c in android_string:
+      if is_backslash_sequence:
+        # Unescape \\, \n, \t, \", and \'.
+        assert c in backslash_map, 'Illegal escape sequence: \\%s' % c
+        output.append(backslash_map[c])
+        is_backslash_sequence = False
+      elif c == '\\':
+        is_backslash_sequence = True
+      elif c.isspace() and not is_quoted_section:
+        # Turn whitespace into ' ' and collapse consecutive whitespaces.
+        if not prev_char.isspace():
+          output.append(' ')
+      elif c == '"':
+        is_quoted_section = not is_quoted_section
+      else:
+        output.append(c)
+      prev_char = c
+    output = ''.join(output)
+
+    if is_quoted_section:
+      print('Warning: unbalanced quotes in string: %s' % android_string)
+
+    if is_backslash_sequence:
+      print('Warning: trailing backslash in string: %s' % android_string)
+
+    # Check for format specifiers outside of placeholder tags.
+    if not inside_placeholder:
+      format_specifier = _FORMAT_SPECIFIER.search(output)
+      if format_specifier:
+        print('Warning: format specifiers are not inside a placeholder '
+              '<xliff:g/> tag: %s' % output)
+
+    return output
+
+  def __FormatPlaceholderText(self, placeholder_node):
+    """Returns the text inside of an <xliff:g> placeholder node."""
+    text = []
+    for childNode in placeholder_node.childNodes:
+      if childNode.nodeType in (Node.TEXT_NODE, Node.CDATA_SECTION_NODE):
+        text.append(childNode.data)
+      elif childNode.nodeType != Node.COMMENT_NODE:
+        assert False, 'Unknown node type in ' + placeholder_node.toxml()
+    return self.__FormatAndroidString(''.join(text), inside_placeholder=True)
+
+  def __CreateMessageNode(self, messages_node, grd_name, description, msg,
+                          translatable):
+    """Creates and initializes a <message> element.
+
+    Message elements correspond to Android <string> elements in that they
+    declare a string resource along with a programmatic id.
+    """
+    if not description:
+      print('Warning: no description for %s' % grd_name)
+    # Check that we actually fit within the character limit we've specified.
+    match = _CHAR_LIMIT.search(description)
+    if match:
+      char_limit = int(match.group(1))
+      msg_content = msg.GetRealContent()
+      if len(msg_content) > char_limit:
+        print('Warning: char-limit for %s is %d, but length is %d: %s' %
+              (grd_name, char_limit, len(msg_content), msg_content))
+    return message.MessageNode.Construct(parent=messages_node,
+                                         name=grd_name,
+                                         message=msg,
+                                         desc=description,
+                                         translateable=translatable)
+
+  def __CreateFileNode(self, translations_node, lang):
+    """Creates and initializes the <file> elements.
+
+    File elements provide information on the location of translation files
+    (xtbs)
+    """
+    xtb_file = os.path.normpath(os.path.join(
+        self.xtb_dir, '%s_%s.xtb' % (self.name, lang)))
+    fnode = node_io.FileNode()
+    fnode.StartParsing(u'file', translations_node)
+    fnode.HandleAttribute('path', xtb_file)
+    fnode.HandleAttribute('lang', lang)
+    fnode.EndParsing()
+    translations_node.AddChild(fnode)
+    return fnode
+
+  def __CreateCppHeaderOutputNode(self, outputs_node, header_dir):
+    """Creates the <output> element corresponding to the generated c header."""
+    header_file_name = os.path.join(header_dir, self.name + '.h')
+    header_node = node_io.OutputNode()
+    header_node.StartParsing(u'output', outputs_node)
+    header_node.HandleAttribute('filename', header_file_name)
+    header_node.HandleAttribute('type', 'rc_header')
+    emit_node = node_io.EmitNode()
+    emit_node.StartParsing(u'emit', header_node)
+    emit_node.HandleAttribute('emit_type', 'prepend')
+    emit_node.EndParsing()
+    header_node.AddChild(emit_node)
+    header_node.EndParsing()
+    outputs_node.AddChild(header_node)
+    return header_node
+
+  def __CreateRcOutputNode(self, outputs_node, lang, rc_dir):
+    """Creates the <output> element corresponding to various rc file output."""
+    rc_file_name = self.name + '_' + lang + ".rc"
+    rc_path = os.path.join(rc_dir, rc_file_name)
+    node = node_io.OutputNode()
+    node.StartParsing(u'output', outputs_node)
+    node.HandleAttribute('filename', rc_path)
+    node.HandleAttribute('lang', lang)
+    node.HandleAttribute('type', 'rc_all')
+    node.EndParsing()
+    outputs_node.AddChild(node)
+    return node
+
+  def __CreateAndroidXmlOutputNode(self, outputs_node, locale, xml_res_dir):
+    """Creates the <output> element corresponding to various rc file output."""
+    # Need to check to see if the locale has a region, e.g. the GB in en-GB.
+    # When a locale has a region Android expects the region to be prefixed
+    # with an 'r'. For example for en-GB Android expects a values-en-rGB
+    # directory.  Also, Android expects nb, tl, in, iw, ji as the language
+    # codes for Norwegian, Tagalog/Filipino, Indonesian, Hebrew, and Yiddish:
+    # http://developer.android.com/reference/java/util/Locale.html
+    if locale == 'es-419':
+      android_locale = 'es-rUS'
+    else:
+      android_lang, dash, region = locale.partition('-')
+      lang_map = {'no': 'nb', 'fil': 'tl', 'id': 'in', 'he': 'iw', 'yi': 'ji'}
+      android_lang = lang_map.get(android_lang, android_lang)
+      android_locale = android_lang + ('-r' + region if region else '')
+    values = 'values-' + android_locale if android_locale != 'en' else 'values'
+    xml_path = os.path.normpath(os.path.join(
+        xml_res_dir, values, 'strings.xml'))
+
+    node = node_io.OutputNode()
+    node.StartParsing(u'output', outputs_node)
+    node.HandleAttribute('filename', xml_path)
+    node.HandleAttribute('lang', locale)
+    node.HandleAttribute('type', 'android')
+    node.EndParsing()
+    outputs_node.AddChild(node)
+    return node
+
+  def IsTranslatable(self, android_string):
+    """Determines if a <string> element is a candidate for translation.
+
+    A <string> element is by default translatable unless otherwise marked.
+    """
+    if android_string.hasAttribute('translatable'):
+      value = android_string.getAttribute('translatable').lower()
+      if value not in ('true', 'false'):
+        print('Warning: translatable attribute has invalid value: %s' % value)
+      return value == 'true'
+    else:
+      return True
diff --git a/tools/grit/grit/tool/android2grd_unittest.py b/tools/grit/grit/tool/android2grd_unittest.py
new file mode 100644
index 0000000000..a6934a707c
--- /dev/null
+++ b/tools/grit/grit/tool/android2grd_unittest.py
@@ -0,0 +1,181 @@
+#!/usr/bin/env python
+# Copyright (c) 2012 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.
+
+'''Unit tests for grit.tool.android2grd'''
+
+from __future__ import print_function
+
+import os
+import sys
+if __name__ == '__main__':
+  sys.path.append(os.path.join(os.path.dirname(__file__), '../..'))
+
+import unittest
+import xml.dom.minidom
+
+from grit import util
+from grit.node import empty
+from grit.node import message
+from grit.node import misc
+from grit.node import node_io
+from grit.tool import android2grd
+
+
+class Android2GrdUnittest(unittest.TestCase):
+
+  def __Parse(self, xml_string):
+    return xml.dom.minidom.parseString(xml_string).childNodes[0]
+
+  def testCreateTclibMessage(self):
+    tool = android2grd.Android2Grd()
+    msg = tool.CreateTclibMessage(self.__Parse(r'''
+        <string name="simple">A simple string</string>'''))
+    self.assertEqual(msg.GetRealContent(), 'A simple string')
+    msg = tool.CreateTclibMessage(self.__Parse(r'''
+        <string name="outer_whitespace">
+          Strip leading/trailing whitespace
+        </string>'''))
+    self.assertEqual(msg.GetRealContent(), 'Strip leading/trailing whitespace')
+    msg = tool.CreateTclibMessage(self.__Parse(r'''
+        <string name="inner_whitespace">Fold  multiple   spaces</string>'''))
+    self.assertEqual(msg.GetRealContent(), 'Fold multiple spaces')
+    msg = tool.CreateTclibMessage(self.__Parse(r'''
+        <string name="escaped_spaces">Retain \n escaped\t spaces</string>'''))
+    self.assertEqual(msg.GetRealContent(), 'Retain \n escaped\t spaces')
+    msg = tool.CreateTclibMessage(self.__Parse(r'''
+        <string name="quotes">   " Quotes  preserve
+          whitespace"  but  only  for  "enclosed   elements  "
+        </string>'''))
+    self.assertEqual(msg.GetRealContent(), ''' Quotes  preserve
+          whitespace but only for enclosed   elements  ''')
+    msg = tool.CreateTclibMessage(self.__Parse(
+        r'''<string name="escaped_characters">Escaped characters: \"\'\\\t\n'''
+        '</string>'))
+    self.assertEqual(msg.GetRealContent(), '''Escaped characters: "'\\\t\n''')
+    msg = tool.CreateTclibMessage(self.__Parse(
+        '<string xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2" '
+        'name="placeholders">'
+        'Open <xliff:g id="FILENAME" example="internet.html">%s</xliff:g>?'
+        '</string>'))
+    self.assertEqual(msg.GetRealContent(), 'Open %s?')
+    self.assertEqual(len(msg.GetPlaceholders()), 1)
+    self.assertEqual(msg.GetPlaceholders()[0].presentation, 'FILENAME')
+    self.assertEqual(msg.GetPlaceholders()[0].original, '%s')
+    self.assertEqual(msg.GetPlaceholders()[0].example, 'internet.html')
+    msg = tool.CreateTclibMessage(self.__Parse(r'''
+        <string name="comment">Contains a <!-- ignore this --> comment
+        </string>'''))
+    self.assertEqual(msg.GetRealContent(), 'Contains a comment')
+
+  def testIsTranslatable(self):
+    tool = android2grd.Android2Grd()
+    string_el = self.__Parse('<string>Hi</string>')
+    self.assertTrue(tool.IsTranslatable(string_el))
+    string_el = self.__Parse(
+        '<string translatable="true">Hi</string>')
+    self.assertTrue(tool.IsTranslatable(string_el))
+    string_el = self.__Parse(
+        '<string translatable="false">Hi</string>')
+    self.assertFalse(tool.IsTranslatable(string_el))
+
+  def __ParseAndroidXml(self, options = []):
+    tool = android2grd.Android2Grd()
+
+    tool.ParseOptions(options)
+
+    android_path = util.PathFromRoot('grit/testdata/android.xml')
+    with open(android_path) as android_file:
+      android_dom = xml.dom.minidom.parse(android_file)
+
+    grd = tool.AndroidDomToGrdDom(android_dom)
+    self.assertTrue(isinstance(grd, misc.GritNode))
+
+    return grd
+
+  def testAndroidDomToGrdDom(self):
+    grd = self.__ParseAndroidXml(['--languages', 'en-US,en-GB,ru'])
+
+    # Check that the structure of the GritNode is as expected.
+    messages = grd.GetChildrenOfType(message.MessageNode)
+    translations = grd.GetChildrenOfType(empty.TranslationsNode)
+    files = grd.GetChildrenOfType(node_io.FileNode)
+
+    self.assertEqual(len(translations), 1)
+    self.assertEqual(len(files), 3)
+    self.assertEqual(len(messages), 5)
+
+    # Check that a message node is constructed correctly.
+    msg = [x for x in messages if x.GetTextualIds()[0] == 'IDS_PLACEHOLDERS']
+    self.assertTrue(msg)
+    msg = msg[0]
+
+    self.assertTrue(msg.IsTranslateable())
+    self.assertEqual(msg.attrs["desc"], "A string with placeholder.")
+
+  def testTranslatableAttribute(self):
+    grd = self.__ParseAndroidXml([])
+    messages = grd.GetChildrenOfType(message.MessageNode)
+    msgs = [x for x in messages if x.GetTextualIds()[0] == 'IDS_CONSTANT']
+    self.assertTrue(msgs)
+    self.assertFalse(msgs[0].IsTranslateable())
+
+  def testTranslations(self):
+    grd = self.__ParseAndroidXml(['--languages', 'en-US,en-GB,ru,id'])
+
+    files = grd.GetChildrenOfType(node_io.FileNode)
+    us_file = [x for x in files if x.attrs['lang'] == 'en-US']
+    self.assertTrue(us_file)
+    self.assertEqual(us_file[0].GetInputPath(),
+                     'chrome_android_strings_en-US.xtb')
+
+    id_file = [x for x in files if x.attrs['lang'] == 'id']
+    self.assertTrue(id_file)
+    self.assertEqual(id_file[0].GetInputPath(),
+                     'chrome_android_strings_id.xtb')
+
+  def testOutputs(self):
+    grd = self.__ParseAndroidXml(['--languages', 'en-US,ru,id',
+                                  '--rc-dir', 'rc/dir',
+                                  '--header-dir', 'header/dir',
+                                  '--xtb-dir', 'xtb/dir',
+                                  '--xml-dir', 'xml/dir'])
+
+    outputs = grd.GetChildrenOfType(node_io.OutputNode)
+    self.assertEqual(len(outputs), 7)
+
+    header_outputs = [x for x in outputs if x.GetType() == 'rc_header']
+    rc_outputs = [x for x in outputs if x.GetType() == 'rc_all']
+    xml_outputs = [x for x in outputs if x.GetType() == 'android']
+
+    self.assertEqual(len(header_outputs), 1)
+    self.assertEqual(len(rc_outputs), 3)
+    self.assertEqual(len(xml_outputs), 3)
+
+    # The header node should have an "<emit>" child and the proper filename.
+    self.assertTrue(header_outputs[0].GetChildrenOfType(node_io.EmitNode))
+    self.assertEqual(util.normpath(header_outputs[0].GetFilename()),
+                     util.normpath('header/dir/chrome_android_strings.h'))
+
+    id_rc = [x for x in rc_outputs if x.GetLanguage() == 'id']
+    id_xml = [x for x in xml_outputs if x.GetLanguage() == 'id']
+    self.assertTrue(id_rc)
+    self.assertTrue(id_xml)
+    self.assertEqual(util.normpath(id_rc[0].GetFilename()),
+                     util.normpath('rc/dir/chrome_android_strings_id.rc'))
+    self.assertEqual(util.normpath(id_xml[0].GetFilename()),
+                     util.normpath('xml/dir/values-in/strings.xml'))
+
+    us_rc = [x for x in rc_outputs if x.GetLanguage() == 'en-US']
+    us_xml = [x for x in xml_outputs if x.GetLanguage() == 'en-US']
+    self.assertTrue(us_rc)
+    self.assertTrue(us_xml)
+    self.assertEqual(util.normpath(us_rc[0].GetFilename()),
+                     util.normpath('rc/dir/chrome_android_strings_en-US.rc'))
+    self.assertEqual(util.normpath(us_xml[0].GetFilename()),
+                     util.normpath('xml/dir/values-en-rUS/strings.xml'))
+
+
+if __name__ == '__main__':
+  unittest.main()
diff --git a/tools/grit/grit/tool/build.py b/tools/grit/grit/tool/build.py
new file mode 100644
index 0000000000..204592bf0d
--- /dev/null
+++ b/tools/grit/grit/tool/build.py
@@ -0,0 +1,556 @@
+# Copyright (c) 2012 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.
+
+'''The 'grit build' tool.
+'''
+
+from __future__ import print_function
+
+import codecs
+import filecmp
+import getopt
+import gzip
+import os
+import shutil
+import sys
+
+import six
+
+from grit import grd_reader
+from grit import shortcuts
+from grit import util
+from grit.format import minifier
+from grit.node import brotli_util
+from grit.node import include
+from grit.node import message
+from grit.node import structure
+from grit.tool import interface
+
+
+# It would be cleaner to have each module register itself, but that would
+# require importing all of them on every run of GRIT.
+'''Map from <output> node types to modules under grit.format.'''
+_format_modules = {
+  'android': 'android_xml',
+  'c_format': 'c_format',
+  'chrome_messages_json': 'chrome_messages_json',
+  'chrome_messages_json_gzip': 'chrome_messages_json',
+  'data_package': 'data_pack',
+  'policy_templates': 'policy_templates_json',
+  'rc_all': 'rc',
+  'rc_header': 'rc_header',
+  'rc_nontranslateable': 'rc',
+  'rc_translateable': 'rc',
+  'resource_file_map_source': 'resource_map',
+  'resource_map_header': 'resource_map',
+  'resource_map_source': 'resource_map',
+}
+
+def GetFormatter(type):
+  modulename = 'grit.format.' + _format_modules[type]
+  __import__(modulename)
+  module = sys.modules[modulename]
+  try:
+    return module.Format
+  except AttributeError:
+    return module.GetFormatter(type)
+
+
+class RcBuilder(interface.Tool):
+  '''A tool that builds RC files and resource header files for compilation.
+
+Usage:  grit build [-o OUTPUTDIR] [-D NAME[=VAL]]*
+
+All output options for this tool are specified in the input file (see
+'grit help' for details on how to specify the input file - it is a global
+option).
+
+Options:
+
+  -a FILE           Assert that the given file is an output. There can be
+                    multiple "-a" flags listed for multiple outputs. If a "-a"
+                    or "--assert-file-list" argument is present, then the list
+                    of asserted files must match the output files or the tool
+                    will fail. The use-case is for the build system to maintain
+                    separate lists of output files and to catch errors if the
+                    build system's list and the grit list are out-of-sync.
+
+  --assert-file-list  Provide a file listing multiple asserted output files.
+                    There is one file name per line. This acts like specifying
+                    each file with "-a" on the command line, but without the
+                    possibility of running into OS line-length limits for very
+                    long lists.
+
+  -o OUTPUTDIR      Specify what directory output paths are relative to.
+                    Defaults to the current directory.
+
+  -p FILE           Specify a file containing a pre-determined mapping from
+                    resource names to resource ids which will be used to assign
+                    resource ids to those resources. Resources not found in this
+                    file will be assigned ids normally. The motivation is to run
+                    your app's startup and have it dump the resources it loads,
+                    and then pass these via this flag. This will pack startup
+                    resources together, thus reducing paging while all other
+                    resources are unperturbed. The file should have the format:
+                      RESOURCE_ONE_NAME 123
+                      RESOURCE_TWO_NAME 124
+
+  -D NAME[=VAL]     Specify a C-preprocessor-like define NAME with optional
+                    value VAL (defaults to 1) which will be used to control
+                    conditional inclusion of resources.
+
+  -E NAME=VALUE     Set environment variable NAME to VALUE (within grit).
+
+  -f FIRSTIDSFILE   Path to a python file that specifies the first id of
+                    value to use for resources.  A non-empty value here will
+                    override the value specified in the <grit> node's
+                    first_ids_file.
+
+  -w WHITELISTFILE  Path to a file containing the string names of the
+                    resources to include.  Anything not listed is dropped.
+
+  -t PLATFORM       Specifies the platform the build is targeting; defaults
+                    to the value of sys.platform. The value provided via this
+                    flag should match what sys.platform would report for your
+                    target platform; see grit.node.base.EvaluateCondition.
+
+  --whitelist-support
+                    Generate code to support extracting a resource whitelist
+                    from executables.
+
+  --write-only-new flag
+                    If flag is non-0, write output files to a temporary file
+                    first, and copy it to the real output only if the new file
+                    is different from the old file.  This allows some build
+                    systems to realize that dependent build steps might be
+                    unnecessary, at the cost of comparing the output data at
+                    grit time.
+
+  --depend-on-stamp
+                    If specified along with --depfile and --depdir, the depfile
+                    generated will depend on a stampfile instead of the first
+                    output in the input .grd file.
+
+  --js-minifier     A command to run the Javascript minifier. If not set then
+                    Javascript won't be minified. The command should read the
+                    original Javascript from standard input, and output the
+                    minified Javascript to standard output. A non-zero exit
+                    status will be taken as indicating failure.
+
+  --css-minifier    A command to run the CSS minifier. If not set then CSS won't
+                    be minified. The command should read the original CSS from
+                    standard input, and output the minified CSS to standard
+                    output. A non-zero exit status will be taken as indicating
+                    failure.
+
+  --brotli          The full path to the brotli executable generated by
+                    third_party/brotli/BUILD.gn, required if any entries use
+                    compress="brotli".
+
+Conditional inclusion of resources only affects the output of files which
+control which resources get linked into a binary, e.g. it affects .rc files
+meant for compilation but it does not affect resource header files (that define
+IDs).  This helps ensure that values of IDs stay the same, that all messages
+are exported to translation interchange files (e.g. XMB files), etc.
+'''
+
+  def ShortDescription(self):
+    return 'A tool that builds RC files for compilation.'
+
+  def Run(self, opts, args):
+    brotli_util.SetBrotliCommand(None)
+    os.environ['cwd'] = os.getcwd()
+    self.output_directory = '.'
+    first_ids_file = None
+    predetermined_ids_file = None
+    whitelist_filenames = []
+    assert_output_files = []
+    target_platform = None
+    depfile = None
+    depdir = None
+    whitelist_support = False
+    write_only_new = False
+    depend_on_stamp = False
+    js_minifier = None
+    css_minifier = None
+    replace_ellipsis = True
+    (own_opts, args) = getopt.getopt(
+        args, 'a:p:o:D:E:f:w:t:',
+        ('depdir=', 'depfile=', 'assert-file-list=', 'help',
+         'output-all-resource-defines', 'no-output-all-resource-defines',
+         'no-replace-ellipsis', 'depend-on-stamp', 'js-minifier=',
+         'css-minifier=', 'write-only-new=', 'whitelist-support', 'brotli='))
+    for (key, val) in own_opts:
+      if key == '-a':
+        assert_output_files.append(val)
+      elif key == '--assert-file-list':
+        with open(val) as f:
+          assert_output_files += f.read().splitlines()
+      elif key == '-o':
+        self.output_directory = val
+      elif key == '-D':
+        name, val = util.ParseDefine(val)
+        self.defines[name] = val
+      elif key == '-E':
+        (env_name, env_value) = val.split('=', 1)
+        os.environ[env_name] = env_value
+      elif key == '-f':
+        # TODO(joi@chromium.org): Remove this override once change
+        # lands in WebKit.grd to specify the first_ids_file in the
+        # .grd itself.
+        first_ids_file = val
+      elif key == '-w':
+        whitelist_filenames.append(val)
+      elif key == '--no-replace-ellipsis':
+        replace_ellipsis = False
+      elif key == '-p':
+        predetermined_ids_file = val
+      elif key == '-t':
+        target_platform = val
+      elif key == '--depdir':
+        depdir = val
+      elif key == '--depfile':
+        depfile = val
+      elif key == '--write-only-new':
+        write_only_new = val != '0'
+      elif key == '--depend-on-stamp':
+        depend_on_stamp = True
+      elif key == '--js-minifier':
+        js_minifier = val
+      elif key == '--css-minifier':
+        css_minifier = val
+      elif key == '--whitelist-support':
+        whitelist_support = True
+      elif key == '--brotli':
+        brotli_util.SetBrotliCommand([os.path.abspath(val)])
+      elif key == '--help':
+        self.ShowUsage()
+        sys.exit(0)
+
+    if len(args):
+      print('This tool takes no tool-specific arguments.')
+      return 2
+    self.SetOptions(opts)
+    self.VerboseOut('Output directory: %s (absolute path: %s)\n' %
+                    (self.output_directory,
+                     os.path.abspath(self.output_directory)))
+
+    if whitelist_filenames:
+      self.whitelist_names = set()
+      for whitelist_filename in whitelist_filenames:
+        self.VerboseOut('Using whitelist: %s\n' % whitelist_filename);
+        whitelist_contents = util.ReadFile(whitelist_filename, 'utf-8')
+        self.whitelist_names.update(whitelist_contents.strip().split('\n'))
+
+    if js_minifier:
+      minifier.SetJsMinifier(js_minifier)
+
+    if css_minifier:
+      minifier.SetCssMinifier(css_minifier)
+
+    self.write_only_new = write_only_new
+
+    self.res = grd_reader.Parse(opts.input,
+                                debug=opts.extra_verbose,
+                                first_ids_file=first_ids_file,
+                                predetermined_ids_file=predetermined_ids_file,
+                                defines=self.defines,
+                                target_platform=target_platform)
+
+    # Set an output context so that conditionals can use defines during the
+    # gathering stage; we use a dummy language here since we are not outputting
+    # a specific language.
+    self.res.SetOutputLanguage('en')
+    self.res.SetWhitelistSupportEnabled(whitelist_support)
+    self.res.RunGatherers()
+
+    # Replace ... with the single-character version. http://crbug.com/621772
+    if replace_ellipsis:
+      for node in self.res:
+        if isinstance(node, message.MessageNode):
+          node.SetReplaceEllipsis(True)
+
+    self.Process()
+
+    if assert_output_files:
+      if not self.CheckAssertedOutputFiles(assert_output_files):
+        return 2
+
+    if depfile and depdir:
+      self.GenerateDepfile(depfile, depdir, first_ids_file, depend_on_stamp)
+
+    return 0
+
+  def __init__(self, defines=None):
+    # Default file-creation function is codecs.open().  Only done to allow
+    # overriding by unit test.
+    self.fo_create = codecs.open
+
+    # key/value pairs of C-preprocessor like defines that are used for
+    # conditional output of resources
+    self.defines = defines or {}
+
+    # self.res is a fully-populated resource tree if Run()
+    # has been called, otherwise None.
+    self.res = None
+
+    # The set of names that are whitelisted to actually be included in the
+    # output.
+    self.whitelist_names = None
+
+    # Whether to compare outputs to their old contents before writing.
+    self.write_only_new = False
+
+  @staticmethod
+  def AddWhitelistTags(start_node, whitelist_names):
+    # Walk the tree of nodes added attributes for the nodes that shouldn't
+    # be written into the target files (skip markers).
+    for node in start_node:
+      # Same trick data_pack.py uses to see what nodes actually result in
+      # real items.
+      if (isinstance(node, include.IncludeNode) or
+          isinstance(node, message.MessageNode) or
+          isinstance(node, structure.StructureNode)):
+        text_ids = node.GetTextualIds()
+        # Mark the item to be skipped if it wasn't in the whitelist.
+        if text_ids and text_ids[0] not in whitelist_names:
+          node.SetWhitelistMarkedAsSkip(True)
+
+  @staticmethod
+  def ProcessNode(node, output_node, outfile):
+    '''Processes a node in-order, calling its formatter before and after
+    recursing to its children.
+
+    Args:
+      node: grit.node.base.Node subclass
+      output_node: grit.node.io.OutputNode
+      outfile: open filehandle
+    '''
+    base_dir = util.dirname(output_node.GetOutputFilename())
+
+    formatter = GetFormatter(output_node.GetType())
+    formatted = formatter(node, output_node.GetLanguage(), output_dir=base_dir)
+    # NB: Formatters may be generators or return lists.  The writelines API
+    # accepts iterables as a shortcut to calling write directly.  That means
+    # you can pass strings (iteration yields characters), but not bytes (as
+    # iteration yields integers).  Python 2 worked due to its quirks with
+    # bytes/string implementation, but Python 3 fails.  It's also a bit more
+    # inefficient to call write once per character/byte.  Handle all of this
+    # ourselves by calling write directly on strings/bytes before falling back
+    # to writelines.
+    if isinstance(formatted, (six.string_types, six.binary_type)):
+      outfile.write(formatted)
+    else:
+      outfile.writelines(formatted)
+    if output_node.GetType() == 'data_package':
+      with open(output_node.GetOutputFilename() + '.info', 'w') as infofile:
+        if node.info:
+          # We terminate with a newline so that when these files are
+          # concatenated later we consistently terminate with a newline so
+          # consumers can account for terminating newlines.
+          infofile.writelines(['\n'.join(node.info), '\n'])
+
+  @staticmethod
+  def _EncodingForOutputType(output_type):
+    # Microsoft's RC compiler can only deal with single-byte or double-byte
+    # files (no UTF-8), so we make all RC files UTF-16 to support all
+    # character sets.
+    if output_type in ('rc_header', 'resource_file_map_source',
+                       'resource_map_header', 'resource_map_source'):
+      return 'cp1252'
+    if output_type in ('android', 'c_format',  'plist', 'plist_strings', 'doc',
+                       'json', 'android_policy', 'chrome_messages_json',
+                       'chrome_messages_json_gzip', 'policy_templates'):
+      return 'utf_8'
+    # TODO(gfeher) modify here to set utf-8 encoding for admx/adml
+    return 'utf_16'
+
+  def Process(self):
+    for output in self.res.GetOutputFiles():
+      output.output_filename = os.path.abspath(os.path.join(
+        self.output_directory, output.GetOutputFilename()))
+
+    # If there are whitelisted names, tag the tree once up front, this way
+    # while looping through the actual output, it is just an attribute check.
+    if self.whitelist_names:
+      self.AddWhitelistTags(self.res, self.whitelist_names)
+
+    for output in self.res.GetOutputFiles():
+      self.VerboseOut('Creating %s...' % output.GetOutputFilename())
+
+      # Set the context, for conditional inclusion of resources
+      self.res.SetOutputLanguage(output.GetLanguage())
+      self.res.SetOutputContext(output.GetContext())
+      self.res.SetFallbackToDefaultLayout(output.GetFallbackToDefaultLayout())
+      self.res.SetDefines(self.defines)
+
+      # Assign IDs only once to ensure that all outputs use the same IDs.
+      if self.res.GetIdMap() is None:
+        self.res.InitializeIds()
+
+      # Make the output directory if it doesn't exist.
+      self.MakeDirectoriesTo(output.GetOutputFilename())
+
+      # Write the results to a temporary file and only overwrite the original
+      # if the file changed.  This avoids unnecessary rebuilds.
+      out_filename = output.GetOutputFilename()
+      tmp_filename = out_filename + '.tmp'
+      tmpfile = self.fo_create(tmp_filename, 'wb')
+
+      output_type = output.GetType()
+      if output_type != 'data_package':
+        encoding = self._EncodingForOutputType(output_type)
+        tmpfile = util.WrapOutputStream(tmpfile, encoding)
+
+      # Iterate in-order through entire resource tree, calling formatters on
+      # the entry into a node and on exit out of it.
+      with tmpfile:
+        self.ProcessNode(self.res, output, tmpfile)
+
+      if output_type == 'chrome_messages_json_gzip':
+        gz_filename = tmp_filename + '.gz'
+        with open(tmp_filename, 'rb') as tmpfile, open(gz_filename, 'wb') as f:
+          with gzip.GzipFile(filename='', mode='wb', fileobj=f, mtime=0) as fgz:
+            shutil.copyfileobj(tmpfile, fgz)
+        os.remove(tmp_filename)
+        tmp_filename = gz_filename
+
+      # Now copy from the temp file back to the real output, but on Windows,
+      # only if the real output doesn't exist or the contents of the file
+      # changed.  This prevents identical headers from being written and .cc
+      # files from recompiling (which is painful on Windows).
+      if not os.path.exists(out_filename):
+        os.rename(tmp_filename, out_filename)
+      else:
+        # CHROMIUM SPECIFIC CHANGE.
+        # This clashes with gyp + vstudio, which expect the output timestamp
+        # to change on a rebuild, even if nothing has changed, so only do
+        # it when opted in.
+        if not self.write_only_new:
+          write_file = True
+        else:
+          files_match = filecmp.cmp(out_filename, tmp_filename)
+          write_file = not files_match
+        if write_file:
+          shutil.copy2(tmp_filename, out_filename)
+        os.remove(tmp_filename)
+
+      self.VerboseOut(' done.\n')
+
+    # Print warnings if there are any duplicate shortcuts.
+    warnings = shortcuts.GenerateDuplicateShortcutsWarnings(
+        self.res.UberClique(), self.res.GetTcProject())
+    if warnings:
+      print('\n'.join(warnings))
+
+    # Print out any fallback warnings, and missing translation errors, and
+    # exit with an error code if there are missing translations in a non-pseudo
+    # and non-official build.
+    warnings = (self.res.UberClique().MissingTranslationsReport().
+        encode('ascii', 'replace'))
+    if warnings:
+      self.VerboseOut(warnings)
+    if self.res.UberClique().HasMissingTranslations():
+      print(self.res.UberClique().missing_translations_)
+      sys.exit(-1)
+
+
+  def CheckAssertedOutputFiles(self, assert_output_files):
+    '''Checks that the asserted output files are specified in the given list.
+
+    Returns true if the asserted files are present. If they are not, returns
+    False and prints the failure.
+    '''
+    # Compare the absolute path names, sorted.
+    asserted = sorted([os.path.abspath(i) for i in assert_output_files])
+    actual = sorted([
+        os.path.abspath(os.path.join(self.output_directory,
+                                     i.GetOutputFilename()))
+        for i in self.res.GetOutputFiles()])
+
+    if asserted != actual:
+      missing = list(set(asserted) - set(actual))
+      extra = list(set(actual) - set(asserted))
+      error = '''Asserted file list does not match.
+
+Expected output files:
+%s
+Actual output files:
+%s
+Missing output files:
+%s
+Extra output files:
+%s
+'''
+      print(error % ('\n'.join(asserted), '\n'.join(actual), '\n'.join(missing),
+                     ' \n'.join(extra)))
+      return False
+    return True
+
+
+  def GenerateDepfile(self, depfile, depdir, first_ids_file, depend_on_stamp):
+    '''Generate a depfile that contains the imlicit dependencies of the input
+    grd. The depfile will be in the same format as a makefile, and will contain
+    references to files relative to |depdir|. It will be put in |depfile|.
+
+    For example, supposing we have three files in a directory src/
+
+    src/
+      blah.grd    <- depends on input{1,2}.xtb
+      input1.xtb
+      input2.xtb
+
+    and we run
+
+      grit -i blah.grd -o ../out/gen \
+           --depdir ../out \
+           --depfile ../out/gen/blah.rd.d
+
+    from the directory src/ we will generate a depfile ../out/gen/blah.grd.d
+    that has the contents
+
+      gen/blah.h: ../src/input1.xtb ../src/input2.xtb
+
+    Where "gen/blah.h" is the first output (Ninja expects the .d file to list
+    the first output in cases where there is more than one). If the flag
+    --depend-on-stamp is specified, "gen/blah.rd.d.stamp" will be used that is
+    'touched' whenever a new depfile is generated.
+
+    Note that all paths in the depfile are relative to ../out, the depdir.
+    '''
+    depfile = os.path.abspath(depfile)
+    depdir = os.path.abspath(depdir)
+    infiles = self.res.GetInputFiles()
+
+    # We want to trigger a rebuild if the first ids change.
+    if first_ids_file is not None:
+      infiles.append(first_ids_file)
+
+    if (depend_on_stamp):
+      output_file = depfile + ".stamp"
+      # Touch the stamp file before generating the depfile.
+      with open(output_file, 'a'):
+        os.utime(output_file, None)
+    else:
+      # Get the first output file relative to the depdir.
+      outputs = self.res.GetOutputFiles()
+      output_file = os.path.join(self.output_directory,
+                                 outputs[0].GetOutputFilename())
+
+    output_file = os.path.relpath(output_file, depdir)
+    # The path prefix to prepend to dependencies in the depfile.
+    prefix = os.path.relpath(os.getcwd(), depdir)
+    deps_text = ' '.join([os.path.join(prefix, i) for i in infiles])
+
+    depfile_contents = output_file + ': ' + deps_text
+    self.MakeDirectoriesTo(depfile)
+    outfile = self.fo_create(depfile, 'w', encoding='utf-8')
+    outfile.write(depfile_contents)
+
+  @staticmethod
+  def MakeDirectoriesTo(file):
+    '''Creates directories necessary to contain |file|.'''
+    dir = os.path.split(file)[0]
+    if not os.path.exists(dir):
+      os.makedirs(dir)
diff --git a/tools/grit/grit/tool/build_unittest.py b/tools/grit/grit/tool/build_unittest.py
new file mode 100644
index 0000000000..c4a2f2752b
--- /dev/null
+++ b/tools/grit/grit/tool/build_unittest.py
@@ -0,0 +1,341 @@
+#!/usr/bin/env python
+# Copyright (c) 2012 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.
+
+'''Unit tests for the 'grit build' tool.
+'''
+
+from __future__ import print_function
+
+import codecs
+import os
+import sys
+if __name__ == '__main__':
+  sys.path.append(os.path.join(os.path.dirname(__file__), '../..'))
+
+import unittest
+
+from grit import util
+from grit.tool import build
+
+
+class BuildUnittest(unittest.TestCase):
+
+  # IDs should not change based on whitelisting.
+  # Android WebView currently relies on this.
+  EXPECTED_ID_MAP = {
+      'IDS_MESSAGE_WHITELISTED': 6889,
+      'IDR_STRUCTURE_WHITELISTED': 11546,
+      'IDR_STRUCTURE_IN_TRUE_IF_WHITELISTED': 11548,
+      'IDR_INCLUDE_WHITELISTED': 15601,
+  }
+
+  def testFindTranslationsWithSubstitutions(self):
+    # This is a regression test; we had a bug where GRIT would fail to find
+    # messages with substitutions e.g. "Hello [IDS_USER]" where IDS_USER is
+    # another <message>.
+    output_dir = util.TempDir({})
+    builder = build.RcBuilder()
+    class DummyOpts(object):
+      def __init__(self):
+        self.input = util.PathFromRoot('grit/testdata/substitute.grd')
+        self.verbose = False
+        self.extra_verbose = False
+    builder.Run(DummyOpts(), ['-o', output_dir.GetPath()])
+    output_dir.CleanUp()
+
+  def testGenerateDepFile(self):
+    output_dir = util.TempDir({})
+    builder = build.RcBuilder()
+    class DummyOpts(object):
+      def __init__(self):
+        self.input = util.PathFromRoot('grit/testdata/depfile.grd')
+        self.verbose = False
+        self.extra_verbose = False
+    expected_dep_file = output_dir.GetPath('substitute.grd.d')
+    builder.Run(DummyOpts(), ['-o', output_dir.GetPath(),
+                              '--depdir', output_dir.GetPath(),
+                              '--depfile', expected_dep_file])
+
+    self.failUnless(os.path.isfile(expected_dep_file))
+    with open(expected_dep_file) as f:
+      line = f.readline()
+      (dep_output_file, deps_string) = line.split(': ')
+      deps = deps_string.split(' ')
+
+      self.failUnlessEqual("default_100_percent.pak", dep_output_file)
+      self.failUnlessEqual(deps, [
+          util.PathFromRoot('grit/testdata/default_100_percent/a.png'),
+          util.PathFromRoot('grit/testdata/grit_part.grdp'),
+          util.PathFromRoot('grit/testdata/special_100_percent/a.png'),
+      ])
+    output_dir.CleanUp()
+
+  def testGenerateDepFileWithResourceIds(self):
+    output_dir = util.TempDir({})
+    builder = build.RcBuilder()
+    class DummyOpts(object):
+      def __init__(self):
+        self.input = util.PathFromRoot('grit/testdata/substitute_no_ids.grd')
+        self.verbose = False
+        self.extra_verbose = False
+    expected_dep_file = output_dir.GetPath('substitute_no_ids.grd.d')
+    builder.Run(DummyOpts(),
+        ['-f', util.PathFromRoot('grit/testdata/resource_ids'),
+         '-o', output_dir.GetPath(),
+         '--depdir', output_dir.GetPath(),
+         '--depfile', expected_dep_file])
+
+    self.failUnless(os.path.isfile(expected_dep_file))
+    with open(expected_dep_file) as f:
+      line = f.readline()
+      (dep_output_file, deps_string) = line.split(': ')
+      deps = deps_string.split(' ')
+
+      self.failUnlessEqual("resource.h", dep_output_file)
+      self.failUnlessEqual(2, len(deps))
+      self.failUnlessEqual(deps[0],
+          util.PathFromRoot('grit/testdata/substitute.xmb'))
+      self.failUnlessEqual(deps[1],
+          util.PathFromRoot('grit/testdata/resource_ids'))
+    output_dir.CleanUp()
+
+  def testAssertOutputs(self):
+    output_dir = util.TempDir({})
+    class DummyOpts(object):
+      def __init__(self):
+        self.input = util.PathFromRoot('grit/testdata/substitute.grd')
+        self.verbose = False
+        self.extra_verbose = False
+
+    # Incomplete output file list should fail.
+    builder_fail = build.RcBuilder()
+    self.failUnlessEqual(2,
+        builder_fail.Run(DummyOpts(), [
+            '-o', output_dir.GetPath(),
+            '-a', os.path.abspath(
+                output_dir.GetPath('en_generated_resources.rc'))]))
+
+    # Complete output file list should succeed.
+    builder_ok = build.RcBuilder()
+    self.failUnlessEqual(0,
+        builder_ok.Run(DummyOpts(), [
+            '-o', output_dir.GetPath(),
+            '-a', os.path.abspath(
+                output_dir.GetPath('en_generated_resources.rc')),
+            '-a', os.path.abspath(
+                output_dir.GetPath('sv_generated_resources.rc')),
+            '-a', os.path.abspath(output_dir.GetPath('resource.h'))]))
+    output_dir.CleanUp()
+
+  def testAssertTemplateOutputs(self):
+    output_dir = util.TempDir({})
+    class DummyOpts(object):
+      def __init__(self):
+        self.input = util.PathFromRoot('grit/testdata/substitute_tmpl.grd')
+        self.verbose = False
+        self.extra_verbose = False
+
+    # Incomplete output file list should fail.
+    builder_fail = build.RcBuilder()
+    self.failUnlessEqual(2,
+        builder_fail.Run(DummyOpts(), [
+            '-o', output_dir.GetPath(),
+            '-E', 'name=foo',
+            '-a', os.path.abspath(output_dir.GetPath('en_foo_resources.rc'))]))
+
+    # Complete output file list should succeed.
+    builder_ok = build.RcBuilder()
+    self.failUnlessEqual(0,
+        builder_ok.Run(DummyOpts(), [
+            '-o', output_dir.GetPath(),
+            '-E', 'name=foo',
+            '-a', os.path.abspath(output_dir.GetPath('en_foo_resources.rc')),
+            '-a', os.path.abspath(output_dir.GetPath('sv_foo_resources.rc')),
+            '-a', os.path.abspath(output_dir.GetPath('resource.h'))]))
+    output_dir.CleanUp()
+
+  def _verifyWhitelistedOutput(self,
+                               filename,
+                               whitelisted_ids,
+                               non_whitelisted_ids,
+                               encoding='utf8'):
+    self.failUnless(os.path.exists(filename))
+    whitelisted_ids_found = []
+    non_whitelisted_ids_found = []
+    with codecs.open(filename, encoding=encoding) as f:
+      for line in f.readlines():
+        for whitelisted_id in whitelisted_ids:
+          if whitelisted_id in line:
+            whitelisted_ids_found.append(whitelisted_id)
+            if filename.endswith('.h'):
+              numeric_id = int(line.split()[2])
+              expected_numeric_id = self.EXPECTED_ID_MAP.get(whitelisted_id)
+              self.assertEqual(
+                  expected_numeric_id, numeric_id,
+                  'Numeric ID for {} was {} should be {}'.format(
+                      whitelisted_id, numeric_id, expected_numeric_id))
+        for non_whitelisted_id in non_whitelisted_ids:
+          if non_whitelisted_id in line:
+            non_whitelisted_ids_found.append(non_whitelisted_id)
+    self.longMessage = True
+    self.assertEqual(whitelisted_ids,
+                     whitelisted_ids_found,
+                     '\nin file {}'.format(os.path.basename(filename)))
+    non_whitelisted_msg = ('Non-Whitelisted IDs {} found in {}'
+        .format(non_whitelisted_ids_found, os.path.basename(filename)))
+    self.assertFalse(non_whitelisted_ids_found, non_whitelisted_msg)
+
+  def testWhitelistStrings(self):
+    output_dir = util.TempDir({})
+    builder = build.RcBuilder()
+    class DummyOpts(object):
+      def __init__(self):
+        self.input = util.PathFromRoot('grit/testdata/whitelist_strings.grd')
+        self.verbose = False
+        self.extra_verbose = False
+    whitelist_file = util.PathFromRoot('grit/testdata/whitelist.txt')
+    builder.Run(DummyOpts(), ['-o', output_dir.GetPath(),
+                              '-w', whitelist_file])
+    header = output_dir.GetPath('whitelist_test_resources.h')
+    rc = output_dir.GetPath('en_whitelist_test_strings.rc')
+
+    whitelisted_ids = ['IDS_MESSAGE_WHITELISTED']
+    non_whitelisted_ids = ['IDS_MESSAGE_NOT_WHITELISTED']
+    self._verifyWhitelistedOutput(
+      header,
+      whitelisted_ids,
+      non_whitelisted_ids,
+    )
+    self._verifyWhitelistedOutput(
+      rc,
+      whitelisted_ids,
+      non_whitelisted_ids,
+      encoding='utf16'
+    )
+    output_dir.CleanUp()
+
+  def testWhitelistResources(self):
+    output_dir = util.TempDir({})
+    builder = build.RcBuilder()
+    class DummyOpts(object):
+      def __init__(self):
+        self.input = util.PathFromRoot('grit/testdata/whitelist_resources.grd')
+        self.verbose = False
+        self.extra_verbose = False
+    whitelist_file = util.PathFromRoot('grit/testdata/whitelist.txt')
+    builder.Run(DummyOpts(), ['-o', output_dir.GetPath(),
+                              '-w', whitelist_file])
+    header = output_dir.GetPath('whitelist_test_resources.h')
+    map_cc = output_dir.GetPath('whitelist_test_resources_map.cc')
+    map_h = output_dir.GetPath('whitelist_test_resources_map.h')
+    pak = output_dir.GetPath('whitelist_test_resources.pak')
+
+    # Ensure the resource map header and .pak files exist, but don't verify
+    # their content.
+    self.failUnless(os.path.exists(map_h))
+    self.failUnless(os.path.exists(pak))
+
+    whitelisted_ids = [
+        'IDR_STRUCTURE_WHITELISTED',
+        'IDR_STRUCTURE_IN_TRUE_IF_WHITELISTED',
+        'IDR_INCLUDE_WHITELISTED',
+    ]
+    non_whitelisted_ids = [
+        'IDR_STRUCTURE_NOT_WHITELISTED',
+        'IDR_STRUCTURE_IN_TRUE_IF_NOT_WHITELISTED',
+        'IDR_STRUCTURE_IN_FALSE_IF_WHITELISTED',
+        'IDR_STRUCTURE_IN_FALSE_IF_NOT_WHITELISTED',
+        'IDR_INCLUDE_NOT_WHITELISTED',
+    ]
+    for output_file in (header, map_cc):
+      self._verifyWhitelistedOutput(
+        output_file,
+        whitelisted_ids,
+        non_whitelisted_ids,
+      )
+    output_dir.CleanUp()
+
+  def testWriteOnlyNew(self):
+    output_dir = util.TempDir({})
+    builder = build.RcBuilder()
+    class DummyOpts(object):
+      def __init__(self):
+        self.input = util.PathFromRoot('grit/testdata/substitute.grd')
+        self.verbose = False
+        self.extra_verbose = False
+    UNCHANGED = 10
+    header = output_dir.GetPath('resource.h')
+
+    builder.Run(DummyOpts(), ['-o', output_dir.GetPath()])
+    self.failUnless(os.path.exists(header))
+    first_mtime = os.stat(header).st_mtime
+
+    os.utime(header, (UNCHANGED, UNCHANGED))
+    builder.Run(DummyOpts(),
+                ['-o', output_dir.GetPath(), '--write-only-new', '0'])
+    self.failUnless(os.path.exists(header))
+    second_mtime = os.stat(header).st_mtime
+
+    os.utime(header, (UNCHANGED, UNCHANGED))
+    builder.Run(DummyOpts(),
+                ['-o', output_dir.GetPath(), '--write-only-new', '1'])
+    self.failUnless(os.path.exists(header))
+    third_mtime = os.stat(header).st_mtime
+
+    self.assertTrue(abs(second_mtime - UNCHANGED) > 5)
+    self.assertTrue(abs(third_mtime - UNCHANGED) < 5)
+    output_dir.CleanUp()
+
+  def testGenerateDepFileWithDependOnStamp(self):
+    output_dir = util.TempDir({})
+    builder = build.RcBuilder()
+    class DummyOpts(object):
+      def __init__(self):
+        self.input = util.PathFromRoot('grit/testdata/substitute.grd')
+        self.verbose = False
+        self.extra_verbose = False
+    expected_dep_file_name = 'substitute.grd.d'
+    expected_stamp_file_name = expected_dep_file_name + '.stamp'
+    expected_dep_file = output_dir.GetPath(expected_dep_file_name)
+    expected_stamp_file = output_dir.GetPath(expected_stamp_file_name)
+    if os.path.isfile(expected_stamp_file):
+      os.remove(expected_stamp_file)
+    builder.Run(DummyOpts(), ['-o', output_dir.GetPath(),
+                              '--depdir', output_dir.GetPath(),
+                              '--depfile', expected_dep_file,
+                              '--depend-on-stamp'])
+    self.failUnless(os.path.isfile(expected_stamp_file))
+    first_mtime = os.stat(expected_stamp_file).st_mtime
+
+    # Reset mtime to very old.
+    OLDTIME = 10
+    os.utime(expected_stamp_file, (OLDTIME, OLDTIME))
+
+    builder.Run(DummyOpts(), ['-o', output_dir.GetPath(),
+                              '--depdir', output_dir.GetPath(),
+                              '--depfile', expected_dep_file,
+                              '--depend-on-stamp'])
+    self.failUnless(os.path.isfile(expected_stamp_file))
+    second_mtime = os.stat(expected_stamp_file).st_mtime
+
+    # Some OS have a 2s stat resolution window, so can't do a direct comparison.
+    self.assertTrue((second_mtime - OLDTIME) > 5)
+    self.assertTrue(abs(second_mtime - first_mtime) < 5)
+
+    self.failUnless(os.path.isfile(expected_dep_file))
+    with open(expected_dep_file) as f:
+      line = f.readline()
+      (dep_output_file, deps_string) = line.split(': ')
+      deps = deps_string.split(' ')
+
+      self.failUnlessEqual(expected_stamp_file_name, dep_output_file)
+      self.failUnlessEqual(deps, [
+          util.PathFromRoot('grit/testdata/substitute.xmb'),
+      ])
+    output_dir.CleanUp()
+
+
+if __name__ == '__main__':
+  unittest.main()
diff --git a/tools/grit/grit/tool/buildinfo.py b/tools/grit/grit/tool/buildinfo.py
new file mode 100644
index 0000000000..7f8d1a3b04
--- /dev/null
+++ b/tools/grit/grit/tool/buildinfo.py
@@ -0,0 +1,78 @@
+# Copyright (c) 2012 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.
+
+"""Output the list of files to be generated by GRIT from an input.
+"""
+
+from __future__ import print_function
+
+import getopt
+import os
+import sys
+
+from grit import grd_reader
+from grit.node import structure
+from grit.tool import interface
+
+class DetermineBuildInfo(interface.Tool):
+  """Determine what files will be read and output by GRIT.
+Outputs the list of generated files and inputs used to stdout.
+
+Usage: grit buildinfo [-o DIR]
+
+The output directory is used for display only.
+"""
+
+  def __init__(self):
+    pass
+
+  def ShortDescription(self):
+    """Describes this tool for the usage message."""
+    return ('Determine what files will be needed and\n'
+            'output by GRIT with a given input.')
+
+  def Run(self, opts, args):
+    """Main method for the buildinfo tool."""
+    self.output_directory = '.'
+    (own_opts, args) = getopt.getopt(args, 'o:', ('help',))
+    for (key, val) in own_opts:
+      if key == '-o':
+        self.output_directory = val
+      elif key == '--help':
+        self.ShowUsage()
+        sys.exit(0)
+    if len(args) > 0:
+      print('This tool takes exactly one argument: the output directory via -o')
+      return 2
+    self.SetOptions(opts)
+
+    res_tree = grd_reader.Parse(opts.input, debug=opts.extra_verbose)
+
+    langs = {}
+    for output in res_tree.GetOutputFiles():
+      if output.attrs['lang']:
+        langs[output.attrs['lang']] = os.path.dirname(output.GetFilename())
+
+    for lang, dirname in langs.items():
+      old_output_language = res_tree.output_language
+      res_tree.SetOutputLanguage(lang)
+      for node in res_tree.ActiveDescendants():
+        with node:
+          if (isinstance(node, structure.StructureNode) and
+              node.HasFileForLanguage()):
+            path = node.FileForLanguage(lang, dirname, create_file=False,
+                                        return_if_not_generated=False)
+            if path:
+              path = os.path.join(self.output_directory, path)
+              path = os.path.normpath(path)
+              print('%s|%s' % ('rc_all', path))
+      res_tree.SetOutputLanguage(old_output_language)
+
+    for output in res_tree.GetOutputFiles():
+      path = os.path.join(self.output_directory, output.GetFilename())
+      path = os.path.normpath(path)
+      print('%s|%s' % (output.GetType(), path))
+
+    for infile in res_tree.GetInputFiles():
+      print('input|%s' % os.path.normpath(infile))
diff --git a/tools/grit/grit/tool/buildinfo_unittest.py b/tools/grit/grit/tool/buildinfo_unittest.py
new file mode 100644
index 0000000000..24e9ddf8d8
--- /dev/null
+++ b/tools/grit/grit/tool/buildinfo_unittest.py
@@ -0,0 +1,90 @@
+#!/usr/bin/env python
+# Copyright (c) 2012 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.
+
+"""Unit tests for the 'grit buildinfo' tool.
+"""
+
+from __future__ import print_function
+
+import os
+import sys
+import unittest
+
+# This is needed to find some of the imports below.
+if __name__ == '__main__':
+  sys.path.append(os.path.join(os.path.dirname(__file__), '../..'))
+
+from six import StringIO
+
+# pylint: disable-msg=C6204
+from grit.tool import buildinfo
+
+
+class BuildInfoUnittest(unittest.TestCase):
+  def setUp(self):
+    self.old_cwd = os.getcwd()
+    # Change CWD to make tests work independently of callers CWD.
+    os.chdir(os.path.dirname(__file__))
+    os.chdir('..')
+    self.buf = StringIO()
+    self.old_stdout = sys.stdout
+    sys.stdout = self.buf
+
+  def tearDown(self):
+    sys.stdout = self.old_stdout
+    os.chdir(self.old_cwd)
+
+  def testBuildOutput(self):
+    """Find all of the inputs and outputs for a GRD file."""
+    info_object = buildinfo.DetermineBuildInfo()
+
+    class DummyOpts(object):
+      def __init__(self):
+        self.input = '../grit/testdata/buildinfo.grd'
+        self.print_header = False
+        self.verbose = False
+        self.extra_verbose = False
+    info_object.Run(DummyOpts(), [])
+    output = self.buf.getvalue().replace('\\', '/')
+    self.failUnless(output.count(r'rc_all|sv_sidebar_loading.html'))
+    self.failUnless(output.count(r'rc_header|resource.h'))
+    self.failUnless(output.count(r'rc_all|en_generated_resources.rc'))
+    self.failUnless(output.count(r'rc_all|sv_generated_resources.rc'))
+    self.failUnless(output.count(r'input|../grit/testdata/substitute.xmb'))
+    self.failUnless(output.count(r'input|../grit/testdata/pr.bmp'))
+    self.failUnless(output.count(r'input|../grit/testdata/pr2.bmp'))
+    self.failUnless(
+        output.count(r'input|../grit/testdata/sidebar_loading.html'))
+    self.failUnless(output.count(r'input|../grit/testdata/transl.rc'))
+    self.failUnless(output.count(r'input|../grit/testdata/transl1.rc'))
+
+  def testBuildOutputWithDir(self):
+    """Find all the inputs and outputs for a GRD file with an output dir."""
+    info_object = buildinfo.DetermineBuildInfo()
+
+    class DummyOpts(object):
+      def __init__(self):
+        self.input = '../grit/testdata/buildinfo.grd'
+        self.print_header = False
+        self.verbose = False
+        self.extra_verbose = False
+    info_object.Run(DummyOpts(), ['-o', '../grit/testdata'])
+    output = self.buf.getvalue().replace('\\', '/')
+    self.failUnless(
+        output.count(r'rc_all|../grit/testdata/sv_sidebar_loading.html'))
+    self.failUnless(output.count(r'rc_header|../grit/testdata/resource.h'))
+    self.failUnless(
+        output.count(r'rc_all|../grit/testdata/en_generated_resources.rc'))
+    self.failUnless(
+        output.count(r'rc_all|../grit/testdata/sv_generated_resources.rc'))
+    self.failUnless(output.count(r'input|../grit/testdata/substitute.xmb'))
+    self.failUnlessEqual(0,
+        output.count(r'rc_all|../grit/testdata/sv_welcome_toast.html'))
+    self.failUnless(
+        output.count(r'rc_all|../grit/testdata/en_welcome_toast.html'))
+
+
+if __name__ == '__main__':
+  unittest.main()
diff --git a/tools/grit/grit/tool/count.py b/tools/grit/grit/tool/count.py
new file mode 100644
index 0000000000..ab37f2ddb3
--- /dev/null
+++ b/tools/grit/grit/tool/count.py
@@ -0,0 +1,52 @@
+# Copyright (c) 2012 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.
+
+'''Count number of occurrences of a given message ID.'''
+
+from __future__ import print_function
+
+import getopt
+import sys
+
+from grit import grd_reader
+from grit.tool import interface
+
+
+class CountMessage(interface.Tool):
+  '''Count the number of times a given message ID is used.'''
+
+  def __init__(self):
+    pass
+
+  def ShortDescription(self):
+    return 'Count the number of times a given message ID is used.'
+
+  def ParseOptions(self, args):
+    """Set this objects and return all non-option arguments."""
+    own_opts, args = getopt.getopt(args, '', ('help',))
+    for key, val in own_opts:
+      if key == '--help':
+        self.ShowUsage()
+        sys.exit(0)
+    return args
+
+  def Run(self, opts, args):
+    args = self.ParseOptions(args)
+    if len(args) != 1:
+      print('This tool takes a single tool-specific argument, the message '
+            'ID to count.')
+      return 2
+    self.SetOptions(opts)
+
+    id = args[0]
+    res_tree = grd_reader.Parse(opts.input, debug=opts.extra_verbose)
+    res_tree.OnlyTheseTranslations([])
+    res_tree.RunGatherers()
+
+    count = 0
+    for c in res_tree.UberClique().AllCliques():
+      if c.GetId() == id:
+        count += 1
+
+    print("There are %d occurrences of message %s." % (count, id))
diff --git a/tools/grit/grit/tool/diff_structures.py b/tools/grit/grit/tool/diff_structures.py
new file mode 100644
index 0000000000..d69e009b58
--- /dev/null
+++ b/tools/grit/grit/tool/diff_structures.py
@@ -0,0 +1,119 @@
+# Copyright (c) 2012 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.
+
+'''The 'grit sdiff' tool.
+'''
+
+from __future__ import print_function
+
+import os
+import getopt
+import sys
+import tempfile
+
+from grit.node import structure
+from grit.tool import interface
+
+from grit import constants
+from grit import util
+
+# Builds the description for the tool (used as the __doc__
+# for the DiffStructures class).
+_class_doc = """\
+Allows you to view the differences in the structure of two files,
+disregarding their translateable content.  Translateable portions of
+each file are changed to the string "TTTTTT" before invoking the diff program
+specified by the P4DIFF environment variable.
+
+Usage: grit sdiff [-t TYPE] [-s SECTION] [-e ENCODING] LEFT RIGHT
+
+LEFT and RIGHT are the files you want to diff.  SECTION is required
+for structure types like 'dialog' to identify the part of the file to look at.
+ENCODING indicates the encoding of the left and right files (default 'cp1252').
+TYPE can be one of the following, defaults to 'tr_html':
+"""
+for gatherer in structure._GATHERERS:
+  _class_doc += " - %s\n" % gatherer
+
+
+class DiffStructures(interface.Tool):
+  __doc__ = _class_doc
+
+  def __init__(self):
+    self.section = None
+    self.left_encoding = 'cp1252'
+    self.right_encoding = 'cp1252'
+    self.structure_type = 'tr_html'
+
+  def ShortDescription(self):
+    return 'View differences without regard for translateable portions.'
+
+  def Run(self, global_opts, args):
+    (opts, args) = getopt.getopt(args, 's:e:t:',
+                                 ('help', 'left_encoding=', 'right_encoding='))
+    for key, val in opts:
+      if key == '-s':
+        self.section = val
+      elif key == '-e':
+        self.left_encoding = val
+        self.right_encoding = val
+      elif key == '-t':
+        self.structure_type = val
+      elif key == '--left_encoding':
+        self.left_encoding = val
+      elif key == '--right_encoding':
+        self.right_encoding == val
+      elif key == '--help':
+        self.ShowUsage()
+        sys.exit(0)
+
+    if len(args) != 2:
+      print("Incorrect usage - 'grit help sdiff' for usage details.")
+      return 2
+
+    if 'P4DIFF' not in os.environ:
+      print("Environment variable P4DIFF not set; defaulting to 'windiff'.")
+      diff_program = 'windiff'
+    else:
+      diff_program = os.environ['P4DIFF']
+
+    left_trans = self.MakeStaticTranslation(args[0], self.left_encoding)
+    try:
+      try:
+        right_trans = self.MakeStaticTranslation(args[1], self.right_encoding)
+
+        os.system('%s %s %s' % (diff_program, left_trans, right_trans))
+      finally:
+        os.unlink(right_trans)
+    finally:
+      os.unlink(left_trans)
+
+  def MakeStaticTranslation(self, original_filename, encoding):
+    """Given the name of the structure type (self.structure_type), the filename
+    of the file holding the original structure, and optionally the "section" key
+    identifying the part of the file to look at (self.section), creates a
+    temporary file holding a "static" translation of the original structure
+    (i.e. one where all translateable parts have been replaced with "TTTTTT")
+    and returns the temporary file name.  It is the caller's responsibility to
+    delete the file when finished.
+
+    Args:
+      original_filename: 'c:\\bingo\\bla.rc'
+
+    Return:
+      'c:\\temp\\werlkjsdf334.tmp'
+    """
+    original = structure._GATHERERS[self.structure_type](original_filename,
+                                                         extkey=self.section,
+                                                         encoding=encoding)
+    original.Parse()
+    translated = original.Translate(constants.CONSTANT_LANGUAGE, False)
+
+    fname = tempfile.mktemp()
+    with util.WrapOutputStream(open(fname, 'wb')) as writer:
+      writer.write("Original filename: %s\n=============\n\n"
+                       % original_filename)
+      writer.write(translated)  # write in UTF-8
+
+    return fname
diff --git a/tools/grit/grit/tool/diff_structures_unittest.py b/tools/grit/grit/tool/diff_structures_unittest.py
new file mode 100644
index 0000000000..a6d7585761
--- /dev/null
+++ b/tools/grit/grit/tool/diff_structures_unittest.py
@@ -0,0 +1,46 @@
+#!/usr/bin/env python
+# Copyright 2020 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.
+
+'''Unit tests for the 'grit newgrd' tool.'''
+
+from __future__ import print_function
+
+import os
+import sys
+if __name__ == '__main__':
+  sys.path.append(os.path.join(os.path.dirname(__file__), '../..'))
+
+import unittest
+
+from grit.tool import diff_structures
+
+
+class DummyOpts(object):
+  """Options needed by NewGrd."""
+
+
+class DiffStructuresUnittest(unittest.TestCase):
+
+  def testMissingFiles(self):
+    """Verify failure w/out file inputs."""
+    tool = diff_structures.DiffStructures()
+    ret = tool.Run(DummyOpts(), [])
+    self.assertIsNotNone(ret)
+    self.assertGreater(ret, 0)
+
+    ret = tool.Run(DummyOpts(), ['left'])
+    self.assertIsNotNone(ret)
+    self.assertGreater(ret, 0)
+
+  def testTooManyArgs(self):
+    """Verify failure w/too many inputs."""
+    tool = diff_structures.DiffStructures()
+    ret = tool.Run(DummyOpts(), ['a', 'b', 'c'])
+    self.assertIsNotNone(ret)
+    self.assertGreater(ret, 0)
+
+
+if __name__ == '__main__':
+  unittest.main()
diff --git a/tools/grit/grit/tool/interface.py b/tools/grit/grit/tool/interface.py
new file mode 100644
index 0000000000..e923205223
--- /dev/null
+++ b/tools/grit/grit/tool/interface.py
@@ -0,0 +1,62 @@
+# Copyright (c) 2012 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.
+
+'''Base class and interface for tools.
+'''
+
+from __future__ import print_function
+
+class Tool(object):
+  '''Base class for all tools.  Tools should use their docstring (i.e. the
+  class-level docstring) for the help they want to have printed when they
+  are invoked.'''
+
+  #
+  # Interface (abstract methods)
+  #
+
+  def ShortDescription(self):
+    '''Returns a short description of the functionality of the tool.'''
+    raise NotImplementedError()
+
+  def Run(self, global_options, my_arguments):
+    '''Runs the tool.
+
+    Args:
+      global_options: object grit_runner.Options
+      my_arguments: [arg1 arg2 ...]
+
+    Return:
+      0 for success, non-0 for error
+    '''
+    raise NotImplementedError()
+
+  #
+  # Base class implementation
+  #
+
+  def __init__(self):
+    self.o = None
+
+  def ShowUsage(self):
+    '''Show usage text for this tool.'''
+    print(self.__doc__)
+
+  def SetOptions(self, opts):
+    self.o = opts
+
+  def Out(self, text):
+    '''Always writes out 'text'.'''
+    self.o.output_stream.write(text)
+
+  def VerboseOut(self, text):
+    '''Writes out 'text' if the verbose option is on.'''
+    if self.o.verbose:
+      self.o.output_stream.write(text)
+
+  def ExtraVerboseOut(self, text):
+    '''Writes out 'text' if the extra-verbose option is on.
+    '''
+    if self.o.extra_verbose:
+      self.o.output_stream.write(text)
diff --git a/tools/grit/grit/tool/menu_from_parts.py b/tools/grit/grit/tool/menu_from_parts.py
new file mode 100644
index 0000000000..fcec26c5b1
--- /dev/null
+++ b/tools/grit/grit/tool/menu_from_parts.py
@@ -0,0 +1,79 @@
+# Copyright (c) 2012 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.
+
+'''The 'grit menufromparts' tool.'''
+
+from __future__ import print_function
+
+import six
+
+from grit import grd_reader
+from grit import util
+from grit import xtb_reader
+from grit.tool import interface
+from grit.tool import transl2tc
+
+import grit.extern.tclib
+
+
+class MenuTranslationsFromParts(interface.Tool):
+  '''One-off tool to generate translated menu messages (where each menu is kept
+in a single message) based on existing translations of the individual menu
+items.  Was needed when changing menus from being one message per menu item
+to being one message for the whole menu.'''
+
+  def ShortDescription(self):
+    return ('Create translations of whole menus from existing translations of '
+            'menu items.')
+
+  def Run(self, globopt, args):
+    self.SetOptions(globopt)
+    assert len(args) == 2, "Need exactly two arguments, the XTB file and the output file"
+
+    xtb_file = args[0]
+    output_file = args[1]
+
+    grd = grd_reader.Parse(self.o.input, debug=self.o.extra_verbose)
+    grd.OnlyTheseTranslations([])  # don't load translations
+    grd.RunGatherers()
+
+    xtb = {}
+    def Callback(msg_id, parts):
+      msg = []
+      for part in parts:
+        if part[0]:
+          msg = []
+          break  # it had a placeholder so ignore it
+        else:
+          msg.append(part[1])
+      if len(msg):
+        xtb[msg_id] = ''.join(msg)
+    with open(xtb_file, 'rb') as f:
+      xtb_reader.Parse(f, Callback)
+
+    translations = []  # list of translations as per transl2tc.WriteTranslations
+    for node in grd:
+      if node.name == 'structure' and node.attrs['type'] == 'menu':
+        assert len(node.GetCliques()) == 1
+        message = node.GetCliques()[0].GetMessage()
+        translation = []
+
+        contents = message.GetContent()
+        for part in contents:
+          if isinstance(part, six.string_types):
+            id = grit.extern.tclib.GenerateMessageId(part)
+            if id not in xtb:
+              print("WARNING didn't find all translations for menu %s" %
+                    (node.attrs['name'],))
+              translation = []
+              break
+            translation.append(xtb[id])
+          else:
+            translation.append(part.GetPresentation())
+
+        if len(translation):
+          translations.append([message.GetId(), ''.join(translation)])
+
+    with util.WrapOutputStream(open(output_file, 'wb')) as f:
+      transl2tc.TranslationToTc.WriteTranslations(f, translations)
diff --git a/tools/grit/grit/tool/newgrd.py b/tools/grit/grit/tool/newgrd.py
new file mode 100644
index 0000000000..66a18e9c04
--- /dev/null
+++ b/tools/grit/grit/tool/newgrd.py
@@ -0,0 +1,85 @@
+# Copyright (c) 2012 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.
+
+'''Tool to create a new, empty .grd file with all the basic sections.
+'''
+
+from __future__ import print_function
+
+import getopt
+import sys
+
+from grit.tool import interface
+from grit import constants
+from grit import util
+
+# The contents of the new .grd file
+_FILE_CONTENTS = '''\
+<?xml version="1.0" encoding="UTF-8"?>
+<grit base_dir="." latest_public_release="0" current_release="1"
+      source_lang_id="en" enc_check="%s">
+  <outputs>
+    <!-- TODO add each of your output files.  Modify the three below, and add
+    your own for your various languages.  See the user's guide for more
+    details.
+    Note that all output references are relative to the output directory
+    which is specified at build time. -->
+    <output filename="resource.h" type="rc_header" />
+    <output filename="en_resource.rc" type="rc_all" />
+    <output filename="fr_resource.rc" type="rc_all" />
+  </outputs>
+  <translations>
+    <!-- TODO add references to each of the XTB files (from the Translation
+    Console) that contain translations of messages in your project.  Each
+    takes a form like <file path="english.xtb" />.  Remember that all file
+    references are relative to this .grd file. -->
+  </translations>
+  <release seq="1">
+    <includes>
+      <!-- TODO add a list of your included resources here, e.g. BMP and GIF
+      resources. -->
+    </includes>
+    <structures>
+      <!-- TODO add a list of all your structured resources here, e.g. HTML
+      templates, menus, dialogs etc.  Note that for menus, dialogs and version
+      information resources you reference an .rc file containing them.-->
+    </structures>
+    <messages>
+      <!-- TODO add all of your "string table" messages here.  Remember to
+      change nontranslateable parts of the messages into placeholders (using the
+      <ph> element).  You can also use the 'grit add' tool to help you identify
+      nontranslateable parts and create placeholders for them. -->
+    </messages>
+  </release>
+</grit>''' % constants.ENCODING_CHECK
+
+
+class NewGrd(interface.Tool):
+  '''Usage: grit newgrd OUTPUT_FILE
+
+Creates a new, empty .grd file OUTPUT_FILE with comments about what to put
+where in the file.'''
+
+  def ShortDescription(self):
+    return 'Create a new empty .grd file.'
+
+  def ParseOptions(self, args):
+    """Set this objects and return all non-option arguments."""
+    own_opts, args = getopt.getopt(args, '', ('help',))
+    for key, val in own_opts:
+      if key == '--help':
+        self.ShowUsage()
+        sys.exit(0)
+    return args
+
+  def Run(self, opts, args):
+    args = self.ParseOptions(args)
+    if len(args) != 1:
+      print('This tool requires exactly one argument, the name of the output '
+            'file.')
+      return 2
+    filename = args[0]
+    with util.WrapOutputStream(open(filename, 'wb'), 'utf-8') as out:
+      out.write(_FILE_CONTENTS)
+    print("Wrote file %s" % filename)
diff --git a/tools/grit/grit/tool/newgrd_unittest.py b/tools/grit/grit/tool/newgrd_unittest.py
new file mode 100644
index 0000000000..f7c8831df5
--- /dev/null
+++ b/tools/grit/grit/tool/newgrd_unittest.py
@@ -0,0 +1,51 @@
+#!/usr/bin/env python
+# Copyright 2020 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.
+
+'''Unit tests for the 'grit newgrd' tool.'''
+
+from __future__ import print_function
+
+import os
+import sys
+if __name__ == '__main__':
+  sys.path.append(os.path.join(os.path.dirname(__file__), '../..'))
+
+import unittest
+
+from grit import util
+from grit.tool import newgrd
+
+
+class DummyOpts(object):
+  """Options needed by NewGrd."""
+
+
+class NewgrdUnittest(unittest.TestCase):
+
+  def testNewFile(self):
+    """Create a new file."""
+    tool = newgrd.NewGrd()
+    with util.TempDir({}) as output_dir:
+      output_file = os.path.join(output_dir.GetPath(), 'new.grd')
+      self.assertIsNone(tool.Run(DummyOpts(), [output_file]))
+      self.assertTrue(os.path.exists(output_file))
+
+  def testMissingFile(self):
+    """Verify failure w/out file output."""
+    tool = newgrd.NewGrd()
+    ret = tool.Run(DummyOpts(), [])
+    self.assertIsNotNone(ret)
+    self.assertGreater(ret, 0)
+
+  def testTooManyArgs(self):
+    """Verify failure w/too many outputs."""
+    tool = newgrd.NewGrd()
+    ret = tool.Run(DummyOpts(), ['a', 'b'])
+    self.assertIsNotNone(ret)
+    self.assertGreater(ret, 0)
+
+
+if __name__ == '__main__':
+  unittest.main()
diff --git a/tools/grit/grit/tool/postprocess_interface.py b/tools/grit/grit/tool/postprocess_interface.py
new file mode 100644
index 0000000000..4bb8c5871f
--- /dev/null
+++ b/tools/grit/grit/tool/postprocess_interface.py
@@ -0,0 +1,29 @@
+# Copyright (c) 2012 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.
+
+''' Base class for postprocessing of RC files.
+'''
+
+from __future__ import print_function
+
+class PostProcessor(object):
+  ''' Base class for postprocessing of the RC file data before being
+  output through the RC2GRD tool. You should implement this class if
+  you want GRIT to do specific things to the RC files after it has
+  converted the data into GRD format, i.e. change the content of the
+  RC file, and put it into a P4 changelist, etc.'''
+
+
+  def Process(self, rctext, rcpath, grdnode):
+    ''' Processes the data in rctext and grdnode.
+    Args:
+      rctext: string containing the contents of the RC file being processed.
+      rcpath: the path used to access the file.
+      grdtext: the root node of the grd xml data generated by
+      the rc2grd tool.
+
+    Return:
+      The root node of the processed GRD tree.
+    '''
+    raise NotImplementedError()
diff --git a/tools/grit/grit/tool/postprocess_unittest.py b/tools/grit/grit/tool/postprocess_unittest.py
new file mode 100644
index 0000000000..77fe228bbe
--- /dev/null
+++ b/tools/grit/grit/tool/postprocess_unittest.py
@@ -0,0 +1,64 @@
+#!/usr/bin/env python
+# Copyright (c) 2012 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.
+
+'''Unit test that checks postprocessing of files.
+   Tests postprocessing by having the postprocessor
+   modify the grd data tree, changing the message name attributes.
+'''
+
+from __future__ import print_function
+
+import os
+import re
+import sys
+if __name__ == '__main__':
+  sys.path.append(os.path.join(os.path.dirname(__file__), '../..'))
+
+import unittest
+
+import grit.tool.postprocess_interface
+from grit.tool import rc2grd
+
+
+class PostProcessingUnittest(unittest.TestCase):
+
+  def testPostProcessing(self):
+    rctext = '''STRINGTABLE
+BEGIN
+  DUMMY_STRING_1         "String 1"
+  // Some random description
+  DUMMY_STRING_2        "This text was added during preprocessing"
+END
+    '''
+    tool = rc2grd.Rc2Grd()
+    class DummyOpts(object):
+      verbose = False
+      extra_verbose = False
+    tool.o = DummyOpts()
+    tool.post_process = 'grit.tool.postprocess_unittest.DummyPostProcessor'
+    result = tool.Process(rctext, '.\resource.rc')
+
+    self.failUnless(
+      result.children[2].children[2].children[0].attrs['name'] == 'SMART_STRING_1')
+    self.failUnless(
+      result.children[2].children[2].children[1].attrs['name'] == 'SMART_STRING_2')
+
+class DummyPostProcessor(grit.tool.postprocess_interface.PostProcessor):
+  '''
+  Post processing replaces all message name attributes containing "DUMMY" to
+  "SMART".
+  '''
+  def Process(self, rctext, rcpath, grdnode):
+    smarter = re.compile(r'(DUMMY)(.*)')
+    messages = grdnode.children[2].children[2]
+    for node in messages.children:
+      name_attr = node.attrs['name']
+      m = smarter.search(name_attr)
+      if m:
+         node.attrs['name'] = 'SMART' + m.group(2)
+    return grdnode
+
+if __name__ == '__main__':
+  unittest.main()
diff --git a/tools/grit/grit/tool/preprocess_interface.py b/tools/grit/grit/tool/preprocess_interface.py
new file mode 100644
index 0000000000..67974e704e
--- /dev/null
+++ b/tools/grit/grit/tool/preprocess_interface.py
@@ -0,0 +1,25 @@
+# Copyright (c) 2012 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.
+
+''' Base class for preprocessing of RC files.
+'''
+
+from __future__ import print_function
+
+class PreProcessor(object):
+  ''' Base class for preprocessing of the RC file data before being
+  output through the RC2GRD tool. You should implement this class if
+  you have specific constructs in your RC files that GRIT cannot handle.'''
+
+
+  def Process(self, rctext, rcpath):
+    ''' Processes the data in rctext.
+    Args:
+      rctext: string containing the contents of the RC file being processed
+      rcpath: the path used to access the file.
+
+    Return:
+      The processed text.
+    '''
+    raise NotImplementedError()
diff --git a/tools/grit/grit/tool/preprocess_unittest.py b/tools/grit/grit/tool/preprocess_unittest.py
new file mode 100644
index 0000000000..40b95cd6f8
--- /dev/null
+++ b/tools/grit/grit/tool/preprocess_unittest.py
@@ -0,0 +1,50 @@
+#!/usr/bin/env python
+# Copyright (c) 2012 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.
+
+'''Unit test that checks preprocessing of files.
+   Tests preprocessing by adding having the preprocessor
+   provide the actual rctext data.
+'''
+
+from __future__ import print_function
+
+import os
+import sys
+if __name__ == '__main__':
+  sys.path.append(os.path.join(os.path.dirname(__file__), '../..'))
+
+import unittest
+
+import grit.tool.preprocess_interface
+from grit.tool import rc2grd
+
+
+class PreProcessingUnittest(unittest.TestCase):
+
+  def testPreProcessing(self):
+    tool = rc2grd.Rc2Grd()
+    class DummyOpts(object):
+      verbose = False
+      extra_verbose = False
+    tool.o = DummyOpts()
+    tool.pre_process = 'grit.tool.preprocess_unittest.DummyPreProcessor'
+    result = tool.Process('', '.\resource.rc')
+
+    self.failUnless(
+      result.children[2].children[2].children[0].attrs['name'] == 'DUMMY_STRING_1')
+
+class DummyPreProcessor(grit.tool.preprocess_interface.PreProcessor):
+  def Process(self, rctext, rcpath):
+    rctext = '''STRINGTABLE
+BEGIN
+  DUMMY_STRING_1         "String 1"
+  // Some random description
+  DUMMY_STRING_2        "This text was added during preprocessing"
+END
+    '''
+    return rctext
+
+if __name__ == '__main__':
+  unittest.main()
diff --git a/tools/grit/grit/tool/rc2grd.py b/tools/grit/grit/tool/rc2grd.py
new file mode 100644
index 0000000000..3195b39000
--- /dev/null
+++ b/tools/grit/grit/tool/rc2grd.py
@@ -0,0 +1,418 @@
+# Copyright (c) 2012 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.
+
+'''The 'grit rc2grd' tool.'''
+
+from __future__ import print_function
+
+import os.path
+import getopt
+import re
+import sys
+
+import six
+from six import StringIO
+
+import grit.node.empty
+from grit.node import include
+from grit.node import structure
+from grit.node import message
+
+from grit.gather import rc
+from grit.gather import tr_html
+
+from grit.tool import interface
+from grit.tool import postprocess_interface
+from grit.tool import preprocess_interface
+
+from grit import grd_reader
+from grit import lazy_re
+from grit import tclib
+from grit import util
+
+
+# Matches files referenced from an .rc file
+_FILE_REF = lazy_re.compile(r'''
+  ^(?P<id>[A-Z_0-9.]+)[ \t]+
+  (?P<type>[A-Z_0-9]+)[ \t]+
+  "(?P<file>.*?([^"]|""))"[ \t]*$''', re.VERBOSE | re.MULTILINE)
+
+
+# Matches a dialog section
+_DIALOG = lazy_re.compile(
+    r'^(?P<id>[A-Z0-9_]+)\s+DIALOG(EX)?\s.+?^BEGIN\s*$.+?^END\s*$',
+    re.MULTILINE | re.DOTALL)
+
+
+# Matches a menu section
+_MENU = lazy_re.compile(r'^(?P<id>[A-Z0-9_]+)\s+MENU.+?^BEGIN\s*$.+?^END\s*$',
+                        re.MULTILINE | re.DOTALL)
+
+
+# Matches a versioninfo section
+_VERSIONINFO = lazy_re.compile(
+    r'^(?P<id>[A-Z0-9_]+)\s+VERSIONINFO\s.+?^BEGIN\s*$.+?^END\s*$',
+    re.MULTILINE | re.DOTALL)
+
+
+# Matches a stringtable
+_STRING_TABLE = lazy_re.compile(
+    (r'^STRINGTABLE(\s+(PRELOAD|DISCARDABLE|CHARACTERISTICS.+|LANGUAGE.+|'
+     r'VERSION.+))*\s*\nBEGIN\s*$(?P<body>.+?)^END\s*$'),
+    re.MULTILINE | re.DOTALL)
+
+
+# Matches each message inside a stringtable, breaking it up into comments,
+# the ID of the message, and the (RC-escaped) message text.
+_MESSAGE = lazy_re.compile(r'''
+  (?P<comment>(^\s+//.+?)*)  # 0 or more lines of comments preceding the message
+  ^\s*
+  (?P<id>[A-Za-z0-9_]+)  # id
+  \s+
+  "(?P<text>.*?([^"]|""))"([^"]|$)  # The message itself
+  ''', re.MULTILINE | re.DOTALL | re.VERBOSE)
+
+
+# Matches each line of comment text in a multi-line comment.
+_COMMENT_TEXT = lazy_re.compile(r'^\s*//\s*(?P<text>.+?)$', re.MULTILINE)
+
+
+# Matches a string that is empty or all whitespace
+_WHITESPACE_ONLY = lazy_re.compile(r'\A\s*\Z', re.MULTILINE)
+
+
+# Finds printf and FormatMessage style format specifiers
+# Uses non-capturing groups except for the outermost group, so the output of
+# re.split() should include both the normal text and what we intend to
+# replace with placeholders.
+# TODO(joi) Check documentation for printf (and Windows variants) and FormatMessage
+_FORMAT_SPECIFIER = lazy_re.compile(
+  r'(%[-# +]?(?:[0-9]*|\*)(?:\.(?:[0-9]+|\*))?(?:h|l|L)?' # printf up to last char
+  r'(?:d|i|o|u|x|X|e|E|f|F|g|G|c|r|s|ls|ws)'              # printf last char
+  r'|\$[1-9][0-9]*)')                                     # FormatMessage
+
+
+class Rc2Grd(interface.Tool):
+  '''A tool for converting .rc files to .grd files.  This tool is only for
+converting the source (nontranslated) .rc file to a .grd file.  For importing
+existing translations, use the rc2xtb tool.
+
+Usage:  grit [global options] rc2grd [OPTIONS] RCFILE
+
+The tool takes a single argument, which is the path to the .rc file to convert.
+It outputs a .grd file with the same name in the same directory as the .rc file.
+The .grd file may have one or more TODO comments for things that have to be
+cleaned up manually.
+
+OPTIONS may be any of the following:
+
+  -e ENCODING    Specify the ENCODING of the .rc file. Default is 'cp1252'.
+
+  -h TYPE        Specify the TYPE attribute for HTML structures.
+                 Default is 'tr_html'.
+
+  -u ENCODING    Specify the ENCODING of HTML files. Default is 'utf-8'.
+
+  -n MATCH       Specify the regular expression to match in comments that will
+                 indicate that the resource the comment belongs to is not
+                 translateable. Default is 'Not locali(s|z)able'.
+
+  -r GRDFILE     Specify that GRDFILE should be used as a "role model" for
+                 any placeholders that otherwise would have had TODO names.
+                 This attempts to find an identical message in the GRDFILE
+                 and uses that instead of the automatically placeholderized
+                 message.
+
+  --pre CLASS    Specify an optional, fully qualified classname, which
+                 has to be a subclass of grit.tool.PreProcessor, to
+                 run on the text of the RC file before conversion occurs.
+                 This can be used to support constructs in the RC files
+                 that GRIT cannot handle on its own.
+
+  --post CLASS   Specify an optional, fully qualified classname, which
+                 has to be a subclass of grit.tool.PostProcessor, to
+                 run on the text of the converted RC file.
+                 This can be used to alter the content of the RC file
+                 based on the conversion that occured.
+
+For menus, dialogs and version info, the .grd file will refer to the original
+.rc file.  Once conversion is complete, you can strip the original .rc file
+of its string table and all comments as these will be available in the .grd
+file.
+
+Note that this tool WILL NOT obey C preprocessor rules, so even if something
+is #if 0-ed out it will still be included in the output of this tool
+Therefore, if your .rc file contains sections like this, you should run the
+C preprocessor on the .rc file or manually edit it before using this tool.
+'''
+
+  def ShortDescription(self):
+    return 'A tool for converting .rc source files to .grd files.'
+
+  def __init__(self):
+    self.input_encoding = 'cp1252'
+    self.html_type = 'tr_html'
+    self.html_encoding = 'utf-8'
+    self.not_localizable_re = re.compile('Not locali(s|z)able')
+    self.role_model = None
+    self.pre_process = None
+    self.post_process = None
+
+  def ParseOptions(self, args, help_func=None):
+    '''Given a list of arguments, set this object's options and return
+    all non-option arguments.
+    '''
+    (own_opts, args) = getopt.getopt(args, 'e:h:u:n:r',
+                                     ('help', 'pre=', 'post='))
+    for (key, val) in own_opts:
+      if key == '-e':
+        self.input_encoding = val
+      elif key == '-h':
+        self.html_type = val
+      elif key == '-u':
+        self.html_encoding = val
+      elif key == '-n':
+        self.not_localizable_re = re.compile(val)
+      elif key == '-r':
+        self.role_model = grd_reader.Parse(val)
+      elif key == '--pre':
+        self.pre_process = val
+      elif key == '--post':
+        self.post_process = val
+      elif key == '--help':
+        if help_func is None:
+          self.ShowUsage()
+        else:
+          help_func()
+        sys.exit(0)
+    return args
+
+  def Run(self, opts, args):
+    args = self.ParseOptions(args)
+    if len(args) != 1:
+      print('This tool takes a single tool-specific argument, the path to the\n'
+            '.rc file to process.')
+      return 2
+    self.SetOptions(opts)
+
+    path = args[0]
+    out_path = os.path.join(util.dirname(path),
+                os.path.splitext(os.path.basename(path))[0] + '.grd')
+
+    rctext = util.ReadFile(path, self.input_encoding)
+    grd_text = six.text_type(self.Process(rctext, path))
+    with util.WrapOutputStream(open(out_path, 'wb'), 'utf-8') as outfile:
+      outfile.write(grd_text)
+
+    print('Wrote output file %s.\nPlease check for TODO items in the file.' %
+          (out_path,))
+
+
+  def Process(self, rctext, rc_path):
+    '''Processes 'rctext' and returns a resource tree corresponding to it.
+
+    Args:
+      rctext: complete text of the rc file
+      rc_path: 'resource\resource.rc'
+
+    Return:
+      grit.node.base.Node subclass
+    '''
+
+    if self.pre_process:
+      preprocess_class = util.NewClassInstance(self.pre_process,
+                                               preprocess_interface.PreProcessor)
+      if preprocess_class:
+        rctext = preprocess_class.Process(rctext, rc_path)
+      else:
+        self.Out(
+          'PreProcessing class could not be found. Skipping preprocessing.\n')
+
+    # Start with a basic skeleton for the .grd file
+    root = grd_reader.Parse(StringIO(
+      '''<?xml version="1.0" encoding="UTF-8"?>
+      <grit base_dir="." latest_public_release="0"
+          current_release="1" source_lang_id="en">
+        <outputs />
+        <translations />
+        <release seq="1">
+          <includes />
+          <structures />
+          <messages />
+        </release>
+      </grit>'''), util.dirname(rc_path))
+    includes = root.children[2].children[0]
+    structures = root.children[2].children[1]
+    messages = root.children[2].children[2]
+    assert (isinstance(includes, grit.node.empty.IncludesNode) and
+            isinstance(structures, grit.node.empty.StructuresNode) and
+            isinstance(messages, grit.node.empty.MessagesNode))
+
+    self.AddIncludes(rctext, includes)
+    self.AddStructures(rctext, structures, os.path.basename(rc_path))
+    self.AddMessages(rctext, messages)
+
+    self.VerboseOut('Validating that all IDs are unique...\n')
+    root.ValidateUniqueIds()
+    self.ExtraVerboseOut('Done validating that all IDs are unique.\n')
+
+    if self.post_process:
+      postprocess_class = util.NewClassInstance(self.post_process,
+                                                postprocess_interface.PostProcessor)
+      if postprocess_class:
+        root = postprocess_class.Process(rctext, rc_path, root)
+      else:
+        self.Out(
+          'PostProcessing class could not be found. Skipping postprocessing.\n')
+
+    return root
+
+
+  def IsHtml(self, res_type, fname):
+    '''Check whether both the type and file extension indicate HTML'''
+    fext = fname.split('.')[-1].lower()
+    return res_type == 'HTML' and fext in ('htm', 'html')
+
+
+  def AddIncludes(self, rctext, node):
+    '''Scans 'rctext' for included resources (e.g. BITMAP, ICON) and
+    adds each included resource as an <include> child node of 'node'.'''
+    for m in _FILE_REF.finditer(rctext):
+      id = m.group('id')
+      res_type = m.group('type').upper()
+      fname = rc.Section.UnEscape(m.group('file'))
+      assert fname.find('\n') == -1
+      if not self.IsHtml(res_type, fname):
+        self.VerboseOut('Processing %s with ID %s (filename: %s)\n' %
+                        (res_type, id, fname))
+        node.AddChild(include.IncludeNode.Construct(node, id, res_type, fname))
+
+
+  def AddStructures(self, rctext, node, rc_filename):
+    '''Scans 'rctext' for structured resources (e.g. menus, dialogs, version
+    information resources and HTML templates) and adds each as a <structure>
+    child of 'node'.'''
+    # First add HTML includes
+    for m in _FILE_REF.finditer(rctext):
+      id = m.group('id')
+      res_type = m.group('type').upper()
+      fname = rc.Section.UnEscape(m.group('file'))
+      if self.IsHtml(type, fname):
+        node.AddChild(structure.StructureNode.Construct(
+          node, id, self.html_type, fname, self.html_encoding))
+
+    # Then add all RC includes
+    def AddStructure(res_type, id):
+      self.VerboseOut('Processing %s with ID %s\n' % (res_type, id))
+      node.AddChild(structure.StructureNode.Construct(node, id, res_type,
+                                                      rc_filename,
+                                                      encoding=self.input_encoding))
+    for m in _MENU.finditer(rctext):
+      AddStructure('menu', m.group('id'))
+    for m in _DIALOG.finditer(rctext):
+      AddStructure('dialog', m.group('id'))
+    for m in _VERSIONINFO.finditer(rctext):
+      AddStructure('version', m.group('id'))
+
+
+  def AddMessages(self, rctext, node):
+    '''Scans 'rctext' for all messages in string tables, preprocesses them as
+    much as possible for placeholders (e.g. messages containing $1, $2 or %s, %d
+    type format specifiers get those specifiers replaced with placeholders, and
+    HTML-formatted messages get run through the HTML-placeholderizer).  Adds
+    each message as a <message> node child of 'node'.'''
+    for tm in _STRING_TABLE.finditer(rctext):
+      table = tm.group('body')
+      for mm in _MESSAGE.finditer(table):
+        comment_block = mm.group('comment')
+        comment_text = []
+        for cm in _COMMENT_TEXT.finditer(comment_block):
+          comment_text.append(cm.group('text'))
+        comment_text = ' '.join(comment_text)
+
+        id = mm.group('id')
+        text = rc.Section.UnEscape(mm.group('text'))
+
+        self.VerboseOut('Processing message %s (text: "%s")\n' % (id, text))
+
+        msg_obj = self.Placeholderize(text)
+
+        # Messages that contain only placeholders do not need translation.
+        is_translateable = False
+        for item in msg_obj.GetContent():
+          if isinstance(item, six.string_types):
+            if not _WHITESPACE_ONLY.match(item):
+              is_translateable = True
+
+        if self.not_localizable_re.search(comment_text):
+          is_translateable = False
+
+        message_meaning = ''
+        internal_comment = ''
+
+        # If we have a "role model" (existing GRD file) and this node exists
+        # in the role model, use the description, meaning and translateable
+        # attributes from the role model.
+        if self.role_model:
+          role_node = self.role_model.GetNodeById(id)
+          if role_node:
+            is_translateable = role_node.IsTranslateable()
+            message_meaning = role_node.attrs['meaning']
+            comment_text = role_node.attrs['desc']
+            internal_comment = role_node.attrs['internal_comment']
+
+        # For nontranslateable messages, we don't want the complexity of
+        # placeholderizing everything.
+        if not is_translateable:
+          msg_obj = tclib.Message(text=text)
+
+        msg_node = message.MessageNode.Construct(node, msg_obj, id,
+                                                 desc=comment_text,
+                                                 translateable=is_translateable,
+                                                 meaning=message_meaning)
+        msg_node.attrs['internal_comment'] = internal_comment
+
+        node.AddChild(msg_node)
+        self.ExtraVerboseOut('Done processing message %s\n' % id)
+
+
+  def Placeholderize(self, text):
+    '''Creates a tclib.Message object from 'text', attempting to recognize
+    a few different formats of text that can be automatically placeholderized
+    (HTML code, printf-style format strings, and FormatMessage-style format
+    strings).
+    '''
+
+    try:
+      # First try HTML placeholderizing.
+      # TODO(joi) Allow use of non-TotalRecall flavors of HTML placeholderizing
+      msg = tr_html.HtmlToMessage(text, True)
+      for item in msg.GetContent():
+        if not isinstance(item, six.string_types):
+          return msg  # Contained at least one placeholder, so we're done
+
+      # HTML placeholderization didn't do anything, so try to find printf or
+      # FormatMessage format specifiers and change them into placeholders.
+      msg = tclib.Message()
+      parts = _FORMAT_SPECIFIER.split(text)
+      todo_counter = 1  # We make placeholder IDs 'TODO_0001' etc.
+      for part in parts:
+        if _FORMAT_SPECIFIER.match(part):
+          msg.AppendPlaceholder(tclib.Placeholder(
+            'TODO_%04d' % todo_counter, part, 'TODO'))
+          todo_counter += 1
+        elif part != '':
+          msg.AppendText(part)
+
+      if self.role_model and len(parts) > 1:  # there are TODO placeholders
+        role_model_msg = self.role_model.UberClique().BestCliqueByOriginalText(
+          msg.GetRealContent(), '')
+        if role_model_msg:
+          # replace wholesale to get placeholder names and examples
+          msg = role_model_msg
+
+      return msg
+    except:
+      print('Exception processing message with text "%s"' % text)
+      raise
diff --git a/tools/grit/grit/tool/rc2grd_unittest.py b/tools/grit/grit/tool/rc2grd_unittest.py
new file mode 100644
index 0000000000..6d53794c27
--- /dev/null
+++ b/tools/grit/grit/tool/rc2grd_unittest.py
@@ -0,0 +1,163 @@
+#!/usr/bin/env python
+# Copyright (c) 2012 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.
+
+'''Unit tests for grit.tool.rc2grd'''
+
+from __future__ import print_function
+
+import os
+import sys
+if __name__ == '__main__':
+  sys.path.append(os.path.join(os.path.dirname(__file__), '../..'))
+
+import re
+import unittest
+
+from six import StringIO
+
+from grit import grd_reader
+from grit import util
+from grit.node import base
+from grit.tool import rc2grd
+
+
+class Rc2GrdUnittest(unittest.TestCase):
+  def testPlaceholderize(self):
+    tool = rc2grd.Rc2Grd()
+    original = "Hello %s, how are you? I'm $1 years old!"
+    msg = tool.Placeholderize(original)
+    self.failUnless(msg.GetPresentableContent() == "Hello TODO_0001, how are you? I'm TODO_0002 years old!")
+    self.failUnless(msg.GetRealContent() == original)
+
+  def testHtmlPlaceholderize(self):
+    tool = rc2grd.Rc2Grd()
+    original = "Hello <b>[USERNAME]</b>, how are you? I'm [AGE] years old!"
+    msg = tool.Placeholderize(original)
+    self.failUnless(msg.GetPresentableContent() ==
+                    "Hello BEGIN_BOLDX_USERNAME_XEND_BOLD, how are you? I'm X_AGE_X years old!")
+    self.failUnless(msg.GetRealContent() == original)
+
+  def testMenuWithoutWhitespaceRegression(self):
+    # There was a problem in the original regular expression for parsing out
+    # menu sections, that would parse the following block of text as a single
+    # menu instead of two.
+    two_menus = '''
+// Hyper context menus
+IDR_HYPERMENU_FOLDER MENU
+BEGIN
+    POPUP "HyperFolder"
+    BEGIN
+        MENUITEM "Open Containing Folder",      IDM_OPENFOLDER
+    END
+END
+
+IDR_HYPERMENU_FILE MENU
+BEGIN
+    POPUP "HyperFile"
+    BEGIN
+        MENUITEM "Open Folder",                 IDM_OPENFOLDER
+    END
+END
+
+'''
+    self.failUnless(len(rc2grd._MENU.findall(two_menus)) == 2)
+
+  def testRegressionScriptWithTranslateable(self):
+    tool = rc2grd.Rc2Grd()
+
+    # test rig
+    class DummyNode(base.Node):
+      def AddChild(self, item):
+        self.node = item
+      verbose = False
+      extra_verbose = False
+    tool.not_localizable_re = re.compile('')
+    tool.o = DummyNode()
+
+    rc_text = '''STRINGTABLE\nBEGIN\nID_BINGO "<SPAN id=hp style='BEHAVIOR: url(#default#homepage)'></SPAN><script>if (!hp.isHomePage('[$~HOMEPAGE~$]')) {document.write(""<a href=\\""[$~SETHOMEPAGEURL~$]\\"" >Set As Homepage</a> - "");}</script>"\nEND\n'''
+    tool.AddMessages(rc_text, tool.o)
+    self.failUnless(tool.o.node.GetCdata().find('Set As Homepage') != -1)
+
+    # TODO(joi) Improve the HTML parser to support translateables inside
+    # <script> blocks?
+    self.failUnless(tool.o.node.attrs['translateable'] == 'false')
+
+  def testRoleModel(self):
+    rc_text = ('STRINGTABLE\n'
+               'BEGIN\n'
+               '  // This should not show up\n'
+               '  IDS_BINGO "Hello %s, how are you?"\n'
+               '  // The first description\n'
+               '  IDS_BONGO "Hello %s, my name is %s, and yours?"\n'
+               '  IDS_PROGRAMS_SHUTDOWN_TEXT      "Google Desktop Search needs to close the following programs:\\n\\n$1\\nThe installation will not proceed if you choose to cancel."\n'
+               'END\n')
+    tool = rc2grd.Rc2Grd()
+    tool.role_model = grd_reader.Parse(StringIO(
+      '''<?xml version="1.0" encoding="UTF-8"?>
+      <grit latest_public_release="2" source_lang_id="en-US" current_release="3" base_dir=".">
+        <release seq="3">
+          <messages>
+            <message name="IDS_BINGO">
+              Hello <ph name="USERNAME">%s<ex>Joi</ex></ph>, how are you?
+            </message>
+            <message name="IDS_BONGO" desc="The other description">
+              Hello <ph name="USERNAME">%s<ex>Jakob</ex></ph>, my name is <ph name="ADMINNAME">%s<ex>Joi</ex></ph>, and yours?
+            </message>
+            <message name="IDS_PROGRAMS_SHUTDOWN_TEXT" desc="LIST_OF_PROGRAMS is replaced by a bulleted list of program names.">
+              Google Desktop Search needs to close the following programs:
+
+<ph name="LIST_OF_PROGRAMS">$1<ex>Program 1, Program 2</ex></ph>
+The installation will not proceed if you choose to cancel.
+            </message>
+          </messages>
+        </release>
+      </grit>'''), dir='.')
+
+    # test rig
+    class DummyOpts(object):
+      verbose = False
+      extra_verbose = False
+    tool.o = DummyOpts()
+    result = tool.Process(rc_text, '.\resource.rc')
+    self.failUnless(
+      result.children[2].children[2].children[0].attrs['desc'] == '')
+    self.failUnless(
+      result.children[2].children[2].children[0].children[0].attrs['name'] == 'USERNAME')
+    self.failUnless(
+      result.children[2].children[2].children[1].attrs['desc'] == 'The other description')
+    self.failUnless(
+      result.children[2].children[2].children[1].attrs['meaning'] == '')
+    self.failUnless(
+      result.children[2].children[2].children[1].children[0].attrs['name'] == 'USERNAME')
+    self.failUnless(
+      result.children[2].children[2].children[1].children[1].attrs['name'] == 'ADMINNAME')
+    self.failUnless(
+      result.children[2].children[2].children[2].children[0].attrs['name'] == 'LIST_OF_PROGRAMS')
+
+  def testRunOutput(self):
+    """Verify basic correct Run behavior."""
+    tool = rc2grd.Rc2Grd()
+    class DummyOpts(object):
+      verbose = False
+      extra_verbose = False
+    with util.TempDir({}) as output_dir:
+      rcfile = os.path.join(output_dir.GetPath(), 'foo.rc')
+      open(rcfile, 'w').close()
+      self.assertIsNone(tool.Run(DummyOpts(), [rcfile]))
+      self.assertTrue(os.path.exists(os.path.join(output_dir.GetPath(), 'foo.grd')))
+
+  def testMissingOutput(self):
+    """Verify failure with no args."""
+    tool = rc2grd.Rc2Grd()
+    class DummyOpts(object):
+      verbose = False
+      extra_verbose = False
+    ret = tool.Run(DummyOpts(), [])
+    self.assertIsNotNone(ret)
+    self.assertGreater(ret, 0)
+
+
+if __name__ == '__main__':
+  unittest.main()
diff --git a/tools/grit/grit/tool/resize.py b/tools/grit/grit/tool/resize.py
new file mode 100644
index 0000000000..6a897c077e
--- /dev/null
+++ b/tools/grit/grit/tool/resize.py
@@ -0,0 +1,295 @@
+# Copyright (c) 2012 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.
+
+'''The 'grit resize' tool.
+'''
+
+from __future__ import print_function
+
+import getopt
+import os
+import sys
+
+from grit import grd_reader
+from grit import pseudo
+from grit import util
+from grit.format import rc
+from grit.format import rc_header
+from grit.node import include
+from grit.tool import interface
+
+
+# Template for the .vcproj file, with a couple of [[REPLACEABLE]] parts.
+PROJECT_TEMPLATE = '''\
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+  ProjectType="Visual C++"
+  Version="7.10"
+  Name="[[DIALOG_NAME]]"
+  ProjectGUID="[[PROJECT_GUID]]"
+  Keyword="Win32Proj">
+  <Platforms>
+    <Platform
+      Name="Win32"/>
+  </Platforms>
+  <Configurations>
+    <Configuration
+      Name="Debug|Win32"
+      OutputDirectory="Debug"
+      IntermediateDirectory="Debug"
+      ConfigurationType="1"
+      CharacterSet="2">
+    </Configuration>
+  </Configurations>
+  <References>
+  </References>
+  <Files>
+    <Filter
+      Name="Resource Files"
+      Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
+      UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
+      <File
+        RelativePath=".\\[[DIALOG_NAME]].rc">
+      </File>
+    </Filter>
+  </Files>
+  <Globals>
+  </Globals>
+</VisualStudioProject>'''
+
+
+# Template for the .rc file with a couple of [[REPLACEABLE]] parts.
+# TODO(joi) Improve this (and the resource.h template) to allow saving and then
+# reopening of the RC file in Visual Studio.  Currently you can only open it
+# once and change it, then after you close it you won't be able to reopen it.
+RC_TEMPLATE = '''\
+// This file is automatically generated by GRIT and intended for editing
+// the layout of the dialogs contained in it.  Do not edit anything but the
+// dialogs.  Any changes made to translateable portions of the dialogs will
+// be ignored by GRIT.
+
+#include "resource.h"
+#include <winresrc.h>
+#ifdef IDC_STATIC
+#undef IDC_STATIC
+#endif
+#define IDC_STATIC (-1)
+
+LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
+
+#pragma code_page([[CODEPAGE_NUM]])
+
+[[INCLUDES]]
+
+[[DIALOGS]]
+'''
+
+
+# Template for the resource.h file with a couple of [[REPLACEABLE]] parts.
+HEADER_TEMPLATE = '''\
+// This file is automatically generated by GRIT.  Do not edit.
+
+#pragma once
+
+// Edit commands
+#define ID_EDIT_CLEAR                   0xE120
+#define ID_EDIT_CLEAR_ALL               0xE121
+#define ID_EDIT_COPY                    0xE122
+#define ID_EDIT_CUT                     0xE123
+#define ID_EDIT_FIND                    0xE124
+#define ID_EDIT_PASTE                   0xE125
+#define ID_EDIT_PASTE_LINK              0xE126
+#define ID_EDIT_PASTE_SPECIAL           0xE127
+#define ID_EDIT_REPEAT                  0xE128
+#define ID_EDIT_REPLACE                 0xE129
+#define ID_EDIT_SELECT_ALL              0xE12A
+#define ID_EDIT_UNDO                    0xE12B
+#define ID_EDIT_REDO                    0xE12C
+
+
+[[DEFINES]]
+'''
+
+
+class ResizeDialog(interface.Tool):
+  '''Generates an RC file, header and Visual Studio project that you can use
+with Visual Studio's GUI resource editor to modify the layout of dialogs for
+the language of your choice.  You then use the RC file, after you resize the
+dialog, for the language or languages of your choice, using the <skeleton> child
+of the <structure> node for the dialog.  The translateable bits of the dialog
+will be ignored when you use the <skeleton> node (GRIT will instead use the
+translateable bits from the original dialog) but the layout changes you make
+will be used.  Note that your layout changes must preserve the order of the
+translateable elements in the RC file.
+
+Usage: grit resize [-f BASEFOLDER] [-l LANG] [-e RCENCODING] DIALOGID*
+
+Arguments:
+  DIALOGID        The 'name' attribute of a dialog to output for resizing.  Zero
+                  or more of these parameters can be used.  If none are
+                  specified, all dialogs from the input .grd file are output.
+
+Options:
+
+  -f BASEFOLDER   The project will be created in a subfolder of BASEFOLDER.
+                  The name of the subfolder will be the first DIALOGID you
+                  specify.  Defaults to '.'
+
+  -l LANG         Specifies that the RC file should contain a dialog translated
+                  into the language LANG.  The default is a cp1252-representable
+                  pseudotranslation, because Visual Studio's GUI RC editor only
+                  supports single-byte encodings.
+
+  -c CODEPAGE     Code page number to indicate to the RC compiler the encoding
+                  of the RC file, default is something reasonable for the
+                  language you selected (but this does not work for every single
+                  language).  See details on codepages below.  NOTE that you do
+                  not need to specify the codepage unless the tool complains
+                  that it's not sure which codepage to use.  See the following
+                  page for codepage numbers supported by Windows:
+                  http://www.microsoft.com/globaldev/reference/wincp.mspx
+
+  -D NAME[=VAL]   Specify a C-preprocessor-like define NAME with optional
+                  value VAL (defaults to 1) which will be used to control
+                  conditional inclusion of resources.
+
+
+IMPORTANT NOTE:  For now, the tool outputs a UTF-8 encoded file for any language
+that can not be represented in cp1252 (i.e. anything other than Western
+European languages).  You will need to open this file in a text editor and
+save it using the codepage indicated in the #pragma code_page(XXXX) command
+near the top of the file, before you open it in Visual Studio.
+
+'''
+
+  # TODO(joi) It would be cool to have this tool note the Perforce revision
+  # of the original RC file somewhere, such that the <skeleton> node could warn
+  # if the original RC file gets updated without the skeleton file being updated.
+
+  # TODO(joi) Would be cool to have option to add the files to Perforce
+
+  def __init__(self):
+    self.lang = pseudo.PSEUDO_LANG
+    self.defines = {}
+    self.base_folder = '.'
+    self.codepage_number = 1252
+    self.codepage_number_specified_explicitly = False
+
+  def SetLanguage(self, lang):
+    '''Sets the language code to output things in.
+    '''
+    self.lang = lang
+    if not self.codepage_number_specified_explicitly:
+      self.codepage_number = util.LanguageToCodepage(lang)
+
+  def GetEncoding(self):
+    if self.codepage_number == 1200:
+      return 'utf_16'
+    if self.codepage_number == 65001:
+      return 'utf_8'
+    return 'cp%d' % self.codepage_number
+
+  def ShortDescription(self):
+    return 'Generate a file where you can resize a given dialog.'
+
+  def Run(self, opts, args):
+    self.SetOptions(opts)
+
+    own_opts, args = getopt.getopt(args, 'l:f:c:D:', ('help',))
+    for key, val in own_opts:
+      if key == '-l':
+        self.SetLanguage(val)
+      if key == '-f':
+        self.base_folder = val
+      if key == '-c':
+        self.codepage_number = int(val)
+        self.codepage_number_specified_explicitly = True
+      if key == '-D':
+        name, val = util.ParseDefine(val)
+        self.defines[name] = val
+      elif key == '--help':
+        self.ShowUsage()
+        sys.exit(0)
+
+    res_tree = grd_reader.Parse(opts.input, debug=opts.extra_verbose)
+    res_tree.OnlyTheseTranslations([self.lang])
+    res_tree.RunGatherers()
+
+    # Dialog IDs are either explicitly listed, or we output all dialogs from the
+    # .grd file
+    dialog_ids = args
+    if not len(dialog_ids):
+      for node in res_tree:
+        if node.name == 'structure' and node.attrs['type'] == 'dialog':
+          dialog_ids.append(node.attrs['name'])
+
+    self.Process(res_tree, dialog_ids)
+
+  def Process(self, grd, dialog_ids):
+    '''Outputs an RC file and header file for the dialog 'dialog_id' stored in
+    resource tree 'grd', to self.base_folder, as discussed in this class's
+    documentation.
+
+    Arguments:
+      grd: grd = grd_reader.Parse(...); grd.RunGatherers()
+      dialog_ids: ['IDD_MYDIALOG', 'IDD_OTHERDIALOG']
+    '''
+    grd.SetOutputLanguage(self.lang)
+    grd.SetDefines(self.defines)
+
+    project_name = dialog_ids[0]
+
+    dir_path = os.path.join(self.base_folder, project_name)
+    if not os.path.isdir(dir_path):
+      os.mkdir(dir_path)
+
+    # If this fails then we're not on Windows (or you don't have the required
+    # win32all Python libraries installed), so what are you doing mucking
+    # about with RC files anyway? :)
+    # pylint: disable=import-error
+    import pythoncom
+
+    # Create the .vcproj file
+    project_text = PROJECT_TEMPLATE.replace(
+      '[[PROJECT_GUID]]', str(pythoncom.CreateGuid())
+      ).replace('[[DIALOG_NAME]]', project_name)
+    fname = os.path.join(dir_path, '%s.vcproj' % project_name)
+    self.WriteFile(fname, project_text)
+    print("Wrote %s" % fname)
+
+    # Create the .rc file
+    # Output all <include> nodes since the dialogs might depend on them (e.g.
+    # for icons and bitmaps).
+    include_items = []
+    for node in grd.ActiveDescendants():
+      if isinstance(node, include.IncludeNode):
+        include_items.append(rc.FormatInclude(node, self.lang, '.'))
+    rc_text = RC_TEMPLATE.replace('[[CODEPAGE_NUM]]',
+                                  str(self.codepage_number))
+    rc_text = rc_text.replace('[[INCLUDES]]', ''.join(include_items))
+
+    # Then output the dialogs we have been asked to output.
+    dialogs = []
+    for dialog_id in dialog_ids:
+      node = grd.GetNodeById(dialog_id)
+      assert node.name == 'structure' and node.attrs['type'] == 'dialog'
+      # TODO(joi) Add exception handling for better error reporting
+      dialogs.append(rc.FormatStructure(node, self.lang, '.'))
+    rc_text = rc_text.replace('[[DIALOGS]]', ''.join(dialogs))
+
+    fname = os.path.join(dir_path, '%s.rc' % project_name)
+    self.WriteFile(fname, rc_text, self.GetEncoding())
+    print("Wrote %s" % fname)
+
+    # Create the resource.h file
+    header_defines = ''.join(rc_header.FormatDefines(grd))
+    header_text = HEADER_TEMPLATE.replace('[[DEFINES]]', header_defines)
+    fname = os.path.join(dir_path, 'resource.h')
+    self.WriteFile(fname, header_text)
+    print("Wrote %s" % fname)
+
+  def WriteFile(self, filename, contents, encoding='cp1252'):
+    with open(filename, 'wb') as f:
+      writer = util.WrapOutputStream(f, encoding)
+      writer.write(contents)
diff --git a/tools/grit/grit/tool/test.py b/tools/grit/grit/tool/test.py
new file mode 100644
index 0000000000..241a976d74
--- /dev/null
+++ b/tools/grit/grit/tool/test.py
@@ -0,0 +1,24 @@
+# Copyright (c) 2012 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.
+
+from __future__ import print_function
+
+from grit.tool import interface
+
+class TestTool(interface.Tool):
+  '''This tool does nothing except print out the global options and
+tool-specific arguments that it receives.  It is intended only for testing,
+hence the name :)
+'''
+
+  def ShortDescription(self):
+    return 'A do-nothing tool for testing command-line parsing.'
+
+  def Run(self, global_options, my_arguments):
+    print('NOTE This tool is only for testing the parsing of global options and')
+    print('tool-specific arguments that it receives.  You may have intended to')
+    print('run "grit unit" which is the unit-test suite for GRIT.')
+    print('Options: %s' % repr(global_options))
+    print('Arguments: %s' % repr(my_arguments))
+    return 0
diff --git a/tools/grit/grit/tool/transl2tc.py b/tools/grit/grit/tool/transl2tc.py
new file mode 100644
index 0000000000..45301bbf58
--- /dev/null
+++ b/tools/grit/grit/tool/transl2tc.py
@@ -0,0 +1,251 @@
+# Copyright (c) 2012 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.
+
+'''The 'grit transl2tc' tool.
+'''
+
+from __future__ import print_function
+
+from grit import grd_reader
+from grit import util
+from grit.tool import interface
+from grit.tool import rc2grd
+
+from grit.extern import tclib
+
+
+class TranslationToTc(interface.Tool):
+  '''A tool for importing existing translations in RC format into the
+Translation Console.
+
+Usage:
+
+grit -i GRD transl2tc [-l LIMITS] [RCOPTS] SOURCE_RC TRANSLATED_RC OUT_FILE
+
+The tool needs a "source" RC file, i.e. in English, and an RC file that is a
+translation of precisely the source RC file (not of an older or newer version).
+
+The tool also requires you to provide a .grd file (input file) e.g. using the
+-i global option or the GRIT_INPUT environment variable.  The tool uses
+information from your .grd file to correct placeholder names in the
+translations and ensure that only translatable items and translations still
+being used are output.
+
+This tool will accept all the same RCOPTS as the 'grit rc2grd' tool.  To get
+a list of these options, run 'grit help rc2grd'.
+
+Additionally, you can use the -l option (which must be the first option to the
+tool) to specify a file containing a list of message IDs to which output should
+be limited.  This is only useful if you are limiting the output to your XMB
+files using the 'grit xmb' tool's -l option.  See 'grit help xmb' for how to
+generate a file containing a list of the message IDs in an XMB file.
+
+The tool will scan through both of the RC files as well as any HTML files they
+refer to, and match together the source messages and translated messages.  It
+will output a file (OUTPUT_FILE) you can import directly into the TC using the
+Bulk Translation Upload tool.
+'''
+
+  def ShortDescription(self):
+    return 'Import existing translations in RC format into the TC'
+
+  def Setup(self, globopt, args):
+    '''Sets the instance up for use.
+    '''
+    self.SetOptions(globopt)
+    self.rc2grd = rc2grd.Rc2Grd()
+    self.rc2grd.SetOptions(globopt)
+    self.limits = None
+    if len(args) and args[0] == '-l':
+      self.limits = util.ReadFile(args[1], 'utf-8').splitlines()
+      args = args[2:]
+    return self.rc2grd.ParseOptions(args, help_func=self.ShowUsage)
+
+  def Run(self, globopt, args):
+    args = self.Setup(globopt, args)
+
+    if len(args) != 3:
+      self.Out('This tool takes exactly three arguments:\n'
+             '  1. The path to the original RC file\n'
+             '  2. The path to the translated RC file\n'
+             '  3. The output file path.\n')
+      return 2
+
+    grd = grd_reader.Parse(self.o.input, debug=self.o.extra_verbose)
+    grd.RunGatherers()
+
+    source_rc = util.ReadFile(args[0], self.rc2grd.input_encoding)
+    transl_rc = util.ReadFile(args[1], self.rc2grd.input_encoding)
+    translations = self.ExtractTranslations(grd,
+                                            source_rc, args[0],
+                                            transl_rc, args[1])
+
+    with util.WrapOutputStream(open(args[2], 'wb')) as output_file:
+      self.WriteTranslations(output_file, translations.items())
+
+    self.Out('Wrote output file %s' % args[2])
+
+  def ExtractTranslations(self, current_grd, source_rc, source_path,
+                                             transl_rc, transl_path):
+    '''Extracts translations from the translated RC file, matching them with
+    translations in the source RC file to calculate their ID, and correcting
+    placeholders, limiting output to translateables, etc. using the supplied
+    .grd file which is the current .grd file for your project.
+
+    If this object's 'limits' attribute is not None but a list, the output of
+    this function will be further limited to include only messages that have
+    message IDs in the 'limits' list.
+
+    Args:
+      current_grd: grit.node.base.Node child, that has had RunGatherers() run
+                   on it
+      source_rc: Complete text of source RC file
+      source_path: Path to the source RC file
+      transl_rc: Complete text of translated RC file
+      transl_path: Path to the translated RC file
+
+    Return:
+      { id1 : text1, '12345678' : 'Hello USERNAME, howzit?' }
+    '''
+    source_grd = self.rc2grd.Process(source_rc, source_path)
+    self.VerboseOut('Read %s into GRIT format, running gatherers.\n' % source_path)
+    source_grd.SetOutputLanguage(current_grd.output_language)
+    source_grd.SetDefines(current_grd.defines)
+    source_grd.RunGatherers(debug=self.o.extra_verbose)
+    transl_grd = self.rc2grd.Process(transl_rc, transl_path)
+    transl_grd.SetOutputLanguage(current_grd.output_language)
+    transl_grd.SetDefines(current_grd.defines)
+    self.VerboseOut('Read %s into GRIT format, running gatherers.\n' % transl_path)
+    transl_grd.RunGatherers(debug=self.o.extra_verbose)
+    self.VerboseOut('Done running gatherers for %s.\n' % transl_path)
+
+    # Proceed to create a map from ID to translation, getting the ID from the
+    # source GRD and the translation from the translated GRD.
+    id2transl = {}
+    for source_node in source_grd:
+      source_cliques = source_node.GetCliques()
+      if not len(source_cliques):
+        continue
+
+      assert 'name' in source_node.attrs, 'All nodes with cliques should have an ID'
+      node_id = source_node.attrs['name']
+      self.ExtraVerboseOut('Processing node %s\n' % node_id)
+      transl_node = transl_grd.GetNodeById(node_id)
+
+      if transl_node:
+        transl_cliques = transl_node.GetCliques()
+        if not len(transl_cliques) == len(source_cliques):
+          self.Out(
+            'Warning: Translation for %s has wrong # of cliques, skipping.\n' %
+            node_id)
+          continue
+      else:
+        self.Out('Warning: No translation for %s, skipping.\n' % node_id)
+        continue
+
+      if source_node.name == 'message':
+        # Fixup placeholders as well as possible based on information from
+        # the current .grd file if they are 'TODO_XXXX' placeholders.  We need
+        # to fixup placeholders in the translated message so that it looks right
+        # and we also need to fixup placeholders in the source message so that
+        # its calculated ID will match the current message.
+        current_node = current_grd.GetNodeById(node_id)
+        if current_node:
+          assert len(source_cliques) == len(current_node.GetCliques()) == 1
+
+          source_msg = source_cliques[0].GetMessage()
+          current_msg = current_node.GetCliques()[0].GetMessage()
+
+          # Only do this for messages whose source version has not changed.
+          if (source_msg.GetRealContent() != current_msg.GetRealContent()):
+            self.VerboseOut('Info: Message %s has changed; skipping\n' % node_id)
+          else:
+            transl_msg = transl_cliques[0].GetMessage()
+            transl_content = transl_msg.GetContent()
+            current_content = current_msg.GetContent()
+            source_content = source_msg.GetContent()
+
+            ok_to_fixup = True
+            if (len(transl_content) != len(current_content)):
+              # message structure of translation is different, don't try fixup
+              ok_to_fixup = False
+            if ok_to_fixup:
+              for ix in range(len(transl_content)):
+                if isinstance(transl_content[ix], tclib.Placeholder):
+                  if not isinstance(current_content[ix], tclib.Placeholder):
+                    ok_to_fixup = False  # structure has changed
+                    break
+                  if (transl_content[ix].GetOriginal() !=
+                      current_content[ix].GetOriginal()):
+                    ok_to_fixup = False  # placeholders have likely been reordered
+                    break
+                else:  # translated part is not a placeholder but a string
+                  if isinstance(current_content[ix], tclib.Placeholder):
+                    ok_to_fixup = False  # placeholders have likely been reordered
+                    break
+
+            if not ok_to_fixup:
+              self.VerboseOut(
+                'Info: Structure of message %s has changed; skipping.\n' % node_id)
+            else:
+              def Fixup(content, ix):
+                if (isinstance(content[ix], tclib.Placeholder) and
+                    content[ix].GetPresentation().startswith('TODO_')):
+                  assert isinstance(current_content[ix], tclib.Placeholder)
+                  # Get the placeholder ID and example from the current message
+                  content[ix] = current_content[ix]
+              for ix in range(len(transl_content)):
+                Fixup(transl_content, ix)
+                Fixup(source_content, ix)
+
+      # Only put each translation once into the map.  Warn if translations
+      # for the same message are different.
+      for ix in range(len(transl_cliques)):
+        source_msg = source_cliques[ix].GetMessage()
+        source_msg.GenerateId()  # needed to refresh ID based on new placeholders
+        message_id = source_msg.GetId()
+        translated_content = transl_cliques[ix].GetMessage().GetPresentableContent()
+
+        if message_id in id2transl:
+          existing_translation = id2transl[message_id]
+          if existing_translation != translated_content:
+            original_text = source_cliques[ix].GetMessage().GetPresentableContent()
+            self.Out('Warning: Two different translations for "%s":\n'
+                   '  Translation 1: "%s"\n'
+                   '  Translation 2: "%s"\n' %
+                   (original_text, existing_translation, translated_content))
+        else:
+          id2transl[message_id] = translated_content
+
+    # Remove translations for messages that do not occur in the current .grd
+    # or have been marked as not translateable, or do not occur in the 'limits'
+    # list (if it has been set).
+    current_message_ids = current_grd.UberClique().AllMessageIds()
+    for message_id in list(id2transl.keys()):
+      if (message_id not in current_message_ids or
+          not current_grd.UberClique().BestClique(message_id).IsTranslateable() or
+          (self.limits and message_id not in self.limits)):
+        del id2transl[message_id]
+
+    return id2transl
+
+  @staticmethod
+  def WriteTranslations(output_file, translations):
+    '''Writes the provided list of translations to the provided output file
+    in the format used by the TC's Bulk Translation Upload tool.  The file
+    must be UTF-8 encoded.
+
+    Args:
+      output_file: util.WrapOutputStream(open('bingo.out', 'wb'))
+      translations: [ [id1, text1], ['12345678', 'Hello USERNAME, howzit?'] ]
+
+    Return:
+      None
+    '''
+    for id, text in translations:
+      text = text.replace('<', '&lt;').replace('>', '&gt;')
+      output_file.write(id)
+      output_file.write(' ')
+      output_file.write(text)
+      output_file.write('\n')
diff --git a/tools/grit/grit/tool/transl2tc_unittest.py b/tools/grit/grit/tool/transl2tc_unittest.py
new file mode 100644
index 0000000000..22e937f9f2
--- /dev/null
+++ b/tools/grit/grit/tool/transl2tc_unittest.py
@@ -0,0 +1,133 @@
+#!/usr/bin/env python
+# Copyright (c) 2012 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.
+
+'''Unit tests for the 'grit transl2tc' tool.'''
+
+from __future__ import print_function
+
+import os
+import sys
+if __name__ == '__main__':
+  sys.path.append(os.path.join(os.path.dirname(__file__), '../..'))
+
+import unittest
+
+from six import StringIO
+
+from grit.tool import transl2tc
+from grit import grd_reader
+from grit import util
+
+
+def MakeOptions():
+  from grit import grit_runner
+  return grit_runner.Options()
+
+
+class TranslationToTcUnittest(unittest.TestCase):
+
+  def testOutput(self):
+    buf = StringIO()
+    tool = transl2tc.TranslationToTc()
+    translations = [
+      ['1', 'Hello USERNAME, how are you?'],
+      ['12', 'Howdie doodie!'],
+      ['123', 'Hello\n\nthere\n\nhow are you?'],
+      ['1234', 'Hello is > goodbye but < howdie pardner'],
+    ]
+    tool.WriteTranslations(buf, translations)
+    output = buf.getvalue()
+    self.failUnless(output.strip() == '''
+1 Hello USERNAME, how are you?
+12 Howdie doodie!
+123 Hello
+
+there
+
+how are you?
+1234 Hello is &gt; goodbye but &lt; howdie pardner
+'''.strip())
+
+  def testExtractTranslations(self):
+    path = util.PathFromRoot('grit/testdata')
+    current_grd = grd_reader.Parse(StringIO('''<?xml version="1.0" encoding="UTF-8"?>
+      <grit latest_public_release="2" source_lang_id="en-US" current_release="3" base_dir=".">
+        <release seq="3">
+          <messages>
+            <message name="IDS_SIMPLE">
+              One
+            </message>
+            <message name="IDS_PLACEHOLDER">
+              <ph name="NUMBIRDS">%s<ex>3</ex></ph> birds
+            </message>
+            <message name="IDS_PLACEHOLDERS">
+              <ph name="ITEM">%d<ex>1</ex></ph> of <ph name="COUNT">%d<ex>3</ex></ph>
+            </message>
+            <message name="IDS_REORDERED_PLACEHOLDERS">
+              <ph name="ITEM">$1<ex>1</ex></ph> of <ph name="COUNT">$2<ex>3</ex></ph>
+            </message>
+            <message name="IDS_CHANGED">
+              This is the new version
+            </message>
+            <message name="IDS_TWIN_1">Hello</message>
+            <message name="IDS_TWIN_2">Hello</message>
+            <message name="IDS_NOT_TRANSLATEABLE" translateable="false">:</message>
+            <message name="IDS_LONGER_TRANSLATED">
+              Removed document <ph name="FILENAME">$1<ex>c:\temp</ex></ph>
+            </message>
+            <message name="IDS_DIFFERENT_TWIN_1">Howdie</message>
+            <message name="IDS_DIFFERENT_TWIN_2">Howdie</message>
+          </messages>
+          <structures>
+            <structure type="dialog" name="IDD_ABOUTBOX" encoding="utf-16" file="klonk.rc" />
+            <structure type="menu" name="IDC_KLONKMENU" encoding="utf-16" file="klonk.rc" />
+          </structures>
+        </release>
+      </grit>'''), path)
+    current_grd.SetOutputLanguage('en')
+    current_grd.RunGatherers()
+
+    source_rc_path = util.PathFromRoot('grit/testdata/source.rc')
+    source_rc = util.ReadFile(source_rc_path, 'utf-8')
+    transl_rc_path = util.PathFromRoot('grit/testdata/transl.rc')
+    transl_rc = util.ReadFile(transl_rc_path, 'utf-8')
+
+    tool = transl2tc.TranslationToTc()
+    output_buf = StringIO()
+    globopts = MakeOptions()
+    globopts.verbose = True
+    globopts.output_stream = output_buf
+    tool.Setup(globopts, [])
+    translations = tool.ExtractTranslations(current_grd,
+                                            source_rc, source_rc_path,
+                                            transl_rc, transl_rc_path)
+
+    values = list(translations.values())
+    output = output_buf.getvalue()
+
+    self.failUnless('Ein' in values)
+    self.failUnless('NUMBIRDS Vogeln' in values)
+    self.failUnless('ITEM von COUNT' in values)
+    self.failUnless(values.count('Hallo') == 1)
+    self.failIf('Dass war die alte Version' in values)
+    self.failIf(':' in values)
+    self.failIf('Dokument FILENAME ist entfernt worden' in values)
+    self.failIf('Nicht verwendet' in values)
+    self.failUnless(('Howdie' in values or 'Hallo sagt man' in values) and not
+      ('Howdie' in values and 'Hallo sagt man' in values))
+
+    self.failUnless('XX01XX&SkraXX02XX&HaettaXX03XXThetta er "Klonk" sem eg fylaXX04XXgonkurinnXX05XXKlonk && er [good]XX06XX&HjalpXX07XX&Um...XX08XX' in values)
+
+    self.failUnless('I lagi' in values)
+
+    self.failUnless(output.count('Structure of message IDS_REORDERED_PLACEHOLDERS has changed'))
+    self.failUnless(output.count('Message IDS_CHANGED has changed'))
+    self.failUnless(output.count('Structure of message IDS_LONGER_TRANSLATED has changed'))
+    self.failUnless(output.count('Two different translations for "Howdie"'))
+    self.failUnless(output.count('IDD_DIFFERENT_LENGTH_IN_TRANSL has wrong # of cliques'))
+
+
+if __name__ == '__main__':
+  unittest.main()
diff --git a/tools/grit/grit/tool/unit.py b/tools/grit/grit/tool/unit.py
new file mode 100644
index 0000000000..7e96b699c3
--- /dev/null
+++ b/tools/grit/grit/tool/unit.py
@@ -0,0 +1,43 @@
+# Copyright (c) 2012 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.
+
+'''GRIT tool that runs the unit test suite for GRIT.'''
+
+from __future__ import print_function
+
+import getopt
+import sys
+import unittest
+
+try:
+  import grit.test_suite_all
+except ImportError:
+  pass
+from grit.tool import interface
+
+
+class UnitTestTool(interface.Tool):
+  '''By using this tool (e.g. 'grit unit') you run all the unit tests for GRIT.
+This happens in the environment that is set up by the basic GRIT runner.'''
+
+  def ShortDescription(self):
+    return 'Use this tool to run all the unit tests for GRIT.'
+
+  def ParseOptions(self, args):
+    """Set this objects and return all non-option arguments."""
+    own_opts, args = getopt.getopt(args, '', ('help',))
+    for key, val in own_opts:
+      if key == '--help':
+        self.ShowUsage()
+        sys.exit(0)
+    return args
+
+  def Run(self, opts, args):
+    args = self.ParseOptions(args)
+    if args:
+      print('This tool takes no arguments.')
+      return 2
+
+    return unittest.TextTestRunner(verbosity=2).run(
+      grit.test_suite_all.TestSuiteAll())
diff --git a/tools/grit/grit/tool/update_resource_ids/__init__.py b/tools/grit/grit/tool/update_resource_ids/__init__.py
new file mode 100644
index 0000000000..3006fbffab
--- /dev/null
+++ b/tools/grit/grit/tool/update_resource_ids/__init__.py
@@ -0,0 +1,305 @@
+# Copyright 2019 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.
+"""Package grit.tool.update_resource_ids
+
+Updates GRID resource_ids from linked GRD files, while preserving structure.
+
+A resource_ids file is a JSON dict (with Python comments) that maps GRD paths
+to *items*. Item order is ignored by GRIT, but is important since it establishes
+a narrative of item dependency (needs non-overlapping IDs) and mutual exclusion
+(allows ID overlap). Example:
+
+{
+  # The first entry in the file, SRCDIR, is special: It is a relative path from
+  # this file to the base of your checkout.
+  "SRCDIR": "../..",
+
+  # First GRD file. This entry is an "Item".
+  "1.grd": {
+    "messages": [400],  # "Tag".
+  },
+  # Depends on 1.grd, i.e., 500 >= 400 + (# of IDs used in 1.grd).
+  "2a.grd": {
+    "includes": [500],    # "Tag".
+    "structures": [510],  # "Tag" (etc.).
+  },
+  # Depends on 2a.grd.
+  "3a.grd": {
+    "includes": [1000],
+  },
+  # Depends on 2a.grd, but overlaps with 3b.grd due to mutually exclusivity.
+  "3b.grd": {
+    "includes": [1000],
+  },
+  # Depends on {3a.grd, 3b.grd}.
+  "4.grd": {
+    "META": {"join": 2},  # Hint for update_resource_ids.
+    "structures": [1500],
+  },
+  # Depends on 1.grd but overlaps with 2a.grd.
+  "2b.grd": {
+    "includes": [500],
+    "structures": [540],
+  },
+  # Depends on {4.grd, 2b.grd}.
+  "5.grd": {
+    "META": {"join": 2},  # Hint for update_resource_ids.
+    "includes": [600],
+  },
+  # Depends on 5.grd. File is generated, so hint is needed for sizes.
+  "<(SHARED_INTERMEDIATE_DIR)/6.grd": {
+    "META": {"sizes": {"includes": [10]}},
+    "includes": [700],
+  },
+}
+
+The "structure" within a resouces_ids file are as follows:
+1. Comments and spacing.
+2. Item ordering, to establish dependency and grouping.
+3. Special provision to allow ID overlaps from mutual exclusion.
+
+This module parses a resource_ids file, reads ID usages from GRD files it refers
+to, and generates an updated version of the resource_ids file while preserving
+structure elements 1-3 stated above.
+"""
+
+from __future__ import print_function
+
+import collections
+import getopt
+import os
+import shutil
+import sys
+import tempfile
+
+from grit.tool import interface
+from grit.tool.update_resource_ids import assigner, common, parser, reader
+
+
+def _ReadData(input_file):
+  if input_file == '-':
+    data = sys.stdin.read()
+    file_dir = os.getcwd()
+  else:
+    with open(input_file, 'rt') as f:
+      data = f.read()
+    file_dir = os.path.dirname(input_file)
+  return data, file_dir
+
+
+def _MultiReplace(data, repl):
+  """Multi-replacement of text |data| by ranges and replacement text.
+
+  Args:
+    data: Original text.
+    repl: List of (lo, hi, s) tuples, specifying that |data[lo:hi]| should be
+      replaced with |s|. The ranges must be inside |data|, and not overlap.
+  Returns: New text.
+  """
+  res = []
+  prev = 0
+  for (lo, hi, s) in sorted(repl):
+    if prev < lo:
+      res.append(data[prev:lo])
+    res.append(s)
+    prev = hi
+  res.append(data[prev:])
+  return ''.join(res)
+
+
+def _WriteFileIfChanged(output, new_data):
+  if not output:
+    sys.stdout.write(new_data)
+    return
+
+  # Avoid touching outputs if file contents has not changed so that ninja
+  # does not rebuild dependent when not necessary.
+  if os.path.exists(output) and _ReadData(output)[0] == new_data:
+    return
+
+  # Write to a temporary file to ensure atomic changes.
+  with tempfile.NamedTemporaryFile('wt', delete=False) as f:
+    f.write(new_data)
+  shutil.move(f.name, output)
+
+
+class _Args:
+  """Encapsulated arguments for this module."""
+  def __init__(self):
+    self.add_header = False
+    self.analyze_inputs = False
+    self.count = False
+    self.depfile = None
+    self.fake = False
+    self.input = None
+    self.naive = False
+    self.output = None
+    self.parse = False
+    self.tokenize = False
+
+  @staticmethod
+  def Parse(raw_args):
+    own_opts, raw_args = getopt.getopt(raw_args, 'o:cpt', [
+        'add-header',
+        'analyze-inputs',
+        'count',
+        'depfile=',
+        'fake',
+        'naive',
+        'parse',
+        'tokenize',
+    ])
+    args = _Args();
+    if not len(raw_args) == 1:
+      print('grit update_resource_ids takes exactly one argument, the path to '
+            'the resource ids file.')
+      return 2
+    args.input = raw_args[0]
+    for (key, val) in own_opts:
+      if key == '-o':
+        args.output = val
+      elif key == '--add-header':
+        args.add_header = True
+      elif key == '--analyze-inputs':
+        args.analyze_inputs = True
+      elif key in ('--count', '-c'):
+        args.count = True
+      elif key == '--depfile':
+        args.depfile = val
+      elif key == '--fake':
+        args.fake = True
+      elif key == '--naive':
+        args.naive = True
+      elif key in ('--parse', '-p'):
+        args.parse = True
+      elif key in ('--tokenize', '-t'):
+        args.tokenize = True
+    return args
+
+
+class UpdateResourceIds(interface.Tool):
+  """Updates all start IDs in an resource_ids file by reading all GRD files it
+refers to, estimating the number of required IDs of each type, then rewrites
+start IDs while preserving structure.
+
+Usage: grit update_resource_ids [--parse|-p] [--read-grd|-r] [--tokenize|-t]
+                                [--naive] [--fake] [-o OUTPUT_FILE]
+                                [--analyze-inputs] [--depfile DEPFILE]
+                                [--add-header] RESOURCE_IDS_FILE
+
+RESOURCE_IDS_FILE is the path of the input resource_ids file.
+
+The -o option redirects output (default stdout) to OUPTUT_FILE, which can also
+be RESOURCE_IDS_FILE.
+
+Other options:
+
+  -E NAME=VALUE     Sets environment variable NAME to VALUE (within grit).
+
+  --count|-c        Parses RESOURCE_IDS_FILE, reads the GRD files, and prints
+                    required sizes.
+
+  --fake            For testing: Skips reading GRD files, and assigns 10 as the
+                    usage of every tag.
+
+  --naive           Use naive coarse assigner.
+
+  --parse|-p        Parses RESOURCE_IDS_FILE and dumps its nodes to console.
+
+  --tokenize|-t     Tokenizes RESOURCE_IDS_FILE and reprints it as syntax-
+                    highlighted output.
+
+  --depfile=DEPFILE Write out a depfile for ninja to know about dependencies.
+  --analyze-inputs  Writes dependencies to stdout.
+  --add-header      Adds a "THIS FILE IS GENERATED" header to the output.
+"""
+
+  def __init(self):
+    super(UpdateResourceIds, self).__init__()
+
+  def ShortDescription(self):
+    return 'Updates a resource_ids file based on usage, preserving structure'
+
+  def _DumpTokens(self, data, tok_gen):
+    # Reprint |data| with syntax highlight.
+    color_map = {
+        '#': common.Color.GRAY,
+        'S': common.Color.CYAN,
+        '0': common.Color.RED,
+        '{': common.Color.YELLOW,
+        '}': common.Color.YELLOW,
+        '[': common.Color.GREEN,
+        ']': common.Color.GREEN,
+        ':': common.Color.MAGENTA,
+        ',': common.Color.MAGENTA,
+    }
+    for t, lo, hi in tok_gen:
+      c = color_map.get(t, common.Color.NONE)
+      sys.stdout.write(c(data[lo:hi]))
+
+  def _DumpRootObj(self, root_obj):
+    print(root_obj)
+
+  def _DumpResourceCounts(self, usage_gen):
+    tot = collections.Counter()
+    for item, tag_name_to_usage in usage_gen:
+      c = common.Color.YELLOW if item.grd.startswith('<') else common.Color.CYAN
+      print('%s: %r' % (c(item.grd), dict(tag_name_to_usage)))
+      tot += collections.Counter(tag_name_to_usage)
+    print(common.Color.GRAY('-' * 80))
+    print('%s: %r' % (common.Color.GREEN('Total'), dict(tot)))
+    print('%s: %d' % (common.Color.GREEN('Grand Total'), sum(tot.values())))
+
+  def Run(self, opts, raw_args):
+    self.SetOptions(opts)
+
+    args = _Args.Parse(raw_args)
+    data, file_dir = _ReadData(args.input)
+
+    tok_gen = parser.Tokenize(data)
+    if args.tokenize:
+      return self._DumpTokens(data, tok_gen)
+
+    root_obj = parser.ResourceIdParser(data, tok_gen).Parse()
+    if args.parse:
+      return self._DumpRootObj(root_obj)
+    item_list = common.BuildItemList(root_obj)
+
+    src_dir = os.path.normpath(os.path.join(file_dir, root_obj['SRCDIR'].val))
+    seen_files = set()
+    usage_gen = reader.GenerateResourceUsages(item_list, src_dir, args.fake,
+                                              seen_files)
+    if args.count:
+      return self._DumpResourceCounts(usage_gen)
+    for item, tag_name_to_usage in usage_gen:
+      item.SetUsages(tag_name_to_usage)
+
+    if args.analyze_inputs:
+      print('\n'.join(sorted(seen_files)))
+      return 0
+
+    new_ids_gen = assigner.GenerateNewIds(item_list, args.naive)
+    # Create replacement specs usable by _MultiReplace().
+    repl = [(tag.lo, tag.hi, str(new_id)) for tag, new_id in new_ids_gen]
+    rel_input_dir = args.input
+    # Update "SRCDIR" entry if output is specified.
+    if args.output:
+      new_srcdir = os.path.relpath(src_dir, os.path.dirname(args.output))
+      repl.append((root_obj['SRCDIR'].lo, root_obj['SRCDIR'].hi,
+                   repr(new_srcdir)))
+      rel_input_dir = os.path.join('$SRCDIR',
+                                   os.path.relpath(rel_input_dir, new_srcdir))
+
+    new_data = _MultiReplace(data, repl)
+    if args.add_header:
+      header = []
+      header.append('# GENERATED FILE.')
+      header.append('# Edit %s instead.' % rel_input_dir)
+      header.append('#' * 80)
+      new_data = '\n'.join(header + ['']) + new_data
+    _WriteFileIfChanged(args.output, new_data)
+
+    if args.depfile:
+      deps_data = '{}: {}'.format(args.output, ' '.join(sorted(seen_files)))
+      _WriteFileIfChanged(args.depfile, deps_data)
diff --git a/tools/grit/grit/tool/update_resource_ids/assigner.py b/tools/grit/grit/tool/update_resource_ids/assigner.py
new file mode 100644
index 0000000000..6cd46031a6
--- /dev/null
+++ b/tools/grit/grit/tool/update_resource_ids/assigner.py
@@ -0,0 +1,286 @@
+# Copyright 2019 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.
+"""Assign IDs to resource_ids file based on usage, while preserving structure.
+
+resource_ids assignment is divided into two parts:
+(A) Coarse assignment: Assigns start IDs of items.
+(B) Quota assignment: Assigns per-tag ID allotments for a given item, allowing
+    padding for IDs.
+
+These parts are interdependent: Start IDs (A) of an item depends on ID
+allotments (B) of *other* items; and ID allotment (B) of an item depends on its
+start IDs (A) to compute alignment.
+
+(B) hides padding and alignment details of tags so that (A) can be abstracted
+into the graph construction and traversal problem in DagCoarseIdAssigner.
+"""
+
+import math
+
+from grit.tool.update_resource_ids import common
+
+
+class Aligner:
+  """Helper to allot IDs, given start ID and ID usage.
+
+  Args:
+    expand: Scale factor relative to ID usage. Must be >= 1.0.
+    slack: Minimum number of reserved ID at end. Must be >= 0.
+    align: ID alignment of results. Must be >= 1.
+  """
+
+  def __init__(self, expand=1.0, slack=0, align=1):
+    assert expand >= 1.0 and slack >= 0 and align >= 1
+    self._expand = expand
+    self._slack = slack
+    self._align = align
+
+  def Calc(self, cur_id, usage):
+    quota = max(int(math.ceil(usage * self._expand)), usage + self._slack)
+    return common.AlignUp(cur_id + quota, self._align)
+
+
+class QuotaAssigner:
+  """Main class for (B), for ID allotment of tags for an item."""
+
+  def __init__(self, aligner):
+    self._aligner = aligner
+
+  def Gen(self, item, start_id):
+    """Generates per-tag *end* ID in |item|, succeeding |start_id|."""
+    cur_id = start_id
+    for tag in item.tags:  # Sorted by |tag.lo|.
+      cur_id = self._aligner.Calc(cur_id, tag.usage)
+      yield tag, cur_id
+
+
+class BaseCoarseIdAssigner(object):
+  """Base class for coarse assignment."""
+
+  def __init__(self, item_list, align):
+    self._item_list = item_list
+    self._align = align
+
+  def GenStartIds(self):
+    """Visits |_item_list| and yields (|item|, new |start_id|).
+
+    Visit follows dependency order: If item B succeeds item A, then A is visited
+    before B. Caller must call FeedWeight() to assign ID allotment.
+    """
+    raise NotImplementedError()
+
+  def FeedWeight(self, item, weight):
+    """Callback to assign number of IDs allotted to |item|."""
+    raise NotImplementedError()
+
+
+class NaiveCoarseIdAssigner(BaseCoarseIdAssigner):
+  """CoarseIdAssigner that assigns item with non-overlapping start IDs."""
+
+  def __init__(self, item_list, align):
+    super(NaiveCoarseIdAssigner, self).__init__(item_list, align)
+    first_id = self._item_list[0].tags[0].id
+    self._cur_id = common.AlignUp(first_id, self._align)
+
+  def GenStartIds(self):
+    """Visits items in array order."""
+    for item in self._item_list:
+      yield item, self._cur_id
+
+  def FeedWeight(self, item, weight):
+    self._cur_id = common.AlignUp(self._cur_id + weight, self._align)
+
+
+class DagCoarseIdAssigner(BaseCoarseIdAssigner):
+  """CoarseIdAssigner that preserves existing structure.
+
+Start ID assignment in resource_ids is structured a Series-Parallel Graph, which
+is a directed, acyclic multi-graph generated by the following:
+* Start: Single directed edge. S <-- T.
+* Operation 1: A <-- B becomes A <-- C <-- B.
+* Operation 2: A <-- B becomes A <== B (add parallel edge).
+
+Each vertex (A, B, ...) is a start ID. S = globally minimal ID. T = \infty is an
+implicit sentinel. Each edge maps to an item, and edge weight is ID allotment.
+The edge A <-- B means "A's ID assignment needs to be determined before B's"
+(i.e., "B depends on A"), and requires A < B.
+
+resource_ids stores a "flattened" representation of the graph, as a list of
+items (with meta data). Thus coarse ID assignment consists of the following:
+(1) Process list of items (with old start ID and meta data) to rebuild graph.
+(2) Traverse graph in an order that satisfies dependencies.
+(3) When vertex A has its ID assigned, the weight of each edge "A <--" (i.e., an
+    item) can have its weight (ID allotment) computed via quota assignment of A.
+(4) New start IDs satisfy A + w <= B for each edge A <-- B with weight w > 0.
+
+The key algorithm challenge is (1). Note that it does not need weight details,
+so we only assume A < B whenever A <-- B. Now we're faced with 2 subproblems:
+(1a) How to represent the graph as a list of integers (with meta data)?
+(1b) Given the list representation, how to recover the graph?
+
+For (1a), we start with DFS traversal of the (transposed, i.e., reversed) graph
+starting from S, and apply the following:
+* For each edge A <-- B traversed, emit A into sequence,
+* Traverse a B <-- Y only when all X <-- B have been traversed.
+
+The resulting sequence has the length as the number of edges, and has the useful
+property that a vertex's dependencies always appear before the vertex itself!
+Note this the sentinel T is omitted.
+
+Example 1:
+  S <-- A <-- B <-- C <-- T  => "SABC".
+
+Example 2:
+  S <-- A <-- B <-- C <-- T  => "SA|AB|SDEC|SF",
+  |     |     |     |     |  or "SF|SA|AB|SDEC",
+  |     + <-- +     |     |  or "SDE|SA|ABC|SF",
+  |                 |     |  or "SF|SDE|SA|ABC".
+  + <---D <-- E <---+     |
+  |                       |
+  + <-- F <---------------+
+
+Here, "X|Y" denotes backtracking between visiting X and visiting Y. This appears
+if and only if X >= Y, so "|" an optional (but illustrative) character that's
+not in the actual output. We will use it consistently in comments, and so the
+absence of "|" denotes the converse. For example, "XY" implies X < Y.
+
+In terms of the basic operations:
+* Start: S <-- T => "S".
+* Operation 1: "...AB..." => "...ACB..." (or "...A" => "...AB").
+* Operation 2: "...AB..." => "...A|AB..." (or "...A" => "...A|A").
+
+For Example 2, a viable "evolution path" is:
+"S" => "S|S" => "SC|S" => "S|SC|S" => "SA|SC|S" => "SAB|SC|S" => "SA|AB|SC|S"
+    => "SA|AB|SDC|S" => "SA|AB|SDEC|S" => "SA|AB|SDEC|SF".
+(Alternative: "S|S" => "S|SC" => etc.).
+
+Note: {A, ...} are *unlabelled* integers, and "spurious equalities" such as
+A = D or A = F can occur!
+
+For (1b), we wish to build the graph from the sequence. This requires (1a) to be
+injective (up to isomorphism). Unfortunately, this does not always hold.
+Example:
+  S <-- A <-- C <-- D <-- T  => "SA|SBCD".
+  |           |
+  + <-- B <---+
+vs.
+  S <----- A <----- D <-- T  => "SA|SBCD".
+  |                 |
+  + <-- B <-- C <---+
+
+To fix this, we prepend a "join" label (*) to each vertex that has multiple
+dependencies. With this, the example above produce different results:
+   "SA|SB*CD" != "SA|SBC*D".
+
+Unfortunately, this is also inadequate.  Example:
+  S <-------- B <-- T  => "S|S|S|S*A*B",
+  |           |
+  + <---------+
+  |           |
+  + <-- A <---+
+  |     |
+  + <---+
+vs.
+  S <-------- B <-- T  => "S|S|S|S*A*B".
+  |           |
+  + <---A <---+
+  |     |
+  + <---+
+  |     |
+  + <---+
+
+To fix this, we also label the number of dependencies. In text representation,
+we just show multiple (#dependencies - 1) copies of '*'. Now we have:
+  "S|S|S|S*A**B" != "S|S|S|S**A*B".
+
+The "join" label with count adequately addresses the issue (proof omitted). In
+the resource_ids files, these are stored as the "join" field of an item's meta
+data.
+
+Additional comments for (1b) and other steps are detailed below.
+"""
+
+  class DagNode:
+    """An element of the implicit graph, corresponding to an item.
+
+    This actually represents an edge-vertex pair, corresponding to an item.
+    A vertex is represented by a collection of DagNode that uses |sib| to link
+    to a "representative node". The representative node, in turn, holds the list
+    of all |deps| (dependencies) of the vertex.
+    """
+
+    def __init__(self, item, old_id):
+      self.item = item
+      self.old_id = old_id
+      self.new_id = None
+      self.weight = None
+
+  def __init__(self, item_list, align):
+    super(DagCoarseIdAssigner, self).__init__(item_list, align)
+    self._node_dict = {}  # Maps from |lo| to item.
+
+  def GenStartIds(self):
+    """Traverses implicit graph and yields new IDs.
+
+    Algorithm: Process |old_id| of items sequentially. Successive items A and B
+    can be "AB" (A < B), "A*...B" (A < B), or "A|B" (A >= B). "AB" and "A*...B"
+    imply A <-- B, and are accumulated in |trace|. "A|B" are jumps that rewinds
+    |trace| to the latest B (must exist), and A is pushed into |jumps|. A join
+    "A*...B" also pops |num_join - 1| items {X_i} in |jump|, and X_i <-- B. In
+    the end, unprocessed elements in |jumps| all link to sentinel T, and can be
+    ignored.
+    """
+    # DagNode stack of "A" when "AB" is found (increasing |old_id|).
+    trace = []
+    # DagNode stack of "A" when "A|B" jumps is found.
+    jumps = []
+    for item in self._item_list:  # Sorted by |lo|.
+      meta = item.meta
+      # |num_join| indicates "*" in "A*...B", and specify B's dependencies: +1
+      # from A, and +count("*") from |jumps|.
+      num_join = meta['join'].val if meta and 'join' in meta else None
+      node = DagCoarseIdAssigner.DagNode(item, item.tags[0].id)
+      self._node_dict[item.lo] = node
+      if trace:
+        if trace[-1].old_id >= node.old_id:  # "A|B".
+          if num_join:
+            raise ValueError('Cannot join on jump: %d' % node.old_id)
+          jumps.append(trace[-1])  # Add A to |jumps|, for later join.
+          while trace and trace[-1].old_id > node.old_id:  # Rewind to find B.
+            trace.pop()
+          if not trace or trace[-1].old_id != node.old_id:  #
+            raise ValueError('Cannot jump to unvisited: %d' % node.old_id)
+          node.new_id = trace.pop().new_id  # Copy B & remove. Will re-add B.
+        else:  # "AB" or "A*...B".
+          node.new_id = trace[-1].new_id + trace[-1].weight  # A --> B
+          if num_join:  # "A*...B".
+            for _ in range(1, num_join):
+              t = jumps.pop()
+              node.new_id = max(node.new_id, t.new_id + t.weight)  # X_i --> B.
+      else:
+        node.new_id = node.old_id  # Initial S.
+      trace.append(node)  # Add B.
+      align = meta['align'].val if meta and 'align' in meta else self._align
+      node.new_id = common.AlignUp(node.new_id, align)
+      yield node.item, node.new_id
+      # Expect caller to calling FreedWeight() and update |node.weight|.
+
+  def FeedWeight(self, item, weight):
+    self._node_dict[item.lo].weight = weight
+
+
+def GenerateNewIds(item_list, use_naive):
+  """Visits all tags in |item_list| and generates new ids.
+
+  New ids are generated based on old ids and usages.
+  """
+  Assigner = NaiveCoarseIdAssigner if use_naive else DagCoarseIdAssigner
+  coarse_id_assigner = Assigner(item_list, 10)
+  quota_assigner = QuotaAssigner(Aligner(expand=1.15, slack=3, align=10))
+  for item, start_id in coarse_id_assigner.GenStartIds():  # Topo-sorted.
+    cur_id = start_id
+    for tag, next_id in quota_assigner.Gen(item, start_id):  # Sorted by |lo|.
+      yield tag, cur_id
+      cur_id = next_id
+    coarse_id_assigner.FeedWeight(item, next_id - start_id)
diff --git a/tools/grit/grit/tool/update_resource_ids/assigner_unittest.py b/tools/grit/grit/tool/update_resource_ids/assigner_unittest.py
new file mode 100644
index 0000000000..164d820762
--- /dev/null
+++ b/tools/grit/grit/tool/update_resource_ids/assigner_unittest.py
@@ -0,0 +1,154 @@
+#!/usr/bin/env python
+# Copyright 2019 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.
+
+from __future__ import print_function
+
+import os
+import sys
+import traceback
+import unittest
+if __name__ == '__main__':
+  sys.path.append(os.path.join(os.path.dirname(__file__), '../../..'))
+
+from grit.tool.update_resource_ids import assigner, common, parser
+
+# |spec| format: A comma-separated list of (old) start IDs. Modifiers:
+# * Prefix with n '*' to assign the item's META "join" field to n + 1.
+# * Suffix with "+[usage]" to assign |usage| for the item (else default=10)
+
+
+def _RenderTestResourceId(spec):
+  """Renders barebone resource_ids data based on |spec|."""
+  data = '{"SRCDIR": ".",'
+  for i, tok in enumerate(spec.split(',')):
+    num_star = len(tok) - len(tok.lstrip('*'))
+    tok = tok[num_star:]
+    meta = '"META":{"join": %d},' % (num_star + 1) if num_star else ''
+    start_id = tok.split('+')[0]  # Strip '+usage'.
+    data += '"foo%d.grd": {%s"includes": [%s]},' % (i, meta, start_id)
+  data += '}'
+  return data
+
+
+def _CreateTestItemList(spec):
+  """Creates list of ItemInfo based on |spec|."""
+  data = _RenderTestResourceId(spec)
+  item_list = common.BuildItemList(
+      parser.ResourceIdParser(data, parser.Tokenize(data)).Parse())
+  # Assign usages from "id+usage", default to 10.
+  for i, tok in enumerate(spec.split(',')):
+    item_list[i].tags[0].usage = int((tok.split('+') + ['10'])[1])
+  return item_list
+
+
+def _RunCoarseIdAssigner(spec):
+  item_list = _CreateTestItemList(spec)
+  coarse_id_assigner = assigner.DagCoarseIdAssigner(item_list, 1)
+  new_id_list = []  # List of new IDs, to check ID assignment.
+  new_spec_list = []  # List of new tokens to construct new |spec|.
+  for item, start_id in coarse_id_assigner.GenStartIds():  # Topo-sorted..
+    new_id_list.append(str(start_id))
+    meta = item.meta
+    num_join = meta['join'].val if meta and 'join' in meta else 0
+    t = '*' * max(0, num_join - 1)
+    t += str(start_id)
+    t += '' if item.tags[0].usage == 10 else '+' + str(item.tags[0].usage)
+    new_spec_list.append((item.lo, t))
+    coarse_id_assigner.FeedWeight(item, item.tags[0].usage)
+  new_spec = ','.join(s for _, s in sorted(new_spec_list))
+  return ','.join(new_id_list), new_spec
+
+
+class AssignerUnittest(unittest.TestCase):
+
+  def testDagAssigner(self):
+    test_cases = [
+        # Trivial.
+        ('0', '0'),
+        ('137', '137'),
+        ('5,15', '5,6'),
+        ('11,18', '11+7,12'),
+        ('5,5', '5,5'),
+        # Series only.
+        ('0,10,20,30,40', '0,1,2,3,4'),
+        ('5,15,25,35,45,55', '5,6,7,8,9,10'),
+        ('5,15,25,35,45,55', '5,7,100,101,256,1001'),
+        ('0,10,20,45,85', '0,1,2+25,3+40,4'),
+        # Branching with and without join.
+        ('0,0,10,20,20,30,40', '0,0,1,2,2,3,4'),
+        ('0,0,10,20,20,30,40', '0,0,*1,2,2,*3,4'),
+        ('0,0,2,12,12,16,26', '0+4,0+2,1,2+8,2+4,3,4'),
+        ('0,0,4,14,14,22,32', '0+4,0+2,*1,2+8,2+4,*3,4'),
+        # Wide branching with and without join.
+        ('0,10,10,10,10,10,10,20,30', '0,1,1,1,1,1,1,2,3'),
+        ('0,10,10,10,10,10,10,20,30', '0,1,1,1,1,1,1,*****2,3'),
+        ('0,2,2,2,2,2,2,7,17', '0+2,1+4,1+19,1,1+4,1+2,1+5,2,3'),
+        ('0,2,2,2,2,2,2,21,31', '0+2,1+4,1+19,1,1+4,1+2,1+5,*****2,3'),
+        # Expanding different branch, without join.
+        ('0,10,10,10,60,70,80', '0,1+15,1+15,1+50,2,3,4'),
+        ('0,10,10,10,25,35,45', '0,1+15,1+50,1+15,2,3,4'),
+        ('0,10,10,10,25,35,45', '0,1+50,1+15,1+15,2,3,4'),
+        # ... with join.
+        ('0,10,10,10,60,70,80', '0,1+15,1+15,1+50,**2,3,4'),
+        ('0,10,10,10,60,70,80', '0,1+15,1+50,1+15,**2,3,4'),
+        ('0,10,10,10,60,70,80', '0,1+50,1+15,1+15,**2,3,4'),
+        # ... with alternative join.
+        ('0,10,10,10,60,70,80', '0,1+15,1+15,1+50,2,**3,4'),
+        ('0,10,10,10,25,60,70', '0,1+15,1+50,1+15,2,**3,4'),
+        ('0,10,10,10,25,60,70', '0,1+50,1+15,1+15,2,**3,4'),
+        # Examples from assigner.py.
+        ('0,10,10,20,0,10,20,30,0,10',
+         '0,1,1,*2,0,4,5,*6,0,7'),  # SA|AB|SDEC|SF
+        ('0,10,0,10,20,30', '0,1,0,2,*3,4'),  # SA|SB*CD
+        ('0,10,0,10,20,30', '0,1,0,2,3,*4'),  # SA|SBC*D
+        ('0,7,0,5,11,21', '0+7,1+4,0+5,2+3,*3,4'),  # SA|SB*CD
+        ('0,7,0,5,8,18', '0+7,1+4,0+5,2+3,3,*4'),  # SA|SBC*D
+        ('0,0,0,0,10,20', '0,0,0,0,*1,**2'),  # S|S|S|S*A**B
+        ('0,0,0,0,10,20', '0,0,0,0,**1,*2'),  # S|S|S|S**A*B
+        ('0,0,0,0,6,16', '0+8,0+7,0+6,0+5,*1,**2'),  # S|S|S|S*A**B
+        ('0,0,0,0,7,17', '0+8,0+7,0+6,0+5,**1,*2'),  # S|S|S|S**A*B
+        # Long branches without join.
+        ('0,10,0,0,10,20,0,10,20,30', '0,1,0,0,1,2,0,1,2,3'),
+        ('0,30,0,0,20,30,0,10,13,28', '0+30,1,0+50,0+20,1,2+17,0,1+3,2+15,3'),
+        # Long branches with join.
+        ('0,10,0,0,10,20,0,10,20,30', '0,1,0,0,1,2,0,1,2,***3'),
+        ('0,30,0,0,20,30,0,10,13,50',
+         '0+30,1,0+50,0+20,1,2+17,0,1+3,2+15,***3'),
+        # 2-level hierarchy.
+        ('0,10,10,20,0,10,10,20,30', '0,1,1,*2,0,1,1,*2,*3'),
+        ('0,2,2,10,0,3,3,6,34', '0+2,1+5,1+8,*2+24,0+3,1+2,1+3,*2+27,*3'),
+        ('0,2,2,10,0,3,3,6,34', '0+2,1+5,1+8,*2+24,0+3,1+2,1+3,*2+28,*3'),
+        ('0,2,2,10,0,3,3,6,35', '0+2,1+5,1+8,*2+24,0+3,1+2,1+3,*2+29,*3'),
+        # Binary hierarchy.
+        ('0,0,10,0,0,10,20,0,0,10,0,0,10,20,30',
+         '0,0,*1,0,0,*1,*2,0,0,*1,0,0,*1,*2,*3'),
+        ('0,0,2,0,0,5,11,0,0,8,0,0,5,14,18',
+         '0+1,0+2,*1+3,0+4,0+5,*1+6,*2+7,0+8,0+7,*1+6,0+5,0+4,*1+3,*2+2,*3+1'),
+        # Joining from different heads.
+        ('0,10,20,30,40,30,20,10,0,50', '0,1,2,3,4,3,2,1,0,****5'),
+        # Miscellaneous.
+        ('0,1,0,11', '0+1,1,0,*1'),
+    ]
+    for exp, spec in test_cases:
+      try:
+        actual, new_spec = _RunCoarseIdAssigner(spec)
+        self.failUnlessEqual(exp, actual)
+        # Test that assignment is idempotent.
+        actual2, new_spec2 = _RunCoarseIdAssigner(new_spec)
+        self.failUnlessEqual(actual, actual2)
+        self.failUnlessEqual(new_spec, new_spec2)
+      except Exception as e:
+        print(common.Color.RED(traceback.format_exc().rstrip()))
+        print('Failed spec: %s' % common.Color.CYAN(spec))
+        print('   Expected: %s' % common.Color.YELLOW(exp))
+        print('     Actual: %s' % common.Color.YELLOW(actual))
+        if new_spec != new_spec2:
+          print('Not idempotent')
+        if isinstance(e, AssertionError):
+          raise e
+
+
+if __name__ == '__main__':
+  unittest.main()
diff --git a/tools/grit/grit/tool/update_resource_ids/common.py b/tools/grit/grit/tool/update_resource_ids/common.py
new file mode 100644
index 0000000000..004d8aa0e3
--- /dev/null
+++ b/tools/grit/grit/tool/update_resource_ids/common.py
@@ -0,0 +1,101 @@
+# Copyright 2019 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.
+
+
+def AlignUp(v, align):
+  return (v + align - 1) // align * align
+
+
+def StripPlural(s):
+  assert s.endswith('s'), 'Expect %s to be plural' % s
+  return s[:-1]
+
+
+class Color:
+
+  def _MakeColor(code):
+    t = '\033[' + code + 'm%s\033[0m'
+    return lambda s: t % s
+
+  NONE = staticmethod(lambda s: s)
+  RED = staticmethod(_MakeColor('31'))
+  GREEN = staticmethod(_MakeColor('32'))
+  YELLOW = staticmethod(_MakeColor('33'))
+  BLUE = staticmethod(_MakeColor('34'))
+  MAGENTA = staticmethod(_MakeColor('35'))
+  CYAN = staticmethod(_MakeColor('36'))
+  WHITE = staticmethod(_MakeColor('37'))
+  GRAY = staticmethod(_MakeColor('30;1'))
+
+
+class TagInfo:
+  """Stores resource_ids tag entry (e.g., {"includes": 100} pair)."""
+
+  def __init__(self, raw_key, raw_value):
+    """TagInfo Constructor.
+
+    Args:
+      raw_key: parser.AnnotatedValue for the parsed key, e.g., "includes".
+      raw_value: parser.AnnotatedValue for the parsed value, e.g., 100.
+    """
+    # Tag name, e.g., 'include' (no "s" at end).
+    self.name = StripPlural(raw_key.val)
+    # |len(raw_value) > 1| is possible, e.g., see grd_reader_unittest.py's
+    # testAssignFirstIdsMultipleMessages. This feature seems unused though.
+    # TODO(huangs): Reconcile this (may end up removing multi-value feature).
+    assert len(raw_value) == 1
+    # Inclusive start *position* of the tag's start ID in resource_ids.
+    self.lo = raw_value[0].lo
+    # Exclusive end *position* of the tag's start ID in resource_ids.
+    self.hi = raw_value[0].hi
+    # The tag's start ID. Initially the old value, but may be reassigned to new.
+    self.id = raw_value[0].val
+    # The number of IDs the tag uses, to be assigned by ItemInfo.SetUsages().
+    self.usage = None
+
+
+class ItemInfo:
+  """resource_ids item, containing multiple TagInfo."""
+
+  def __init__(self, lo, grd, raw_item):
+    # Inclusive start position of the item's key. Serve as unique identifier.
+    self.lo = lo
+    # The GRD filename for the item.
+    self.grd = grd
+    # Optional META information for the item.
+    self.meta = None
+    # List of TagInfo associated witih the item.
+    self.tags = []
+    for k, v in raw_item.items():
+      if k.val == 'META':
+        assert self.meta is None
+        self.meta = v  # Not flattened.
+      else:
+        self.tags.append(TagInfo(k, v))
+    self.tags.sort(key=lambda tag: tag.lo)
+
+  def SetUsages(self, tag_name_to_usage):
+    for tag in self.tags:
+      tag.usage = tag_name_to_usage.get(tag.name, 0)
+
+
+def BuildItemList(root_obj):
+  """Extracts ID assignments and structure from parsed resource_ids.
+
+  Returns: A list of ItemInfo, ordered by |lo|.
+  """
+  item_list = []
+  grd_seen = set()
+  for raw_key, raw_item in root_obj.items():  # Unordered.
+    grd = raw_key.val
+    if grd == 'SRCDIR':
+      continue
+    if not grd.endswith('.grd'):
+      raise ValueError('Invalid GRD file: %s' % grd)
+    if grd in grd_seen:
+      raise ValueError('Duplicate GRD: %s' % grd)
+    grd_seen.add(grd)
+    item_list.append(ItemInfo(raw_key.lo, grd, raw_item))
+  item_list.sort(key=lambda item: item.lo)
+  return item_list
diff --git a/tools/grit/grit/tool/update_resource_ids/parser.py b/tools/grit/grit/tool/update_resource_ids/parser.py
new file mode 100644
index 0000000000..da956bbd1c
--- /dev/null
+++ b/tools/grit/grit/tool/update_resource_ids/parser.py
@@ -0,0 +1,231 @@
+# Copyright 2019 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.
+"""Structure-preserving parser for resource_ids files.
+
+Naive usage of eval() destroys resource_ids structure. This module provides a
+custom parser that annotates source byte ranges of "leaf values" (strings and
+integers).
+"""
+
+from __future__ import print_function
+
+_isWhitespace = lambda ch: ch in ' \t\n'
+_isNotNewline = lambda ch: ch != '\n'
+_isDigit = lambda ch: ch.isdigit()
+
+
+def _RenderLineCol(data, pos):
+  """Renders |pos| within text |data| in as text showing line and column."""
+  # This is used to pinpoint fatal parse errors, so okay to be inefficient.
+  new_lines = [i for i in range(pos) if data[i] == '\n']
+  row = 1 + len(new_lines)
+  col = (pos - new_lines[-1]) if new_lines else 1 + pos
+  return 'line %d, column %d' % (row, col)
+
+
+def Tokenize(data):
+  """Generator to split |data| into tokens.
+
+  Each token is specified as |(t, lo, hi)|:
+  * |t|: Type, with '#' = space / comments, '0' = int, 'S' = string, 'E' = end,
+         and other characters denoting themselves.
+  * |lo, hi|: Token's range within |data| (as |data[lo:hi]|).
+  """
+
+  class ctx:  # Local context for mutable data shared across inner functions.
+    pos = 0
+
+  def _HasData():
+    return ctx.pos < len(data)
+
+  # Returns True if ended by |not pred()|, or False if ended by EOF.
+  def _EatWhile(pred):
+    while _HasData():
+      if pred(data[ctx.pos]):
+        ctx.pos += 1
+      else:
+        return True
+    return False
+
+  def _NextBlank():
+    lo = ctx.pos
+    while True:
+      if not _EatWhile(_isWhitespace) or data[ctx.pos] != '#':
+        break
+      ctx.pos += 1
+      if not _EatWhile(_isNotNewline):
+        break
+      ctx.pos += 1
+    return None if ctx.pos == lo else (lo, ctx.pos)
+
+  def _EatString():
+    lo = ctx.pos
+    delim = data[ctx.pos]
+    is_escaped = False
+    ctx.pos += 1
+    while _HasData():
+      ch = data[ctx.pos]
+      ctx.pos += 1
+      if is_escaped:
+        is_escaped = False
+      elif ch == '\\':
+        is_escaped = True
+      elif ch == delim:
+        return
+    raise ValueError('Unterminated string at %s' % _RenderLineCol(data, lo))
+
+  while _HasData():
+    blank = _NextBlank()
+    if blank is not None:
+      yield ('#', blank[0], blank[1])
+    if not _HasData():
+      break
+    lo = ctx.pos
+    ch = data[ctx.pos]
+    if ch in '{}[],:':
+      ctx.pos += 1
+      t = ch
+    elif ch.isdigit():
+      _EatWhile(_isDigit)
+      t = '0'
+    elif ch in '+-':
+      ctx.pos += 1
+      if not _HasData() or not data[ctx.pos].isdigit():
+        raise ValueError('Invalid int at %s' % _RenderLineCol(data, lo))
+      _EatWhile(_isDigit)
+      t = '0'
+    elif ch in '"\'':
+      _EatString()
+      t = 'S'
+    else:
+      raise ValueError('Unknown char %s at %s' %
+                       (repr(ch), _RenderLineCol(data, lo)))
+    yield (t, lo, ctx.pos)
+  yield ('E', ctx.pos, ctx.pos)  # End sentinel.
+
+
+def _SkipBlanks(toks):
+  """Generator to remove whitespace and comments from Tokenize()."""
+  for t, lo, hi in toks:
+    if t != '#':
+      yield t, lo, hi
+
+
+class AnnotatedValue:
+  """Container for leaf values (ints or strings) with an annotated range."""
+
+  def __init__(self, val, lo, hi):
+    self.val = val
+    self.lo = lo
+    self.hi = hi
+
+  def __str__(self):
+    return '<%s@%d:%d>' % (str(self.val), self.lo, self.hi)
+
+  def __repr__(self):
+    return '<%r@%d:%d>' % (self.val, self.lo, self.hi)
+
+  def __hash__(self):
+    return hash(self.val)
+
+  def __eq__(self, other):
+    return self.val == other
+
+
+class ResourceIdParser:
+  """resource_ids parser that stores leaf values as AnnotatedValue.
+
+  Algorithm: Use Tokenize() to split |data| into tokens and _SkipBlanks() to
+  ignore comments and spacing, then apply a recursive parsing, using a one-token
+  look-ahead for decision making.
+  """
+
+  def __init__(self, data, tok_gen):
+    self.data = data
+    self.state = []
+    self.toks = _SkipBlanks(tok_gen)
+    self.tok_look_ahead = None
+
+  def _MakeErr(self, msg, pos):
+    return ValueError(msg + ' at ' + _RenderLineCol(self.data, pos))
+
+  def _PeekTok(self):
+    if self.tok_look_ahead is None:
+      self.tok_look_ahead = next(self.toks)
+    return self.tok_look_ahead
+
+  def _NextTok(self):
+    if self.tok_look_ahead is None:
+      return next(self.toks)
+    ret = self.tok_look_ahead
+    self.tok_look_ahead = None
+    return ret
+
+  def _EatTok(self, exp_t, tok_name=None):
+    t, lo, _ = self._NextTok()
+    if t != exp_t:
+      raise self._MakeErr('Bad token: Expect \'%s\'' % (tok_name or exp_t), lo)
+
+  def _NextIntOrString(self):
+    t, lo, hi = self._NextTok()
+    if t != '0' and t != 'S':
+      raise self._MakeErr('Expected number or string', lo)
+    value = eval(self.data[lo:hi])
+    return AnnotatedValue(value, lo, hi)
+
+  # Consumes separator ',' and returns whether |end_ch| is encountered.
+  def _EatSep(self, end_ch):
+    t, lo, _ = self._PeekTok()
+    if t == ',':
+      self._EatTok(',')
+      # Allow trailing ','.
+      t, _, _ = self._PeekTok()
+      return t == end_ch
+    elif t == end_ch:
+      return True
+    else:
+      raise self._MakeErr('Expect \',\' or \'%s\'' % end_ch, lo)
+
+  def _NextList(self):
+    self._EatTok('[')
+    ret = []
+    t, _, _ = self._PeekTok()
+    if t != ']':
+      while True:
+        ret.append(self._NextObject())
+        if self._EatSep(']'):
+          break
+    self._EatTok(']')
+    return ret
+
+  def _NextDict(self):
+    self._EatTok('{')
+    ret = {}
+    t, _, _ = self._PeekTok()
+    if t != '}':
+      while True:
+        k = self._NextIntOrString()
+        self._EatTok(':')
+        v = self._NextObject()
+        ret[k] = v
+        if self._EatSep('}'):
+          break
+    self._EatTok('}')
+    return ret
+
+  def _NextObject(self):
+    t, lo, _ = self._PeekTok()
+    if t == '[':
+      return self._NextList()
+    elif t == '{':
+      return self._NextDict()
+    elif t == '0' or t == 'S':
+      return self._NextIntOrString()
+    else:
+      raise self._MakeErr('Bad token: Type = %s' % t, lo)
+
+  def Parse(self):
+    root_obj = self._NextObject()
+    self._EatTok('E', 'EOF')
+    return root_obj
diff --git a/tools/grit/grit/tool/update_resource_ids/reader.py b/tools/grit/grit/tool/update_resource_ids/reader.py
new file mode 100644
index 0000000000..0a156d2deb
--- /dev/null
+++ b/tools/grit/grit/tool/update_resource_ids/reader.py
@@ -0,0 +1,83 @@
+# Copyright 2019 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.
+"""Helpers to read GRD files and estimate resource ID usages.
+
+This module uses grit.grd_reader to estimate resource ID usages in GRD
+(and GRDP) files by counting the occurrences of {include, message, structure}
+tags. This approach avoids the complexties of conditional inclusions, but
+produces a conservative estimate of ID usages.
+"""
+
+from __future__ import print_function
+
+import collections
+import os
+
+from grit import grd_reader
+from grit import util
+from grit.tool.update_resource_ids import common
+
+TAGS_OF_INTEREST = set(['include', 'message', 'structure'])
+
+def _CountResourceUsage(grd, seen_files):
+  tag_name_to_count = {tag: set() for tag in TAGS_OF_INTEREST}
+  # Pass '_chromium', but '_google_chrome' would produce the same result.
+  root = grd_reader.Parse(grd, defines={'_chromium': True})
+  seen_files.add(grd)
+  # Count all descendant tags, regardless of whether they're active.
+  for node in root.Preorder():
+    if node.name in TAGS_OF_INTEREST:
+      tag_name_to_count[node.name].add(node.attrs['name'])
+    elif node.name == 'part':
+      part_path = os.path.join(os.path.dirname(grd), node.GetInputPath())
+      seen_files.add(util.normpath(part_path))
+  return {k: len(v) for k, v in tag_name_to_count.items() if v}
+
+
+def GenerateResourceUsages(item_list, src_dir, fake, seen_files):
+  """Visits a list of ItemInfo to generate maps from tag name to usage.
+
+  Args:
+    root_obj: Root dict of a resource_ids file.
+    src_dir: Absolute directory of Chrome's src/ directory.
+    fake: For testing: Sets 10 as usages for all tags, to avoid reading GRD.
+    seen_files: A set to collect paths of files read.
+  Yields:
+    Tuple (item, tag_name_to_usage), where |item| is from |item_list| and
+      |tag_name_to_usage| is a dict() mapping tag name to (int) usage.
+  """
+  if fake:
+    for item in item_list:
+      tag_name_to_usage = collections.Counter({t.name: 10 for t in item.tags})
+      yield item, tag_name_to_usage
+    return
+  for item in item_list:
+    supported_tag_names = set(tag.name for tag in item.tags)
+    if item.meta and 'sizes' in item.meta:
+      # If META has "sizes" field, use it instead of reading GRD.
+      tag_name_to_usage = collections.Counter()
+      for k, vlist in item.meta['sizes'].items():
+        tag_name_to_usage[common.StripPlural(k.val)] = sum(v.val for v in vlist)
+      tag_names = set(tag_name_to_usage.keys())
+      if tag_names != supported_tag_names:
+        raise ValueError('META "sizes" field have identical fields as actual '
+                         '"sizes" field.')
+    else:
+      # Generated GRD start with '<(SHARED_INTERMEDIATE_DIR)'. Just check '<'.
+      if item.grd.startswith('<'):
+        raise ValueError('%s: Generated GRD must use META with "sizes" field '
+                         'to specify size bounds.' % item.grd)
+      grd_file = os.path.join(src_dir, item.grd)
+      if not os.path.exists(grd_file):
+        # Silently skip missing files so that src-internal files do not break
+        # public checkouts.
+        yield item, {}
+        continue
+      tag_name_to_usage = _CountResourceUsage(grd_file, seen_files)
+      tag_names = set(tag_name_to_usage.keys())
+      if not tag_names.issubset(supported_tag_names):
+        missing = [t + 's' for t in tag_names - supported_tag_names]
+        raise ValueError(
+            'Resource ids for %s needs entry for %s' % (item.grd, missing))
+    yield item, tag_name_to_usage
diff --git a/tools/grit/grit/tool/xmb.py b/tools/grit/grit/tool/xmb.py
new file mode 100644
index 0000000000..b821308369
--- /dev/null
+++ b/tools/grit/grit/tool/xmb.py
@@ -0,0 +1,295 @@
+# Copyright (c) 2012 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.
+
+"""The 'grit xmb' tool.
+"""
+
+from __future__ import print_function
+
+import getopt
+import os
+import sys
+
+from xml.sax import saxutils
+
+import six
+
+from grit import grd_reader
+from grit import lazy_re
+from grit import tclib
+from grit import util
+from grit.tool import interface
+
+
+# Used to collapse presentable content to determine if
+# xml:space="preserve" is needed.
+_WHITESPACES_REGEX = lazy_re.compile(r'\s\s*')
+
+
+# See XmlEscape below.
+_XML_QUOTE_ESCAPES = {
+    u"'":  u'&apos;',
+    u'"':  u'&quot;',
+}
+
+def _XmlEscape(s):
+  """Returns text escaped for XML in a way compatible with Google's
+  internal Translation Console tool.  May be used for attributes as
+  well as for contents.
+  """
+  return saxutils.escape(six.text_type(s), _XML_QUOTE_ESCAPES).encode('utf-8')
+
+
+def _WriteAttribute(file, name, value):
+  """Writes an XML attribute to the specified file.
+
+    Args:
+      file: file to write to
+      name: name of the attribute
+      value: (unescaped) value of the attribute
+    """
+  name = name.encode('utf-8')
+  if value:
+    file.write(b' %s="%s"' % (name, _XmlEscape(value)))
+
+
+def _WriteMessage(file, message):
+  presentable_content = message.GetPresentableContent()
+  assert (isinstance(presentable_content, six.string_types) or
+          (len(message.parts) == 1 and
+           type(message.parts[0] == tclib.Placeholder)))
+  preserve_space = presentable_content != _WHITESPACES_REGEX.sub(
+      u' ', presentable_content.strip())
+
+  file.write(b'<msg')
+  _WriteAttribute(file, 'desc', message.GetDescription())
+  _WriteAttribute(file, 'id', message.GetId())
+  _WriteAttribute(file, 'meaning', message.GetMeaning())
+  if preserve_space:
+    _WriteAttribute(file, 'xml:space', 'preserve')
+  file.write(b'>')
+  if not preserve_space:
+    file.write(b'\n  ')
+
+  parts = message.GetContent()
+  for part in parts:
+    if isinstance(part, tclib.Placeholder):
+      file.write(b'<ph')
+      _WriteAttribute(file, 'name', part.GetPresentation())
+      file.write(b'><ex>')
+      file.write(_XmlEscape(part.GetExample()))
+      file.write(b'</ex>')
+      file.write(_XmlEscape(part.GetOriginal()))
+      file.write(b'</ph>')
+    else:
+      file.write(_XmlEscape(part))
+  if not preserve_space:
+    file.write(b'\n')
+  file.write(b'</msg>\n')
+
+
+def WriteXmbFile(file, messages):
+  """Writes the given grit.tclib.Message items to the specified open
+  file-like object in the XMB format.
+  """
+  file.write(b"""<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE messagebundle [
+<!ELEMENT messagebundle (msg)*>
+<!ATTLIST messagebundle class CDATA #IMPLIED>
+
+<!ELEMENT msg (#PCDATA|ph|source)*>
+<!ATTLIST msg id CDATA #IMPLIED>
+<!ATTLIST msg seq CDATA #IMPLIED>
+<!ATTLIST msg name CDATA #IMPLIED>
+<!ATTLIST msg desc CDATA #IMPLIED>
+<!ATTLIST msg meaning CDATA #IMPLIED>
+<!ATTLIST msg obsolete (obsolete) #IMPLIED>
+<!ATTLIST msg xml:space (default|preserve) "default">
+<!ATTLIST msg is_hidden CDATA #IMPLIED>
+
+<!ELEMENT source (#PCDATA)>
+
+<!ELEMENT ph (#PCDATA|ex)*>
+<!ATTLIST ph name CDATA #REQUIRED>
+
+<!ELEMENT ex (#PCDATA)>
+]>
+<messagebundle>
+""")
+  for message in messages:
+    _WriteMessage(file, message)
+  file.write(b'</messagebundle>')
+
+
+class OutputXmb(interface.Tool):
+  """Outputs all translateable messages in the .grd input file to an
+.xmb file, which is the format used to give source messages to
+Google's internal Translation Console tool.  The format could easily
+be used for other systems.
+
+Usage: grit xmb [-i|-h] [-l LIMITFILE] OUTPUTPATH
+
+OUTPUTPATH is the path you want to output the .xmb file to.
+
+The -l option can be used to output only some of the resources to the .xmb file.
+LIMITFILE is the path to a file that is used to limit the items output to the
+xmb file.  If the filename extension is .grd, the file must be a .grd file
+and the tool only output the contents of nodes from the input file that also
+exist in the limit file (as compared on the 'name' attribute). Otherwise it must
+contain a list of the IDs that output should be limited to, one ID per line, and
+the tool will only output nodes with 'name' attributes that match one of the
+IDs.
+
+The -i option causes 'grit xmb' to output an "IDs only" file instead of an XMB
+file.  The "IDs only" file contains the message ID of each message that would
+normally be output to the XMB file, one message ID per line.  It is designed for
+use with the 'grit transl2tc' tool's -l option.
+
+Other options:
+
+  -D NAME[=VAL]     Specify a C-preprocessor-like define NAME with optional
+                    value VAL (defaults to 1) which will be used to control
+                    conditional inclusion of resources.
+
+  -E NAME=VALUE     Set environment variable NAME to VALUE (within grit).
+
+"""
+  # The different output formats supported by this tool
+  FORMAT_XMB = 0
+  FORMAT_IDS_ONLY = 1
+
+  def __init__(self, defines=None):
+    super(OutputXmb, self).__init__()
+    self.format = self.FORMAT_XMB
+    self.defines = defines or {}
+
+  def ShortDescription(self):
+    return 'Exports all translateable messages into an XMB file.'
+
+  def Run(self, opts, args):
+    os.environ['cwd'] = os.getcwd()
+
+    self.SetOptions(opts)
+
+    limit_file = None
+    limit_is_grd = False
+    limit_file_dir = None
+    own_opts, args = getopt.getopt(args, 'l:D:ih', ('help',))
+    for key, val in own_opts:
+      if key == '-l':
+        limit_file = open(val, 'r')
+        limit_file_dir = util.dirname(val)
+        if not len(limit_file_dir):
+          limit_file_dir = '.'
+        limit_is_grd = os.path.splitext(val)[1] == '.grd'
+      elif key == '-i':
+        self.format = self.FORMAT_IDS_ONLY
+      elif key == '-D':
+        name, val = util.ParseDefine(val)
+        self.defines[name] = val
+      elif key == '-E':
+        (env_name, env_value) = val.split('=', 1)
+        os.environ[env_name] = env_value
+      elif key == '--help':
+        self.ShowUsage()
+        sys.exit(0)
+    if not len(args) == 1:
+      print('grit xmb takes exactly one argument, the path to the XMB file '
+            'to output.')
+      return 2
+
+    xmb_path = args[0]
+    res_tree = grd_reader.Parse(opts.input, debug=opts.extra_verbose, defines=self.defines)
+    res_tree.SetOutputLanguage('en')
+    res_tree.SetDefines(self.defines)
+    res_tree.OnlyTheseTranslations([])
+    res_tree.RunGatherers()
+
+    with open(xmb_path, 'wb') as output_file:
+      self.Process(
+        res_tree, output_file, limit_file, limit_is_grd, limit_file_dir)
+    if limit_file:
+      limit_file.close()
+    print("Wrote %s" % xmb_path)
+
+  def Process(self, res_tree, output_file, limit_file=None, limit_is_grd=False,
+              dir=None):
+    """Writes a document with the contents of res_tree into output_file,
+    limiting output to the IDs specified in limit_file, which is a GRD file if
+    limit_is_grd is true, otherwise a file with one ID per line.
+
+    The format of the output document depends on this object's format attribute.
+    It can be FORMAT_XMB or FORMAT_IDS_ONLY.
+
+    The FORMAT_IDS_ONLY format causes this function to write just a list
+    of the IDs of all messages that would have been added to the XMB file, one
+    ID per line.
+
+    The FORMAT_XMB format causes this function to output the (default) XMB
+    format.
+
+    Args:
+      res_tree: base.Node()
+      output_file: file open for writing
+      limit_file: None or file open for reading
+      limit_is_grd: True | False
+      dir: Directory of the limit file
+    """
+    if limit_file:
+      if limit_is_grd:
+        limit_list = []
+        limit_tree = grd_reader.Parse(limit_file,
+                                      dir=dir,
+                                      debug=self.o.extra_verbose)
+        for node in limit_tree:
+          if 'name' in node.attrs:
+            limit_list.append(node.attrs['name'])
+      else:
+        # Not a GRD file, so it's just a file with one ID per line
+        limit_list = [item.strip() for item in limit_file.read().split('\n')]
+
+    ids_already_done = {}
+    messages = []
+    for node in res_tree:
+      if (limit_file and
+          not ('name' in node.attrs and node.attrs['name'] in limit_list)):
+        continue
+      if not node.IsTranslateable():
+        continue
+
+      for clique in node.GetCliques():
+        if not clique.IsTranslateable():
+          continue
+        if not clique.GetMessage().GetRealContent():
+          continue
+
+        # Some explanation is in order here.  Note that we can have
+        # many messages with the same ID.
+        #
+        # The way we work around this is to maintain a list of cliques
+        # per message ID (in the UberClique) and select the "best" one
+        # (the first one that has a description, or an arbitrary one
+        # if there is no description) for inclusion in the XMB file.
+        # The translations are all going to be the same for messages
+        # with the same ID, although the way we replace placeholders
+        # might be slightly different.
+        id = clique.GetMessage().GetId()
+        if id in ids_already_done:
+          continue
+        ids_already_done[id] = 1
+
+        message = node.UberClique().BestClique(id).GetMessage()
+        messages += [message]
+
+    # Ensure a stable order of messages, to help regression testing.
+    messages.sort(key=lambda x:x.GetId())
+
+    if self.format == self.FORMAT_IDS_ONLY:
+      # We just print the list of IDs to the output file.
+      for msg in messages:
+        output_file.write(msg.GetId())
+        output_file.write('\n')
+    else:
+      assert self.format == self.FORMAT_XMB
+      WriteXmbFile(output_file, messages)
diff --git a/tools/grit/grit/tool/xmb_unittest.py b/tools/grit/grit/tool/xmb_unittest.py
new file mode 100644
index 0000000000..3c7e92cee7
--- /dev/null
+++ b/tools/grit/grit/tool/xmb_unittest.py
@@ -0,0 +1,132 @@
+#!/usr/bin/env python
+# Copyright (c) 2012 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.
+
+'''Unit tests for 'grit xmb' tool.'''
+
+from __future__ import print_function
+
+import io
+import os
+import sys
+if __name__ == '__main__':
+  sys.path.append(os.path.join(os.path.dirname(__file__), '../..'))
+
+import unittest
+import xml.sax
+
+from six import StringIO
+
+from grit import grd_reader
+from grit import util
+from grit.tool import xmb
+
+
+class XmbUnittest(unittest.TestCase):
+  def setUp(self):
+    self.res_tree = grd_reader.Parse(
+        io.BytesIO(u'''<?xml version="1.0" encoding="UTF-8"?>
+      <grit latest_public_release="2" source_lang_id="en-US" current_release="3" base_dir=".">
+        <release seq="3">
+          <includes>
+            <include type="gif" name="ID_LOGO" file="images/logo.gif" />
+          </includes>
+          <messages>
+            <message name="GOOD" desc="sub" sub_variable="true">
+              excellent
+            </message>
+            <message name="IDS_GREETING" desc="Printed to greet the currently logged in user">
+              Hello <ph name="USERNAME">%s<ex>Joi</ex></ph>, are you doing [GOOD] today?
+            </message>
+            <message name="IDS_BONGOBINGO">
+              Yibbee
+            </message>
+            <message name="IDS_UNICODE">
+              Ol\xe1, \u4eca\u65e5\u306f! \U0001F60A
+            </message>
+          </messages>
+          <structures>
+            <structure type="dialog" name="IDD_SPACYBOX" encoding="utf-16" file="grit/testdata/klonk.rc" />
+          </structures>
+        </release>
+      </grit>'''.encode('utf-8')), '.')
+    self.xmb_file = io.BytesIO()
+
+  def testNormalOutput(self):
+    xmb.OutputXmb().Process(self.res_tree, self.xmb_file)
+    output = self.xmb_file.getvalue().decode('utf-8')
+    self.failUnless(output.count('Joi'))
+    self.failUnless(output.count('Yibbee'))
+    self.failUnless(output.count(u'Ol\xe1, \u4eca\u65e5\u306f! \U0001F60A'))
+
+  def testLimitList(self):
+    limit_file = StringIO(
+      'IDS_BONGOBINGO\nIDS_DOES_NOT_EXIST\nIDS_ALSO_DOES_NOT_EXIST')
+    xmb.OutputXmb().Process(self.res_tree, self.xmb_file, limit_file, False)
+    output = self.xmb_file.getvalue().decode('utf-8')
+    self.failUnless(output.count('Yibbee'))
+    self.failUnless(not output.count('Joi'))
+
+  def testLimitGrd(self):
+    limit_file = StringIO('''<?xml version="1.0" encoding="UTF-8"?>
+      <grit latest_public_release="2" source_lang_id="en-US" current_release="3" base_dir=".">
+        <release seq="3">
+          <messages>
+            <message name="IDS_GREETING" desc="Printed to greet the currently logged in user">
+              Hello <ph name="USERNAME">%s<ex>Joi</ex></ph>, how are you doing today?
+            </message>
+          </messages>
+        </release>
+      </grit>''')
+    tool = xmb.OutputXmb()
+    class DummyOpts(object):
+      extra_verbose = False
+    tool.o = DummyOpts()
+    tool.Process(self.res_tree, self.xmb_file, limit_file, True, dir='.')
+    output = self.xmb_file.getvalue().decode('utf-8')
+    self.failUnless(output.count('Joi'))
+    self.failUnless(not output.count('Yibbee'))
+
+  def testSubstitution(self):
+    self.res_tree.SetOutputLanguage('en')
+    os.chdir(util.PathFromRoot('.'))  # so it can find klonk.rc
+    self.res_tree.RunGatherers()
+    xmb.OutputXmb().Process(self.res_tree, self.xmb_file)
+    output = self.xmb_file.getvalue().decode('utf-8')
+    self.failUnless(output.count(
+        '<ph name="GOOD_1"><ex>excellent</ex>[GOOD]</ph>'))
+
+  def testLeadingTrailingWhitespace(self):
+    # Regression test for problems outputting messages with leading or
+    # trailing whitespace (these come in via structures only, as
+    # message nodes already strip and store whitespace).
+    self.res_tree.SetOutputLanguage('en')
+    os.chdir(util.PathFromRoot('.'))  # so it can find klonk.rc
+    self.res_tree.RunGatherers()
+    xmb.OutputXmb().Process(self.res_tree, self.xmb_file)
+    output = self.xmb_file.getvalue().decode('utf-8')
+    self.failUnless(output.count('OK ? </msg>'))
+
+  def testDisallowedChars(self):
+    # Validate that the invalid unicode is not accepted. Since it's not valid,
+    # we can't specify it in a string literal, so write as a byte sequence.
+    bad_xml = io.BytesIO()
+    bad_xml.write(b'''<?xml version="1.0" encoding="UTF-8"?>
+      <grit latest_public_release="2" source_lang_id="en-US"
+            current_release="3" base_dir=".">
+        <release seq="3">
+          <messages>
+            <message name="ID_FOO">''')
+    # UTF-8 corresponding to to \U00110000
+    # http://apps.timwhitlock.info/unicode/inspect/hex/110000
+    bad_xml.write(b'\xF4\x90\x80\x80')
+    bad_xml.write(b'''</message>
+          </messages>
+        </release>
+      </grit>''')
+    bad_xml.seek(0)
+    self.assertRaises(xml.sax.SAXParseException, grd_reader.Parse, bad_xml, '.')
+
+if __name__ == '__main__':
+  unittest.main()
diff --git a/tools/grit/grit/util.py b/tools/grit/grit/util.py
new file mode 100644
index 0000000000..98433d154c
--- /dev/null
+++ b/tools/grit/grit/util.py
@@ -0,0 +1,691 @@
+# Copyright (c) 2012 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.
+
+'''Utilities used by GRIT.
+'''
+
+from __future__ import print_function
+
+import codecs
+import io
+import os
+import re
+import shutil
+import sys
+import tempfile
+from xml.sax import saxutils
+
+import six
+from six import StringIO
+from six.moves import html_entities as entities
+
+from grit import lazy_re
+
+_root_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
+
+
+# Unique constants for use by ReadFile().
+BINARY = 0
+
+
+# Unique constants representing data pack encodings.
+_, UTF8, UTF16 = range(3)
+
+
+def Encode(message, encoding):
+  '''Returns a byte stream that represents |message| in the given |encoding|.'''
+  # |message| is a python unicode string, so convert to a byte stream that
+  # has the correct encoding requested for the datapacks. We skip the first
+  # 2 bytes of text resources because it is the BOM.
+  if encoding == UTF8:
+    return message.encode('utf8')
+  if encoding == UTF16:
+    return message.encode('utf16')[2:]
+  # Default is BINARY
+  return message
+
+
+# Matches all different types of linebreaks.
+LINEBREAKS = re.compile('\r\n|\n|\r')
+
+def MakeRelativePath(base_path, path_to_make_relative):
+  """Returns a relative path such from the base_path to
+  the path_to_make_relative.
+
+  In other words, os.join(base_path,
+    MakeRelativePath(base_path, path_to_make_relative))
+  is the same location as path_to_make_relative.
+
+  Args:
+    base_path: the root path
+    path_to_make_relative: an absolute path that is on the same drive
+      as base_path
+  """
+
+  def _GetPathAfterPrefix(prefix_path, path_with_prefix):
+    """Gets the subpath within in prefix_path for the path_with_prefix
+    with no beginning or trailing path separators.
+
+    Args:
+      prefix_path: the base path
+      path_with_prefix: a path that starts with prefix_path
+    """
+    assert path_with_prefix.startswith(prefix_path)
+    path_without_prefix = path_with_prefix[len(prefix_path):]
+    normalized_path = os.path.normpath(path_without_prefix.strip(os.path.sep))
+    if normalized_path == '.':
+      normalized_path = ''
+    return normalized_path
+
+  def _GetCommonBaseDirectory(*args):
+    """Returns the common prefix directory for the given paths
+
+    Args:
+      The list of paths (at least one of which should be a directory)
+    """
+    prefix = os.path.commonprefix(args)
+    # prefix is a character-by-character prefix (i.e. it does not end
+    # on a directory bound, so this code fixes that)
+
+    # if the prefix ends with the separator, then it is prefect.
+    if len(prefix) > 0 and prefix[-1] == os.path.sep:
+      return prefix
+
+    # We need to loop through all paths or else we can get
+    # tripped up by "c:\a" and "c:\abc".  The common prefix
+    # is "c:\a" which is a directory and looks good with
+    # respect to the first directory but it is clear that
+    # isn't a common directory when the second path is
+    # examined.
+    for path in args:
+      assert len(path) >= len(prefix)
+      # If the prefix the same length as the path,
+      # then the prefix must be a directory (since one
+      # of the arguements should be a directory).
+      if path == prefix:
+        continue
+      # if the character after the prefix in the path
+      # is the separator, then the prefix appears to be a
+      # valid a directory as well for the given path
+      if path[len(prefix)] == os.path.sep:
+        continue
+      # Otherwise, the prefix is not a directory, so it needs
+      # to be shortened to be one
+      index_sep = prefix.rfind(os.path.sep)
+      # The use "index_sep + 1" because it includes the final sep
+      # and it handles the case when the index_sep is -1 as well
+      prefix = prefix[:index_sep + 1]
+      # At this point we backed up to a directory bound which is
+      # common to all paths, so we can quit going through all of
+      # the paths.
+      break
+    return prefix
+
+  prefix =  _GetCommonBaseDirectory(base_path, path_to_make_relative)
+  # If the paths had no commonality at all, then return the absolute path
+  # because it is the best that can be done.  If the path had to be relative
+  # then eventually this absolute path will be discovered (when a build breaks)
+  # and an appropriate fix can be made, but having this allows for the best
+  # backward compatibility with the absolute path behavior in the past.
+  if len(prefix) <= 0:
+    return path_to_make_relative
+  # Build a path from the base dir to the common prefix
+  remaining_base_path = _GetPathAfterPrefix(prefix, base_path)
+
+  #  The follow handles two case: "" and "foo\\bar"
+  path_pieces = remaining_base_path.split(os.path.sep)
+  base_depth_from_prefix = len([d for d in path_pieces if len(d)])
+  base_to_prefix = (".." + os.path.sep) * base_depth_from_prefix
+
+  # Put add in the path from the prefix to the path_to_make_relative
+  remaining_other_path = _GetPathAfterPrefix(prefix, path_to_make_relative)
+  return base_to_prefix + remaining_other_path
+
+
+KNOWN_SYSTEM_IDENTIFIERS = set()
+
+SYSTEM_IDENTIFIERS = None
+
+def SetupSystemIdentifiers(ids):
+  '''Adds ids to a regexp of known system identifiers.
+
+  Can be called many times, ids will be accumulated.
+
+  Args:
+    ids: an iterable of strings
+  '''
+  KNOWN_SYSTEM_IDENTIFIERS.update(ids)
+  global SYSTEM_IDENTIFIERS
+  SYSTEM_IDENTIFIERS = lazy_re.compile(
+      ' | '.join([r'\b%s\b' % i for i in KNOWN_SYSTEM_IDENTIFIERS]),
+      re.VERBOSE)
+
+
+# Matches all of the resource IDs predefined by Windows.
+SetupSystemIdentifiers((
+    'IDOK', 'IDCANCEL', 'IDC_STATIC', 'IDYES', 'IDNO',
+    'ID_FILE_NEW', 'ID_FILE_OPEN', 'ID_FILE_CLOSE', 'ID_FILE_SAVE',
+    'ID_FILE_SAVE_AS', 'ID_FILE_PAGE_SETUP', 'ID_FILE_PRINT_SETUP',
+    'ID_FILE_PRINT', 'ID_FILE_PRINT_DIRECT', 'ID_FILE_PRINT_PREVIEW',
+    'ID_FILE_UPDATE', 'ID_FILE_SAVE_COPY_AS', 'ID_FILE_SEND_MAIL',
+    'ID_FILE_MRU_FIRST', 'ID_FILE_MRU_LAST',
+    'ID_EDIT_CLEAR', 'ID_EDIT_CLEAR_ALL', 'ID_EDIT_COPY',
+    'ID_EDIT_CUT', 'ID_EDIT_FIND', 'ID_EDIT_PASTE', 'ID_EDIT_PASTE_LINK',
+    'ID_EDIT_PASTE_SPECIAL', 'ID_EDIT_REPEAT', 'ID_EDIT_REPLACE',
+    'ID_EDIT_SELECT_ALL', 'ID_EDIT_UNDO', 'ID_EDIT_REDO',
+    'VS_VERSION_INFO', 'IDRETRY',
+    'ID_APP_ABOUT', 'ID_APP_EXIT',
+    'ID_NEXT_PANE', 'ID_PREV_PANE',
+    'ID_WINDOW_NEW', 'ID_WINDOW_ARRANGE', 'ID_WINDOW_CASCADE',
+    'ID_WINDOW_TILE_HORZ', 'ID_WINDOW_TILE_VERT', 'ID_WINDOW_SPLIT',
+    'ATL_IDS_SCSIZE', 'ATL_IDS_SCMOVE', 'ATL_IDS_SCMINIMIZE',
+    'ATL_IDS_SCMAXIMIZE', 'ATL_IDS_SCNEXTWINDOW', 'ATL_IDS_SCPREVWINDOW',
+    'ATL_IDS_SCCLOSE', 'ATL_IDS_SCRESTORE', 'ATL_IDS_SCTASKLIST',
+    'ATL_IDS_MDICHILD', 'ATL_IDS_IDLEMESSAGE', 'ATL_IDS_MRU_FILE' ))
+
+
+# Matches character entities, whether specified by name, decimal or hex.
+_HTML_ENTITY = lazy_re.compile(
+  '&(#(?P<decimal>[0-9]+)|#x(?P<hex>[a-fA-F0-9]+)|(?P<named>[a-z0-9]+));',
+  re.IGNORECASE)
+
+# Matches characters that should be HTML-escaped.  This is <, > and &, but only
+# if the & is not the start of an HTML character entity.
+_HTML_CHARS_TO_ESCAPE = lazy_re.compile(
+    '"|<|>|&(?!#[0-9]+|#x[0-9a-z]+|[a-z]+;)',
+    re.IGNORECASE | re.MULTILINE)
+
+
+def ReadFile(filename, encoding):
+  '''Reads and returns the entire contents of the given file.
+
+  Args:
+    filename: The path to the file.
+    encoding: A Python codec name or the special value: BINARY to read
+              the file in binary mode.
+  '''
+  if encoding == BINARY:
+    mode = 'rb'
+    encoding = None
+  else:
+    mode = 'rU'
+
+  with io.open(filename, mode, encoding=encoding) as f:
+    return f.read()
+
+
+def WrapOutputStream(stream, encoding = 'utf-8'):
+  '''Returns a stream that wraps the provided stream, making it write
+  characters using the specified encoding.'''
+  return codecs.getwriter(encoding)(stream)
+
+
+def ChangeStdoutEncoding(encoding = 'utf-8'):
+  '''Changes STDOUT to print characters using the specified encoding.'''
+  # If we're unittesting, don't reconfigure.
+  if isinstance(sys.stdout, StringIO):
+    return
+
+  if sys.version_info.major < 3:
+    # Python 2 has binary streams by default, so reconfigure directly.
+    sys.stdout = WrapOutputStream(sys.stdout, encoding)
+    sys.stderr = WrapOutputStream(sys.stderr, encoding)
+  elif sys.version_info < (3, 7):
+    # Python 3 has text streams by default, so we have to detach them first.
+    sys.stdout = WrapOutputStream(sys.stdout.detach(), encoding)
+    sys.stderr = WrapOutputStream(sys.stderr.detach(), encoding)
+  else:
+    # Python 3.7+ provides an API for this specifically.
+    sys.stdout.reconfigure(encoding=encoding)
+    sys.stderr.reconfigure(encoding=encoding)
+
+
+def EscapeHtml(text, escape_quotes = False):
+  '''Returns 'text' with <, > and & (and optionally ") escaped to named HTML
+  entities.  Any existing named entity or HTML entity defined by decimal or
+  hex code will be left untouched.  This is appropriate for escaping text for
+  inclusion in HTML, but not for XML.
+  '''
+  def Replace(match):
+    if match.group() == '&': return '&amp;'
+    elif match.group() == '<': return '&lt;'
+    elif match.group() == '>': return '&gt;'
+    elif match.group() == '"':
+      if escape_quotes: return '&quot;'
+      else: return match.group()
+    else: assert False
+  out = _HTML_CHARS_TO_ESCAPE.sub(Replace, text)
+  return out
+
+
+def UnescapeHtml(text, replace_nbsp=True):
+  '''Returns 'text' with all HTML character entities (both named character
+  entities and those specified by decimal or hexadecimal Unicode ordinal)
+  replaced by their Unicode characters (or latin1 characters if possible).
+
+  The only exception is that &nbsp; will not be escaped if 'replace_nbsp' is
+  False.
+  '''
+  def Replace(match):
+    groups = match.groupdict()
+    if groups['hex']:
+      return six.unichr(int(groups['hex'], 16))
+    elif groups['decimal']:
+      return six.unichr(int(groups['decimal'], 10))
+    else:
+      name = groups['named']
+      if name == 'nbsp' and not replace_nbsp:
+        return match.group()  # Don't replace &nbsp;
+      assert name != None
+      if name in entities.name2codepoint:
+        return six.unichr(entities.name2codepoint[name])
+      else:
+        return match.group()  # Unknown HTML character entity - don't replace
+
+  out = _HTML_ENTITY.sub(Replace, text)
+  return out
+
+
+def EncodeCdata(cdata):
+  '''Returns the provided cdata in either escaped format or <![CDATA[xxx]]>
+  format, depending on which is more appropriate for easy editing.  The data
+  is escaped for inclusion in an XML element's body.
+
+  Args:
+    cdata: 'If x < y and y < z then x < z'
+
+  Return:
+    '<![CDATA[If x < y and y < z then x < z]]>'
+  '''
+  if cdata.count('<') > 1 or cdata.count('>') > 1 and cdata.count(']]>') == 0:
+    return '<![CDATA[%s]]>' % cdata
+  else:
+    return saxutils.escape(cdata)
+
+
+def FixupNamedParam(function, param_name, param_value):
+  '''Returns a closure that is identical to 'function' but ensures that the
+  named parameter 'param_name' is always set to 'param_value' unless explicitly
+  set by the caller.
+
+  Args:
+    function: callable
+    param_name: 'bingo'
+    param_value: 'bongo' (any type)
+
+  Return:
+    callable
+  '''
+  def FixupClosure(*args, **kw):
+    if not param_name in kw:
+      kw[param_name] = param_value
+    return function(*args, **kw)
+  return FixupClosure
+
+
+def PathFromRoot(path):
+  r'''Takes a path relative to the root directory for GRIT (the one that grit.py
+  resides in) and returns a path that is either absolute or relative to the
+  current working directory (i.e .a path you can use to open the file).
+
+  Args:
+    path: 'rel_dir\file.ext'
+
+  Return:
+    'c:\src\tools\rel_dir\file.ext
+  '''
+  return os.path.normpath(os.path.join(_root_dir, path))
+
+
+def ParseGrdForUnittest(body, base_dir=None, predetermined_ids_file=None,
+                        run_gatherers=False):
+  '''Parse a skeleton .grd file and return it, for use in unit tests.
+
+  Args:
+    body: XML that goes inside the <release> element.
+    base_dir: The base_dir attribute of the <grit> tag.
+  '''
+  from grit import grd_reader
+  if isinstance(body, six.text_type):
+    body = body.encode('utf-8')
+  if base_dir is None:
+    base_dir = PathFromRoot('.')
+  lines = [b'<?xml version="1.0" encoding="UTF-8"?>']
+  lines.append(b'<grit latest_public_release="2" current_release="3" '
+               b'source_lang_id="en" base_dir="%s">' % base_dir.encode('utf-8'))
+  if b'<outputs>' in body:
+    lines.append(body)
+  else:
+    lines.append(b'  <outputs></outputs>')
+    lines.append(b'  <release seq="3">')
+    lines.append(body)
+    lines.append(b'  </release>')
+  lines.append(b'</grit>')
+  ret = grd_reader.Parse(io.BytesIO(b'\n'.join(lines)), dir='.')
+  ret.SetOutputLanguage('en')
+  if run_gatherers:
+    ret.RunGatherers()
+  ret.SetPredeterminedIdsFile(predetermined_ids_file)
+  ret.InitializeIds()
+  return ret
+
+
+def StripBlankLinesAndComments(text):
+  '''Strips blank lines and comments from C source code, for unit tests.'''
+  return '\n'.join(line for line in text.splitlines()
+                        if line and not line.startswith('//'))
+
+
+def dirname(filename):
+  '''Version of os.path.dirname() that never returns empty paths (returns
+  '.' if the result of os.path.dirname() is empty).
+  '''
+  ret = os.path.dirname(filename)
+  if ret == '':
+    ret = '.'
+  return ret
+
+
+def normpath(path):
+  '''Version of os.path.normpath that also changes backward slashes to
+  forward slashes when not running on Windows.
+  '''
+  # This is safe to always do because the Windows version of os.path.normpath
+  # will replace forward slashes with backward slashes.
+  path = path.replace('\\', '/')
+  return os.path.normpath(path)
+
+
+_LANGUAGE_SPLIT_RE = lazy_re.compile('-|_|/')
+
+
+def CanonicalLanguage(code):
+  '''Canonicalizes two-part language codes by using a dash and making the
+  second part upper case.  Returns one-part language codes unchanged.
+
+  Args:
+    code: 'zh_cn'
+
+  Return:
+    code: 'zh-CN'
+  '''
+  parts = _LANGUAGE_SPLIT_RE.split(code)
+  code = [ parts[0] ]
+  for part in parts[1:]:
+    code.append(part.upper())
+  return '-'.join(code)
+
+
+_LANG_TO_CODEPAGE = {
+  'en' : 1252,
+  'fr' : 1252,
+  'it' : 1252,
+  'de' : 1252,
+  'es' : 1252,
+  'nl' : 1252,
+  'sv' : 1252,
+  'no' : 1252,
+  'da' : 1252,
+  'fi' : 1252,
+  'pt-BR' : 1252,
+  'ru' : 1251,
+  'ja' : 932,
+  'zh-TW' : 950,
+  'zh-CN' : 936,
+  'ko' : 949,
+}
+
+
+def LanguageToCodepage(lang):
+  '''Returns the codepage _number_ that can be used to represent 'lang', which
+  may be either in formats such as 'en', 'pt_br', 'pt-BR', etc.
+
+  The codepage returned will be one of the 'cpXXXX' codepage numbers.
+
+  Args:
+    lang: 'de'
+
+  Return:
+    1252
+  '''
+  lang = CanonicalLanguage(lang)
+  if lang in _LANG_TO_CODEPAGE:
+    return _LANG_TO_CODEPAGE[lang]
+  else:
+    print("Not sure which codepage to use for %s, assuming cp1252" % lang)
+    return 1252
+
+def NewClassInstance(class_name, class_type):
+  '''Returns an instance of the class specified in classname
+
+  Args:
+    class_name: the fully qualified, dot separated package + classname,
+    i.e. "my.package.name.MyClass". Short class names are not supported.
+    class_type: the class or superclass this object must implement
+
+  Return:
+    An instance of the class, or None if none was found
+  '''
+  lastdot = class_name.rfind('.')
+  module_name = ''
+  if lastdot >= 0:
+    module_name = class_name[0:lastdot]
+    if module_name:
+      class_name = class_name[lastdot+1:]
+      module = __import__(module_name, globals(), locals(), [''])
+      if hasattr(module, class_name):
+        class_ = getattr(module, class_name)
+        class_instance = class_()
+        if isinstance(class_instance, class_type):
+          return class_instance
+  return None
+
+
+def FixLineEnd(text, line_end):
+  # First normalize
+  text = text.replace('\r\n', '\n')
+  text = text.replace('\r', '\n')
+  # Then fix
+  text = text.replace('\n', line_end)
+  return text
+
+
+def BoolToString(bool):
+  if bool:
+    return 'true'
+  else:
+    return 'false'
+
+
+verbose = False
+extra_verbose = False
+
+def IsVerbose():
+  return verbose
+
+def IsExtraVerbose():
+  return extra_verbose
+
+def ParseDefine(define):
+  '''Parses a define argument and returns the name and value.
+
+  The format is either "NAME=VAL" or "NAME", using True as the default value.
+  Values of "1"/"true" and "0"/"false" are transformed to True and False
+  respectively.
+
+  Args:
+    define: a string of the form "NAME=VAL" or "NAME".
+
+  Returns:
+    A (name, value) pair. name is a string, value a string or boolean.
+  '''
+  parts = [part.strip() for part in define.split('=', 1)]
+  assert len(parts) >= 1
+  name = parts[0]
+  val = True
+  if len(parts) > 1:
+    val = parts[1]
+  if val == "1" or val == "true": val = True
+  elif val == "0" or val == "false": val = False
+  return (name, val)
+
+
+class Substituter(object):
+  '''Finds and substitutes variable names in text strings.
+
+  Given a dictionary of variable names and values, prepares to
+  search for patterns of the form [VAR_NAME] in a text.
+  The value will be substituted back efficiently.
+  Also applies to tclib.Message objects.
+  '''
+
+  def __init__(self):
+    '''Create an empty substituter.'''
+    self.substitutions_ = {}
+    self.dirty_ = True
+
+  def AddSubstitutions(self, subs):
+    '''Add new values to the substitutor.
+
+    Args:
+      subs: A dictionary of new substitutions.
+    '''
+    self.substitutions_.update(subs)
+    self.dirty_ = True
+
+  def AddMessages(self, messages, lang):
+    '''Adds substitutions extracted from node.Message objects.
+
+    Args:
+      messages: a list of node.Message objects.
+      lang: The translation language to use in substitutions.
+    '''
+    subs = [(str(msg.attrs['name']), msg.Translate(lang)) for msg in messages]
+    self.AddSubstitutions(dict(subs))
+    self.dirty_ = True
+
+  def GetExp(self):
+    '''Obtain a regular expression that will find substitution keys in text.
+
+    Create and cache if the substituter has been updated. Use the cached value
+    otherwise. Keys will be enclosed in [square brackets] in text.
+
+    Returns:
+      A regular expression object.
+    '''
+    if self.dirty_:
+      components = [r'\[%s\]' % (k,) for k in self.substitutions_]
+      self.exp = re.compile(r'(%s)' % ('|'.join(components),))
+      self.dirty_ = False
+    return self.exp
+
+  def Substitute(self, text):
+    '''Substitute the variable values in the given text.
+
+    Text of the form [message_name] will be replaced by the message's value.
+
+    Args:
+      text: A string of text.
+
+    Returns:
+      A string of text with substitutions done.
+    '''
+    return ''.join([self._SubFragment(f) for f in self.GetExp().split(text)])
+
+  def _SubFragment(self, fragment):
+    '''Utility function for Substitute.
+
+    Performs a simple substitution if the fragment is exactly of the form
+    [message_name].
+
+    Args:
+      fragment: A simple string.
+
+    Returns:
+      A string with the substitution done.
+    '''
+    if len(fragment) > 2 and fragment[0] == '[' and fragment[-1] == ']':
+      sub = self.substitutions_.get(fragment[1:-1], None)
+      if sub is not None:
+        return sub
+    return fragment
+
+  def SubstituteMessage(self, msg):
+    '''Apply substitutions to a tclib.Message object.
+
+    Text of the form [message_name] will be replaced by a new placeholder,
+    whose presentation will take the form the message_name_{UsageCount}, and
+    whose example will be the message's value. Existing placeholders are
+    not affected.
+
+    Args:
+      msg: A tclib.Message object.
+
+    Returns:
+      A tclib.Message object, with substitutions done.
+    '''
+    from grit import tclib  # avoid circular import
+    counts = {}
+    text = msg.GetPresentableContent()
+    placeholders = []
+    newtext = ''
+    for f in self.GetExp().split(text):
+      sub = self._SubFragment(f)
+      if f != sub:
+        f = str(f)
+        count = counts.get(f, 0) + 1
+        counts[f] = count
+        name = "%s_%d" % (f[1:-1], count)
+        placeholders.append(tclib.Placeholder(name, f, sub))
+        newtext += name
+      else:
+        newtext += f
+    if placeholders:
+      return tclib.Message(newtext, msg.GetPlaceholders() + placeholders,
+                           msg.GetDescription(), msg.GetMeaning())
+    else:
+      return msg
+
+
+class TempDir(object):
+  '''Creates files with the specified contents in a temporary directory,
+  for unit testing.
+  '''
+
+  def __init__(self, file_data, mode='w'):
+    self._tmp_dir_name = tempfile.mkdtemp()
+    assert not os.listdir(self.GetPath())
+    for name, contents in file_data.items():
+      file_path = self.GetPath(name)
+      dir_path = os.path.split(file_path)[0]
+      if not os.path.exists(dir_path):
+        os.makedirs(dir_path)
+      with open(file_path, mode) as f:
+        f.write(file_data[name])
+
+  def __enter__(self):
+    return self
+
+  def __exit__(self, *exc_info):
+    self.CleanUp()
+
+  def CleanUp(self):
+    shutil.rmtree(self.GetPath())
+
+  def GetPath(self, name=''):
+    name = os.path.join(self._tmp_dir_name, name)
+    assert name.startswith(self._tmp_dir_name)
+    return name
+
+  def AsCurrentDir(self):
+    return self._AsCurrentDirClass(self.GetPath())
+
+  class _AsCurrentDirClass(object):
+    def __init__(self, path):
+      self.path = path
+    def __enter__(self):
+      self.oldpath = os.getcwd()
+      os.chdir(self.path)
+    def __exit__(self, *exc_info):
+      os.chdir(self.oldpath)
diff --git a/tools/grit/grit/util_unittest.py b/tools/grit/grit/util_unittest.py
new file mode 100644
index 0000000000..7d6efaf858
--- /dev/null
+++ b/tools/grit/grit/util_unittest.py
@@ -0,0 +1,118 @@
+#!/usr/bin/env python
+# Copyright (c) 2012 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.
+
+'''Unit test that checks some of util functions.
+'''
+
+from __future__ import print_function
+
+import os
+import sys
+if __name__ == '__main__':
+  sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
+
+import unittest
+
+import six
+
+from grit import util
+
+
+class UtilUnittest(unittest.TestCase):
+  ''' Tests functions from util
+  '''
+
+  def testNewClassInstance(self):
+    # Test short class name with no fully qualified package name
+    # Should fail, it is not supported by the function now (as documented)
+    cls = util.NewClassInstance('grit.util.TestClassToLoad',
+                                TestBaseClassToLoad)
+    self.failUnless(cls == None)
+
+    # Test non existent class name
+    cls = util.NewClassInstance('grit.util_unittest.NotExistingClass',
+                                TestBaseClassToLoad)
+    self.failUnless(cls == None)
+
+    # Test valid class name and valid base class
+    cls = util.NewClassInstance('grit.util_unittest.TestClassToLoad',
+                                TestBaseClassToLoad)
+    self.failUnless(isinstance(cls, TestBaseClassToLoad))
+
+    # Test valid class name with wrong hierarchy
+    cls = util.NewClassInstance('grit.util_unittest.TestClassNoBase',
+                                TestBaseClassToLoad)
+    self.failUnless(cls == None)
+
+  def testCanonicalLanguage(self):
+    self.failUnless(util.CanonicalLanguage('en') == 'en')
+    self.failUnless(util.CanonicalLanguage('pt_br') == 'pt-BR')
+    self.failUnless(util.CanonicalLanguage('pt-br') == 'pt-BR')
+    self.failUnless(util.CanonicalLanguage('pt-BR') == 'pt-BR')
+    self.failUnless(util.CanonicalLanguage('pt/br') == 'pt-BR')
+    self.failUnless(util.CanonicalLanguage('pt/BR') == 'pt-BR')
+    self.failUnless(util.CanonicalLanguage('no_no_bokmal') == 'no-NO-BOKMAL')
+
+  def testUnescapeHtml(self):
+    self.failUnless(util.UnescapeHtml('&#1010;') == six.unichr(1010))
+    self.failUnless(util.UnescapeHtml('&#xABcd;') == six.unichr(43981))
+
+  def testRelativePath(self):
+    """ Verify that MakeRelativePath works in some tricky cases."""
+
+    def TestRelativePathCombinations(base_path, other_path, expected_result):
+      """ Verify that the relative path function works for
+      the given paths regardless of whether or not they end with
+      a trailing slash."""
+      for path1 in [base_path, base_path + os.path.sep]:
+        for path2 in [other_path, other_path + os.path.sep]:
+          result = util.MakeRelativePath(path1, path2)
+          self.failUnless(result == expected_result)
+
+    # set-up variables
+    root_dir = 'c:%sa' % os.path.sep
+    result1 = '..%sabc' % os.path.sep
+    path1 = root_dir + 'bc'
+    result2 = 'bc'
+    path2 = '%s%s%s' % (root_dir, os.path.sep, result2)
+    # run the tests
+    TestRelativePathCombinations(root_dir, path1, result1)
+    TestRelativePathCombinations(root_dir, path2, result2)
+
+  def testReadFile(self):
+    def Test(data, encoding, expected_result):
+      with open('testfile', 'wb') as f:
+        f.write(data)
+      self.assertEqual(util.ReadFile('testfile', encoding), expected_result)
+
+    test_std_newline = b'\xEF\xBB\xBFabc\ndef'  # EF BB BF is UTF-8 BOM
+    newlines = [b'\n', b'\r\n', b'\r']
+
+    with util.TempDir({}) as tmp_dir:
+      with tmp_dir.AsCurrentDir():
+        for newline in newlines:
+          test = test_std_newline.replace(b'\n', newline)
+          Test(test, util.BINARY, test)
+          # utf-8 doesn't strip BOM
+          Test(test, 'utf-8', test_std_newline.decode('utf-8'))
+          # utf-8-sig strips BOM
+          Test(test, 'utf-8-sig', test_std_newline.decode('utf-8')[1:])
+          # test another encoding
+          Test(test, 'cp1252', test_std_newline.decode('cp1252'))
+        self.assertRaises(UnicodeDecodeError, Test, b'\x80', 'utf-8', None)
+
+
+class TestBaseClassToLoad(object):
+  pass
+
+class TestClassToLoad(TestBaseClassToLoad):
+  pass
+
+class TestClassNoBase(object):
+  pass
+
+
+if __name__ == '__main__':
+  unittest.main()
diff --git a/tools/grit/grit/xtb_reader.py b/tools/grit/grit/xtb_reader.py
new file mode 100644
index 0000000000..e0f842588a
--- /dev/null
+++ b/tools/grit/grit/xtb_reader.py
@@ -0,0 +1,140 @@
+# Copyright (c) 2012 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.
+
+'''Fast and efficient parser for XTB files.
+'''
+
+from __future__ import print_function
+
+import sys
+import xml.sax
+import xml.sax.handler
+
+import grit.node.base
+
+
+class XtbContentHandler(xml.sax.handler.ContentHandler):
+  '''A content handler that calls a given callback function for each
+  translation in the XTB file.
+  '''
+
+  def __init__(self, callback, defs=None, debug=False, target_platform=None):
+    self.callback = callback
+    self.debug = debug
+    # 0 if we are not currently parsing a translation, otherwise the message
+    # ID of that translation.
+    self.current_id = 0
+    # Empty if we are not currently parsing a translation, otherwise the
+    # parts we have for that translation - a list of tuples
+    # (is_placeholder, text)
+    self.current_structure = []
+    # Set to the language ID when we see the <translationbundle> node.
+    self.language = ''
+    # Keep track of the if block we're inside.  We can't nest ifs.
+    self.if_expr = None
+    # Root defines to be used with if expr.
+    if defs:
+      self.defines = defs
+    else:
+      self.defines = {}
+    # Target platform for build.
+    if target_platform:
+      self.target_platform = target_platform
+    else:
+      self.target_platform = sys.platform
+
+  def startElement(self, name, attrs):
+    if name == 'translation':
+      assert self.current_id == 0 and len(self.current_structure) == 0, (
+              "Didn't expect a <translation> element here.")
+      self.current_id = attrs.getValue('id')
+    elif name == 'ph':
+      assert self.current_id != 0, "Didn't expect a <ph> element here."
+      self.current_structure.append((True, attrs.getValue('name')))
+    elif name == 'translationbundle':
+      self.language = attrs.getValue('lang')
+    elif name in ('if', 'then', 'else'):
+      assert self.if_expr is None, "Can't nest <if> or use <else> in xtb files"
+      self.if_expr = attrs.getValue('expr')
+
+  def endElement(self, name):
+    if name == 'translation':
+      assert self.current_id != 0
+
+      defs = self.defines
+      def pp_ifdef(define):
+        return define in defs
+      def pp_if(define):
+        return define in defs and defs[define]
+
+      # If we're in an if block, only call the callback (add the translation)
+      # if the expression is True.
+      should_run_callback = True
+      if self.if_expr:
+        should_run_callback = grit.node.base.Node.EvaluateExpression(
+            self.if_expr, self.defines, self.target_platform)
+      if should_run_callback:
+        self.callback(self.current_id, self.current_structure)
+
+      self.current_id = 0
+      self.current_structure = []
+    elif name == 'if':
+      assert self.if_expr is not None
+      self.if_expr = None
+
+  def characters(self, content):
+    if self.current_id != 0:
+      # We are inside a <translation> node so just add the characters to our
+      # structure.
+      #
+      # This naive way of handling characters is OK because in the XTB format,
+      # <ph> nodes are always empty (always <ph name="XXX"/>) and whitespace
+      # inside the <translation> node should be preserved.
+      self.current_structure.append((False, content))
+
+
+class XtbErrorHandler(xml.sax.handler.ErrorHandler):
+  def error(self, exception):
+    pass
+
+  def fatalError(self, exception):
+    raise exception
+
+  def warning(self, exception):
+    pass
+
+
+def Parse(xtb_file, callback_function, defs=None, debug=False,
+          target_platform=None):
+  '''Parse xtb_file, making a call to callback_function for every translation
+  in the XTB file.
+
+  The callback function must have the signature as described below.  The 'parts'
+  parameter is a list of tuples (is_placeholder, text).  The 'text' part is
+  either the raw text (if is_placeholder is False) or the name of the placeholder
+  (if is_placeholder is True).
+
+  Args:
+    xtb_file:           open('fr.xtb', 'rb')
+    callback_function:  def Callback(msg_id, parts): pass
+    defs:               None, or a dictionary of preprocessor definitions.
+    debug:              Default False. Set True for verbose debug output.
+    target_platform:    None, or a sys.platform-like identifier of the build
+                        target platform.
+
+  Return:
+    The language of the XTB, e.g. 'fr'
+  '''
+  # Start by advancing the file pointer past the DOCTYPE thing, as the TC
+  # uses a path to the DTD that only works in Unix.
+  # TODO(joi) Remove this ugly hack by getting the TC gang to change the
+  # XTB files somehow?
+  front_of_file = xtb_file.read(1024)
+  xtb_file.seek(front_of_file.find(b'<translationbundle'))
+
+  handler = XtbContentHandler(callback=callback_function, defs=defs,
+                              debug=debug, target_platform=target_platform)
+  xml.sax.parse(xtb_file, handler)
+  assert handler.language != ''
+  return handler.language
diff --git a/tools/grit/grit/xtb_reader_unittest.py b/tools/grit/grit/xtb_reader_unittest.py
new file mode 100644
index 0000000000..79c0ac9ef1
--- /dev/null
+++ b/tools/grit/grit/xtb_reader_unittest.py
@@ -0,0 +1,110 @@
+#!/usr/bin/env python
+# Copyright (c) 2012 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.
+
+'''Unit tests for grit.xtb_reader'''
+
+from __future__ import print_function
+
+import io
+import os
+import sys
+if __name__ == '__main__':
+  sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
+
+import unittest
+
+from grit import util
+from grit import xtb_reader
+from grit.node import empty
+
+
+class XtbReaderUnittest(unittest.TestCase):
+  def testParsing(self):
+    xtb_file = io.BytesIO(b'''<?xml version="1.0" encoding="UTF-8"?>
+      <!DOCTYPE translationbundle>
+      <translationbundle lang="fr">
+        <translation id="5282608565720904145">Bingo.</translation>
+        <translation id="2955977306445326147">Bongo longo.</translation>
+        <translation id="238824332917605038">Hullo</translation>
+        <translation id="6629135689895381486"><ph name="PROBLEM_REPORT"/> peut <ph name="START_LINK"/>utilisation excessive de majuscules<ph name="END_LINK"/>.</translation>
+        <translation id="7729135689895381486">Hello
+this is another line
+and another
+
+and another after a blank line.</translation>
+      </translationbundle>''')
+
+    messages = []
+    def Callback(id, structure):
+      messages.append((id, structure))
+    xtb_reader.Parse(xtb_file, Callback)
+    self.failUnless(len(messages[0][1]) == 1)
+    self.failUnless(messages[3][1][0])  # PROBLEM_REPORT placeholder
+    self.failUnless(messages[4][0] == '7729135689895381486')
+    self.failUnless(messages[4][1][7][1] == 'and another after a blank line.')
+
+  def testParsingIntoMessages(self):
+    root = util.ParseGrdForUnittest('''
+      <messages>
+        <message name="ID_MEGA">Fantastic!</message>
+        <message name="ID_HELLO_USER">Hello <ph name="USERNAME">%s<ex>Joi</ex></ph></message>
+      </messages>''')
+
+    msgs, = root.GetChildrenOfType(empty.MessagesNode)
+    clique_mega = msgs.children[0].GetCliques()[0]
+    msg_mega = clique_mega.GetMessage()
+    clique_hello_user = msgs.children[1].GetCliques()[0]
+    msg_hello_user = clique_hello_user.GetMessage()
+
+    xtb_file = io.BytesIO(b'''<?xml version="1.0" encoding="UTF-8"?>
+      <!DOCTYPE translationbundle>
+      <translationbundle lang="is">
+        <translation id="%s">Meirihattar!</translation>
+        <translation id="%s">Saelir <ph name="USERNAME"/></translation>
+      </translationbundle>''' % (
+        msg_mega.GetId().encode('utf-8'),
+        msg_hello_user.GetId().encode('utf-8')))
+
+    xtb_reader.Parse(xtb_file,
+                     msgs.UberClique().GenerateXtbParserCallback('is'))
+    self.assertEqual('Meirihattar!',
+                     clique_mega.MessageForLanguage('is').GetRealContent())
+    self.failUnless('Saelir %s',
+                    clique_hello_user.MessageForLanguage('is').GetRealContent())
+
+  def testIfNodesWithUseNameForId(self):
+    root = util.ParseGrdForUnittest('''
+      <messages>
+        <message name="ID_BINGO" use_name_for_id="true">Bingo!</message>
+      </messages>''')
+    msgs, = root.GetChildrenOfType(empty.MessagesNode)
+    clique = msgs.children[0].GetCliques()[0]
+    msg = clique.GetMessage()
+
+    xtb_file = io.BytesIO(b'''<?xml version="1.0" encoding="UTF-8"?>
+      <!DOCTYPE translationbundle>
+      <translationbundle lang="is">
+        <if expr="is_linux">
+          <translation id="ID_BINGO">Bongo!</translation>
+        </if>
+        <if expr="not is_linux">
+          <translation id="ID_BINGO">Congo!</translation>
+        </if>
+      </translationbundle>''')
+    xtb_reader.Parse(xtb_file,
+                     msgs.UberClique().GenerateXtbParserCallback('is'),
+                     target_platform='darwin')
+    self.assertEqual('Congo!', clique.MessageForLanguage('is').GetRealContent())
+
+  def testParseLargeFile(self):
+    def Callback(id, structure):
+      pass
+    path = util.PathFromRoot('grit/testdata/generated_resources_fr.xtb')
+    with open(path, 'rb') as xtb:
+      xtb_reader.Parse(xtb, Callback)
+
+
+if __name__ == '__main__':
+  unittest.main()
diff --git a/tools/grit/grit_info.py b/tools/grit/grit_info.py
new file mode 100644
index 0000000000..55738f25f6
--- /dev/null
+++ b/tools/grit/grit_info.py
@@ -0,0 +1,173 @@
+#!/usr/bin/env python
+# Copyright (c) 2012 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.
+
+'''Tool to determine inputs and outputs of a grit file.
+'''
+
+from __future__ import print_function
+
+import optparse
+import os
+import posixpath
+import sys
+
+from grit import grd_reader
+from grit import util
+
+class WrongNumberOfArguments(Exception):
+  pass
+
+
+def Outputs(filename, defines, ids_file, target_platform=None):
+  grd = grd_reader.Parse(
+      filename, defines=defines, tags_to_ignore=set(['messages']),
+      first_ids_file=ids_file, target_platform=target_platform)
+
+  target = []
+  lang_folders = {}
+  # Add all explicitly-specified output files
+  for output in grd.GetOutputFiles():
+    path = output.GetFilename()
+    target.append(path)
+
+    if path.endswith('.h'):
+      path, filename = os.path.split(path)
+    if output.attrs['lang']:
+      lang_folders[output.attrs['lang']] = os.path.dirname(path)
+
+  return [t.replace('\\', '/') for t in target]
+
+
+def GritSourceFiles():
+  files = []
+  grit_root_dir = os.path.relpath(os.path.dirname(__file__), os.getcwd())
+  for root, dirs, filenames in os.walk(grit_root_dir):
+    grit_src = [os.path.join(root, f) for f in filenames
+                if f.endswith('.py') and not f.endswith('_unittest.py')]
+    files.extend(grit_src)
+  return sorted(files)
+
+
+def Inputs(filename, defines, ids_file, target_platform=None):
+  grd = grd_reader.Parse(
+      filename, debug=False, defines=defines, tags_to_ignore=set(['message']),
+      first_ids_file=ids_file, target_platform=target_platform)
+  files = set()
+  for lang, ctx, fallback in grd.GetConfigurations():
+    # TODO(tdanderson): Refactor all places which perform the action of setting
+    #                   output attributes on the root. See crbug.com/503637.
+    grd.SetOutputLanguage(lang or grd.GetSourceLanguage())
+    grd.SetOutputContext(ctx)
+    grd.SetFallbackToDefaultLayout(fallback)
+    for node in grd.ActiveDescendants():
+      with node:
+        if (node.name == 'structure' or node.name == 'skeleton' or
+            (node.name == 'file' and node.parent and
+             node.parent.name == 'translations')):
+          path = node.GetInputPath()
+          if path is not None:
+            files.add(grd.ToRealPath(path))
+
+          # If it's a flattened node, grab inlined resources too.
+          if node.name == 'structure' and node.attrs['flattenhtml'] == 'true':
+            node.RunPreSubstitutionGatherer()
+            files.update(node.GetHtmlResourceFilenames())
+        elif node.name == 'grit':
+          first_ids_file = node.GetFirstIdsFile()
+          if first_ids_file:
+            files.add(first_ids_file)
+        elif node.name == 'include':
+          files.add(grd.ToRealPath(node.GetInputPath()))
+          # If it's a flattened node, grab inlined resources too.
+          if node.attrs['flattenhtml'] == 'true':
+            files.update(node.GetHtmlResourceFilenames())
+        elif node.name == 'part':
+          files.add(util.normpath(os.path.join(os.path.dirname(filename),
+                                               node.GetInputPath())))
+
+  cwd = os.getcwd()
+  return [os.path.relpath(f, cwd) for f in sorted(files)]
+
+
+def PrintUsage():
+  print('USAGE: ./grit_info.py --inputs [-D foo] [-f resource_ids] <grd-file>')
+  print('       ./grit_info.py --outputs [-D foo] [-f resource_ids] ' +
+        '<out-prefix> <grd-file>')
+
+
+def DoMain(argv):
+  os.environ['cwd'] = os.getcwd()
+
+  parser = optparse.OptionParser()
+  parser.add_option("--inputs", action="store_true", dest="inputs")
+  parser.add_option("--outputs", action="store_true", dest="outputs")
+  parser.add_option("-D", action="append", dest="defines", default=[])
+  # grit build also supports '-E KEY=VALUE', support that to share command
+  # line flags.
+  parser.add_option("-E", action="append", dest="build_env", default=[])
+  parser.add_option("-p", action="store", dest="predetermined_ids_file")
+  parser.add_option("-w", action="append", dest="whitelist_files", default=[])
+  parser.add_option("-f", dest="ids_file", default="")
+  parser.add_option("-t", dest="target_platform", default=None)
+
+  options, args = parser.parse_args(argv)
+
+  defines = {}
+  for define in options.defines:
+    name, val = util.ParseDefine(define)
+    defines[name] = val
+
+  for env_pair in options.build_env:
+    (env_name, env_value) = env_pair.split('=', 1)
+    os.environ[env_name] = env_value
+
+  if options.inputs:
+    if len(args) > 1:
+      raise WrongNumberOfArguments("Expected 0 or 1 arguments for --inputs.")
+
+    inputs = []
+    if len(args) == 1:
+      filename = args[0]
+      inputs = Inputs(filename, defines, options.ids_file,
+                      options.target_platform)
+
+    # Add in the grit source files.  If one of these change, we want to re-run
+    # grit.
+    inputs.extend(GritSourceFiles())
+    inputs = [f.replace('\\', '/') for f in inputs]
+
+    if len(args) == 1:
+      # Include grd file as second input (works around gyp expecting it).
+      inputs.insert(1, args[0])
+    if options.whitelist_files:
+      inputs.extend(options.whitelist_files)
+    return '\n'.join(inputs)
+  elif options.outputs:
+    if len(args) != 2:
+      raise WrongNumberOfArguments(
+          "Expected exactly 2 arguments for --outputs.")
+
+    prefix, filename = args
+    outputs = [posixpath.join(prefix, f)
+               for f in Outputs(filename, defines,
+                                options.ids_file, options.target_platform)]
+    return '\n'.join(outputs)
+  else:
+    raise WrongNumberOfArguments("Expected --inputs or --outputs.")
+
+
+def main(argv):
+  try:
+    result = DoMain(argv[1:])
+  except WrongNumberOfArguments as e:
+    PrintUsage()
+    print(e)
+    return 1
+  print(result)
+  return 0
+
+
+if __name__ == '__main__':
+  sys.exit(main(sys.argv))
diff --git a/tools/grit/grit_rule.gni b/tools/grit/grit_rule.gni
new file mode 100644
index 0000000000..fb107ef1a3
--- /dev/null
+++ b/tools/grit/grit_rule.gni
@@ -0,0 +1,485 @@
+# 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.
+
+# Instantiate grit. This will produce a script target to run grit (named
+# ${target_name}_grit), and a static library that compiles the .cc files.
+#
+# In general, code should depend on the static library. However, if the
+# generated files are only processed by other actions to generate other
+# files, it is possible to depend on the script target directly.
+#
+# Parameters
+#
+#   source (required)
+#       Path to .grd file.
+#
+#   enable_input_discovery_for_gn_analyze (default=true)
+#       Runs grit_info.py via exec_script() when compute_inputs_for_analyze=true
+#       in order to discover all files that affect this target.
+#       Turn this off when the .grd file is generated, or an <include> with
+#       flattenhtml=true points to a generated file.
+#       For "gn analyze" to be correct with this arg disabled, all inputs
+#       must be listed via |inputs|.
+#
+#   inputs  (optional)
+#       List of additional files, required for grit to process source file.
+#
+#   outputs (required)
+#       List of outputs from grit, relative to the target_gen_dir. Grit will
+#       verify at build time that this list is correct and will fail if there
+#       is a mismatch between the outputs specified by the .grd file and the
+#       outputs list here.
+#
+#       To get this list, you can look in the .grd file for
+#       <output filename="..." and put those filename here. The base directory
+#       of the list in Grit and the output list specified in the GN grit target
+#       are the same (the target_gen_dir) so you can generally copy the names
+#       exactly.
+#
+#       To get the list of outputs programatically, run:
+#           python tools/grit/grit_info.py --outputs . path/to/your.grd
+#       And strip the leading "./" from the output files.
+#
+#   defines (optional)
+#       Extra defines to pass to grit (on top of the global grit_defines list).
+#
+#   grit_flags (optional)
+#       List of strings containing extra command-line flags to pass to Grit.
+#
+#   resource_ids (optional)
+#       Path to a grit "firstidsfile". Default is
+#       //tools/gritsettings/resource_ids. Set to "" to use the value specified
+#       in the <grit> nodes of the processed files.
+#
+#   output_dir (optional)
+#       Directory for generated files. If you specify this, you will often
+#       want to specify output_name if the target name is not particularly
+#       unique, since this can cause files from multiple grit targets to
+#       overwrite each other.
+#
+#   output_name (optional)
+#       Provide an alternate base name for the generated files, like the .d
+#       files. Normally these are based on the target name and go in the
+#       output_dir, but if multiple targets with the same name end up in
+#       the same output_dir, they can collide.
+#
+#   configs (optional)
+#       List of additional configs to be applied to the generated target.
+#
+#   deps  (optional)
+#   testonly (optional)
+#   visibility  (optional)
+#       Normal meaning.
+#
+# Example
+#
+#   grit("my_resources") {
+#     # Source and outputs are required.
+#     source = "myfile.grd"
+#     outputs = [
+#       "foo_strings.h",
+#       "foo_strings.pak",
+#     ]
+#
+#     grit_flags = [ "-E", "foo=bar" ]  # Optional extra flags.
+#     # You can also put deps here if the grit source depends on generated
+#     # files.
+#   }
+import("//build/config/chrome_build.gni")
+import("//build/config/chromeos/ui_mode.gni")
+import("//build/config/compiler/compiler.gni")
+import("//build/config/compute_inputs_for_analyze.gni")
+import("//build/config/crypto.gni")
+import("//build/config/features.gni")
+import("//build/config/sanitizers/sanitizers.gni")
+import("//build/config/ui.gni")
+import("//build/toolchain/gcc_toolchain.gni")
+
+declare_args() {
+  enable_resource_whitelist_generation = is_android && is_official_build
+}
+
+if (enable_resource_whitelist_generation) {
+  assert(target_os == "android" || target_os == "win",
+         "unsupported platform for resource whitelist generation")
+  assert(
+      symbol_level > 0 && !strip_debug_info && !is_component_build,
+      "resource whitelist generation only works on non-component builds with debug info enabled.")
+}
+
+grit_defines = []
+
+if (is_mac || is_win || is_linux || is_chromeos || is_ios) {
+  grit_defines += [
+    "-D",
+    "scale_factors=2x",
+  ]
+}
+
+# Mac and iOS want Title Case strings.
+use_titlecase_in_grd_files = is_apple
+if (use_titlecase_in_grd_files) {
+  grit_defines += [
+    "-D",
+    "use_titlecase",
+  ]
+}
+
+if (is_chrome_branded) {
+  grit_defines += [
+    "-D",
+    "_google_chrome",
+    "-E",
+    "CHROMIUM_BUILD=google_chrome",
+  ]
+} else {
+  grit_defines += [
+    "-D",
+    "_chromium",
+    "-E",
+    "CHROMIUM_BUILD=chromium",
+  ]
+}
+
+if (is_chromeos) {
+  grit_defines += [
+    "-D",
+    "chromeos",
+  ]
+}
+
+if (chromeos_is_browser_only) {
+  grit_defines += [
+    "-D",
+    "lacros",
+  ]
+}
+
+if (is_desktop_linux) {
+  grit_defines += [
+    "-D",
+    "desktop_linux",
+  ]
+}
+
+if (toolkit_views) {
+  grit_defines += [
+    "-D",
+    "toolkit_views",
+  ]
+}
+
+if (use_aura) {
+  grit_defines += [
+    "-D",
+    "use_aura",
+  ]
+}
+
+if (use_nss_certs) {
+  grit_defines += [
+    "-D",
+    "use_nss_certs",
+  ]
+}
+
+if (use_ozone) {
+  grit_defines += [
+    "-D",
+    "use_ozone",
+  ]
+}
+
+if (is_android) {
+  grit_defines += [
+    "-E",
+    "ANDROID_JAVA_TAGGED_ONLY=true",
+  ]
+}
+
+# When cross-compiling, explicitly pass the target system to grit.
+if (current_toolchain != host_toolchain) {
+  if (is_android) {
+    grit_defines += [
+      "-t",
+      "android",
+    ]
+  }
+  if (is_ios) {
+    grit_defines += [
+      "-t",
+      "ios",
+    ]
+  }
+  if (is_linux || is_chromeos) {
+    grit_defines += [
+      "-t",
+      "linux2",
+    ]
+  }
+  if (is_mac) {
+    grit_defines += [
+      "-t",
+      "darwin",
+    ]
+  }
+  if (is_win) {
+    grit_defines += [
+      "-t",
+      "win32",
+    ]
+  }
+}
+
+_strip_resource_files = is_android && is_official_build
+_js_minifier = "//tools/grit/minify_with_uglify.py"
+_css_minifier = "//tools/grit/minimize_css.py"
+
+grit_resource_id_target = "//tools/gritsettings:default_resource_ids"
+grit_resource_id_file =
+    get_label_info(grit_resource_id_target, "target_gen_dir") +
+    "/default_resource_ids"
+grit_info_script = "//tools/grit/grit_info.py"
+
+# TODO(asvitkine): Add predetermined ids files for other platforms.
+grit_predetermined_resource_ids_file = ""
+if (is_mac) {
+  grit_predetermined_resource_ids_file =
+      "//tools/gritsettings/startup_resources_mac.txt"
+}
+if (is_win) {
+  grit_predetermined_resource_ids_file =
+      "//tools/gritsettings/startup_resources_win.txt"
+}
+
+template("grit") {
+  if (defined(invoker.output_dir)) {
+    _output_dir = invoker.output_dir
+  } else {
+    _output_dir = target_gen_dir
+  }
+
+  _grit_outputs =
+      get_path_info(rebase_path(invoker.outputs, ".", _output_dir), "abspath")
+
+  # Add .info output for all pak files
+  _pak_info_outputs = []
+  foreach(output, _grit_outputs) {
+    if (get_path_info(output, "extension") == "pak") {
+      _pak_info_outputs += [ output + ".info" ]
+    }
+  }
+
+  if (defined(invoker.output_name)) {
+    _grit_output_name = invoker.output_name
+  } else {
+    _grit_output_name = target_name
+  }
+
+  _grit_custom_target = target_name + "_grit"
+  action(_grit_custom_target) {
+    testonly = defined(invoker.testonly) && invoker.testonly
+
+    script = "//tools/grit/grit.py"
+    depfile = "$target_gen_dir/$target_name.d"
+
+    inputs = [ invoker.source ]
+    deps = [ "//tools/grit:grit_sources" ]
+    outputs = [ "${depfile}.stamp" ] + _grit_outputs + _pak_info_outputs
+
+    _grit_flags = grit_defines
+
+    # Add extra defines with -D flags.
+    if (defined(invoker.defines)) {
+      foreach(i, invoker.defines) {
+        _grit_flags += [
+          "-D",
+          i,
+        ]
+      }
+    }
+
+    if (defined(invoker.grit_flags)) {
+      _grit_flags += invoker.grit_flags
+    }
+
+    _rebased_source_path = rebase_path(invoker.source, root_build_dir)
+    _enable_grit_info =
+        !defined(invoker.enable_input_discovery_for_gn_analyze) ||
+        invoker.enable_input_discovery_for_gn_analyze
+    if (_enable_grit_info && compute_inputs_for_analyze) {
+      # Only call exec_script when the user has explicitly opted into greater
+      # precision at the expense of performance.
+      _rel_inputs = exec_script("//tools/grit/grit_info.py",
+                                [
+                                      "--inputs",
+                                      _rebased_source_path,
+                                    ] + _grit_flags,
+                                "list lines")
+      inputs += rebase_path(_rel_inputs, ".", root_build_dir)
+    }
+
+    args = [
+             "-i",
+             _rebased_source_path,
+             "build",
+             "-o",
+             rebase_path(_output_dir, root_build_dir),
+             "--depdir",
+             ".",
+             "--depfile",
+             rebase_path(depfile, root_build_dir),
+             "--write-only-new=1",
+             "--depend-on-stamp",
+           ] + _grit_flags
+
+    # Add brotli executable if using brotli.
+    if (defined(invoker.use_brotli) && invoker.use_brotli) {
+      _brotli_target = "//third_party/brotli:brotli($host_toolchain)"
+      _brotli_executable = get_label_info(_brotli_target, "root_out_dir") +
+                           "/" + get_label_info(_brotli_target, "name")
+      if (host_os == "win") {
+        _brotli_executable += ".exe"
+      }
+
+      inputs += [ _brotli_executable ]
+      args += [
+        "--brotli",
+        rebase_path(_brotli_executable, root_build_dir),
+      ]
+    }
+
+    _resource_ids = grit_resource_id_file
+    if (defined(invoker.resource_ids)) {
+      _resource_ids = invoker.resource_ids
+    }
+
+    if (_resource_ids != "") {
+      inputs += [ _resource_ids ]
+      args += [
+        "-f",
+        rebase_path(_resource_ids, root_build_dir),
+      ]
+      if (_resource_ids == grit_resource_id_file) {
+        deps += [ grit_resource_id_target ]
+      }
+    }
+    if (grit_predetermined_resource_ids_file != "") {
+      inputs += [ grit_predetermined_resource_ids_file ]
+      args += [
+        "-p",
+        rebase_path(grit_predetermined_resource_ids_file, root_build_dir),
+      ]
+    }
+
+    # We want to make sure the declared outputs actually match what Grit is
+    # writing. We write the list to a file (some of the output lists are long
+    # enough to not fit on a Windows command line) and ask Grit to verify those
+    # are the actual outputs at runtime.
+    _asserted_list_file =
+        "$target_out_dir/${_grit_output_name}_expected_outputs.txt"
+    write_file(_asserted_list_file,
+               rebase_path(invoker.outputs, root_build_dir, _output_dir))
+    inputs += [ _asserted_list_file ]
+    args += [
+      "--assert-file-list",
+      rebase_path(_asserted_list_file, root_build_dir),
+    ]
+
+    if (enable_resource_whitelist_generation) {
+      _rc_grit_outputs = []
+      foreach(output, _grit_outputs) {
+        if (get_path_info(output, "extension") == "rc") {
+          _rc_grit_outputs += [ output ]
+        }
+      }
+
+      if (_rc_grit_outputs != []) {
+        # Resource whitelisting cannot be used with .rc files.
+        # Make sure that there aren't any .pak outputs which would require
+        # whitelist annotations.
+        assert(_pak_info_outputs == [], "can't combine .pak and .rc outputs")
+      } else {
+        args += [ "--whitelist-support" ]
+      }
+    }
+    if (_strip_resource_files) {
+      _js_minifier_command = rebase_path(_js_minifier, root_build_dir)
+      _css_minifier_command = rebase_path(_css_minifier, root_build_dir)
+      args += [
+        "--js-minifier",
+        _js_minifier_command,
+        "--css-minifier",
+        _css_minifier_command,
+      ]
+      inputs += [
+        _js_minifier,
+        _css_minifier,
+      ]
+    }
+
+    if (defined(invoker.visibility)) {
+      # This needs to include both what the invoker specified (since they
+      # probably include generated headers from this target), as well as the
+      # generated source set (since there's no guarantee that the visibility
+      # specified by the invoker includes our target).
+      #
+      # Only define visibility at all if the invoker specified it. Otherwise,
+      # we want to keep the public "no visibility specified" default.
+      visibility = [ ":${invoker.target_name}" ] + invoker.visibility
+    }
+
+    if (defined(invoker.use_brotli) && invoker.use_brotli) {
+      if (is_mac && is_asan) {
+        deps += [ "//tools/grit:brotli_mac_asan_workaround" ]
+      } else {
+        deps += [ "//third_party/brotli:brotli($host_toolchain)" ]
+      }
+    }
+    if (defined(invoker.deps)) {
+      deps += invoker.deps
+    }
+    if (defined(invoker.inputs)) {
+      inputs += invoker.inputs
+    }
+  }
+
+  # This is the thing that people actually link with, it must be named the
+  # same as the argument the template was invoked with.
+  source_set(target_name) {
+    testonly = defined(invoker.testonly) && invoker.testonly
+
+    # Since we generate a file, we need to be run before the targets that
+    # depend on us.
+    sources = []
+    foreach(_output, _grit_outputs) {
+      _extension = get_path_info(_output, "extension")
+      if (_extension != "json" && _extension != "gz" && _extension != "pak" &&
+          _extension != "xml") {
+        sources += [ _output ]
+      }
+    }
+
+    # Deps set on the template invocation will go on the action that runs
+    # grit above rather than this library. This target needs to depend on the
+    # action publicly so other scripts can take the outputs from the grit
+    # script as inputs.
+    public_deps = [ ":$_grit_custom_target" ]
+
+    deps = [ "//base" ]
+
+    if (defined(invoker.public_configs)) {
+      public_configs += invoker.public_configs
+    }
+
+    if (defined(invoker.configs)) {
+      configs += invoker.configs
+    }
+
+    if (defined(invoker.visibility)) {
+      visibility = invoker.visibility
+    }
+    output_name = _grit_output_name
+  }
+}
diff --git a/tools/grit/minify_with_uglify.py b/tools/grit/minify_with_uglify.py
new file mode 100644
index 0000000000..788ffa6a75
--- /dev/null
+++ b/tools/grit/minify_with_uglify.py
@@ -0,0 +1,44 @@
+#!/usr/bin/env python
+# Copyright 2019 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.
+
+from __future__ import print_function
+
+import os
+import sys
+import tempfile
+
+_HERE_PATH = os.path.dirname(__file__)
+_SRC_PATH = os.path.normpath(os.path.join(_HERE_PATH, '..', '..'))
+sys.path.append(os.path.join(_SRC_PATH, 'third_party', 'node'))
+
+import node
+import node_modules
+
+def Minify(source):
+  # Open two temporary files, so that uglify can read the input from one and
+  # write its output to the other.
+  with tempfile.NamedTemporaryFile(suffix='.js') as infile, \
+       tempfile.NamedTemporaryFile(suffix='.js') as outfile:
+    infile.write(source)
+    infile.flush();
+    node.RunNode([
+        node_modules.PathToUglify(), infile.name, '--output', outfile.name])
+    result = outfile.read()
+    return result
+
+
+def main():
+  orig_stdout = sys.stdout
+  result = ''
+  try:
+    sys.stdout = sys.stderr
+    result = Minify(sys.stdin.read())
+  finally:
+    sys.stdout = orig_stdout
+    print(result)
+
+
+if __name__ == '__main__':
+  main()
diff --git a/tools/grit/minimize_css.py b/tools/grit/minimize_css.py
new file mode 100644
index 0000000000..2c3b8aeb1e
--- /dev/null
+++ b/tools/grit/minimize_css.py
@@ -0,0 +1,105 @@
+#!/usr/bin/env python
+# Copyright 2016 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 re
+import sys
+
+class CSSMinimizer(object):
+
+  INITIAL = 0
+  MAYBE_COMMENT_START = 1
+  INSIDE_COMMENT = 2
+  MAYBE_COMMENT_END = 3
+  INSIDE_SINGLE_QUOTE = 4
+  INSIDE_SINGLE_QUOTE_ESCAPE = 5
+  INSIDE_DOUBLE_QUOTE = 6
+  INSIDE_DOUBLE_QUOTE_ESCAPE = 7
+
+  def __init__(self):
+    self._output = ''
+    self._codeblock = ''
+
+  def flush_codeblock(self):
+    stripped = re.sub(r"\s+", ' ', self._codeblock)
+    stripped = re.sub(r";?\s*(?P<op>[{};])\s*", r'\g<op>', stripped)
+    self._output += stripped
+    self._codeblock = ''
+
+  def parse(self, content):
+    state = self.INITIAL
+    for char in content:
+      if state == self.INITIAL:
+        if char == '/':
+          state = self.MAYBE_COMMENT_START
+        elif char == "'":
+          self.flush_codeblock()
+          self._output += char
+          state = self.INSIDE_SINGLE_QUOTE
+        elif char == '"':
+          self.flush_codeblock()
+          self._output += char
+          state = self.INSIDE_DOUBLE_QUOTE
+        else:
+          self._codeblock += char
+      elif state == self.MAYBE_COMMENT_START:
+        if char == '*':
+          self.flush_codeblock()
+          state = self.INSIDE_COMMENT
+        else:
+          self._codeblock += '/' + char
+          state = self.INITIAL
+      elif state == self.INSIDE_COMMENT:
+        if char == '*':
+          state = self.MAYBE_COMMENT_END
+        else:
+          pass
+      elif state == self.MAYBE_COMMENT_END:
+        if char == '/':
+          state = self.INITIAL
+        else:
+          state = self.INSIDE_COMMENT
+      elif state == self.INSIDE_SINGLE_QUOTE:
+        if char == '\\':
+          self._output += char
+          state = self.INSIDE_SINGLE_QUOTE_ESCAPE
+        elif char == "'":
+          self._output += char
+          state = self.INITIAL
+        else:
+          self._output += char
+      elif state == self.INSIDE_SINGLE_QUOTE_ESCAPE:
+        self._output += char
+        state = self.INSIDE_SINGLE_QUOTE
+      elif state == self.INSIDE_DOUBLE_QUOTE:
+        if char == '\\':
+          self._output += char
+          state = self.INSIDE_DOUBLE_QUOTE_ESCAPE
+        elif char == '"':
+          self._output += char
+          state = self.INITIAL
+        else:
+          self._output += char
+      elif state == self.INSIDE_DOUBLE_QUOTE_ESCAPE:
+        self._output += char
+        state = self.INSIDE_DOUBLE_QUOTE
+
+    self.flush_codeblock()
+    self._output = self._output.strip()
+    return self._output
+
+  @classmethod
+  def minimize_css(cls, content):
+    minimizer = CSSMinimizer()
+    return minimizer.parse(content)
+
+def main():
+  result = ''
+  try:
+    result = CSSMinimizer.minimize_css(sys.stdin.read())
+  finally:
+    print(result)
+
+if __name__ == '__main__':
+  main()
diff --git a/tools/grit/minimize_css_unittest.py b/tools/grit/minimize_css_unittest.py
new file mode 100644
index 0000000000..cddc313078
--- /dev/null
+++ b/tools/grit/minimize_css_unittest.py
@@ -0,0 +1,58 @@
+#!/usr/bin/env python
+# Copyright 2016 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 unittest
+
+import minimize_css
+
+
+class CSSMinimizerTest(unittest.TestCase):
+
+    def test_simple(self):
+        source = """
+            div {
+                color: blue;
+            }
+        """
+        minimized = minimize_css.CSSMinimizer.minimize_css(source)
+        self.assertEquals(minimized, "div{color: blue}")
+
+    def test_attribute_selectors(self):
+        source = """
+            input[type="search" i]::-webkit-textfield-decoration-container {
+                direction: ltr;
+            }
+        """
+        minimized = minimize_css.CSSMinimizer.minimize_css(source)
+        self.assertEquals(
+            minimized,
+            # pylint: disable=line-too-long
+            """input[type="search" i]::-webkit-textfield-decoration-container{direction: ltr}""")
+
+    def test_strip_comment(self):
+        source = """
+        /* header */
+        html {
+            /* inside block */
+            display: block;
+        }
+        /* footer */
+        """
+        minimized = minimize_css.CSSMinimizer.minimize_css(source)
+        self.assertEquals(minimized, "html{ display: block}")
+
+    def test_no_strip_inside_quotes(self):
+        source = """div[foo=' bar ']"""
+        minimized = minimize_css.CSSMinimizer.minimize_css(source)
+        self.assertEquals(minimized, source)
+
+        source = """div[foo=" bar "]"""
+        minimized = minimize_css.CSSMinimizer.minimize_css(source)
+        self.assertEquals(minimized, source)
+
+    def test_escape_string(self):
+        source = """content: " <a onclick=\\\"javascript:  alert  ( 'foobar' ); \\\">";"""
+        minimized = minimize_css.CSSMinimizer.minimize_css(source)
+        self.assertEquals(minimized, source)
diff --git a/tools/grit/pak_util.py b/tools/grit/pak_util.py
new file mode 100644
index 0000000000..ede638bbe1
--- /dev/null
+++ b/tools/grit/pak_util.py
@@ -0,0 +1,223 @@
+#!/usr/bin/env python
+# Copyright 2017 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.
+
+"""A tool for interacting with .pak files.
+
+For details on the pak file format, see:
+https://dev.chromium.org/developers/design-documents/linuxresourcesandlocalizedstrings
+"""
+
+from __future__ import print_function
+
+import argparse
+import gzip
+import hashlib
+import os
+import shutil
+import sys
+import tempfile
+
+# Import grit first to get local third_party modules.
+import grit  # pylint: disable=ungrouped-imports,unused-import
+
+import six
+
+from grit.format import data_pack
+
+
+def _RepackMain(args):
+  output_info_filepath = args.output_pak_file + '.info'
+  if args.compress:
+    # If the file needs to be compressed, call RePack with a tempfile path,
+    # then compress the tempfile to args.output_pak_file.
+    temp_outfile = tempfile.NamedTemporaryFile()
+    out_path = temp_outfile.name
+    # Strip any non .pak extension from the .info output file path.
+    splitext = os.path.splitext(args.output_pak_file)
+    if splitext[1] != '.pak':
+      output_info_filepath = splitext[0] + '.info'
+  else:
+    out_path = args.output_pak_file
+  data_pack.RePack(out_path, args.input_pak_files, args.whitelist,
+                   args.suppress_removed_key_output,
+                   output_info_filepath=output_info_filepath)
+  if args.compress:
+    with open(args.output_pak_file, 'wb') as out:
+      with gzip.GzipFile(filename='', mode='wb', fileobj=out, mtime=0) as outgz:
+        shutil.copyfileobj(temp_outfile, outgz)
+
+
+def _ExtractMain(args):
+  pak = data_pack.ReadDataPack(args.pak_file)
+  if args.textual_id:
+    info_dict = data_pack.ReadGrdInfo(args.pak_file)
+  for resource_id, payload in pak.resources.items():
+    filename = (
+        info_dict[resource_id].textual_id
+        if args.textual_id else str(resource_id))
+    path = os.path.join(args.output_dir, filename)
+    with open(path, 'w') as f:
+      f.write(payload)
+
+
+def _CreateMain(args):
+  pak = {}
+  for name in os.listdir(args.input_dir):
+    try:
+      resource_id = int(name)
+    except:
+      continue
+    filename = os.path.join(args.input_dir, name)
+    if os.path.isfile(filename):
+      with open(filename, 'rb') as f:
+        pak[resource_id] = f.read()
+  data_pack.WriteDataPack(pak, args.output_pak_file, data_pack.UTF8)
+
+
+def _PrintMain(args):
+  pak = data_pack.ReadDataPack(args.pak_file)
+  if args.textual_id:
+    info_dict = data_pack.ReadGrdInfo(args.pak_file)
+  output = args.output
+  encoding = 'binary'
+  if pak.encoding == 1:
+    encoding = 'utf-8'
+  elif pak.encoding == 2:
+    encoding = 'utf-16'
+  else:
+    encoding = '?' + str(pak.encoding)
+
+  output.write('version: {}\n'.format(pak.version))
+  output.write('encoding: {}\n'.format(encoding))
+  output.write('num_resources: {}\n'.format(len(pak.resources)))
+  output.write('num_aliases: {}\n'.format(len(pak.aliases)))
+  breakdown = ', '.join('{}: {}'.format(*x) for x in pak.sizes)
+  output.write('total_size: {} ({})\n'.format(pak.sizes.total, breakdown))
+
+  try_decode = args.decode and encoding.startswith('utf')
+  # Print IDs in ascending order, since that's the order in which they appear in
+  # the file (order is lost by Python dict).
+  for resource_id in sorted(pak.resources):
+    data = pak.resources[resource_id]
+    canonical_id = pak.aliases.get(resource_id, resource_id)
+    desc = '<data>'
+    if try_decode:
+      try:
+        desc = six.text_type(data, encoding)
+        if len(desc) > 60:
+          desc = desc[:60] + u'...'
+        desc = desc.replace('\n', '\\n')
+      except UnicodeDecodeError:
+        pass
+    sha1 = hashlib.sha1(data).hexdigest()[:10]
+    if args.textual_id:
+      textual_id = info_dict[resource_id].textual_id
+      canonical_textual_id = info_dict[canonical_id].textual_id
+      output.write(
+          u'Entry(id={}, canonical_id={}, size={}, sha1={}): {}\n'.format(
+              textual_id, canonical_textual_id, len(data), sha1,
+              desc).encode('utf-8'))
+    else:
+      output.write(
+          u'Entry(id={}, canonical_id={}, size={}, sha1={}): {}\n'.format(
+              resource_id, canonical_id, len(data), sha1, desc).encode('utf-8'))
+
+
+def _ListMain(args):
+  pak = data_pack.ReadDataPack(args.pak_file)
+  if args.textual_id or args.path:
+    info_dict = data_pack.ReadGrdInfo(args.pak_file)
+    fmt = ''.join([
+        '{id}', ' = {textual_id}' if args.textual_id else '',
+        ' @ {path}' if args.path else '', '\n'
+    ])
+    for resource_id in sorted(pak.resources):
+      item = info_dict[resource_id]
+      args.output.write(
+          fmt.format(textual_id=item.textual_id, id=item.id, path=item.path))
+  else:
+    for resource_id in sorted(pak.resources):
+      args.output.write('%d\n' % resource_id)
+
+
+def main():
+  parser = argparse.ArgumentParser(
+      description=__doc__, formatter_class=argparse.RawTextHelpFormatter)
+  # Subparsers are required by default under Python 2.  Python 3 changed to
+  # not required, but didn't include a required option until 3.7.  Setting
+  # the required member works in all versions (and setting dest name).
+  sub_parsers = parser.add_subparsers(dest='action')
+  sub_parsers.required = True
+
+  sub_parser = sub_parsers.add_parser('repack',
+      help='Combines several .pak files into one.')
+  sub_parser.add_argument('output_pak_file', help='File to create.')
+  sub_parser.add_argument('input_pak_files', nargs='+',
+      help='Input .pak files.')
+  sub_parser.add_argument('--whitelist',
+      help='Path to a whitelist used to filter output pak file resource IDs.')
+  sub_parser.add_argument('--suppress-removed-key-output', action='store_true',
+      help='Do not log which keys were removed by the whitelist.')
+  sub_parser.add_argument('--compress', dest='compress', action='store_true',
+      default=False, help='Compress output_pak_file using gzip.')
+  sub_parser.set_defaults(func=_RepackMain)
+
+  sub_parser = sub_parsers.add_parser('extract', help='Extracts pak file')
+  sub_parser.add_argument('pak_file')
+  sub_parser.add_argument('-o', '--output-dir', default='.',
+                          help='Directory to extract to.')
+  sub_parser.add_argument(
+      '-t',
+      '--textual-id',
+      action='store_true',
+      help='Use textual resource ID (name) (from .info file) as filenames.')
+  sub_parser.set_defaults(func=_ExtractMain)
+
+  sub_parser = sub_parsers.add_parser('create',
+      help='Creates pak file from extracted directory.')
+  sub_parser.add_argument('output_pak_file', help='File to create.')
+  sub_parser.add_argument('-i', '--input-dir', default='.',
+                          help='Directory to create from.')
+  sub_parser.set_defaults(func=_CreateMain)
+
+  sub_parser = sub_parsers.add_parser('print',
+      help='Prints all pak IDs and contents. Useful for diffing.')
+  sub_parser.add_argument('pak_file')
+  sub_parser.add_argument('--output', type=argparse.FileType('w'),
+      default=sys.stdout,
+      help='The resource list path to write (default stdout)')
+  sub_parser.add_argument('--no-decode', dest='decode', action='store_false',
+      default=True, help='Do not print entry data.')
+  sub_parser.add_argument(
+      '-t',
+      '--textual-id',
+      action='store_true',
+      help='Print textual ID (name) (from .info file) instead of the ID.')
+  sub_parser.set_defaults(func=_PrintMain)
+
+  sub_parser = sub_parsers.add_parser('list-id',
+      help='Outputs all resource IDs to a file.')
+  sub_parser.add_argument('pak_file')
+  sub_parser.add_argument('--output', type=argparse.FileType('w'),
+      default=sys.stdout,
+      help='The resource list path to write (default stdout)')
+  sub_parser.add_argument(
+      '-t',
+      '--textual-id',
+      action='store_true',
+      help='Print the textual resource ID (from .info file).')
+  sub_parser.add_argument(
+      '-p',
+      '--path',
+      action='store_true',
+      help='Print the resource path (from .info file).')
+  sub_parser.set_defaults(func=_ListMain)
+
+  args = parser.parse_args()
+  args.func(args)
+
+
+if __name__ == '__main__':
+  main()
diff --git a/tools/grit/repack.gni b/tools/grit/repack.gni
new file mode 100644
index 0000000000..193f2dc43f
--- /dev/null
+++ b/tools/grit/repack.gni
@@ -0,0 +1,189 @@
+# 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")
+
+# This file defines a template to invoke grit repack in a consistent manner.
+#
+# Parameters:
+#   sources  [required]
+#       List of pak files that need to be combined.
+#
+#   output  [required]
+#       File name (single string) of the output file.
+#
+#   copy_data_to_bundle [optional]
+#       Whether to define a bundle_data() for the resulting pak.
+#
+#   bundle_output [optional]
+#       Path of the file in the application bundle, defaults to
+#       {{bundle_resources_dir}}/{{source_file_part}}.
+#
+#   compress  [optional]
+#       Gzip the resulting bundle (and append .gz to the output name).
+#
+#   deps  [optional]
+#   public_deps  [optional]
+#   visibility  [optional]
+#       Normal meaning.
+template("repack") {
+  _copy_data_to_bundle =
+      defined(invoker.copy_data_to_bundle) && invoker.copy_data_to_bundle
+  _repack_target_name = target_name
+  if (_copy_data_to_bundle) {
+    _repack_target_name = "${target_name}__repack"
+  }
+
+  _compress = defined(invoker.compress) && invoker.compress
+
+  action(_repack_target_name) {
+    forward_variables_from(invoker,
+                           [
+                             "deps",
+                             "public_deps",
+                             "testonly",
+                             "visibility",
+                           ])
+    if (defined(visibility) && _copy_data_to_bundle) {
+      visibility += [ ":${invoker.target_name}" ]
+    }
+    assert(defined(invoker.sources), "Need sources for $target_name")
+    assert(defined(invoker.output), "Need output for $target_name")
+
+    script = "//tools/grit/pak_util.py"
+
+    inputs = invoker.sources
+    outputs = [
+      invoker.output,
+      "${invoker.output}.info",
+    ]
+
+    args = [ "repack" ]
+    if (defined(invoker.repack_whitelist)) {
+      inputs += [ invoker.repack_whitelist ]
+      _rebased_whitelist = rebase_path(invoker.repack_whitelist)
+      args += [ "--whitelist=$_rebased_whitelist" ]
+      args += [ "--suppress-removed-key-output" ]
+    }
+    args += [ rebase_path(invoker.output, root_build_dir) ]
+    args += rebase_path(invoker.sources, root_build_dir)
+    if (_compress) {
+      args += [ "--compress" ]
+    }
+  }
+
+  if (_copy_data_to_bundle) {
+    bundle_data(target_name) {
+      forward_variables_from(invoker,
+                             [
+                               "testonly",
+                               "visibility",
+                             ])
+
+      public_deps = [ ":$_repack_target_name" ]
+      sources = [ invoker.output ]
+      if (defined(invoker.bundle_output)) {
+        outputs = [ invoker.bundle_output ]
+      } else {
+        outputs = [ "{{bundle_resources_dir}}/{{source_file_part}}" ]
+      }
+    }
+  }
+}
+
+# Repacks a set of .pak files for each locale.
+#
+# Parameters:
+#
+#   input_locales [required]
+#       List of locale names to use as inputs.
+#
+#   output_locales [required]
+#       A list containing the corresponding output names for each of the
+#       input names. Mac and iOS use different names in some cases.
+#
+#   source_patterns [required]
+#       The pattern for pak files which need repacked. The filenames always end
+#       with "${locale}.pak".
+#       E.g.:
+#          ${root_gen_dir}/foo_ expands to ${root_gen_dir}/foo_zh-CN.pak
+#        when locale is zh-CN.
+#
+#   output_dir [optional]
+#       Directory in which to put all pak files.
+#
+#   deps  [optional]
+#   visibility  [optional]
+#   testonly  [optional]
+#   copy_data_to_bundle [optional]
+#   repack_whitelist [optional]
+#       Normal meaning.
+template("repack_locales") {
+  if (defined(invoker.output_dir)) {
+    _output_dir = invoker.output_dir
+  } else if (is_ios) {
+    _output_dir = "$target_gen_dir"
+  } else {
+    _output_dir = "$target_gen_dir/$target_name"
+  }
+
+  # GN can't handle invoker.output_locales[foo] (http://crbug.com/614747).
+  _output_locales = invoker.output_locales
+
+  # Collects all targets the loop generates.
+  _locale_targets = []
+
+  # This loop iterates over the input locales and also keeps a counter so it
+  # can simultaneously iterate over the output locales (using GN's very
+  # limited looping capabilities).
+  _current_index = 0
+  foreach(_input_locale, invoker.input_locales) {
+    _output_locale = _output_locales[_current_index]
+
+    # Compute the name of the target for the current file. Save it for the deps.
+    _current_name = "${target_name}_${_input_locale}"
+    _locale_targets += [ ":$_current_name" ]
+
+    repack(_current_name) {
+      forward_variables_from(invoker,
+                             [
+                               "copy_data_to_bundle",
+                               "bundle_output",
+                               "compress",
+                               "deps",
+                               "repack_whitelist",
+                               "testonly",
+                             ])
+      visibility = [ ":${invoker.target_name}" ]
+      if (is_ios) {
+        output = "$_output_dir/${_output_locale}.lproj/locale.pak"
+      } else {
+        output = "$_output_dir/${_output_locale}.pak"
+      }
+      if (defined(copy_data_to_bundle) && copy_data_to_bundle) {
+        bundle_output =
+            "{{bundle_resources_dir}}/${_output_locale}.lproj/locale.pak"
+      }
+      sources = []
+      foreach(_pattern, invoker.source_patterns) {
+        sources += [ "${_pattern}${_input_locale}.pak" ]
+      }
+    }
+
+    _current_index = _current_index + 1
+  }
+
+  # The group that external targets depend on which collects all deps.
+  group(target_name) {
+    forward_variables_from(invoker,
+                           [
+                             "visibility",
+                             "testonly",
+                           ])
+    public_deps = _locale_targets
+    if (!defined(invoker.copy_data_to_bundle) || !invoker.copy_data_to_bundle) {
+      data_deps = public_deps
+    }
+  }
+}
diff --git a/tools/grit/setup.py b/tools/grit/setup.py
new file mode 100644
index 0000000000..5d86dfc2fc
--- /dev/null
+++ b/tools/grit/setup.py
@@ -0,0 +1,46 @@
+#!/usr/bin/env python3
+# Copyright 2020 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.
+
+"""Install the package!"""
+
+from __future__ import absolute_import
+
+import setuptools
+
+
+setuptools.setup(
+    name='grit',
+    version='0',
+    entry_points={
+        'console_scripts': ['grit = grit.grit_runner:Main'],
+    },
+    packages=setuptools.find_packages(),
+    install_requires=[
+        'six >= 1.10',
+    ],
+    author='The Chromium Authors',
+    author_email='chromium-dev@chromium.org',
+    description='Google Resource and Internationalization Tool for managing '
+                'translations & resource files',
+    license='BSD-3',
+    url='https://chromium.googlesource.com/chromium/src/tools/grit/',
+    classifiers=[
+        'Development Status :: 6 - Mature',
+        'Environment :: Console',
+        'Intended Audience :: Developers',
+        'License :: OSI Approved :: BSD License',
+        'Operating System :: MacOS',
+        'Operating System :: Microsoft :: Windows',
+        'Operating System :: POSIX :: Linux',
+        'Programming Language :: Python',
+        'Programming Language :: Python :: 2.7',
+        'Programming Language :: Python :: 3',
+        'Programming Language :: Python :: 3.6',
+        'Programming Language :: Python :: 3.7',
+        'Programming Language :: Python :: 3.8',
+        'Programming Language :: Python :: 3.9',
+        'Topic :: Utilities',
+    ],
+)
diff --git a/tools/grit/stamp_grit_sources.py b/tools/grit/stamp_grit_sources.py
new file mode 100644
index 0000000000..bc7265c6cb
--- /dev/null
+++ b/tools/grit/stamp_grit_sources.py
@@ -0,0 +1,57 @@
+# 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.
+
+# This script enumerates the files in the given directory, writing an empty
+# stamp file and a .d file listing the inputs required to make the stamp. This
+# allows us to dynamically depend on the grit sources without enumerating the
+# grit directory for every invocation of grit (which is what adding the source
+# files to every .grd file's .d file would entail) or shelling out to grit
+# synchronously during GN execution to get the list (which would be slow).
+#
+# Usage:
+#    stamp_grit_sources.py <directory> <stamp-file> <.d-file>
+
+from __future__ import print_function
+
+import os
+import sys
+
+def GritSourceFiles(grit_root_dir):
+  files = []
+  for root, _, filenames in os.walk(grit_root_dir):
+    grit_src = [os.path.join(root, f) for f in filenames
+                if f.endswith('.py') and not f.endswith('_unittest.py')]
+    files.extend(grit_src)
+  files = [f.replace('\\', '/') for f in files]
+  return sorted(files)
+
+
+def WriteDepFile(dep_file, stamp_file, source_files):
+  with open(dep_file, "w") as f:
+    f.write(stamp_file)
+    f.write(": ")
+    f.write(' '.join(source_files))
+
+
+def WriteStampFile(stamp_file):
+  with open(stamp_file, "w"):
+    pass
+
+
+def main(argv):
+  if len(argv) != 4:
+    print("Error: expecting 3 args.")
+    return 1
+
+  grit_root_dir = sys.argv[1]
+  stamp_file = sys.argv[2]
+  dep_file = sys.argv[3]
+
+  WriteStampFile(stamp_file)
+  WriteDepFile(dep_file, stamp_file, GritSourceFiles(grit_root_dir))
+  return 0
+
+
+if __name__ == '__main__':
+  sys.exit(main(sys.argv))
diff --git a/tools/grit/third_party/six/LICENSE b/tools/grit/third_party/six/LICENSE
new file mode 100644
index 0000000000..e558f9d494
--- /dev/null
+++ b/tools/grit/third_party/six/LICENSE
@@ -0,0 +1,18 @@
+Copyright (c) 2010-2015 Benjamin Peterson
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+the Software, and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/tools/grit/third_party/six/README b/tools/grit/third_party/six/README
new file mode 100644
index 0000000000..ee628a9db6
--- /dev/null
+++ b/tools/grit/third_party/six/README
@@ -0,0 +1,16 @@
+Six is a Python 2 and 3 compatibility library.  It provides utility functions
+for smoothing over the differences between the Python versions with the goal of
+writing Python code that is compatible on both Python versions.  See the
+documentation for more information on what is provided.
+
+Six supports every Python version since 2.6.  It is contained in only one Python
+file, so it can be easily copied into your project. (The copyright and license
+notice must be retained.)
+
+Online documentation is at https://pythonhosted.org/six/.
+
+Bugs can be reported to https://bitbucket.org/gutworth/six.  The code can also
+be found there.
+
+For questions about six or porting in general, email the python-porting mailing
+list: https://mail.python.org/mailman/listinfo/python-porting
diff --git a/tools/grit/third_party/six/README.chromium b/tools/grit/third_party/six/README.chromium
new file mode 100644
index 0000000000..100b24d046
--- /dev/null
+++ b/tools/grit/third_party/six/README.chromium
@@ -0,0 +1,13 @@
+Name: six
+Short Name: six
+URL: https://bitbucket.org/gutworth/six/commits/tag/1.10.0
+Version: 1.10.0
+Revision: 403:e5218c3f66a2
+License: Apache License, Version 2.0
+
+Description:
+Six is a Python 2 and 3 compatibility library.
+
+Local Modifications:
+- Copied six.py as __init__.py.
+- Kept LICENSE and README.
diff --git a/tools/grit/third_party/six/__init__.py b/tools/grit/third_party/six/__init__.py
new file mode 100644
index 0000000000..56e4272cb3
--- /dev/null
+++ b/tools/grit/third_party/six/__init__.py
@@ -0,0 +1,868 @@
+# Copyright (c) 2010-2015 Benjamin Peterson
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in all
+# copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+"""Utilities for writing code that runs on Python 2 and 3"""
+
+from __future__ import absolute_import
+
+import functools
+import itertools
+import operator
+import sys
+import types
+
+__author__ = "Benjamin Peterson <benjamin@python.org>"
+__version__ = "1.10.0"
+
+
+# Useful for very coarse version differentiation.
+PY2 = sys.version_info[0] == 2
+PY3 = sys.version_info[0] == 3
+PY34 = sys.version_info[0:2] >= (3, 4)
+
+if PY3:
+    string_types = str,
+    integer_types = int,
+    class_types = type,
+    text_type = str
+    binary_type = bytes
+
+    MAXSIZE = sys.maxsize
+else:
+    string_types = basestring,
+    integer_types = (int, long)
+    class_types = (type, types.ClassType)
+    text_type = unicode
+    binary_type = str
+
+    if sys.platform.startswith("java"):
+        # Jython always uses 32 bits.
+        MAXSIZE = int((1 << 31) - 1)
+    else:
+        # It's possible to have sizeof(long) != sizeof(Py_ssize_t).
+        class X(object):
+
+            def __len__(self):
+                return 1 << 31
+        try:
+            len(X())
+        except OverflowError:
+            # 32-bit
+            MAXSIZE = int((1 << 31) - 1)
+        else:
+            # 64-bit
+            MAXSIZE = int((1 << 63) - 1)
+        del X
+
+
+def _add_doc(func, doc):
+    """Add documentation to a function."""
+    func.__doc__ = doc
+
+
+def _import_module(name):
+    """Import module, returning the module after the last dot."""
+    __import__(name)
+    return sys.modules[name]
+
+
+class _LazyDescr(object):
+
+    def __init__(self, name):
+        self.name = name
+
+    def __get__(self, obj, tp):
+        result = self._resolve()
+        setattr(obj, self.name, result)  # Invokes __set__.
+        try:
+            # This is a bit ugly, but it avoids running this again by
+            # removing this descriptor.
+            delattr(obj.__class__, self.name)
+        except AttributeError:
+            pass
+        return result
+
+
+class MovedModule(_LazyDescr):
+
+    def __init__(self, name, old, new=None):
+        super(MovedModule, self).__init__(name)
+        if PY3:
+            if new is None:
+                new = name
+            self.mod = new
+        else:
+            self.mod = old
+
+    def _resolve(self):
+        return _import_module(self.mod)
+
+    def __getattr__(self, attr):
+        _module = self._resolve()
+        value = getattr(_module, attr)
+        setattr(self, attr, value)
+        return value
+
+
+class _LazyModule(types.ModuleType):
+
+    def __init__(self, name):
+        super(_LazyModule, self).__init__(name)
+        self.__doc__ = self.__class__.__doc__
+
+    def __dir__(self):
+        attrs = ["__doc__", "__name__"]
+        attrs += [attr.name for attr in self._moved_attributes]
+        return attrs
+
+    # Subclasses should override this
+    _moved_attributes = []
+
+
+class MovedAttribute(_LazyDescr):
+
+    def __init__(self, name, old_mod, new_mod, old_attr=None, new_attr=None):
+        super(MovedAttribute, self).__init__(name)
+        if PY3:
+            if new_mod is None:
+                new_mod = name
+            self.mod = new_mod
+            if new_attr is None:
+                if old_attr is None:
+                    new_attr = name
+                else:
+                    new_attr = old_attr
+            self.attr = new_attr
+        else:
+            self.mod = old_mod
+            if old_attr is None:
+                old_attr = name
+            self.attr = old_attr
+
+    def _resolve(self):
+        module = _import_module(self.mod)
+        return getattr(module, self.attr)
+
+
+class _SixMetaPathImporter(object):
+
+    """
+    A meta path importer to import six.moves and its submodules.
+
+    This class implements a PEP302 finder and loader. It should be compatible
+    with Python 2.5 and all existing versions of Python3
+    """
+
+    def __init__(self, six_module_name):
+        self.name = six_module_name
+        self.known_modules = {}
+
+    def _add_module(self, mod, *fullnames):
+        for fullname in fullnames:
+            self.known_modules[self.name + "." + fullname] = mod
+
+    def _get_module(self, fullname):
+        return self.known_modules[self.name + "." + fullname]
+
+    def find_module(self, fullname, path=None):
+        if fullname in self.known_modules:
+            return self
+        return None
+
+    def __get_module(self, fullname):
+        try:
+            return self.known_modules[fullname]
+        except KeyError:
+            raise ImportError("This loader does not know module " + fullname)
+
+    def load_module(self, fullname):
+        try:
+            # in case of a reload
+            return sys.modules[fullname]
+        except KeyError:
+            pass
+        mod = self.__get_module(fullname)
+        if isinstance(mod, MovedModule):
+            mod = mod._resolve()
+        else:
+            mod.__loader__ = self
+        sys.modules[fullname] = mod
+        return mod
+
+    def is_package(self, fullname):
+        """
+        Return true, if the named module is a package.
+
+        We need this method to get correct spec objects with
+        Python 3.4 (see PEP451)
+        """
+        return hasattr(self.__get_module(fullname), "__path__")
+
+    def get_code(self, fullname):
+        """Return None
+
+        Required, if is_package is implemented"""
+        self.__get_module(fullname)  # eventually raises ImportError
+        return None
+    get_source = get_code  # same as get_code
+
+_importer = _SixMetaPathImporter(__name__)
+
+
+class _MovedItems(_LazyModule):
+
+    """Lazy loading of moved objects"""
+    __path__ = []  # mark as package
+
+
+_moved_attributes = [
+    MovedAttribute("cStringIO", "cStringIO", "io", "StringIO"),
+    MovedAttribute("filter", "itertools", "builtins", "ifilter", "filter"),
+    MovedAttribute("filterfalse", "itertools", "itertools", "ifilterfalse", "filterfalse"),
+    MovedAttribute("input", "__builtin__", "builtins", "raw_input", "input"),
+    MovedAttribute("intern", "__builtin__", "sys"),
+    MovedAttribute("map", "itertools", "builtins", "imap", "map"),
+    MovedAttribute("getcwd", "os", "os", "getcwdu", "getcwd"),
+    MovedAttribute("getcwdb", "os", "os", "getcwd", "getcwdb"),
+    MovedAttribute("range", "__builtin__", "builtins", "xrange", "range"),
+    MovedAttribute("reload_module", "__builtin__", "importlib" if PY34 else "imp", "reload"),
+    MovedAttribute("reduce", "__builtin__", "functools"),
+    MovedAttribute("shlex_quote", "pipes", "shlex", "quote"),
+    MovedAttribute("StringIO", "StringIO", "io"),
+    MovedAttribute("UserDict", "UserDict", "collections"),
+    MovedAttribute("UserList", "UserList", "collections"),
+    MovedAttribute("UserString", "UserString", "collections"),
+    MovedAttribute("xrange", "__builtin__", "builtins", "xrange", "range"),
+    MovedAttribute("zip", "itertools", "builtins", "izip", "zip"),
+    MovedAttribute("zip_longest", "itertools", "itertools", "izip_longest", "zip_longest"),
+    MovedModule("builtins", "__builtin__"),
+    MovedModule("configparser", "ConfigParser"),
+    MovedModule("copyreg", "copy_reg"),
+    MovedModule("dbm_gnu", "gdbm", "dbm.gnu"),
+    MovedModule("_dummy_thread", "dummy_thread", "_dummy_thread"),
+    MovedModule("http_cookiejar", "cookielib", "http.cookiejar"),
+    MovedModule("http_cookies", "Cookie", "http.cookies"),
+    MovedModule("html_entities", "htmlentitydefs", "html.entities"),
+    MovedModule("html_parser", "HTMLParser", "html.parser"),
+    MovedModule("http_client", "httplib", "http.client"),
+    MovedModule("email_mime_multipart", "email.MIMEMultipart", "email.mime.multipart"),
+    MovedModule("email_mime_nonmultipart", "email.MIMENonMultipart", "email.mime.nonmultipart"),
+    MovedModule("email_mime_text", "email.MIMEText", "email.mime.text"),
+    MovedModule("email_mime_base", "email.MIMEBase", "email.mime.base"),
+    MovedModule("BaseHTTPServer", "BaseHTTPServer", "http.server"),
+    MovedModule("CGIHTTPServer", "CGIHTTPServer", "http.server"),
+    MovedModule("SimpleHTTPServer", "SimpleHTTPServer", "http.server"),
+    MovedModule("cPickle", "cPickle", "pickle"),
+    MovedModule("queue", "Queue"),
+    MovedModule("reprlib", "repr"),
+    MovedModule("socketserver", "SocketServer"),
+    MovedModule("_thread", "thread", "_thread"),
+    MovedModule("tkinter", "Tkinter"),
+    MovedModule("tkinter_dialog", "Dialog", "tkinter.dialog"),
+    MovedModule("tkinter_filedialog", "FileDialog", "tkinter.filedialog"),
+    MovedModule("tkinter_scrolledtext", "ScrolledText", "tkinter.scrolledtext"),
+    MovedModule("tkinter_simpledialog", "SimpleDialog", "tkinter.simpledialog"),
+    MovedModule("tkinter_tix", "Tix", "tkinter.tix"),
+    MovedModule("tkinter_ttk", "ttk", "tkinter.ttk"),
+    MovedModule("tkinter_constants", "Tkconstants", "tkinter.constants"),
+    MovedModule("tkinter_dnd", "Tkdnd", "tkinter.dnd"),
+    MovedModule("tkinter_colorchooser", "tkColorChooser",
+                "tkinter.colorchooser"),
+    MovedModule("tkinter_commondialog", "tkCommonDialog",
+                "tkinter.commondialog"),
+    MovedModule("tkinter_tkfiledialog", "tkFileDialog", "tkinter.filedialog"),
+    MovedModule("tkinter_font", "tkFont", "tkinter.font"),
+    MovedModule("tkinter_messagebox", "tkMessageBox", "tkinter.messagebox"),
+    MovedModule("tkinter_tksimpledialog", "tkSimpleDialog",
+                "tkinter.simpledialog"),
+    MovedModule("urllib_parse", __name__ + ".moves.urllib_parse", "urllib.parse"),
+    MovedModule("urllib_error", __name__ + ".moves.urllib_error", "urllib.error"),
+    MovedModule("urllib", __name__ + ".moves.urllib", __name__ + ".moves.urllib"),
+    MovedModule("urllib_robotparser", "robotparser", "urllib.robotparser"),
+    MovedModule("xmlrpc_client", "xmlrpclib", "xmlrpc.client"),
+    MovedModule("xmlrpc_server", "SimpleXMLRPCServer", "xmlrpc.server"),
+]
+# Add windows specific modules.
+if sys.platform == "win32":
+    _moved_attributes += [
+        MovedModule("winreg", "_winreg"),
+    ]
+
+for attr in _moved_attributes:
+    setattr(_MovedItems, attr.name, attr)
+    if isinstance(attr, MovedModule):
+        _importer._add_module(attr, "moves." + attr.name)
+del attr
+
+_MovedItems._moved_attributes = _moved_attributes
+
+moves = _MovedItems(__name__ + ".moves")
+_importer._add_module(moves, "moves")
+
+
+class Module_six_moves_urllib_parse(_LazyModule):
+
+    """Lazy loading of moved objects in six.moves.urllib_parse"""
+
+
+_urllib_parse_moved_attributes = [
+    MovedAttribute("ParseResult", "urlparse", "urllib.parse"),
+    MovedAttribute("SplitResult", "urlparse", "urllib.parse"),
+    MovedAttribute("parse_qs", "urlparse", "urllib.parse"),
+    MovedAttribute("parse_qsl", "urlparse", "urllib.parse"),
+    MovedAttribute("urldefrag", "urlparse", "urllib.parse"),
+    MovedAttribute("urljoin", "urlparse", "urllib.parse"),
+    MovedAttribute("urlparse", "urlparse", "urllib.parse"),
+    MovedAttribute("urlsplit", "urlparse", "urllib.parse"),
+    MovedAttribute("urlunparse", "urlparse", "urllib.parse"),
+    MovedAttribute("urlunsplit", "urlparse", "urllib.parse"),
+    MovedAttribute("quote", "urllib", "urllib.parse"),
+    MovedAttribute("quote_plus", "urllib", "urllib.parse"),
+    MovedAttribute("unquote", "urllib", "urllib.parse"),
+    MovedAttribute("unquote_plus", "urllib", "urllib.parse"),
+    MovedAttribute("urlencode", "urllib", "urllib.parse"),
+    MovedAttribute("splitquery", "urllib", "urllib.parse"),
+    MovedAttribute("splittag", "urllib", "urllib.parse"),
+    MovedAttribute("splituser", "urllib", "urllib.parse"),
+    MovedAttribute("uses_fragment", "urlparse", "urllib.parse"),
+    MovedAttribute("uses_netloc", "urlparse", "urllib.parse"),
+    MovedAttribute("uses_params", "urlparse", "urllib.parse"),
+    MovedAttribute("uses_query", "urlparse", "urllib.parse"),
+    MovedAttribute("uses_relative", "urlparse", "urllib.parse"),
+]
+for attr in _urllib_parse_moved_attributes:
+    setattr(Module_six_moves_urllib_parse, attr.name, attr)
+del attr
+
+Module_six_moves_urllib_parse._moved_attributes = _urllib_parse_moved_attributes
+
+_importer._add_module(Module_six_moves_urllib_parse(__name__ + ".moves.urllib_parse"),
+                      "moves.urllib_parse", "moves.urllib.parse")
+
+
+class Module_six_moves_urllib_error(_LazyModule):
+
+    """Lazy loading of moved objects in six.moves.urllib_error"""
+
+
+_urllib_error_moved_attributes = [
+    MovedAttribute("URLError", "urllib2", "urllib.error"),
+    MovedAttribute("HTTPError", "urllib2", "urllib.error"),
+    MovedAttribute("ContentTooShortError", "urllib", "urllib.error"),
+]
+for attr in _urllib_error_moved_attributes:
+    setattr(Module_six_moves_urllib_error, attr.name, attr)
+del attr
+
+Module_six_moves_urllib_error._moved_attributes = _urllib_error_moved_attributes
+
+_importer._add_module(Module_six_moves_urllib_error(__name__ + ".moves.urllib.error"),
+                      "moves.urllib_error", "moves.urllib.error")
+
+
+class Module_six_moves_urllib_request(_LazyModule):
+
+    """Lazy loading of moved objects in six.moves.urllib_request"""
+
+
+_urllib_request_moved_attributes = [
+    MovedAttribute("urlopen", "urllib2", "urllib.request"),
+    MovedAttribute("install_opener", "urllib2", "urllib.request"),
+    MovedAttribute("build_opener", "urllib2", "urllib.request"),
+    MovedAttribute("pathname2url", "urllib", "urllib.request"),
+    MovedAttribute("url2pathname", "urllib", "urllib.request"),
+    MovedAttribute("getproxies", "urllib", "urllib.request"),
+    MovedAttribute("Request", "urllib2", "urllib.request"),
+    MovedAttribute("OpenerDirector", "urllib2", "urllib.request"),
+    MovedAttribute("HTTPDefaultErrorHandler", "urllib2", "urllib.request"),
+    MovedAttribute("HTTPRedirectHandler", "urllib2", "urllib.request"),
+    MovedAttribute("HTTPCookieProcessor", "urllib2", "urllib.request"),
+    MovedAttribute("ProxyHandler", "urllib2", "urllib.request"),
+    MovedAttribute("BaseHandler", "urllib2", "urllib.request"),
+    MovedAttribute("HTTPPasswordMgr", "urllib2", "urllib.request"),
+    MovedAttribute("HTTPPasswordMgrWithDefaultRealm", "urllib2", "urllib.request"),
+    MovedAttribute("AbstractBasicAuthHandler", "urllib2", "urllib.request"),
+    MovedAttribute("HTTPBasicAuthHandler", "urllib2", "urllib.request"),
+    MovedAttribute("ProxyBasicAuthHandler", "urllib2", "urllib.request"),
+    MovedAttribute("AbstractDigestAuthHandler", "urllib2", "urllib.request"),
+    MovedAttribute("HTTPDigestAuthHandler", "urllib2", "urllib.request"),
+    MovedAttribute("ProxyDigestAuthHandler", "urllib2", "urllib.request"),
+    MovedAttribute("HTTPHandler", "urllib2", "urllib.request"),
+    MovedAttribute("HTTPSHandler", "urllib2", "urllib.request"),
+    MovedAttribute("FileHandler", "urllib2", "urllib.request"),
+    MovedAttribute("FTPHandler", "urllib2", "urllib.request"),
+    MovedAttribute("CacheFTPHandler", "urllib2", "urllib.request"),
+    MovedAttribute("UnknownHandler", "urllib2", "urllib.request"),
+    MovedAttribute("HTTPErrorProcessor", "urllib2", "urllib.request"),
+    MovedAttribute("urlretrieve", "urllib", "urllib.request"),
+    MovedAttribute("urlcleanup", "urllib", "urllib.request"),
+    MovedAttribute("URLopener", "urllib", "urllib.request"),
+    MovedAttribute("FancyURLopener", "urllib", "urllib.request"),
+    MovedAttribute("proxy_bypass", "urllib", "urllib.request"),
+]
+for attr in _urllib_request_moved_attributes:
+    setattr(Module_six_moves_urllib_request, attr.name, attr)
+del attr
+
+Module_six_moves_urllib_request._moved_attributes = _urllib_request_moved_attributes
+
+_importer._add_module(Module_six_moves_urllib_request(__name__ + ".moves.urllib.request"),
+                      "moves.urllib_request", "moves.urllib.request")
+
+
+class Module_six_moves_urllib_response(_LazyModule):
+
+    """Lazy loading of moved objects in six.moves.urllib_response"""
+
+
+_urllib_response_moved_attributes = [
+    MovedAttribute("addbase", "urllib", "urllib.response"),
+    MovedAttribute("addclosehook", "urllib", "urllib.response"),
+    MovedAttribute("addinfo", "urllib", "urllib.response"),
+    MovedAttribute("addinfourl", "urllib", "urllib.response"),
+]
+for attr in _urllib_response_moved_attributes:
+    setattr(Module_six_moves_urllib_response, attr.name, attr)
+del attr
+
+Module_six_moves_urllib_response._moved_attributes = _urllib_response_moved_attributes
+
+_importer._add_module(Module_six_moves_urllib_response(__name__ + ".moves.urllib.response"),
+                      "moves.urllib_response", "moves.urllib.response")
+
+
+class Module_six_moves_urllib_robotparser(_LazyModule):
+
+    """Lazy loading of moved objects in six.moves.urllib_robotparser"""
+
+
+_urllib_robotparser_moved_attributes = [
+    MovedAttribute("RobotFileParser", "robotparser", "urllib.robotparser"),
+]
+for attr in _urllib_robotparser_moved_attributes:
+    setattr(Module_six_moves_urllib_robotparser, attr.name, attr)
+del attr
+
+Module_six_moves_urllib_robotparser._moved_attributes = _urllib_robotparser_moved_attributes
+
+_importer._add_module(Module_six_moves_urllib_robotparser(__name__ + ".moves.urllib.robotparser"),
+                      "moves.urllib_robotparser", "moves.urllib.robotparser")
+
+
+class Module_six_moves_urllib(types.ModuleType):
+
+    """Create a six.moves.urllib namespace that resembles the Python 3 namespace"""
+    __path__ = []  # mark as package
+    parse = _importer._get_module("moves.urllib_parse")
+    error = _importer._get_module("moves.urllib_error")
+    request = _importer._get_module("moves.urllib_request")
+    response = _importer._get_module("moves.urllib_response")
+    robotparser = _importer._get_module("moves.urllib_robotparser")
+
+    def __dir__(self):
+        return ['parse', 'error', 'request', 'response', 'robotparser']
+
+_importer._add_module(Module_six_moves_urllib(__name__ + ".moves.urllib"),
+                      "moves.urllib")
+
+
+def add_move(move):
+    """Add an item to six.moves."""
+    setattr(_MovedItems, move.name, move)
+
+
+def remove_move(name):
+    """Remove item from six.moves."""
+    try:
+        delattr(_MovedItems, name)
+    except AttributeError:
+        try:
+            del moves.__dict__[name]
+        except KeyError:
+            raise AttributeError("no such move, %r" % (name,))
+
+
+if PY3:
+    _meth_func = "__func__"
+    _meth_self = "__self__"
+
+    _func_closure = "__closure__"
+    _func_code = "__code__"
+    _func_defaults = "__defaults__"
+    _func_globals = "__globals__"
+else:
+    _meth_func = "im_func"
+    _meth_self = "im_self"
+
+    _func_closure = "func_closure"
+    _func_code = "func_code"
+    _func_defaults = "func_defaults"
+    _func_globals = "func_globals"
+
+
+try:
+    advance_iterator = next
+except NameError:
+    def advance_iterator(it):
+        return it.next()
+next = advance_iterator
+
+
+try:
+    callable = callable
+except NameError:
+    def callable(obj):
+        return any("__call__" in klass.__dict__ for klass in type(obj).__mro__)
+
+
+if PY3:
+    def get_unbound_function(unbound):
+        return unbound
+
+    create_bound_method = types.MethodType
+
+    def create_unbound_method(func, cls):
+        return func
+
+    Iterator = object
+else:
+    def get_unbound_function(unbound):
+        return unbound.im_func
+
+    def create_bound_method(func, obj):
+        return types.MethodType(func, obj, obj.__class__)
+
+    def create_unbound_method(func, cls):
+        return types.MethodType(func, None, cls)
+
+    class Iterator(object):
+
+        def next(self):
+            return type(self).__next__(self)
+
+    callable = callable
+_add_doc(get_unbound_function,
+         """Get the function out of a possibly unbound function""")
+
+
+get_method_function = operator.attrgetter(_meth_func)
+get_method_self = operator.attrgetter(_meth_self)
+get_function_closure = operator.attrgetter(_func_closure)
+get_function_code = operator.attrgetter(_func_code)
+get_function_defaults = operator.attrgetter(_func_defaults)
+get_function_globals = operator.attrgetter(_func_globals)
+
+
+if PY3:
+    def iterkeys(d, **kw):
+        return iter(d.keys(**kw))
+
+    def itervalues(d, **kw):
+        return iter(d.values(**kw))
+
+    def iteritems(d, **kw):
+        return iter(d.items(**kw))
+
+    def iterlists(d, **kw):
+        return iter(d.lists(**kw))
+
+    viewkeys = operator.methodcaller("keys")
+
+    viewvalues = operator.methodcaller("values")
+
+    viewitems = operator.methodcaller("items")
+else:
+    def iterkeys(d, **kw):
+        return d.iterkeys(**kw)
+
+    def itervalues(d, **kw):
+        return d.itervalues(**kw)
+
+    def iteritems(d, **kw):
+        return d.iteritems(**kw)
+
+    def iterlists(d, **kw):
+        return d.iterlists(**kw)
+
+    viewkeys = operator.methodcaller("viewkeys")
+
+    viewvalues = operator.methodcaller("viewvalues")
+
+    viewitems = operator.methodcaller("viewitems")
+
+_add_doc(iterkeys, "Return an iterator over the keys of a dictionary.")
+_add_doc(itervalues, "Return an iterator over the values of a dictionary.")
+_add_doc(iteritems,
+         "Return an iterator over the (key, value) pairs of a dictionary.")
+_add_doc(iterlists,
+         "Return an iterator over the (key, [values]) pairs of a dictionary.")
+
+
+if PY3:
+    def b(s):
+        return s.encode("latin-1")
+
+    def u(s):
+        return s
+    unichr = chr
+    import struct
+    int2byte = struct.Struct(">B").pack
+    del struct
+    byte2int = operator.itemgetter(0)
+    indexbytes = operator.getitem
+    iterbytes = iter
+    import io
+    StringIO = io.StringIO
+    BytesIO = io.BytesIO
+    _assertCountEqual = "assertCountEqual"
+    if sys.version_info[1] <= 1:
+        _assertRaisesRegex = "assertRaisesRegexp"
+        _assertRegex = "assertRegexpMatches"
+    else:
+        _assertRaisesRegex = "assertRaisesRegex"
+        _assertRegex = "assertRegex"
+else:
+    def b(s):
+        return s
+    # Workaround for standalone backslash
+
+    def u(s):
+        return unicode(s.replace(r'\\', r'\\\\'), "unicode_escape")
+    unichr = unichr
+    int2byte = chr
+
+    def byte2int(bs):
+        return ord(bs[0])
+
+    def indexbytes(buf, i):
+        return ord(buf[i])
+    iterbytes = functools.partial(itertools.imap, ord)
+    import StringIO
+    StringIO = BytesIO = StringIO.StringIO
+    _assertCountEqual = "assertItemsEqual"
+    _assertRaisesRegex = "assertRaisesRegexp"
+    _assertRegex = "assertRegexpMatches"
+_add_doc(b, """Byte literal""")
+_add_doc(u, """Text literal""")
+
+
+def assertCountEqual(self, *args, **kwargs):
+    return getattr(self, _assertCountEqual)(*args, **kwargs)
+
+
+def assertRaisesRegex(self, *args, **kwargs):
+    return getattr(self, _assertRaisesRegex)(*args, **kwargs)
+
+
+def assertRegex(self, *args, **kwargs):
+    return getattr(self, _assertRegex)(*args, **kwargs)
+
+
+if PY3:
+    exec_ = getattr(moves.builtins, "exec")
+
+    def reraise(tp, value, tb=None):
+        if value is None:
+            value = tp()
+        if value.__traceback__ is not tb:
+            raise value.with_traceback(tb)
+        raise value
+
+else:
+    def exec_(_code_, _globs_=None, _locs_=None):
+        """Execute code in a namespace."""
+        if _globs_ is None:
+            frame = sys._getframe(1)
+            _globs_ = frame.f_globals
+            if _locs_ is None:
+                _locs_ = frame.f_locals
+            del frame
+        elif _locs_ is None:
+            _locs_ = _globs_
+        exec("""exec _code_ in _globs_, _locs_""")
+
+    exec_("""def reraise(tp, value, tb=None):
+    raise tp, value, tb
+""")
+
+
+if sys.version_info[:2] == (3, 2):
+    exec_("""def raise_from(value, from_value):
+    if from_value is None:
+        raise value
+    raise value from from_value
+""")
+elif sys.version_info[:2] > (3, 2):
+    exec_("""def raise_from(value, from_value):
+    raise value from from_value
+""")
+else:
+    def raise_from(value, from_value):
+        raise value
+
+
+print_ = getattr(moves.builtins, "print", None)
+if print_ is None:
+    def print_(*args, **kwargs):
+        """The new-style print function for Python 2.4 and 2.5."""
+        fp = kwargs.pop("file", sys.stdout)
+        if fp is None:
+            return
+
+        def write(data):
+            if not isinstance(data, basestring):
+                data = str(data)
+            # If the file has an encoding, encode unicode with it.
+            if (isinstance(fp, file) and
+                    isinstance(data, unicode) and
+                    fp.encoding is not None):
+                errors = getattr(fp, "errors", None)
+                if errors is None:
+                    errors = "strict"
+                data = data.encode(fp.encoding, errors)
+            fp.write(data)
+        want_unicode = False
+        sep = kwargs.pop("sep", None)
+        if sep is not None:
+            if isinstance(sep, unicode):
+                want_unicode = True
+            elif not isinstance(sep, str):
+                raise TypeError("sep must be None or a string")
+        end = kwargs.pop("end", None)
+        if end is not None:
+            if isinstance(end, unicode):
+                want_unicode = True
+            elif not isinstance(end, str):
+                raise TypeError("end must be None or a string")
+        if kwargs:
+            raise TypeError("invalid keyword arguments to print()")
+        if not want_unicode:
+            for arg in args:
+                if isinstance(arg, unicode):
+                    want_unicode = True
+                    break
+        if want_unicode:
+            newline = unicode("\n")
+            space = unicode(" ")
+        else:
+            newline = "\n"
+            space = " "
+        if sep is None:
+            sep = space
+        if end is None:
+            end = newline
+        for i, arg in enumerate(args):
+            if i:
+                write(sep)
+            write(arg)
+        write(end)
+if sys.version_info[:2] < (3, 3):
+    _print = print_
+
+    def print_(*args, **kwargs):
+        fp = kwargs.get("file", sys.stdout)
+        flush = kwargs.pop("flush", False)
+        _print(*args, **kwargs)
+        if flush and fp is not None:
+            fp.flush()
+
+_add_doc(reraise, """Reraise an exception.""")
+
+if sys.version_info[0:2] < (3, 4):
+    def wraps(wrapped, assigned=functools.WRAPPER_ASSIGNMENTS,
+              updated=functools.WRAPPER_UPDATES):
+        def wrapper(f):
+            f = functools.wraps(wrapped, assigned, updated)(f)
+            f.__wrapped__ = wrapped
+            return f
+        return wrapper
+else:
+    wraps = functools.wraps
+
+
+def with_metaclass(meta, *bases):
+    """Create a base class with a metaclass."""
+    # This requires a bit of explanation: the basic idea is to make a dummy
+    # metaclass for one level of class instantiation that replaces itself with
+    # the actual metaclass.
+    class metaclass(meta):
+
+        def __new__(cls, name, this_bases, d):
+            return meta(name, bases, d)
+    return type.__new__(metaclass, 'temporary_class', (), {})
+
+
+def add_metaclass(metaclass):
+    """Class decorator for creating a class with a metaclass."""
+    def wrapper(cls):
+        orig_vars = cls.__dict__.copy()
+        slots = orig_vars.get('__slots__')
+        if slots is not None:
+            if isinstance(slots, str):
+                slots = [slots]
+            for slots_var in slots:
+                orig_vars.pop(slots_var)
+        orig_vars.pop('__dict__', None)
+        orig_vars.pop('__weakref__', None)
+        return metaclass(cls.__name__, cls.__bases__, orig_vars)
+    return wrapper
+
+
+def python_2_unicode_compatible(klass):
+    """
+    A decorator that defines __unicode__ and __str__ methods under Python 2.
+    Under Python 3 it does nothing.
+
+    To support Python 2 and 3 with a single code base, define a __str__ method
+    returning text and apply this decorator to the class.
+    """
+    if PY2:
+        if '__str__' not in klass.__dict__:
+            raise ValueError("@python_2_unicode_compatible cannot be applied "
+                             "to %s because it doesn't define __str__()." %
+                             klass.__name__)
+        klass.__unicode__ = klass.__str__
+        klass.__str__ = lambda self: self.__unicode__().encode('utf-8')
+    return klass
+
+
+# Complete the moves implementation.
+# This code is at the end of this module to speed up module loading.
+# Turn this module into a package.
+__path__ = []  # required for PEP 302 and PEP 451
+__package__ = __name__  # see PEP 366 @ReservedAssignment
+if globals().get("__spec__") is not None:
+    __spec__.submodule_search_locations = []  # PEP 451 @UndefinedVariable
+# Remove other six meta path importers, since they cause problems. This can
+# happen if six is removed from sys.modules and then reloaded. (Setuptools does
+# this for some reason.)
+if sys.meta_path:
+    for i, importer in enumerate(sys.meta_path):
+        # Here's some real nastiness: Another "instance" of the six module might
+        # be floating around. Therefore, we can't use isinstance() to check for
+        # the six meta path importer, since the other six instance will have
+        # inserted an importer with different class.
+        if (type(importer).__name__ == "_SixMetaPathImporter" and
+                importer.name == __name__):
+            del sys.meta_path[i]
+            break
+    del i, importer
+# Finally, add the importer to the meta path import hook.
+sys.meta_path.append(_importer)