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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 // realize we've installed the default theme, we already have an extension | 53 // realize we've installed the default theme, we already have an extension |
54 // unpacked on the filesystem.) | 54 // unpacked on the filesystem.) |
55 const char* kDefaultThemeGalleryID = "hkacjpbfdknhflllbcmjibkdeoafencn"; | 55 const char* kDefaultThemeGalleryID = "hkacjpbfdknhflllbcmjibkdeoafencn"; |
56 | 56 |
57 // Wait this many seconds after startup to garbage collect unused themes. | 57 // Wait this many seconds after startup to garbage collect unused themes. |
58 // Removing unused themes is done after a delay because there is no | 58 // Removing unused themes is done after a delay because there is no |
59 // reason to do it at startup. | 59 // reason to do it at startup. |
60 // ExtensionService::GarbageCollectExtensions() does something similar. | 60 // ExtensionService::GarbageCollectExtensions() does something similar. |
61 const int kRemoveUnusedThemesStartupDelay = 30; | 61 const int kRemoveUnusedThemesStartupDelay = 30; |
62 | 62 |
63 SkColor TintForUnderline(SkColor input) { | |
64 return SkColorSetA(input, SkColorGetA(input) / 3); | |
65 } | |
66 | |
67 SkColor IncreaseLightness(SkColor color, double percent) { | 63 SkColor IncreaseLightness(SkColor color, double percent) { |
68 color_utils::HSL result; | 64 color_utils::HSL result; |
69 color_utils::SkColorToHSL(color, &result); | 65 color_utils::SkColorToHSL(color, &result); |
70 result.l += (1 - result.l) * percent; | 66 result.l += (1 - result.l) * percent; |
71 return color_utils::HSLToSkColor(result, SkColorGetA(color)); | 67 return color_utils::HSLToSkColor(result, SkColorGetA(color)); |
72 } | 68 } |
73 | 69 |
74 // Writes the theme pack to disk on a separate thread. | 70 // Writes the theme pack to disk on a separate thread. |
75 void WritePackToDiskCallback(BrowserThemePack* pack, | 71 void WritePackToDiskCallback(BrowserThemePack* pack, |
76 const base::FilePath& path) { | 72 const base::FilePath& path) { |
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
580 void ThemeService::OnInfobarDestroyed() { | 576 void ThemeService::OnInfobarDestroyed() { |
581 number_of_infobars_--; | 577 number_of_infobars_--; |
582 | 578 |
583 if (number_of_infobars_ == 0) | 579 if (number_of_infobars_ == 0) |
584 RemoveUnusedThemes(false); | 580 RemoveUnusedThemes(false); |
585 } | 581 } |
586 | 582 |
587 ThemeSyncableService* ThemeService::GetThemeSyncableService() const { | 583 ThemeSyncableService* ThemeService::GetThemeSyncableService() const { |
588 return theme_syncable_service_.get(); | 584 return theme_syncable_service_.get(); |
589 } | 585 } |
OLD | NEW |