Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(149)

Side by Side Diff: chrome/browser/themes/custom_theme_supplier.h

Issue 19471005: Add custom default theme support and create a managed user default theme. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address review comments. Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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<
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 {
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|, return true and
pkotwicz 2013/07/19 18:33:20 Nit: returns true
Adrian Kuegel 2013/07/22 12:58:08 I also changed "write" to "writes", and replaced "
47 // write the corresponding value to the output parameter. These functions
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 // Whether this theme provides an image for |id|.
59 virtual bool HasCustomImage(int id) const;
60
61 // Returns the raw PNG encoded data for IDR_THEME_NTP_*. This method is only
pkotwicz 2013/07/19 18:33:20 Nit: This method only works
Adrian Kuegel 2013/07/22 12:58:08 Done.
62 // supposed to work for the NTP attribution and background resources.
63 virtual base::RefCountedMemory* GetRawData(
64 int id, ui::ScaleFactor scale_factor) 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_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698