summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authortony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-04 20:32:52 +0000
committertony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-04 20:32:52 +0000
commitca39c1c2d84c152e7365ab5f2e5fcb1bb6056b55 (patch)
tree1f71fdc61b39b4728dbf5d774f1306c0a34bb96b /tools
parent8acfa0427d4a27763b8cf63a846e55b75e9073d9 (diff)
downloadchromium_src-ca39c1c2d84c152e7365ab5f2e5fcb1bb6056b55.zip
chromium_src-ca39c1c2d84c152e7365ab5f2e5fcb1bb6056b55.tar.gz
chromium_src-ca39c1c2d84c152e7365ab5f2e5fcb1bb6056b55.tar.bz2
Abstract fullscreen exit bubble logic to bring Linux's behaviour in line with
Windows. BUG=30743 TEST= Review URL: http://codereview.chromium.org/7549005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@95480 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools')
-rwxr-xr-xtools/data_pack/data_pack.py13
-rwxr-xr-xtools/grit/grit/format/data_pack.py7
-rw-r--r--tools/grit/grit/format/data_pack_unittest.py8
3 files changed, 15 insertions, 13 deletions
diff --git a/tools/data_pack/data_pack.py b/tools/data_pack/data_pack.py
index fde9483..571842e 100755
--- a/tools/data_pack/data_pack.py
+++ b/tools/data_pack/data_pack.py
@@ -1,5 +1,5 @@
#!/usr/bin/python
-# Copyright (c) 2008 The Chromium Authors. All rights reserved.
+# 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.
@@ -9,7 +9,7 @@ See base/pack_file* for details.
import struct
-FILE_FORMAT_VERSION = 1
+FILE_FORMAT_VERSION = 2
HEADER_LENGTH = 2 * 4 # Two uint32s. (file version and number of entries)
class WrongFileVersion(Exception):
@@ -28,9 +28,9 @@ def ReadDataPack(input_file):
resources = {}
# Read the index and data.
data = data[HEADER_LENGTH:]
- kIndexEntrySize = 3 * 4 # Each entry is 3 uint32s.
+ kIndexEntrySize = 2 + 2 * 4 # Each entry is 1 uint16 and 2 uint32s.
for _ in range(num_entries):
- id, offset, length = struct.unpack("<III", data[:kIndexEntrySize])
+ id, offset, length = struct.unpack("<HII", data[:kIndexEntrySize])
data = data[kIndexEntrySize:]
resources[id] = original_data[offset:offset + length]
@@ -44,12 +44,13 @@ def WriteDataPack(resources, output_file):
# Write file header.
file.write(struct.pack("<II", FILE_FORMAT_VERSION, len(ids)))
- index_length = len(ids) * 3 * 4 # Each entry is 3 uint32s.
+ # Each entry is 1 uint16 and 2 uint32s.
+ index_length = len(ids) * (2 + 2 * 4)
# Write index.
data_offset = HEADER_LENGTH + index_length
for id in ids:
- file.write(struct.pack("<III", id, data_offset, len(resources[id])))
+ file.write(struct.pack("<HII", id, data_offset, len(resources[id])))
data_offset += len(resources[id])
# Write data.
diff --git a/tools/grit/grit/format/data_pack.py b/tools/grit/grit/format/data_pack.py
index c8a46ad..112c13e 100755
--- a/tools/grit/grit/format/data_pack.py
+++ b/tools/grit/grit/format/data_pack.py
@@ -15,7 +15,7 @@ from grit.node import message
from grit.node import misc
-PACK_FILE_VERSION = 1
+PACK_FILE_VERSION = 2
class DataPack(interface.ItemFormatter):
@@ -60,12 +60,13 @@ class DataPack(interface.ItemFormatter):
ret.append(struct.pack("<II", PACK_FILE_VERSION, len(ids)))
HEADER_LENGTH = 2 * 4 # Two uint32s.
- index_length = len(ids) * 3 * 4 # Each entry is 3 uint32s.
+ # Each entry is 1 uint16 + 2 uint32s.
+ index_length = len(ids) * (2 + 2 * 4)
# Write index.
data_offset = HEADER_LENGTH + index_length
for id in ids:
- ret.append(struct.pack("<III", id, data_offset, len(resources[id])))
+ ret.append(struct.pack("<HII", id, data_offset, len(resources[id])))
data_offset += len(resources[id])
# Write data.
diff --git a/tools/grit/grit/format/data_pack_unittest.py b/tools/grit/grit/format/data_pack_unittest.py
index 353f8c1..77c4ba1 100644
--- a/tools/grit/grit/format/data_pack_unittest.py
+++ b/tools/grit/grit/format/data_pack_unittest.py
@@ -1,5 +1,5 @@
#!/usr/bin/python2.4
-# Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+# 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.
@@ -15,9 +15,9 @@ from grit.format import data_pack
class FormatDataPackUnittest(unittest.TestCase):
def testWriteDataPack(self):
- expected = ('\x01\x00\x00\x00\x04\x00\x00\x00\x01\x00\x00\x008\x00\x00'
- '\x00\x00\x00\x00\x00\x04\x00\x00\x008\x00\x00\x00\x0c\x00\x00\x00'
- '\x06\x00\x00\x00D\x00\x00\x00\x0c\x00\x00\x00\n\x00\x00\x00P\x00'
+ expected = ('\x02\x00\x00\x00\x04\x00\x00\x00\x01\x000\x00\x00'
+ '\x00\x00\x00\x00\x00\x04\x000\x00\x00\x00\x0c\x00\x00\x00'
+ '\x06\x00<\x00\x00\x00\x0c\x00\x00\x00\n\x00H\x00'
'\x00\x00\x00\x00\x00\x00this is id 4this is id 6')
input = { 1: "", 4: "this is id 4", 6: "this is id 6", 10: "" }
output = data_pack.DataPack.WriteDataPack(input)