Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(317)

Side by Side Diff: chrome/browser/themes/browser_theme_pack.cc

Issue 7555003: Update the .pak file format to version 2: Make resource ids 16bit (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/themes/browser_theme_pack.h" 5 #include "chrome/browser/themes/browser_theme_pack.h"
6 6
7 #include <limits>
8
7 #include "base/stl_util.h" 9 #include "base/stl_util.h"
8 #include "base/string_util.h" 10 #include "base/string_util.h"
9 #include "base/threading/thread_restrictions.h" 11 #include "base/threading/thread_restrictions.h"
10 #include "base/utf_string_conversions.h" 12 #include "base/utf_string_conversions.h"
11 #include "base/values.h" 13 #include "base/values.h"
12 #include "chrome/browser/themes/theme_service.h" 14 #include "chrome/browser/themes/theme_service.h"
13 #include "content/browser/browser_thread.h" 15 #include "content/browser/browser_thread.h"
14 #include "grit/theme_resources.h" 16 #include "grit/theme_resources.h"
15 #include "grit/theme_resources_standard.h" 17 #include "grit/theme_resources_standard.h"
16 #include "grit/ui_resources.h" 18 #include "grit/ui_resources.h"
17 #include "net/base/file_stream.h" 19 #include "net/base/file_stream.h"
18 #include "net/base/net_errors.h" 20 #include "net/base/net_errors.h"
19 #include "third_party/skia/include/core/SkCanvas.h" 21 #include "third_party/skia/include/core/SkCanvas.h"
20 #include "ui/base/resource/data_pack.h" 22 #include "ui/base/resource/data_pack.h"
21 #include "ui/base/resource/resource_bundle.h" 23 #include "ui/base/resource/resource_bundle.h"
22 #include "ui/gfx/codec/png_codec.h" 24 #include "ui/gfx/codec/png_codec.h"
23 #include "ui/gfx/image/image.h" 25 #include "ui/gfx/image/image.h"
24 #include "ui/gfx/skbitmap_operations.h" 26 #include "ui/gfx/skbitmap_operations.h"
25 27
26 namespace { 28 namespace {
27 29
28 // Version number of the current theme pack. We just throw out and rebuild 30 // Version number of the current theme pack. We just throw out and rebuild
29 // theme packs that aren't int-equal to this. 31 // theme packs that aren't int-equal to this.
30 const int kThemePackVersion = 15; 32 const int kThemePackVersion = 16;
31 33
32 // IDs that are in the DataPack won't clash with the positive integer 34 // IDs that are in the DataPack won't clash with the positive integer
33 // int32_t. kHeaderID should always have the maximum value because we want the 35 // int32_t. kHeaderID should always have the maximum value because we want the
Evan Martin 2011/08/03 18:43:09 uint16
tony 2011/08/04 17:42:53 Fixed
34 // "header" to be written last. That way we can detect whether the pack was 36 // "header" to be written last. That way we can detect whether the pack was
35 // successfully written and ignore and regenerate if it was only partially 37 // successfully written and ignore and regenerate if it was only partially
36 // written (i.e. chrome crashed on a different thread while writing the pack). 38 // written (i.e. chrome crashed on a different thread while writing the pack).
37 const int kHeaderID = UINT_MAX - 1; 39 const int kHeaderID = std::numeric_limits<uint16>::max() - 1;
38 const int kTintsID = UINT_MAX - 2; 40 const int kTintsID = std::numeric_limits<uint16>::max() - 2;
39 const int kColorsID = UINT_MAX - 3; 41 const int kColorsID = std::numeric_limits<uint16>::max() - 3;
40 const int kDisplayPropertiesID = UINT_MAX - 4; 42 const int kDisplayPropertiesID = std::numeric_limits<uint16>::max() - 4;
41 const int kSourceImagesID = UINT_MAX - 5; 43 const int kSourceImagesID = std::numeric_limits<uint16>::max() - 5;
42 44
43 // Static size of the tint/color/display property arrays that are mmapped. 45 // Static size of the tint/color/display property arrays that are mmapped.
44 const int kTintArraySize = 6; 46 const int kTintArraySize = 6;
45 const int kColorArraySize = 19; 47 const int kColorArraySize = 19;
46 const int kDisplayPropertySize = 3; 48 const int kDisplayPropertySize = 3;
47 49
48 // The sum of kFrameBorderThickness and kNonClientRestoredExtraThickness from 50 // The sum of kFrameBorderThickness and kNonClientRestoredExtraThickness from
49 // OpaqueBrowserFrameView. 51 // OpaqueBrowserFrameView.
50 const int kRestoredTabVerticalOffset = 15; 52 const int kRestoredTabVerticalOffset = 15;
51 53
(...skipping 1005 matching lines...) Expand 10 before | Expand all | Expand 10 after
1057 hsl.h = tints_[i].h; 1059 hsl.h = tints_[i].h;
1058 hsl.s = tints_[i].s; 1060 hsl.s = tints_[i].s;
1059 hsl.l = tints_[i].l; 1061 hsl.l = tints_[i].l;
1060 return hsl; 1062 return hsl;
1061 } 1063 }
1062 } 1064 }
1063 } 1065 }
1064 1066
1065 return ThemeService::GetDefaultTint(id); 1067 return ThemeService::GetDefaultTint(id);
1066 } 1068 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698