Index: chrome/browser/themes/theme_service.cc |
diff --git a/chrome/browser/themes/theme_service.cc b/chrome/browser/themes/theme_service.cc |
index fc5c4304a5e31b23549be5169539dc9a01e359e7..a813cea7167f2b5374eb1130a61112d8a11ba6d8 100644 |
--- a/chrome/browser/themes/theme_service.cc |
+++ b/chrome/browser/themes/theme_service.cc |
@@ -13,6 +13,8 @@ |
#include "chrome/browser/chrome_notification_types.h" |
#include "chrome/browser/extensions/extension_service.h" |
#include "chrome/browser/extensions/extension_system.h" |
+#include "chrome/browser/managed_mode/managed_user_service.h" |
+#include "chrome/browser/managed_mode/managed_user_service_factory.h" |
#include "chrome/browser/managed_mode/managed_user_theme.h" |
#include "chrome/browser/profiles/profile.h" |
#include "chrome/browser/themes/browser_theme_pack.h" |
@@ -77,7 +79,8 @@ ThemeService::ThemeService() |
: ready_(false), |
rb_(ResourceBundle::GetSharedInstance()), |
profile_(NULL), |
- number_of_infobars_(0) { |
+ number_of_infobars_(0), |
+ weak_ptr_factory_(this) { |
} |
ThemeService::~ThemeService() { |
@@ -88,6 +91,9 @@ void ThemeService::Init(Profile* profile) { |
DCHECK(CalledOnValidThread()); |
profile_ = profile; |
+ ManagedUserServiceFactory::GetForProfile(profile)->AddInitCallback(base::Bind( |
+ &ThemeService::OnManagedUserInitialized, weak_ptr_factory_.GetWeakPtr())); |
+ |
LoadThemePrefs(); |
if (!ready_) { |
@@ -460,6 +466,18 @@ void ThemeService::SetManagedUserTheme() { |
SetCustomDefaultTheme(new ManagedUserTheme); |
} |
+void ThemeService::OnManagedUserInitialized() { |
+ // Currently when creating a supervised user, the ThemeService is initialized |
+ // before the boolean flag indicating it is a supervised user profile gets |
pkotwicz
2013/08/09 16:49:37
Nit: "indicating the profile belongs to a supervis
Adrian Kuegel
2013/08/09 21:21:59
Done.
|
+ // set. So in order to get the custom managed user theme, we get a callback |
pkotwicz
2013/08/09 16:49:37
Nit: "In order to get the custom managed user them
Adrian Kuegel
2013/08/09 21:21:59
Done.
|
+ // when ManagedUserService is initialized, which happens some time after the |
+ // boolean flag has been set in ProfileManager::InitProfileUserPrefs(). |
pkotwicz
2013/08/09 16:49:37
Also mention that it occurs after the NOTIFICATION
Adrian Kuegel
2013/08/09 21:21:59
Done.
|
+ if (theme_supplier_.get() || !IsManagedUser()) |
+ return; |
+ |
+ SetManagedUserTheme(); |
+} |
+ |
void ThemeService::OnInfobarDisplayed() { |
number_of_infobars_++; |
} |