| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 #include "extensions/browser/extension_registry_observer.h" | 52 #include "extensions/browser/extension_registry_observer.h" |
| 53 #endif | 53 #endif |
| 54 | 54 |
| 55 #if BUILDFLAG(ENABLE_SUPERVISED_USERS) | 55 #if BUILDFLAG(ENABLE_SUPERVISED_USERS) |
| 56 #include "chrome/browser/supervised_user/supervised_user_theme.h" | 56 #include "chrome/browser/supervised_user/supervised_user_theme.h" |
| 57 #endif | 57 #endif |
| 58 | 58 |
| 59 using base::UserMetricsAction; | 59 using base::UserMetricsAction; |
| 60 using content::BrowserThread; | 60 using content::BrowserThread; |
| 61 using extensions::Extension; | 61 using extensions::Extension; |
| 62 using extensions::UnloadedExtensionInfo; | 62 using extensions::UnloadedExtensionReason; |
| 63 using ui::ResourceBundle; | 63 using ui::ResourceBundle; |
| 64 | 64 |
| 65 | 65 |
| 66 // Helpers -------------------------------------------------------------------- | 66 // Helpers -------------------------------------------------------------------- |
| 67 | 67 |
| 68 namespace { | 68 namespace { |
| 69 | 69 |
| 70 // The default theme if we've gone to the theme gallery and installed the | 70 // The default theme if we've gone to the theme gallery and installed the |
| 71 // "Default" theme. We have to detect this case specifically. (By the time we | 71 // "Default" theme. We have to detect this case specifically. (By the time we |
| 72 // realize we've installed the default theme, we already have an extension | 72 // realize we've installed the default theme, we already have an extension |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 theme_service_->installed_pending_load_id_ != kDefaultThemeID && | 188 theme_service_->installed_pending_load_id_ != kDefaultThemeID && |
| 189 theme_service_->installed_pending_load_id_ == extension->id()) { | 189 theme_service_->installed_pending_load_id_ == extension->id()) { |
| 190 theme_service_->SetTheme(extension); | 190 theme_service_->SetTheme(extension); |
| 191 } | 191 } |
| 192 theme_service_->installed_pending_load_id_ = kDefaultThemeID; | 192 theme_service_->installed_pending_load_id_ = kDefaultThemeID; |
| 193 } | 193 } |
| 194 | 194 |
| 195 void OnExtensionUnloaded( | 195 void OnExtensionUnloaded( |
| 196 content::BrowserContext* browser_context, | 196 content::BrowserContext* browser_context, |
| 197 const extensions::Extension* extension, | 197 const extensions::Extension* extension, |
| 198 extensions::UnloadedExtensionInfo::Reason reason) override { | 198 extensions::UnloadedExtensionReason reason) override { |
| 199 if (reason != extensions::UnloadedExtensionInfo::REASON_UPDATE && | 199 if (reason != extensions::UnloadedExtensionReason::REASON_UPDATE && |
| 200 reason != extensions::UnloadedExtensionInfo::REASON_LOCK_ALL && | 200 reason != extensions::UnloadedExtensionReason::REASON_LOCK_ALL && |
| 201 extension->is_theme() && | 201 extension->is_theme() && |
| 202 extension->id() == theme_service_->GetThemeID()) { | 202 extension->id() == theme_service_->GetThemeID()) { |
| 203 theme_service_->UseDefaultTheme(); | 203 theme_service_->UseDefaultTheme(); |
| 204 } | 204 } |
| 205 } | 205 } |
| 206 | 206 |
| 207 ThemeService* theme_service_; | 207 ThemeService* theme_service_; |
| 208 }; | 208 }; |
| 209 #endif // BUILDFLAG(ENABLE_EXTENSIONS) | 209 #endif // BUILDFLAG(ENABLE_EXTENSIONS) |
| 210 | 210 |
| (...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 869 | 869 |
| 870 #if BUILDFLAG(ENABLE_SUPERVISED_USERS) | 870 #if BUILDFLAG(ENABLE_SUPERVISED_USERS) |
| 871 bool ThemeService::IsSupervisedUser() const { | 871 bool ThemeService::IsSupervisedUser() const { |
| 872 return profile_->IsSupervised(); | 872 return profile_->IsSupervised(); |
| 873 } | 873 } |
| 874 | 874 |
| 875 void ThemeService::SetSupervisedUserTheme() { | 875 void ThemeService::SetSupervisedUserTheme() { |
| 876 SetCustomDefaultTheme(new SupervisedUserTheme); | 876 SetCustomDefaultTheme(new SupervisedUserTheme); |
| 877 } | 877 } |
| 878 #endif | 878 #endif |
| OLD | NEW |