summaryrefslogtreecommitdiffstats
path: root/ui/base
diff options
context:
space:
mode:
authorestade <estade@chromium.org>2015-12-11 13:50:40 -0800
committerCommit bot <commit-bot@chromium.org>2015-12-11 21:52:15 +0000
commit68691b28a76845494f3b51d02e24844a69833032 (patch)
tree04e2e6e8c7828646bf7a184b18635d9d6288670e /ui/base
parentcc00189a536f35296017c7703e319f959e4943d3 (diff)
downloadchromium_src-68691b28a76845494f3b51d02e24844a69833032.zip
chromium_src-68691b28a76845494f3b51d02e24844a69833032.tar.gz
chromium_src-68691b28a76845494f3b51d02e24844a69833032.tar.bz2
Rejigger ThemeService: move exposure of ThemeProvider interface to a
separate class. ThemeService provides a static way to get a ThemeProvider from a profile. This allows different ThemeProviders for different profiles (i.e. otr + original), while the majority of ThemeService remains per original profile. As a bonus, UsingSystemTheme is moved from ThemeProvider to ThemeService, where it seems more natural. It's still part of ThemeProvider on OSX, but only because updating OSX will require more effort (and more care). One new incognito color is implemented (for MD mode): COLOR_TOOLBAR. This is ironically not yet visible on the toolbar, but you can see it on the DL shelf. BUG=501377, 568388 Review URL: https://codereview.chromium.org/1492423003 Cr-Commit-Position: refs/heads/master@{#364812}
Diffstat (limited to 'ui/base')
-rw-r--r--ui/base/default_theme_provider.cc4
-rw-r--r--ui/base/default_theme_provider.h2
-rw-r--r--ui/base/default_theme_provider_mac.mm4
-rw-r--r--ui/base/theme_provider.h10
4 files changed, 11 insertions, 9 deletions
diff --git a/ui/base/default_theme_provider.cc b/ui/base/default_theme_provider.cc
index 210ff18..899661c 100644
--- a/ui/base/default_theme_provider.cc
+++ b/ui/base/default_theme_provider.cc
@@ -13,10 +13,6 @@ DefaultThemeProvider::DefaultThemeProvider() {}
DefaultThemeProvider::~DefaultThemeProvider() {}
-bool DefaultThemeProvider::UsingSystemTheme() const {
- return true;
-}
-
gfx::ImageSkia* DefaultThemeProvider::GetImageSkiaNamed(int id) const {
return ResourceBundle::GetSharedInstance().GetImageSkiaNamed(id);
}
diff --git a/ui/base/default_theme_provider.h b/ui/base/default_theme_provider.h
index 173442d..78ea3a3 100644
--- a/ui/base/default_theme_provider.h
+++ b/ui/base/default_theme_provider.h
@@ -24,7 +24,6 @@ class UI_BASE_EXPORT DefaultThemeProvider : public ThemeProvider {
~DefaultThemeProvider() override;
// Overridden from ui::ThemeProvider:
- bool UsingSystemTheme() const override;
gfx::ImageSkia* GetImageSkiaNamed(int id) const override;
SkColor GetColor(int id) const override;
int GetDisplayProperty(int id) const override;
@@ -34,6 +33,7 @@ class UI_BASE_EXPORT DefaultThemeProvider : public ThemeProvider {
const override;
#if defined(OS_MACOSX)
+ bool UsingSystemTheme() const override;
NSImage* GetNSImageNamed(int id) const override;
NSColor* GetNSImageColorNamed(int id) const override;
NSColor* GetNSColor(int id) const override;
diff --git a/ui/base/default_theme_provider_mac.mm b/ui/base/default_theme_provider_mac.mm
index 6d5e684..71b0f8e 100644
--- a/ui/base/default_theme_provider_mac.mm
+++ b/ui/base/default_theme_provider_mac.mm
@@ -10,6 +10,10 @@
namespace ui {
+bool DefaultThemeProvider::UsingSystemTheme() const {
+ return true;
+}
+
NSImage* DefaultThemeProvider::GetNSImageNamed(int id) const {
return ResourceBundle::GetSharedInstance().
GetNativeImageNamed(id).ToNSImage();
diff --git a/ui/base/theme_provider.h b/ui/base/theme_provider.h
index eeab83d..7ad97da 100644
--- a/ui/base/theme_provider.h
+++ b/ui/base/theme_provider.h
@@ -47,10 +47,6 @@ class UI_BASE_EXPORT ThemeProvider {
public:
virtual ~ThemeProvider();
- // Whether we're using the system theme (which may or may not be the
- // same as the default theme).
- virtual bool UsingSystemTheme() const = 0;
-
// Get the image specified by |id|. An implementation of ThemeProvider should
// have its own source of ids (e.g. an enum, or external resource bundle).
virtual gfx::ImageSkia* GetImageSkiaNamed(int id) const = 0;
@@ -78,6 +74,12 @@ class UI_BASE_EXPORT ThemeProvider {
ui::ScaleFactor scale_factor) const = 0;
#if defined(OS_MACOSX)
+ // Whether we're using the system theme (which may or may not be the
+ // same as the default theme).
+ // TODO(estade): this should probably just be part of ThemeService and not
+ // ThemeProvider, but it's used in many places on OSX.
+ virtual bool UsingSystemTheme() const = 0;
+
// Gets the NSImage with the specified |id|.
virtual NSImage* GetNSImageNamed(int id) const = 0;