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" |
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
345 return; | 345 return; |
346 | 346 |
347 std::string current_theme = GetThemeID(); | 347 std::string current_theme = GetThemeID(); |
348 std::vector<std::string> remove_list; | 348 std::vector<std::string> remove_list; |
349 scoped_ptr<const extensions::ExtensionSet> extensions( | 349 scoped_ptr<const extensions::ExtensionSet> extensions( |
350 extensions::ExtensionRegistry::Get(profile_) | 350 extensions::ExtensionRegistry::Get(profile_) |
351 ->GenerateInstalledExtensionsSet()); | 351 ->GenerateInstalledExtensionsSet()); |
352 extensions::ExtensionPrefs* prefs = extensions::ExtensionPrefs::Get(profile_); | 352 extensions::ExtensionPrefs* prefs = extensions::ExtensionPrefs::Get(profile_); |
353 for (extensions::ExtensionSet::const_iterator it = extensions->begin(); | 353 for (extensions::ExtensionSet::const_iterator it = extensions->begin(); |
354 it != extensions->end(); ++it) { | 354 it != extensions->end(); ++it) { |
355 const extensions::Extension* extension = *it; | 355 const extensions::Extension* extension = it->get(); |
356 if (extension->is_theme() && | 356 if (extension->is_theme() && |
357 extension->id() != current_theme) { | 357 extension->id() != current_theme) { |
358 // Only uninstall themes which are not disabled or are disabled with | 358 // Only uninstall themes which are not disabled or are disabled with |
359 // reason DISABLE_USER_ACTION. We cannot blanket uninstall all disabled | 359 // reason DISABLE_USER_ACTION. We cannot blanket uninstall all disabled |
360 // themes because externally installed themes are initially disabled. | 360 // themes because externally installed themes are initially disabled. |
361 int disable_reason = prefs->GetDisableReasons(extension->id()); | 361 int disable_reason = prefs->GetDisableReasons(extension->id()); |
362 if (!prefs->IsExtensionDisabled(extension->id()) || | 362 if (!prefs->IsExtensionDisabled(extension->id()) || |
363 disable_reason == Extension::DISABLE_USER_ACTION) { | 363 disable_reason == Extension::DISABLE_USER_ACTION) { |
364 remove_list.push_back((*it)->id()); | 364 remove_list.push_back((*it)->id()); |
365 } | 365 } |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
604 void ThemeService::OnInfobarDestroyed() { | 604 void ThemeService::OnInfobarDestroyed() { |
605 number_of_infobars_--; | 605 number_of_infobars_--; |
606 | 606 |
607 if (number_of_infobars_ == 0) | 607 if (number_of_infobars_ == 0) |
608 RemoveUnusedThemes(false); | 608 RemoveUnusedThemes(false); |
609 } | 609 } |
610 | 610 |
611 ThemeSyncableService* ThemeService::GetThemeSyncableService() const { | 611 ThemeSyncableService* ThemeService::GetThemeSyncableService() const { |
612 return theme_syncable_service_.get(); | 612 return theme_syncable_service_.get(); |
613 } | 613 } |
OLD | NEW |