| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_CUSTOM_THEME_SUPPLIER_H_ | 5 #ifndef CHROME_BROWSER_THEMES_CUSTOM_THEME_SUPPLIER_H_ |
| 6 #define CHROME_BROWSER_THEMES_CUSTOM_THEME_SUPPLIER_H_ | 6 #define CHROME_BROWSER_THEMES_CUSTOM_THEME_SUPPLIER_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "content/public/browser/browser_thread.h" | 10 #include "content/public/browser/browser_thread.h" |
| 11 #include "third_party/skia/include/core/SkColor.h" | 11 #include "third_party/skia/include/core/SkColor.h" |
| 12 #include "ui/base/layout.h" | 12 #include "ui/base/layout.h" |
| 13 #include "ui/gfx/image/image.h" |
| 13 | 14 |
| 14 namespace base { | 15 namespace base { |
| 15 class RefCountedMemory; | 16 class RefCountedMemory; |
| 16 } | 17 } |
| 17 | 18 |
| 18 namespace color_utils { | 19 namespace color_utils { |
| 19 struct HSL; | 20 struct HSL; |
| 20 } | 21 } |
| 21 | 22 |
| 22 namespace gfx { | 23 namespace gfx { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 50 // If the theme specifies data for the corresponding |id|, returns true and | 51 // If the theme specifies data for the corresponding |id|, returns true and |
| 51 // writes the corresponding value to the output parameter. These methods | 52 // writes the corresponding value to the output parameter. These methods |
| 52 // should not return the default data. These methods should only be called | 53 // should not return the default data. These methods should only be called |
| 53 // from the UI thread. | 54 // from the UI thread. |
| 54 virtual bool GetTint(int id, color_utils::HSL* hsl) const; | 55 virtual bool GetTint(int id, color_utils::HSL* hsl) const; |
| 55 virtual bool GetColor(int id, SkColor* color) const; | 56 virtual bool GetColor(int id, SkColor* color) const; |
| 56 virtual bool GetDisplayProperty(int id, int* result) const; | 57 virtual bool GetDisplayProperty(int id, int* result) const; |
| 57 | 58 |
| 58 // Returns the theme image for |id|. Returns an empty image if no image is | 59 // Returns the theme image for |id|. Returns an empty image if no image is |
| 59 // found for |id|. | 60 // found for |id|. |
| 60 virtual gfx::Image GetImageNamed(int id); | 61 virtual const gfx::Image& GetImageNamed(int id); |
| 61 | 62 |
| 62 // Returns the raw PNG encoded data for IDR_THEME_NTP_*. This method only | 63 // Returns the raw PNG encoded data for IDR_THEME_NTP_*. This method only |
| 63 // works for the NTP attribution and background resources. | 64 // works for the NTP attribution and background resources. |
| 64 virtual base::RefCountedMemory* GetRawData( | 65 virtual base::RefCountedMemory* GetRawData( |
| 65 int id, ui::ScaleFactor scale_factor) const; | 66 int id, ui::ScaleFactor scale_factor) const; |
| 66 | 67 |
| 67 // Whether this theme provides an image for |id|. | 68 // Whether this theme provides an image for |id|. |
| 68 virtual bool HasCustomImage(int id) const; | 69 virtual bool HasCustomImage(int id) const; |
| 69 | 70 |
| 70 protected: | 71 protected: |
| 71 virtual ~CustomThemeSupplier(); | 72 virtual ~CustomThemeSupplier(); |
| 72 | 73 |
| 74 const gfx::Image& empty_image() const { return empty_image_; } |
| 75 |
| 73 private: | 76 private: |
| 74 friend struct content::BrowserThread::DeleteOnThread< | 77 friend struct content::BrowserThread::DeleteOnThread< |
| 75 content::BrowserThread::FILE>; | 78 content::BrowserThread::FILE>; |
| 76 friend class base::DeleteHelper<CustomThemeSupplier>; | 79 friend class base::DeleteHelper<CustomThemeSupplier>; |
| 77 | 80 |
| 78 ThemeType theme_type_; | 81 ThemeType theme_type_; |
| 79 | 82 |
| 83 gfx::Image empty_image_; |
| 84 |
| 80 DISALLOW_COPY_AND_ASSIGN(CustomThemeSupplier); | 85 DISALLOW_COPY_AND_ASSIGN(CustomThemeSupplier); |
| 81 }; | 86 }; |
| 82 | 87 |
| 83 #endif // CHROME_BROWSER_THEMES_CUSTOM_THEME_SUPPLIER_H_ | 88 #endif // CHROME_BROWSER_THEMES_CUSTOM_THEME_SUPPLIER_H_ |
| OLD | NEW |