| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #ifndef CHROME_BROWSER_THEMES_BROWSER_THEME_PACK_H_ | 5 #ifndef CHROME_BROWSER_THEMES_BROWSER_THEME_PACK_H_ |
| 6 #define CHROME_BROWSER_THEMES_BROWSER_THEME_PACK_H_ | 6 #define CHROME_BROWSER_THEMES_BROWSER_THEME_PACK_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <string> | 10 #include <string> |
| 11 | 11 |
| 12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 13 #include "base/scoped_ptr.h" | 13 #include "base/scoped_ptr.h" |
| 14 #include "base/ref_counted.h" | 14 #include "base/ref_counted.h" |
| 15 #include "gfx/color_utils.h" | 15 #include "gfx/color_utils.h" |
| 16 #include "chrome/browser/browser_thread.h" | 16 #include "chrome/browser/browser_thread.h" |
| 17 #include "chrome/common/extensions/extension.h" | 17 #include "chrome/common/extensions/extension.h" |
| 18 | 18 |
| 19 namespace base { | 19 namespace app { |
| 20 class DataPack; | 20 class DataPack; |
| 21 } | 21 } |
| 22 class DictionaryValue; | 22 class DictionaryValue; |
| 23 class FilePath; | 23 class FilePath; |
| 24 class RefCountedMemory; | 24 class RefCountedMemory; |
| 25 | 25 |
| 26 // An optimized representation of a theme, backed by a mmapped DataPack. | 26 // An optimized representation of a theme, backed by a mmapped DataPack. |
| 27 // | 27 // |
| 28 // The idea is to pre-process all images (tinting, compositing, etc) at theme | 28 // The idea is to pre-process all images (tinting, compositing, etc) at theme |
| 29 // install time, save all the PNG-ified data into an mmappable file so we don't | 29 // install time, save all the PNG-ified data into an mmappable file so we don't |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 | 163 |
| 164 // Changes the RefCountedMemory based |images| into StringPiece data in |out|. | 164 // Changes the RefCountedMemory based |images| into StringPiece data in |out|. |
| 165 void AddRawImagesTo(const RawImages& images, RawDataForWriting* out) const; | 165 void AddRawImagesTo(const RawImages& images, RawDataForWriting* out) const; |
| 166 | 166 |
| 167 // Retrieves the tint OR the default tint. Unlike the public interface, we | 167 // Retrieves the tint OR the default tint. Unlike the public interface, we |
| 168 // always need to return a reasonable tint here, instead of partially | 168 // always need to return a reasonable tint here, instead of partially |
| 169 // querying if the tint exists. | 169 // querying if the tint exists. |
| 170 color_utils::HSL GetTintInternal(int id) const; | 170 color_utils::HSL GetTintInternal(int id) const; |
| 171 | 171 |
| 172 // Data pack, if we have one. | 172 // Data pack, if we have one. |
| 173 scoped_ptr<base::DataPack> data_pack_; | 173 scoped_ptr<app::DataPack> data_pack_; |
| 174 | 174 |
| 175 // All structs written to disk need to be packed; no alignment tricks here, | 175 // All structs written to disk need to be packed; no alignment tricks here, |
| 176 // please. | 176 // please. |
| 177 #pragma pack(push,1) | 177 #pragma pack(push,1) |
| 178 // Header that is written to disk. | 178 // Header that is written to disk. |
| 179 struct BrowserThemePackHeader { | 179 struct BrowserThemePackHeader { |
| 180 // Numeric version to make sure we're compatible in the future. | 180 // Numeric version to make sure we're compatible in the future. |
| 181 int32 version; | 181 int32 version; |
| 182 | 182 |
| 183 // 1 if little_endian. 0 if big_endian. On mismatch, abort load. | 183 // 1 if little_endian. 0 if big_endian. On mismatch, abort load. |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 // in |image_memory_| that are in |prepared_images_| or vice versa. | 225 // in |image_memory_| that are in |prepared_images_| or vice versa. |
| 226 ImageCache prepared_images_; | 226 ImageCache prepared_images_; |
| 227 | 227 |
| 228 // Loaded images. These are loaded from |image_memory_| or the |data_pack_|. | 228 // Loaded images. These are loaded from |image_memory_| or the |data_pack_|. |
| 229 mutable ImageCache loaded_images_; | 229 mutable ImageCache loaded_images_; |
| 230 | 230 |
| 231 DISALLOW_COPY_AND_ASSIGN(BrowserThemePack); | 231 DISALLOW_COPY_AND_ASSIGN(BrowserThemePack); |
| 232 }; | 232 }; |
| 233 | 233 |
| 234 #endif // CHROME_BROWSER_THEMES_BROWSER_THEME_PACK_H_ | 234 #endif // CHROME_BROWSER_THEMES_BROWSER_THEME_PACK_H_ |
| OLD | NEW |