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" |
11 #include "base/sequenced_task_runner.h" | 11 #include "base/sequenced_task_runner.h" |
12 #include "base/strings/string_util.h" | 12 #include "base/strings/string_util.h" |
13 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
14 #include "chrome/browser/chrome_notification_types.h" | 14 #include "chrome/browser/chrome_notification_types.h" |
15 #include "chrome/browser/extensions/extension_service.h" | 15 #include "chrome/browser/extensions/extension_service.h" |
16 #include "chrome/browser/profiles/profile.h" | 16 #include "chrome/browser/profiles/profile.h" |
17 #include "chrome/browser/supervised_user/supervised_user_theme.h" | 17 #include "chrome/browser/supervised_user/supervised_user_theme.h" |
18 #include "chrome/browser/themes/browser_theme_pack.h" | 18 #include "chrome/browser/themes/browser_theme_pack.h" |
19 #include "chrome/browser/themes/custom_theme_supplier.h" | 19 #include "chrome/browser/themes/custom_theme_supplier.h" |
20 #include "chrome/browser/themes/theme_properties.h" | 20 #include "chrome/browser/themes/theme_properties.h" |
21 #include "chrome/browser/themes/theme_syncable_service.h" | 21 #include "chrome/browser/themes/theme_syncable_service.h" |
22 #include "chrome/common/chrome_constants.h" | 22 #include "chrome/common/chrome_constants.h" |
23 #include "chrome/common/pref_names.h" | 23 #include "chrome/common/pref_names.h" |
24 #include "content/public/browser/notification_service.h" | 24 #include "content/public/browser/notification_service.h" |
25 #include "content/public/browser/user_metrics.h" | 25 #include "content/public/browser/user_metrics.h" |
26 #include "extensions/browser/extension_prefs.h" | 26 #include "extensions/browser/extension_prefs.h" |
27 #include "extensions/browser/extension_registry.h" | 27 #include "extensions/browser/extension_registry.h" |
28 #include "extensions/browser/extension_system.h" | 28 #include "extensions/browser/extension_system.h" |
| 29 #include "extensions/browser/uninstall_reason.h" |
29 #include "extensions/common/extension.h" | 30 #include "extensions/common/extension.h" |
30 #include "extensions/common/extension_set.h" | 31 #include "extensions/common/extension_set.h" |
31 #include "grit/theme_resources.h" | 32 #include "grit/theme_resources.h" |
32 #include "grit/ui_resources.h" | 33 #include "grit/ui_resources.h" |
33 #include "ui/base/layout.h" | 34 #include "ui/base/layout.h" |
34 #include "ui/base/resource/resource_bundle.h" | 35 #include "ui/base/resource/resource_bundle.h" |
35 #include "ui/gfx/image/image_skia.h" | 36 #include "ui/gfx/image/image_skia.h" |
36 | 37 |
37 #if defined(OS_WIN) | 38 #if defined(OS_WIN) |
38 #include "ui/base/win/shell.h" | 39 #include "ui/base/win/shell.h" |
(...skipping 326 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], extensions::UNINSTALL_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 |