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 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 if (!profile_ || !ready_) | 327 if (!profile_ || !ready_) |
328 return; | 328 return; |
329 if (!ignore_infobars && number_of_infobars_ != 0) | 329 if (!ignore_infobars && number_of_infobars_ != 0) |
330 return; | 330 return; |
331 | 331 |
332 ExtensionService* service = profile_->GetExtensionService(); | 332 ExtensionService* service = profile_->GetExtensionService(); |
333 if (!service) | 333 if (!service) |
334 return; | 334 return; |
335 std::string current_theme = GetThemeID(); | 335 std::string current_theme = GetThemeID(); |
336 std::vector<std::string> remove_list; | 336 std::vector<std::string> remove_list; |
337 scoped_ptr<const ExtensionSet> extensions( | 337 scoped_ptr<const extensions::ExtensionSet> extensions( |
338 service->GenerateInstalledExtensionsSet()); | 338 service->GenerateInstalledExtensionsSet()); |
339 extensions::ExtensionPrefs* prefs = service->extension_prefs(); | 339 extensions::ExtensionPrefs* prefs = service->extension_prefs(); |
340 for (ExtensionSet::const_iterator it = extensions->begin(); | 340 for (extensions::ExtensionSet::const_iterator it = extensions->begin(); |
341 it != extensions->end(); ++it) { | 341 it != extensions->end(); ++it) { |
342 const extensions::Extension* extension = *it; | 342 const extensions::Extension* extension = *it; |
343 if (extension->is_theme() && | 343 if (extension->is_theme() && |
344 extension->id() != current_theme) { | 344 extension->id() != current_theme) { |
345 // Only uninstall themes which are not disabled or are disabled with | 345 // Only uninstall themes which are not disabled or are disabled with |
346 // reason DISABLE_USER_ACTION. We cannot blanket uninstall all disabled | 346 // reason DISABLE_USER_ACTION. We cannot blanket uninstall all disabled |
347 // themes because externally installed themes are initially disabled. | 347 // themes because externally installed themes are initially disabled. |
348 int disable_reason = prefs->GetDisableReasons(extension->id()); | 348 int disable_reason = prefs->GetDisableReasons(extension->id()); |
349 if (!prefs->IsExtensionDisabled(extension->id()) || | 349 if (!prefs->IsExtensionDisabled(extension->id()) || |
350 disable_reason == Extension::DISABLE_USER_ACTION) { | 350 disable_reason == Extension::DISABLE_USER_ACTION) { |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
590 void ThemeService::OnInfobarDestroyed() { | 590 void ThemeService::OnInfobarDestroyed() { |
591 number_of_infobars_--; | 591 number_of_infobars_--; |
592 | 592 |
593 if (number_of_infobars_ == 0) | 593 if (number_of_infobars_ == 0) |
594 RemoveUnusedThemes(false); | 594 RemoveUnusedThemes(false); |
595 } | 595 } |
596 | 596 |
597 ThemeSyncableService* ThemeService::GetThemeSyncableService() const { | 597 ThemeSyncableService* ThemeService::GetThemeSyncableService() const { |
598 return theme_syncable_service_.get(); | 598 return theme_syncable_service_.get(); |
599 } | 599 } |
OLD | NEW |