OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/themes/theme_service.h" | 5 #include "chrome/browser/themes/theme_service.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/memory/ref_counted_memory.h" | 8 #include "base/memory/ref_counted_memory.h" |
9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
10 #include "base/sequenced_task_runner.h" | 10 #include "base/sequenced_task_runner.h" |
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
467 } | 467 } |
468 | 468 |
469 void ThemeService::OnManagedUserInitialized() { | 469 void ThemeService::OnManagedUserInitialized() { |
470 // Currently when creating a supervised user, the ThemeService is initialized | 470 // Currently when creating a supervised user, the ThemeService is initialized |
471 // before the boolean flag indicating the profile belongs to a supervised | 471 // before the boolean flag indicating the profile belongs to a supervised |
472 // user gets set. In order to get the custom managed user theme, we get a | 472 // user gets set. In order to get the custom managed user theme, we get a |
473 // callback when ManagedUserService is initialized, which happens some time | 473 // callback when ManagedUserService is initialized, which happens some time |
474 // after the boolean flag has been set in | 474 // after the boolean flag has been set in |
475 // ProfileManager::InitProfileUserPrefs() and after the | 475 // ProfileManager::InitProfileUserPrefs() and after the |
476 // NOTIFICATION_EXTENSIONS_READY notification is sent. | 476 // NOTIFICATION_EXTENSIONS_READY notification is sent. |
477 if (theme_supplier_.get() || !IsManagedUser()) | 477 if ((theme_supplier_.get() && |
| 478 (theme_supplier_->get_theme_type() == CustomThemeSupplier::EXTENSION || |
| 479 theme_supplier_->get_theme_type() == |
| 480 CustomThemeSupplier::MANAGED_USER_THEME)) || |
| 481 !IsManagedUser()) { |
478 return; | 482 return; |
| 483 } |
479 | 484 |
480 SetManagedUserTheme(); | 485 SetManagedUserTheme(); |
481 } | 486 } |
482 | 487 |
483 void ThemeService::OnInfobarDisplayed() { | 488 void ThemeService::OnInfobarDisplayed() { |
484 number_of_infobars_++; | 489 number_of_infobars_++; |
485 } | 490 } |
486 | 491 |
487 void ThemeService::OnInfobarDestroyed() { | 492 void ThemeService::OnInfobarDestroyed() { |
488 number_of_infobars_--; | 493 number_of_infobars_--; |
489 | 494 |
490 if (number_of_infobars_ == 0) | 495 if (number_of_infobars_ == 0) |
491 RemoveUnusedThemes(); | 496 RemoveUnusedThemes(); |
492 } | 497 } |
493 | 498 |
494 ThemeSyncableService* ThemeService::GetThemeSyncableService() const { | 499 ThemeSyncableService* ThemeService::GetThemeSyncableService() const { |
495 return theme_syncable_service_.get(); | 500 return theme_syncable_service_.get(); |
496 } | 501 } |
OLD | NEW |