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 <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/memory/ref_counted_memory.h" | 10 #include "base/memory/ref_counted_memory.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 using base::UserMetricsAction; | 46 using base::UserMetricsAction; |
47 using content::BrowserThread; | 47 using content::BrowserThread; |
48 using extensions::Extension; | 48 using extensions::Extension; |
49 using extensions::UnloadedExtensionInfo; | 49 using extensions::UnloadedExtensionInfo; |
50 using ui::ResourceBundle; | 50 using ui::ResourceBundle; |
51 | 51 |
52 typedef ThemeProperties Properties; | 52 typedef ThemeProperties Properties; |
53 | 53 |
54 // The default theme if we haven't installed a theme yet or if we've clicked | 54 // The default theme if we haven't installed a theme yet or if we've clicked |
55 // the "Use Classic" button. | 55 // the "Use Classic" button. |
56 const char* ThemeService::kDefaultThemeID = ""; | 56 const char ThemeService::kDefaultThemeID[] = ""; |
57 | 57 |
58 namespace { | 58 namespace { |
59 | 59 |
60 // The default theme if we've gone to the theme gallery and installed the | 60 // The default theme if we've gone to the theme gallery and installed the |
61 // "Default" theme. We have to detect this case specifically. (By the time we | 61 // "Default" theme. We have to detect this case specifically. (By the time we |
62 // realize we've installed the default theme, we already have an extension | 62 // realize we've installed the default theme, we already have an extension |
63 // unpacked on the filesystem.) | 63 // unpacked on the filesystem.) |
64 const char* kDefaultThemeGalleryID = "hkacjpbfdknhflllbcmjibkdeoafencn"; | 64 const char kDefaultThemeGalleryID[] = "hkacjpbfdknhflllbcmjibkdeoafencn"; |
65 | 65 |
66 // Wait this many seconds after startup to garbage collect unused themes. | 66 // Wait this many seconds after startup to garbage collect unused themes. |
67 // Removing unused themes is done after a delay because there is no | 67 // Removing unused themes is done after a delay because there is no |
68 // reason to do it at startup. | 68 // reason to do it at startup. |
69 // ExtensionService::GarbageCollectExtensions() does something similar. | 69 // ExtensionService::GarbageCollectExtensions() does something similar. |
70 const int kRemoveUnusedThemesStartupDelay = 30; | 70 const int kRemoveUnusedThemesStartupDelay = 30; |
71 | 71 |
72 SkColor IncreaseLightness(SkColor color, double percent) { | 72 SkColor IncreaseLightness(SkColor color, double percent) { |
73 color_utils::HSL result; | 73 color_utils::HSL result; |
74 color_utils::SkColorToHSL(color, &result); | 74 color_utils::SkColorToHSL(color, &result); |
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
629 void ThemeService::OnInfobarDestroyed() { | 629 void ThemeService::OnInfobarDestroyed() { |
630 number_of_infobars_--; | 630 number_of_infobars_--; |
631 | 631 |
632 if (number_of_infobars_ == 0) | 632 if (number_of_infobars_ == 0) |
633 RemoveUnusedThemes(false); | 633 RemoveUnusedThemes(false); |
634 } | 634 } |
635 | 635 |
636 ThemeSyncableService* ThemeService::GetThemeSyncableService() const { | 636 ThemeSyncableService* ThemeService::GetThemeSyncableService() const { |
637 return theme_syncable_service_.get(); | 637 return theme_syncable_service_.get(); |
638 } | 638 } |
OLD | NEW |