Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_THEMES_CUSTOM_THEME_SUPPLIER_H_ | |
| 6 #define CHROME_BROWSER_THEMES_CUSTOM_THEME_SUPPLIER_H_ | |
| 7 | |
| 8 #include "base/memory/ref_counted.h" | |
| 9 #include "content/public/browser/browser_thread.h" | |
| 10 #include "third_party/skia/include/core/SkColor.h" | |
| 11 #include "ui/base/layout.h" | |
| 12 | |
| 13 namespace base { | |
| 14 class RefCountedMemory; | |
| 15 } | |
| 16 | |
| 17 namespace color_utils { | |
| 18 struct HSL; | |
| 19 } | |
| 20 | |
| 21 namespace gfx { | |
| 22 class Image; | |
| 23 } | |
| 24 | |
| 25 class CustomThemeSupplier : public base::RefCountedThreadSafe< | |
|
Elliot Glaysher
2013/07/23 19:57:31
Again, class documentation. Imagine I'm coming int
Adrian Kuegel
2013/07/24 12:31:35
Done.
| |
| 26 CustomThemeSupplier, content::BrowserThread::DeleteOnFileThread> { | |
| 27 public: | |
| 28 enum ThemeType { | |
| 29 EXTENSION, | |
| 30 NATIVE_X11, | |
| 31 MANAGED_USER_THEME, | |
| 32 }; | |
| 33 | |
| 34 explicit CustomThemeSupplier(ThemeType type); | |
| 35 | |
| 36 ThemeType GetThemeType() const { | |
|
Elliot Glaysher
2013/07/23 19:57:31
inlined methods should be unix_hacker_cased().
Adrian Kuegel
2013/07/24 12:31:35
Done.
| |
| 37 return theme_type_; | |
| 38 } | |
| 39 | |
| 40 // Called when the theme starts being used. | |
| 41 virtual void StartUsingTheme(); | |
| 42 | |
| 43 // Called when the theme is not used anymore. | |
| 44 virtual void StopUsingTheme(); | |
| 45 | |
| 46 // If the theme specifies data for the corresponding |id|, returns true and | |
| 47 // writes the corresponding value to the output parameter. These methods | |
| 48 // should not return the default data. These methods should only be called | |
| 49 // from the UI thread. | |
| 50 virtual bool GetTint(int id, color_utils::HSL* hsl) const; | |
| 51 virtual bool GetColor(int id, SkColor* color) const; | |
| 52 virtual bool GetDisplayProperty(int id, int* result) const; | |
| 53 | |
| 54 // Returns the theme image for |id|. Returns an empty image if no image is | |
| 55 // found for |id|. | |
| 56 virtual gfx::Image GetImageNamed(int id); | |
| 57 | |
| 58 // Returns the raw PNG encoded data for IDR_THEME_NTP_*. This method only | |
| 59 // works for the NTP attribution and background resources. | |
| 60 virtual base::RefCountedMemory* GetRawData( | |
| 61 int id, ui::ScaleFactor scale_factor) const; | |
| 62 | |
| 63 // Whether this theme provides an image for |id|. | |
| 64 virtual bool HasCustomImage(int id) const; | |
| 65 | |
| 66 protected: | |
| 67 virtual ~CustomThemeSupplier(); | |
| 68 | |
| 69 private: | |
| 70 friend struct content::BrowserThread::DeleteOnThread< | |
| 71 content::BrowserThread::FILE>; | |
| 72 friend class base::DeleteHelper<CustomThemeSupplier>; | |
| 73 | |
| 74 ThemeType theme_type_; | |
| 75 | |
| 76 DISALLOW_COPY_AND_ASSIGN(CustomThemeSupplier); | |
| 77 }; | |
| 78 | |
| 79 #endif // CHROME_BROWSER_THEMES_CUSTOM_THEME_SUPPLIER_H_ | |
| OLD | NEW |