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 #include <vector> | 10 #include <vector> |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 const base::FilePath& path, const std::string& expected_id); | 68 const base::FilePath& path, const std::string& expected_id); |
69 | 69 |
70 // Returns the set of image IDRs which can be overwritten by a user provided | 70 // Returns the set of image IDRs which can be overwritten by a user provided |
71 // theme. | 71 // theme. |
72 static void GetThemeableImageIDRs(std::set<int>* result); | 72 static void GetThemeableImageIDRs(std::set<int>* result); |
73 | 73 |
| 74 // Returns true if an IDR exists. |
| 75 static bool FindThemeableImageIDRs(int id); |
| 76 |
74 // Builds a data pack on disk at |path| for future quick loading by | 77 // Builds a data pack on disk at |path| for future quick loading by |
75 // BuildFromDataPack(). Often (but not always) called from the file thread; | 78 // BuildFromDataPack(). Often (but not always) called from the file thread; |
76 // implementation should be threadsafe because neither thread will write to | 79 // implementation should be threadsafe because neither thread will write to |
77 // |image_memory_| and the worker thread will keep a reference to prevent | 80 // |image_memory_| and the worker thread will keep a reference to prevent |
78 // destruction. | 81 // destruction. |
79 bool WriteToDisk(const base::FilePath& path) const; | 82 bool WriteToDisk(const base::FilePath& path) const; |
80 | 83 |
81 // Overridden from CustomThemeSupplier: | 84 // Overridden from CustomThemeSupplier: |
82 bool GetTint(int id, color_utils::HSL* hsl) const override; | 85 bool GetTint(int id, color_utils::HSL* hsl) const override; |
83 bool GetColor(int id, SkColor* color) const override; | 86 bool GetColor(int id, SkColor* color) const override; |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 // Cache of images created in BuildFromExtension(). Once the theme pack is | 271 // Cache of images created in BuildFromExtension(). Once the theme pack is |
269 // created, this cache should only be accessed on the file thread. There | 272 // created, this cache should only be accessed on the file thread. There |
270 // should be no IDs in |image_memory_| that are in |images_on_file_thread_| | 273 // should be no IDs in |image_memory_| that are in |images_on_file_thread_| |
271 // or vice versa. | 274 // or vice versa. |
272 ImageCache images_on_file_thread_; | 275 ImageCache images_on_file_thread_; |
273 | 276 |
274 DISALLOW_COPY_AND_ASSIGN(BrowserThemePack); | 277 DISALLOW_COPY_AND_ASSIGN(BrowserThemePack); |
275 }; | 278 }; |
276 | 279 |
277 #endif // CHROME_BROWSER_THEMES_BROWSER_THEME_PACK_H_ | 280 #endif // CHROME_BROWSER_THEMES_BROWSER_THEME_PACK_H_ |
OLD | NEW |