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/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
11 #include "base/sequenced_task_runner.h" | 11 #include "base/sequenced_task_runner.h" |
12 #include "base/strings/string_util.h" | 12 #include "base/strings/string_util.h" |
13 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
14 #include "chrome/browser/chrome_notification_types.h" | 14 #include "chrome/browser/chrome_notification_types.h" |
15 #include "chrome/browser/extensions/extension_service.h" | 15 #include "chrome/browser/extensions/extension_service.h" |
16 #include "chrome/browser/managed_mode/managed_user_theme.h" | 16 #include "chrome/browser/managed_mode/managed_user_theme.h" |
17 #include "chrome/browser/profiles/profile.h" | 17 #include "chrome/browser/profiles/profile.h" |
18 #include "chrome/browser/themes/browser_theme_pack.h" | 18 #include "chrome/browser/themes/browser_theme_pack.h" |
19 #include "chrome/browser/themes/custom_theme_supplier.h" | 19 #include "chrome/browser/themes/custom_theme_supplier.h" |
20 #include "chrome/browser/themes/theme_properties.h" | 20 #include "chrome/browser/themes/theme_properties.h" |
21 #include "chrome/browser/themes/theme_syncable_service.h" | 21 #include "chrome/browser/themes/theme_syncable_service.h" |
22 #include "chrome/common/chrome_constants.h" | 22 #include "chrome/common/chrome_constants.h" |
23 #include "chrome/common/pref_names.h" | 23 #include "chrome/common/pref_names.h" |
24 #include "content/public/browser/notification_service.h" | 24 #include "content/public/browser/notification_service.h" |
25 #include "content/public/browser/user_metrics.h" | 25 #include "content/public/browser/user_metrics.h" |
| 26 #include "extensions/browser/extension_prefs.h" |
26 #include "extensions/browser/extension_system.h" | 27 #include "extensions/browser/extension_system.h" |
27 #include "extensions/common/extension.h" | 28 #include "extensions/common/extension.h" |
28 #include "extensions/common/extension_set.h" | 29 #include "extensions/common/extension_set.h" |
29 #include "grit/theme_resources.h" | 30 #include "grit/theme_resources.h" |
30 #include "grit/ui_resources.h" | 31 #include "grit/ui_resources.h" |
31 #include "ui/base/layout.h" | 32 #include "ui/base/layout.h" |
32 #include "ui/base/resource/resource_bundle.h" | 33 #include "ui/base/resource/resource_bundle.h" |
33 #include "ui/gfx/image/image_skia.h" | 34 #include "ui/gfx/image/image_skia.h" |
34 | 35 |
35 #if defined(OS_WIN) | 36 #if defined(OS_WIN) |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 if (!ignore_infobars && number_of_infobars_ != 0) | 332 if (!ignore_infobars && number_of_infobars_ != 0) |
332 return; | 333 return; |
333 | 334 |
334 ExtensionService* service = profile_->GetExtensionService(); | 335 ExtensionService* service = profile_->GetExtensionService(); |
335 if (!service) | 336 if (!service) |
336 return; | 337 return; |
337 std::string current_theme = GetThemeID(); | 338 std::string current_theme = GetThemeID(); |
338 std::vector<std::string> remove_list; | 339 std::vector<std::string> remove_list; |
339 scoped_ptr<const extensions::ExtensionSet> extensions( | 340 scoped_ptr<const extensions::ExtensionSet> extensions( |
340 service->GenerateInstalledExtensionsSet()); | 341 service->GenerateInstalledExtensionsSet()); |
341 extensions::ExtensionPrefs* prefs = service->extension_prefs(); | 342 extensions::ExtensionPrefs* prefs = extensions::ExtensionPrefs::Get(profile_); |
342 for (extensions::ExtensionSet::const_iterator it = extensions->begin(); | 343 for (extensions::ExtensionSet::const_iterator it = extensions->begin(); |
343 it != extensions->end(); ++it) { | 344 it != extensions->end(); ++it) { |
344 const extensions::Extension* extension = *it; | 345 const extensions::Extension* extension = *it; |
345 if (extension->is_theme() && | 346 if (extension->is_theme() && |
346 extension->id() != current_theme) { | 347 extension->id() != current_theme) { |
347 // Only uninstall themes which are not disabled or are disabled with | 348 // Only uninstall themes which are not disabled or are disabled with |
348 // reason DISABLE_USER_ACTION. We cannot blanket uninstall all disabled | 349 // reason DISABLE_USER_ACTION. We cannot blanket uninstall all disabled |
349 // themes because externally installed themes are initially disabled. | 350 // themes because externally installed themes are initially disabled. |
350 int disable_reason = prefs->GetDisableReasons(extension->id()); | 351 int disable_reason = prefs->GetDisableReasons(extension->id()); |
351 if (!prefs->IsExtensionDisabled(extension->id()) || | 352 if (!prefs->IsExtensionDisabled(extension->id()) || |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
592 void ThemeService::OnInfobarDestroyed() { | 593 void ThemeService::OnInfobarDestroyed() { |
593 number_of_infobars_--; | 594 number_of_infobars_--; |
594 | 595 |
595 if (number_of_infobars_ == 0) | 596 if (number_of_infobars_ == 0) |
596 RemoveUnusedThemes(false); | 597 RemoveUnusedThemes(false); |
597 } | 598 } |
598 | 599 |
599 ThemeSyncableService* ThemeService::GetThemeSyncableService() const { | 600 ThemeSyncableService* ThemeService::GetThemeSyncableService() const { |
600 return theme_syncable_service_.get(); | 601 return theme_syncable_service_.get(); |
601 } | 602 } |
OLD | NEW |