OLD | NEW |
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 #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/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 15 #include "base/message_loop_helpers.h" |
15 #include "chrome/common/extensions/extension.h" | 16 #include "chrome/common/extensions/extension.h" |
16 #include "content/public/browser/browser_thread.h" | 17 #include "content/public/browser/browser_thread.h" |
17 #include "ui/gfx/color_utils.h" | 18 #include "ui/gfx/color_utils.h" |
18 | 19 |
19 class FilePath; | 20 class FilePath; |
20 class RefCountedMemory; | 21 class RefCountedMemory; |
21 namespace ui { | 22 namespace ui { |
22 class DataPack; | 23 class DataPack; |
23 } | 24 } |
24 namespace gfx { | 25 namespace gfx { |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 // Returns the raw PNG encoded data for IDR_THEME_NTP_*. This method is only | 87 // Returns the raw PNG encoded data for IDR_THEME_NTP_*. This method is only |
87 // supposed to work for the NTP attribution and background resources. | 88 // supposed to work for the NTP attribution and background resources. |
88 RefCountedMemory* GetRawData(int id) const; | 89 RefCountedMemory* GetRawData(int id) const; |
89 | 90 |
90 // Whether this theme provides an image for |id|. | 91 // Whether this theme provides an image for |id|. |
91 bool HasCustomImage(int id) const; | 92 bool HasCustomImage(int id) const; |
92 | 93 |
93 private: | 94 private: |
94 friend struct content::BrowserThread::DeleteOnThread< | 95 friend struct content::BrowserThread::DeleteOnThread< |
95 content::BrowserThread::FILE>; | 96 content::BrowserThread::FILE>; |
96 friend class DeleteTask<BrowserThemePack>; | 97 friend class base::DeleteHelper<BrowserThemePack>; |
97 friend class BrowserThemePackTest; | 98 friend class BrowserThemePackTest; |
98 | 99 |
99 // Cached images. We cache all retrieved and generated bitmaps and keep | 100 // Cached images. We cache all retrieved and generated bitmaps and keep |
100 // track of the pointers. We own these and will delete them when we're done | 101 // track of the pointers. We own these and will delete them when we're done |
101 // using them. | 102 // using them. |
102 typedef std::map<int, const gfx::Image*> ImageCache; | 103 typedef std::map<int, const gfx::Image*> ImageCache; |
103 | 104 |
104 // The raw PNG memory associated with a certain id. | 105 // The raw PNG memory associated with a certain id. |
105 typedef std::map<int, scoped_refptr<RefCountedMemory> > RawImages; | 106 typedef std::map<int, scoped_refptr<RefCountedMemory> > RawImages; |
106 | 107 |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 // in |image_memory_| that are in |prepared_images_| or vice versa. | 235 // in |image_memory_| that are in |prepared_images_| or vice versa. |
235 ImageCache prepared_images_; | 236 ImageCache prepared_images_; |
236 | 237 |
237 // Loaded images. These are loaded from |image_memory_| or the |data_pack_|. | 238 // Loaded images. These are loaded from |image_memory_| or the |data_pack_|. |
238 mutable ImageCache loaded_images_; | 239 mutable ImageCache loaded_images_; |
239 | 240 |
240 DISALLOW_COPY_AND_ASSIGN(BrowserThemePack); | 241 DISALLOW_COPY_AND_ASSIGN(BrowserThemePack); |
241 }; | 242 }; |
242 | 243 |
243 #endif // CHROME_BROWSER_THEMES_BROWSER_THEME_PACK_H_ | 244 #endif // CHROME_BROWSER_THEMES_BROWSER_THEME_PACK_H_ |
OLD | NEW |