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

Unified Diff: chrome/browser/themes/custom_theme_provider.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: Fix bugs. 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/themes/custom_theme_provider.h
diff --git a/chrome/browser/themes/custom_theme_provider.h b/chrome/browser/themes/custom_theme_provider.h
new file mode 100644
index 0000000000000000000000000000000000000000..270e024db623c90db72626af605a52606685ba9b
--- /dev/null
+++ b/chrome/browser/themes/custom_theme_provider.h
@@ -0,0 +1,76 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_THEMES_CUSTOM_THEME_PROVIDER_H_
+#define CHROME_BROWSER_THEMES_CUSTOM_THEME_PROVIDER_H_
+
+#include "base/memory/ref_counted.h"
+#include "content/public/browser/browser_thread.h"
+#include "third_party/skia/include/core/SkColor.h"
+#include "ui/base/layout.h"
+#include "ui/gfx/image/image.h"
pkotwicz 2013/07/19 05:54:13 gfx::Image could be forward declared as well?
Adrian Kuegel 2013/07/19 13:54:39 Done. I also changed this in browser_theme_pack.h
+
+namespace base {
+class RefCountedMemory;
+}
+
+namespace color_utils {
+struct HSL;
+}
+
+class CustomThemeProvider : public base::RefCountedThreadSafe<
pkotwicz 2013/07/19 05:54:13 I do not like the name CustomThemeProvider because
Adrian Kuegel 2013/07/19 13:54:39 I have chosen the name CustomThemeSupplier now. Cu
+ CustomThemeProvider, content::BrowserThread::DeleteOnFileThread> {
+ public:
+ enum ThemeType {
+ EXTENSION,
+ NATIVE_X11,
+ MANAGED_USER_THEME,
+ };
+
+ explicit CustomThemeProvider(ThemeType type);
+
+ ThemeType GetThemeType() const {
+ return theme_type_;
+ }
+
+ // Called when the theme is started being used.
pkotwicz 2013/07/19 05:54:13 Nit: starts being used
Adrian Kuegel 2013/07/19 13:54:39 Done.
+ virtual void StartUsingTheme();
+
+ // Called when the theme is not used anymore.
+ virtual void StopUsingTheme();
+
+ // If the theme specifies data for the corresponding |id|, return true and
+ // write the corresponding value to the output parameter. These functions
+ // should not return the default data. These methods should only be called
+ // from the UI thread.
+ virtual bool GetTint(int id, color_utils::HSL* hsl) const;
+ virtual bool GetColor(int id, SkColor* color) const;
+ virtual bool GetDisplayProperty(int id, int* result) const;
+
+ // Returns the theme image for |id|. Returns an empty image if no image is
+ // found for |id|.
+ virtual gfx::Image GetImageNamed(int id);
+
+ // Whether this theme provides an image for |id|.
+ virtual bool HasCustomImage(int id) const;
+
+ // Returns the raw PNG encoded data for IDR_THEME_NTP_*. This method is only
+ // supposed to work for the NTP attribution and background resources.
+ virtual base::RefCountedMemory* GetRawData(
+ int id, ui::ScaleFactor scale_factor) const;
+
+ protected:
+ virtual ~CustomThemeProvider();
+
+ private:
+ friend struct content::BrowserThread::DeleteOnThread<
+ content::BrowserThread::FILE>;
+ friend class base::DeleteHelper<CustomThemeProvider>;
+
+ ThemeType theme_type_;
+
+ DISALLOW_COPY_AND_ASSIGN(CustomThemeProvider);
+};
+
+#endif // CHROME_BROWSER_THEMES_CUSTOM_THEME_PROVIDER_H_

Powered by Google App Engine
This is Rietveld 408576698