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 23 matching lines...) Expand all Loading... |
34 #include "ui/base/resource/resource_bundle.h" | 34 #include "ui/base/resource/resource_bundle.h" |
35 #include "ui/gfx/image/image_skia.h" | 35 #include "ui/gfx/image/image_skia.h" |
36 | 36 |
37 #if defined(OS_WIN) | 37 #if defined(OS_WIN) |
38 #include "ui/base/win/shell.h" | 38 #include "ui/base/win/shell.h" |
39 #endif | 39 #endif |
40 | 40 |
41 using base::UserMetricsAction; | 41 using base::UserMetricsAction; |
42 using content::BrowserThread; | 42 using content::BrowserThread; |
43 using extensions::Extension; | 43 using extensions::Extension; |
| 44 using extensions::UninstalledExtensionInfo; |
44 using extensions::UnloadedExtensionInfo; | 45 using extensions::UnloadedExtensionInfo; |
45 using ui::ResourceBundle; | 46 using ui::ResourceBundle; |
46 | 47 |
47 typedef ThemeProperties Properties; | 48 typedef ThemeProperties Properties; |
48 | 49 |
49 // The default theme if we haven't installed a theme yet or if we've clicked | 50 // The default theme if we haven't installed a theme yet or if we've clicked |
50 // the "Use Classic" button. | 51 // the "Use Classic" button. |
51 const char* ThemeService::kDefaultThemeID = ""; | 52 const char* ThemeService::kDefaultThemeID = ""; |
52 | 53 |
53 namespace { | 54 namespace { |
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 remove_list.push_back((*it)->id()); | 366 remove_list.push_back((*it)->id()); |
366 } | 367 } |
367 } | 368 } |
368 } | 369 } |
369 // TODO: Garbage collect all unused themes. This method misses themes which | 370 // TODO: Garbage collect all unused themes. This method misses themes which |
370 // are installed but not loaded because they are blacklisted by a management | 371 // are installed but not loaded because they are blacklisted by a management |
371 // policy provider. | 372 // policy provider. |
372 | 373 |
373 for (size_t i = 0; i < remove_list.size(); ++i) { | 374 for (size_t i = 0; i < remove_list.size(); ++i) { |
374 service->UninstallExtension( | 375 service->UninstallExtension( |
375 remove_list[i], | 376 remove_list[i], UninstalledExtensionInfo::REASON_ORPHANED_THEME, NULL); |
376 ExtensionService::UNINSTALL_REASON_ORPHANED_THEME, | |
377 NULL); | |
378 } | 377 } |
379 } | 378 } |
380 | 379 |
381 void ThemeService::UseDefaultTheme() { | 380 void ThemeService::UseDefaultTheme() { |
382 if (ready_) | 381 if (ready_) |
383 content::RecordAction(UserMetricsAction("Themes_Reset")); | 382 content::RecordAction(UserMetricsAction("Themes_Reset")); |
384 if (IsSupervisedUser()) { | 383 if (IsSupervisedUser()) { |
385 SetSupervisedUserTheme(); | 384 SetSupervisedUserTheme(); |
386 return; | 385 return; |
387 } | 386 } |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
604 void ThemeService::OnInfobarDestroyed() { | 603 void ThemeService::OnInfobarDestroyed() { |
605 number_of_infobars_--; | 604 number_of_infobars_--; |
606 | 605 |
607 if (number_of_infobars_ == 0) | 606 if (number_of_infobars_ == 0) |
608 RemoveUnusedThemes(false); | 607 RemoveUnusedThemes(false); |
609 } | 608 } |
610 | 609 |
611 ThemeSyncableService* ThemeService::GetThemeSyncableService() const { | 610 ThemeSyncableService* ThemeService::GetThemeSyncableService() const { |
612 return theme_syncable_service_.get(); | 611 return theme_syncable_service_.get(); |
613 } | 612 } |
OLD | NEW |