Index: chrome/browser/themes/theme_service.h |
diff --git a/chrome/browser/themes/theme_service.h b/chrome/browser/themes/theme_service.h |
index 51c676c2d0f337cf06f18469e8f6ed485942581e..c941a63de3e10453275152fb74224563aec08c76 100644 |
--- a/chrome/browser/themes/theme_service.h |
+++ b/chrome/browser/themes/theme_service.h |
@@ -16,14 +16,17 @@ |
#include "base/memory/ref_counted.h" |
#include "base/memory/weak_ptr.h" |
#include "base/sequence_checker.h" |
+#include "base/task/cancelable_task_tracker.h" |
#include "build/build_config.h" |
#include "chrome/common/features.h" |
#include "components/keyed_service/core/keyed_service.h" |
#include "content/public/browser/notification_observer.h" |
#include "content/public/browser/notification_registrar.h" |
+#include "extensions/common/extension_id.h" |
#include "extensions/features/features.h" |
#include "ui/base/theme_provider.h" |
+class BrowserThemePack; |
class CustomThemeSupplier; |
class ThemeSyncableService; |
class Profile; |
@@ -82,6 +85,9 @@ class ThemeService : public content::NotificationObserver, public KeyedService { |
// ExtensionService. |
virtual void SetTheme(const extensions::Extension* extension); |
+ // Similar to SetTheme, but doesn't show an undo infobar. |
+ void RevertToTheme(const extensions::Extension* extension); |
+ |
// Reset the theme to default. |
virtual void UseDefaultTheme(); |
@@ -230,6 +236,9 @@ class ThemeService : public content::NotificationObserver, public KeyedService { |
// and contrasting with the foreground tab is the most important). |
static SkColor GetSeparatorColor(SkColor tab_color, SkColor frame_color); |
+ void DoSetTheme(const extensions::Extension* extension, |
+ bool suppress_infobar); |
+ |
// These methods provide the implementation for ui::ThemeProvider (exposed |
// via BrowserThemeProvider). |
gfx::ImageSkia* GetImageSkiaNamed(int id, bool incognito) const; |
@@ -270,8 +279,15 @@ class ThemeService : public content::NotificationObserver, public KeyedService { |
void SaveThemeID(const std::string& id); |
// Implementation of SetTheme() (and the fallback from LoadThemePrefs() in |
- // case we don't have a theme pack). |
- void BuildFromExtension(const extensions::Extension* extension); |
+ // case we don't have a theme pack). |new_theme| indicates whether this is a |
+ // newly installed theme or a migration. |
+ void BuildFromExtension(const extensions::Extension* extension, |
+ bool new_theme); |
+ |
+ // Callback when |pack| has finished or failed building. |
+ void OnThemeBuiltFromExtension(const extensions::ExtensionId& extension_id, |
+ scoped_refptr<BrowserThemePack> pack, |
+ bool new_theme); |
#if BUILDFLAG(ENABLE_SUPERVISED_USERS) |
// Returns true if the profile belongs to a supervised user. |
@@ -328,6 +344,14 @@ class ThemeService : public content::NotificationObserver, public KeyedService { |
SEQUENCE_CHECKER(sequence_checker_); |
+ // Allows us to cancel building a theme pack from an extension. |
+ base::CancelableTaskTracker build_extension_task_tracker_; |
+ |
+ // The ID of the theme that's currently being built on a different thread. |
+ // We hold onto this just to be sure not to uninstall the extension view |
+ // RemoveUnusedThemes while it's still being built. |
+ std::string building_extension_id_; |
+ |
base::WeakPtrFactory<ThemeService> weak_ptr_factory_; |
DISALLOW_COPY_AND_ASSIGN(ThemeService); |