| 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 <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| (...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 // Clear our image cache. | 382 // Clear our image cache. |
| 383 FreePlatformCaches(); | 383 FreePlatformCaches(); |
| 384 | 384 |
| 385 BuildFromExtension(extension); | 385 BuildFromExtension(extension); |
| 386 SaveThemeID(extension->id()); | 386 SaveThemeID(extension->id()); |
| 387 | 387 |
| 388 NotifyThemeChanged(); | 388 NotifyThemeChanged(); |
| 389 content::RecordAction(UserMetricsAction("Themes_Installed")); | 389 content::RecordAction(UserMetricsAction("Themes_Installed")); |
| 390 | 390 |
| 391 if (previous_theme_id != kDefaultThemeID && | 391 if (previous_theme_id != kDefaultThemeID && |
| 392 previous_theme_id != extension->id()) { | 392 previous_theme_id != extension->id() && |
| 393 service->GetInstalledExtension(previous_theme_id)) { |
| 394 // Do not disable the previous theme if it is already uninstalled. Sending |
| 395 // NOTIFICATION_BROWSER_THEME_CHANGED causes the previous theme to be |
| 396 // uninstalled when the notification causes the remaining infobar to close |
| 397 // and does not open any new infobars. See crbug.com/468280. |
| 398 |
| 393 // Disable the old theme. | 399 // Disable the old theme. |
| 394 service->DisableExtension(previous_theme_id, | 400 service->DisableExtension(previous_theme_id, |
| 395 extensions::Extension::DISABLE_USER_ACTION); | 401 extensions::Extension::DISABLE_USER_ACTION); |
| 396 } | 402 } |
| 397 } | 403 } |
| 398 | 404 |
| 399 void ThemeService::SetCustomDefaultTheme( | 405 void ThemeService::SetCustomDefaultTheme( |
| 400 scoped_refptr<CustomThemeSupplier> theme_supplier) { | 406 scoped_refptr<CustomThemeSupplier> theme_supplier) { |
| 401 ClearAllThemeData(); | 407 ClearAllThemeData(); |
| 402 SwapThemeSupplier(theme_supplier); | 408 SwapThemeSupplier(theme_supplier); |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 680 void ThemeService::OnInfobarDestroyed() { | 686 void ThemeService::OnInfobarDestroyed() { |
| 681 number_of_infobars_--; | 687 number_of_infobars_--; |
| 682 | 688 |
| 683 if (number_of_infobars_ == 0) | 689 if (number_of_infobars_ == 0) |
| 684 RemoveUnusedThemes(false); | 690 RemoveUnusedThemes(false); |
| 685 } | 691 } |
| 686 | 692 |
| 687 ThemeSyncableService* ThemeService::GetThemeSyncableService() const { | 693 ThemeSyncableService* ThemeService::GetThemeSyncableService() const { |
| 688 return theme_syncable_service_.get(); | 694 return theme_syncable_service_.get(); |
| 689 } | 695 } |
| OLD | NEW |