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 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 } | 317 } |
318 | 318 |
319 void ThemeService::RemoveUnusedThemes() { | 319 void ThemeService::RemoveUnusedThemes() { |
320 if (!profile_) | 320 if (!profile_) |
321 return; | 321 return; |
322 ExtensionService* service = profile_->GetExtensionService(); | 322 ExtensionService* service = profile_->GetExtensionService(); |
323 if (!service) | 323 if (!service) |
324 return; | 324 return; |
325 std::string current_theme = GetThemeID(); | 325 std::string current_theme = GetThemeID(); |
326 std::vector<std::string> remove_list; | 326 std::vector<std::string> remove_list; |
327 const ExtensionList* extensions = service->extensions(); | 327 const ExtensionSet* extensions = service->extensions(); |
328 for (ExtensionList::const_iterator it = extensions->begin(); | 328 for (ExtensionSet::const_iterator it = extensions->begin(); |
329 it != extensions->end(); ++it) { | 329 it != extensions->end(); ++it) { |
330 if ((*it)->is_theme() && (*it)->id() != current_theme) { | 330 if ((*it)->is_theme() && (*it)->id() != current_theme) { |
331 remove_list.push_back((*it)->id()); | 331 remove_list.push_back((*it)->id()); |
332 } | 332 } |
333 } | 333 } |
334 for (size_t i = 0; i < remove_list.size(); ++i) | 334 for (size_t i = 0; i < remove_list.size(); ++i) |
335 service->UninstallExtension(remove_list[i], false, NULL); | 335 service->UninstallExtension(remove_list[i], false, NULL); |
336 } | 336 } |
337 | 337 |
338 void ThemeService::UseDefaultTheme() { | 338 void ThemeService::UseDefaultTheme() { |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
655 void ThemeService::OnInfobarDisplayed() { | 655 void ThemeService::OnInfobarDisplayed() { |
656 number_of_infobars_++; | 656 number_of_infobars_++; |
657 } | 657 } |
658 | 658 |
659 void ThemeService::OnInfobarDestroyed() { | 659 void ThemeService::OnInfobarDestroyed() { |
660 number_of_infobars_--; | 660 number_of_infobars_--; |
661 | 661 |
662 if (number_of_infobars_ == 0) | 662 if (number_of_infobars_ == 0) |
663 RemoveUnusedThemes(); | 663 RemoveUnusedThemes(); |
664 } | 664 } |
OLD | NEW |