OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 // Builds the theme pack from all data from |extension|. This is often done | 58 // Builds the theme pack from all data from |extension|. This is often done |
59 // on a separate thread as it takes so long. This can fail and return NULL in | 59 // on a separate thread as it takes so long. This can fail and return NULL in |
60 // the case where the theme has invalid data. | 60 // the case where the theme has invalid data. |
61 static scoped_refptr<BrowserThemePack> BuildFromExtension( | 61 static scoped_refptr<BrowserThemePack> BuildFromExtension( |
62 const extensions::Extension* extension); | 62 const extensions::Extension* extension); |
63 | 63 |
64 // Builds the theme pack from a previously performed WriteToDisk(). This | 64 // Builds the theme pack from a previously performed WriteToDisk(). This |
65 // operation should be relatively fast, as it should be an mmap() and some | 65 // operation should be relatively fast, as it should be an mmap() and some |
66 // pointer swizzling. Returns NULL on any error attempting to read |path|. | 66 // pointer swizzling. Returns NULL on any error attempting to read |path|. |
67 static scoped_refptr<BrowserThemePack> BuildFromDataPack( | 67 static scoped_refptr<BrowserThemePack> BuildFromDataPack( |
68 FilePath path, const std::string& expected_id); | 68 const FilePath& path, const std::string& expected_id); |
69 | 69 |
70 // Builds a data pack on disk at |path| for future quick loading by | 70 // Builds a data pack on disk at |path| for future quick loading by |
71 // BuildFromDataPack(). Often (but not always) called from the file thread; | 71 // BuildFromDataPack(). Often (but not always) called from the file thread; |
72 // implementation should be threadsafe because neither thread will write to | 72 // implementation should be threadsafe because neither thread will write to |
73 // |image_memory_| and the worker thread will keep a reference to prevent | 73 // |image_memory_| and the worker thread will keep a reference to prevent |
74 // destruction. | 74 // destruction. |
75 bool WriteToDisk(const FilePath& path) const; | 75 bool WriteToDisk(const FilePath& path) const; |
76 | 76 |
77 // If this theme specifies data for the corresponding |id|, return true and | 77 // If this theme specifies data for the corresponding |id|, return true and |
78 // write the corresponding value to the output parameter. These functions | 78 // write the corresponding value to the output parameter. These functions |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 // in |image_memory_| that are in |prepared_images_| or vice versa. | 242 // in |image_memory_| that are in |prepared_images_| or vice versa. |
243 ImageCache prepared_images_; | 243 ImageCache prepared_images_; |
244 | 244 |
245 // Loaded images. These are loaded from |image_memory_| or the |data_pack_|. | 245 // Loaded images. These are loaded from |image_memory_| or the |data_pack_|. |
246 mutable ImageCache loaded_images_; | 246 mutable ImageCache loaded_images_; |
247 | 247 |
248 DISALLOW_COPY_AND_ASSIGN(BrowserThemePack); | 248 DISALLOW_COPY_AND_ASSIGN(BrowserThemePack); |
249 }; | 249 }; |
250 | 250 |
251 #endif // CHROME_BROWSER_THEMES_BROWSER_THEME_PACK_H_ | 251 #endif // CHROME_BROWSER_THEMES_BROWSER_THEME_PACK_H_ |
OLD | NEW |