| 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/location.h" | 10 #include "base/location.h" | 
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 58 using base::UserMetricsAction; | 58 using base::UserMetricsAction; | 
| 59 using content::BrowserThread; | 59 using content::BrowserThread; | 
| 60 using extensions::Extension; | 60 using extensions::Extension; | 
| 61 using extensions::UnloadedExtensionInfo; | 61 using extensions::UnloadedExtensionInfo; | 
| 62 using ui::ResourceBundle; | 62 using ui::ResourceBundle; | 
| 63 | 63 | 
| 64 typedef ThemeProperties Properties; | 64 typedef ThemeProperties Properties; | 
| 65 | 65 | 
| 66 // The default theme if we haven't installed a theme yet or if we've clicked | 66 // The default theme if we haven't installed a theme yet or if we've clicked | 
| 67 // the "Use Classic" button. | 67 // the "Use Classic" button. | 
| 68 const char* ThemeService::kDefaultThemeID = ""; | 68 const char ThemeService::kDefaultThemeID[] = ""; | 
| 69 | 69 | 
| 70 namespace { | 70 namespace { | 
| 71 | 71 | 
| 72 // The default theme if we've gone to the theme gallery and installed the | 72 // The default theme if we've gone to the theme gallery and installed the | 
| 73 // "Default" theme. We have to detect this case specifically. (By the time we | 73 // "Default" theme. We have to detect this case specifically. (By the time we | 
| 74 // realize we've installed the default theme, we already have an extension | 74 // realize we've installed the default theme, we already have an extension | 
| 75 // unpacked on the filesystem.) | 75 // unpacked on the filesystem.) | 
| 76 const char* kDefaultThemeGalleryID = "hkacjpbfdknhflllbcmjibkdeoafencn"; | 76 const char kDefaultThemeGalleryID[] = "hkacjpbfdknhflllbcmjibkdeoafencn"; | 
| 77 | 77 | 
| 78 // Wait this many seconds after startup to garbage collect unused themes. | 78 // Wait this many seconds after startup to garbage collect unused themes. | 
| 79 // Removing unused themes is done after a delay because there is no | 79 // Removing unused themes is done after a delay because there is no | 
| 80 // reason to do it at startup. | 80 // reason to do it at startup. | 
| 81 // ExtensionService::GarbageCollectExtensions() does something similar. | 81 // ExtensionService::GarbageCollectExtensions() does something similar. | 
| 82 const int kRemoveUnusedThemesStartupDelay = 30; | 82 const int kRemoveUnusedThemesStartupDelay = 30; | 
| 83 | 83 | 
| 84 SkColor IncreaseLightness(SkColor color, double percent) { | 84 SkColor IncreaseLightness(SkColor color, double percent) { | 
| 85   color_utils::HSL result; | 85   color_utils::HSL result; | 
| 86   color_utils::SkColorToHSL(color, &result); | 86   color_utils::SkColorToHSL(color, &result); | 
| (...skipping 664 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 751 | 751 | 
| 752 bool ThemeService::BrowserThemeProvider::HasCustomImage(int id) const { | 752 bool ThemeService::BrowserThemeProvider::HasCustomImage(int id) const { | 
| 753   return theme_service_.HasCustomImage(id); | 753   return theme_service_.HasCustomImage(id); | 
| 754 } | 754 } | 
| 755 | 755 | 
| 756 base::RefCountedMemory* ThemeService::BrowserThemeProvider::GetRawData( | 756 base::RefCountedMemory* ThemeService::BrowserThemeProvider::GetRawData( | 
| 757     int id, | 757     int id, | 
| 758     ui::ScaleFactor scale_factor) const { | 758     ui::ScaleFactor scale_factor) const { | 
| 759   return theme_service_.GetRawData(id, scale_factor); | 759   return theme_service_.GetRawData(id, scale_factor); | 
| 760 } | 760 } | 
| OLD | NEW | 
|---|