OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/string_split.h" | 8 #include "base/string_split.h" |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 } | 331 } |
332 | 332 |
333 void ThemeService::RemoveUnusedThemes() { | 333 void ThemeService::RemoveUnusedThemes() { |
334 if (!profile_) | 334 if (!profile_) |
335 return; | 335 return; |
336 ExtensionService* service = profile_->GetExtensionService(); | 336 ExtensionService* service = profile_->GetExtensionService(); |
337 if (!service) | 337 if (!service) |
338 return; | 338 return; |
339 std::string current_theme = GetThemeID(); | 339 std::string current_theme = GetThemeID(); |
340 std::vector<std::string> remove_list; | 340 std::vector<std::string> remove_list; |
341 const ExtensionSet* extensions = service->extensions(); | 341 const ExtensionList* extensions = service->extensions(); |
342 for (ExtensionSet::const_iterator it = extensions->begin(); | 342 for (ExtensionList::const_iterator it = extensions->begin(); |
343 it != extensions->end(); ++it) { | 343 it != extensions->end(); ++it) { |
344 if ((*it)->is_theme() && (*it)->id() != current_theme) { | 344 if ((*it)->is_theme() && (*it)->id() != current_theme) { |
345 remove_list.push_back((*it)->id()); | 345 remove_list.push_back((*it)->id()); |
346 } | 346 } |
347 } | 347 } |
348 for (size_t i = 0; i < remove_list.size(); ++i) | 348 for (size_t i = 0; i < remove_list.size(); ++i) |
349 service->UninstallExtension(remove_list[i], false, NULL); | 349 service->UninstallExtension(remove_list[i], false, NULL); |
350 } | 350 } |
351 | 351 |
352 void ThemeService::UseDefaultTheme() { | 352 void ThemeService::UseDefaultTheme() { |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
669 void ThemeService::OnInfobarDisplayed() { | 669 void ThemeService::OnInfobarDisplayed() { |
670 number_of_infobars_++; | 670 number_of_infobars_++; |
671 } | 671 } |
672 | 672 |
673 void ThemeService::OnInfobarDestroyed() { | 673 void ThemeService::OnInfobarDestroyed() { |
674 number_of_infobars_--; | 674 number_of_infobars_--; |
675 | 675 |
676 if (number_of_infobars_ == 0) | 676 if (number_of_infobars_ == 0) |
677 RemoveUnusedThemes(); | 677 RemoveUnusedThemes(); |
678 } | 678 } |
OLD | NEW |